A method and system for triggering a timing task
By combining the scheduling agent layer and the task polling module, the problem of task execution failure when the external general-purpose timed task module is abnormal is solved. The secondary scheduling and locking mechanism of tasks are realized, ensuring the stability of the system and the smooth execution of tasks.
Patent Information
- Application Number
- CN202410355158.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-27
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-03-27
AI Technical Summary
In existing internet systems, when the external general-purpose scheduled task module malfunctions, the task cannot be processed automatically, resulting in task execution failure and affecting system stability.
A scheduling agent layer and a task polling module are introduced to receive and process the scheduling information of tasks to be triggered, scan and process failed tasks, and perform secondary scheduling when external scheduling fails. A locking mechanism ensures that tasks are executed smoothly.
This improves system stability, avoids the problem of repeated task execution, and ensures the smooth execution of important tasks.
Smart Images

Figure CN118331698B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of task processing, and particularly relates to a method and system for triggering a timing task. BACKGROUND
[0002] In current Internet systems, there are various timing functions, and in order to meet such timing functions, various timing tasks need to be provided to complete such functions.
[0003] Generally, in order to provide and manage these common timing task functions, a common timing task module is extracted, that is, a task trigger is performed by such an external common timing task module, and a specific task is processed by a task triggering service. However, when the external common timing task module is abnormal, only relevant personnel can process it, and the business system cannot process it, and at this time, the task cannot be executed smoothly. SUMMARY
[0004] The present application solves the technical problem of providing a method and system for triggering a timing task, which can ensure the smooth execution of important tasks and improve overall stability.
[0005] In order to solve the above technical problems, the technical scheme adopted by the present application is:
[0006] A method for triggering a timing task, comprising the steps of:
[0007] The scheduling agent layer receives the first scheduling information of the to-be-triggered task sent by the external common timing task, and processes the to-be-triggered task through the scheduling information;
[0008] The task polling module scans the to-be-triggered task processing failure, and sends the second scheduling information of the to-be-triggered task processing failure to the scheduling agent layer;
[0009] The scheduling agent layer locks the corresponding to-be-triggered task according to the received scheduling information, executes the to-be-triggered task, and unlocks the to-be-triggered task when the to-be-triggered task processing is completed.
[0010] In order to solve the above technical problems, another technical scheme adopted by the present application is:
[0011] A system for triggering a timing task, comprising:
[0012] The scheduling agent layer is configured to receive the first scheduling information of the to-be-triggered task sent by the external common timing task, and process the to-be-triggered task through the scheduling information;
[0013] The task polling module is configured to scan the to-be-triggered task processing failure, and send the second scheduling information of the to-be-triggered task processing failure to the scheduling agent layer;
[0014] The scheduling agent layer is also used for locking the corresponding to-be-triggered task according to the received scheduling information, executing the to-be-triggered task, and unlocking the to-be-triggered task after the to-be-triggered task processing ends.
[0015] The present application has the beneficial effects that: for the to-be-triggered task, an external general timing task is provided to schedule the to-be-triggered task, and in the case of external scheduling failure, the to-be-triggered task can be found in time through the task polling mode, and the to-be-triggered task is scheduled again through the task polling mode; and after the scheduling agent layer receives the scheduling information, the to-be-triggered task is locked, so that the to-be-triggered task can be executed smoothly in the case of multiple triggering mechanisms, the problem of repeated execution of the to-be-triggered task is avoided, and the stability of the system is improved. BRIEF DESCRIPTION OF DRAWINGS
[0016] Figure 1 A flow chart of a timing task triggering method according to an embodiment of the present application;
[0017] Figure 2 A schematic diagram of a timing task triggering system according to an embodiment of the present application;
[0018] LABEL EXPLANATION
[0019] 1. A timing task triggering system; 2. A scheduling agent layer; 3. A task polling module. DETAILED DESCRIPTION
[0020] To make the technical content, the achieved purposes and the effects of the present application clear, the following will be described in detail in combination with the embodiments and the accompanying drawings.
[0021] Please refer to Figure 1 The embodiment of the present application provides a timing task triggering method, which comprises the following steps:
[0022] The scheduling agent layer receives the first scheduling information of the to-be-triggered task sent by the external general timing task, and processes the to-be-triggered task through the scheduling information;
[0023] The task polling module scans the to-be-triggered task with failed processing, and sends the second scheduling information of the to-be-triggered task with failed processing to the scheduling agent layer;
[0024] The scheduling agent layer locks the corresponding to-be-triggered task according to the received scheduling information, executes the to-be-triggered task, and unlocks the to-be-triggered task after the to-be-triggered task processing ends.
[0025] From the above description, the beneficial effects of the present application are that for the to-be-triggered task, an external general timing task is provided to schedule it, and in the case of external scheduling failure, the to-be-triggered task can be found in time through task polling, and the to-be-triggered task is scheduled again through task polling; and when the scheduling agent layer receives the scheduling information, the task is locked to ensure the smooth execution of the task in the case of multiple triggering mechanisms, avoid the problem of repeated execution of the task, and improve the stability of the system.
[0026] Further, the task polling module scans the to-be-triggered task with processing failure, comprising:
[0027] The task polling module acquires the task processing information of the to-be-triggered task in a timely manner, and when the acquired task processing information contains failure information, the to-be-triggered task with processing failure is scanned and obtained.
[0028] From the above description, the to-be-triggered task with processing failure is queried through the task polling module, so that the task triggered by external calling but with processing failure can be scanned in time, so as to process the task in time subsequently.
[0029] Further, the task polling module scans the to-be-triggered task with processing failure, and sends second scheduling information of the to-be-triggered task with failure to the scheduling agent layer, further comprising:
[0030] The task polling module scans the to-be-triggered task with scheduling failure, and sends second scheduling information of the to-be-triggered task with failure to the scheduling agent layer.
[0031] From the above description, the task polling module not only queries the case of processing failure, but also queries the case of scheduling failure, so as to process the to-be-triggered task with scheduling failure in time subsequently.
[0032] Further, the task polling module scans the to-be-triggered task with scheduling failure, comprising:
[0033] The task polling module queries whether the first scheduling information of the to-be-triggered task is received in the scheduling agent layer in a timely manner, and if not received within a preset time, the to-be-triggered task with scheduling failure is scanned and obtained.
[0034] From the above description, when it is determined that there is a scheduling failure, waiting for a preset time before judging can reduce the case of determining that it is a scheduling failure due to a short network delay.
[0035] Further, the task polling module scans the to-be-triggered task with scheduling failure, comprising:
[0036] When a failed to-be-triggered task is scanned, it is judged whether the to-be-triggered task is still in a processing unsuccessful state within a delay time, and if so, second scheduling information of the failed to-be-triggered task is sent to the scheduling agent layer;
[0037] The delay time is determined according to a priority of the to-be-triggered task.
[0038] As can be seen from the above description, when it is determined that there is a task processing failure, the judgment is performed after a delay time, so that the misjudgment can be reduced.
[0039] Please refer to Figure 2 Another embodiment of the present application provides a system for triggering a timing task, comprising:
[0040] A scheduling agent layer is configured to receive first scheduling information of a to-be-triggered task sent by an external general timing task, and process the to-be-triggered task through the scheduling information.
[0041] A task polling module is configured to scan a failed to-be-triggered task, and send second scheduling information of the failed to-be-triggered task to the scheduling agent layer.
[0042] The scheduling agent layer is further configured to lock the corresponding to-be-triggered task according to the received scheduling information, and execute the to-be-triggered task, and unlock the to-be-triggered task when the to-be-triggered task processing is completed.
[0043] As can be seen from the above description, the present application has the following beneficial effects: for a to-be-triggered task, an external general timing task is provided to schedule the to-be-triggered task, and in the case of external scheduling failure, the to-be-triggered task can be found in time through the task polling mode, and then the to-be-triggered task is scheduled again through the task polling; and when the scheduling agent layer receives the scheduling information, the task is locked, so that the task can be executed smoothly in the case of multiple triggering mechanisms, the problem of repeated execution of the task is avoided, and the stability of the system is improved.
[0044] Further, the task polling module scans the failed to-be-triggered task, comprising:
[0045] The task polling module acquires task processing information of the to-be-triggered task in a timely manner, and when the acquired task processing information contains failure information, the failed to-be-triggered task is scanned.
[0046] As can be seen from the above description, the task polling module is used to query the failed to-be-triggered task, so that the task triggered by the external call but failed to process can be scanned in time, so that the task can be processed in time subsequently.
[0047] Further, the task polling module scans the failed to trigger task, and sends the second scheduling information of the failed to trigger task to the scheduling agent layer, and further comprises:
[0048] The task polling module scans the failed to trigger task, and sends the second scheduling information of the failed to trigger task to the scheduling agent layer.
[0049] From the above description, it can be seen that the task polling module not only queries the task processing failure, but also queries the scheduling failure, so as to subsequently process the scheduling failure in time.
[0050] Further, the task polling module scans the failed to trigger task, and sends the second scheduling information of the failed to trigger task to the scheduling agent layer, and further comprises:
[0051] The task polling module queries whether the first scheduling information of the to trigger task is received in the scheduling agent layer in time, and if not, the failed to trigger task is scanned.
[0052] From the above description, it can be seen that when it is determined that there is a scheduling failure, waiting for a predetermined time before judging can reduce the case of determining it as a scheduling failure due to network temporary delay.
[0053] Further, the task polling module scans the failed to trigger task, and sends the second scheduling information of the failed to trigger task to the scheduling agent layer, and further comprises:
[0054] When the failed to trigger task is scanned, it is judged whether the to trigger task is still in the unsuccessful processing state within the delay time, and if so, the second scheduling information of the failed to trigger task is sent to the scheduling agent layer.
[0055] The delay time is determined according to the priority of the to trigger task.
[0056] From the above description, it can be seen that when it is determined that there is a task processing failure, waiting for a delay time before judging can reduce the misjudgment.
[0057] The above-mentioned method and system for triggering a timing task of the application are suitable for ensuring the smooth execution of important tasks and improving overall stability, which will be described below through specific embodiments:
[0058] Embodiment one
[0059] Please refer to Figure 1 A method for triggering a timing task, comprising the steps of:
[0060] S1, the scheduling agent layer receives the first scheduling information of the to trigger task sent by the external general timing task, and processes the to trigger task through the scheduling information.
[0061] Specifically, the external general timing task module sends first scheduling information to the scheduling agent layer when it scans that a task needs to be triggered.
[0062] S2, the task polling module scans the failed to trigger task and sends second scheduling information of the failed to trigger task to the scheduling agent layer.
[0063] S21, the task polling module acquires the task processing information of the to-be-triggered task in a timely manner, and when the acquired task processing information contains failure information, the failed to trigger task is scanned.
[0064] Specifically, the task processing information of the to-be-triggered task is queried in a timely manner by the task polling module, and if failure information appears, the corresponding to-be-triggered task needs to be scanned.
[0065] S22, when the failed to trigger task is scanned, it is judged whether the to-be-triggered task is still in the unsuccessful state within the delay time, and if so, the second scheduling information of the failed to trigger task is sent to the scheduling agent layer.
[0066] In this embodiment, the delay time is determined according to the priority of the to-be-triggered task.
[0067] Specifically, for the task with high priority, the minimum range of delay time is adopted, assuming that the task is divided into three types of high, medium and low, and the range of delay time of the three types of tasks is 5 seconds, 20 seconds and 30 seconds respectively, and different delay times are set for different priority tasks. The purpose of this setting is to wait for a period of time to confirm whether the external scheduling task can be successfully executed, otherwise the local timing task scheduling is executed.
[0068] S3, the scheduling agent layer locks the corresponding to-be-triggered task according to the received scheduling information, and executes the to-be-triggered task, and unlocks the to-be-triggered task when the to-be-triggered task processing is completed.
[0069] Specifically, when the scheduling agent layer receives the first scheduling message or the second scheduling information of the task, the to-be-triggered task is locked by the distributed lock in advance. After locking, the task state is changed to executing, preventing the subsequent task from being triggered again; when the task is executed, the task is modified to have completed state, which includes the case of successful task processing or failed task processing.
[0070] Therefore, through the multiple triggering mechanism of the method, the smooth execution of important tasks can be ensured, and the problem of repeated execution of tasks can be avoided, thereby improving the stability of the system.
[0071] Embodiment two
[0072] The difference between this embodiment and embodiment one is that the task polling module is further limited to scan the triggered task with failed scheduling, and send the second scheduling information of the triggered task with failed scheduling to the scheduling agent layer, and the specific steps are as follows:
[0073] The task polling module queries whether the first scheduling information of the triggered task is received in the scheduling agent layer, if not received within the preset time, the triggered task with failed scheduling is scanned.
[0074] In this embodiment, when the external scheduling fails to send the message or fails to send the message, or when the external scheduling successfully sends the message but the scheduling agent layer does not receive the message, the scheduling agent layer cannot receive the scheduling message, therefore, by querying whether the first scheduling information of the triggered task is received in the scheduling agent layer, all the tasks with failed external scheduling can be obtained.
[0075] Embodiment three
[0076] Please refer to Figure 2 A system 1 for triggering a timed task, a local timed task polling module 3 needs to be developed in the system, and a scheduling agent layer 2 is provided, the scheduling agent layer 2 realizes each step of the scheduling agent layer in the method for triggering a timed task in embodiment one or two, and the task polling module 3 realizes each step of the task polling module in the method for triggering a timed task in embodiment one or two.
[0077] In summary, the method and system for triggering a timed task provided by the application can provide external general timed tasks for scheduling the triggered tasks, and in the case of failed external scheduling, the task polling mode can be used to find the triggered tasks in time, and the triggered tasks can be scheduled again by the task polling mode; and after the scheduling agent layer receives the scheduling information, the tasks can be executed smoothly in the case of multiple triggering mechanisms by locking the tasks, the problem of repeated execution of the tasks is avoided, and the stability of the system is improved.
[0078] The above description is only an embodiment of the application, and does not limit the patent range of the application, any equivalent transformation or direct or indirect application in the related technical field based on the content of the specification and drawings of the application is also included in the patent protection range of the application.
Claims
1. A method of timing task triggering, characterized by, The method comprises the steps of: The scheduling agent layer receives first scheduling information of a to-be-triggered task sent by an external general timing task, and processes the to-be-triggered task through the first scheduling information; The task polling module scans the to-be-triggered task that fails in processing, and sends second scheduling information of the to-be-triggered task that fails in processing to the scheduling agent layer; The scheduling agent layer locks the corresponding to-be-triggered task according to the received second scheduling information, executes the to-be-triggered task, and unlocks the to-be-triggered task after the processing of the to-be-triggered task is completed; The task polling module scans the to-be-triggered task that fails in processing, and sends second scheduling information of the to-be-triggered task that fails in processing to the scheduling agent layer, and further comprises the steps of: The task polling module scans the to-be-triggered task that fails in scheduling, and sends second scheduling information of the to-be-triggered task that fails in scheduling to the scheduling agent layer; The task polling module scans the to-be-triggered task that fails in scheduling, and comprises the steps of: The task polling module periodically inquires whether the first scheduling information of the to-be-triggered task is received in the scheduling agent layer, and if not received within a preset time, scans to obtain the to-be-triggered task that fails in scheduling; The step of sending the second scheduling information of the to-be-triggered task that fails in processing to the scheduling agent layer comprises the steps of: When the to-be-triggered task that fails in processing is scanned, it is judged whether the to-be-triggered task is still in the state of unsuccessful processing within a delay time, and if so, the second scheduling information of the to-be-triggered task that fails in processing is sent to the scheduling agent layer; The delay time is determined according to the priority of the to-be-triggered task.
2. A system for timed task triggering, characterized by The method comprises the steps of: The scheduling agent layer receives first scheduling information of a to-be-triggered task sent by an external general timing task, and processes the to-be-triggered task through the first scheduling information; The task polling module scans the to-be-triggered task that fails in processing, and sends second scheduling information of the to-be-triggered task that fails in processing to the scheduling agent layer; The scheduling agent layer locks the corresponding to-be-triggered task according to the received second scheduling information, executes the to-be-triggered task, and unlocks the to-be-triggered task after the processing of the to-be-triggered task is completed; The task polling module scans the to-be-triggered task that fails in processing, and sends second scheduling information of the to-be-triggered task that fails in processing to the scheduling agent layer, and further comprises the steps of: The task polling module scans the to-be-triggered task that fails in scheduling, and sends second scheduling information of the to-be-triggered task that fails in scheduling to the scheduling agent layer; The task polling module scans the to-be-triggered task that fails in scheduling, and comprises the steps of: The task polling module periodically inquires whether the first scheduling information of the to-be-triggered task is received in the scheduling agent layer, and if not received within a preset time, scans to obtain the to-be-triggered task that fails in scheduling; The step of sending the second scheduling information of the to-be-triggered task that fails in processing to the scheduling agent layer comprises the steps of: When the to-be-triggered task that fails in processing is scanned, it is judged whether the to-be-triggered task is still in the state of unsuccessful processing within a delay time, and if so, the second scheduling information of the to-be-triggered task that fails in processing is sent to the scheduling agent layer; The delay time is determined according to the priority of the to-be-triggered task.
Citation Information
Patent Citations
An alarm response processing action method and system
CN109783306A
Failure task compensation management method and device, computer equipment and storage medium
CN111475515A