Batch scheduling method and system for efficient registration and scheduling of any number of tasks

Through the combination of registration module and task daemon process, dynamic registration and allocation of tasks solves the problem of difficulty in efficiently scheduling any number of tasks in the existing technology, realizes automatic error correction and breakpoint re-running of tasks, and meets the requirements of flexibility and efficiency. need.

CN115080228BActive Publication Date: 2024-10-01IND BANK CO +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210503918.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-10
Publication Date
2024-10-01
Estimated Expiration
2042-05-10

AI Technical Summary

Technical Problem

Existing batch processing scheduling methods are difficult to efficiently register and schedule any number of tasks, especially when the number and type of tasks change frequently. Dynamic registration and automatic error correction cannot be achieved, and the complexity is high, making it difficult to meet the requirements of flexibility and efficiency. need.

Method used

It uses the registration module and task daemon process to dynamically register and assign tasks. It realizes dynamic scheduling and automatic breakpoint re-running of tasks through meta-tasks. It supports the definition of multiple task steps, frequencies and dependencies, and provides a monitoring interface to achieve task efficiency. Execution and automatic error correction.

Benefits of technology

It realizes efficient registration and scheduling of any number of tasks, ensures the safety and efficiency of task processing, can automatically correct errors and rerun at breakpoints, adapt to changes in the number and type of tasks, and reduces the complexity of manual configuration.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115080228B_ABST
    Figure CN115080228B_ABST
Patent Text Reader

Abstract

The present invention provides a batch processing scheduling method and system for efficiently registering and scheduling any number of tasks, including: step S1: deploying a registration module, registering regular tasks and task registration meta-tasks, defining task steps, task frequencies and task dependencies; step S2: deploying a task daemon on a working machine, wherein when the task registration meta-task is started, dynamically registering any number of batch tasks according to preset conditions; step S3: the registration module scans the dynamically registered tasks, and distributes the tasks to the working machines according to a certain number of concurrencies; step S4: after the task execution machine obtains the assigned tasks, it obtains the corresponding execution program for execution according to the preset step definition, and repeatedly triggers steps S3 to S4 until the task is executed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular, to a batch processing scheduling method and system for efficiently registering and scheduling any number of tasks, and more particularly, to a batch processing scheduling method and system for efficiently registering and scheduling any number of tasks. Background Art

[0002] There are usually two solutions for conventional batch scheduling: one is to start a specific task at a specific time through the operating system's timer task. This solution can only be implemented through hard coding for complex functions such as task dependency, breakpoint rerun, and repeated execution check. It requires people to plan the task scheduling time and scheduling machine in advance, and requires a comprehensive understanding of global tasks to achieve ideal results and performance. Therefore, it is only suitable for simple batch scheduling with a small number of tasks. The advantage is that it is simple and fast to implement, and there is no need to deploy additional services; the other solution realizes the decoupling of the scheduling center and the task center. The scheduling center is responsible for configuring the scheduling tasks, and the task center is responsible for the actual execution of the tasks. This solution greatly reduces the complexity of manual configuration. Engineers who configure tasks only need to configure them in the scheduling center, and do not need to worry about which machine the task runs on and how it runs. In addition, the scheduling center usually has a master console, which can intuitively configure task dependencies and task execution status through the interface. The task center is responsible for the actual execution of specific tasks. When the load is high, the number of clusters can be flexibly increased and automatically registered to the scheduling center. Developers only need to focus on the implementation of tasks, and do not need to consider the scheduling method of tasks like the first method. The disadvantage is that the implementation is relatively complex and requires strict compliance with platform coding specifications, otherwise it will cause serious problems such as confusion in dependencies.

[0003] Although the above two solutions have their own advantages and disadvantages in terms of task configuration and dependency configuration, they are essentially planning in advance when to execute what tasks, and the task execution time, task type and task quantity are all fixed.

[0004] Patent document CN107608772A (application number: 201710729991.0) discloses a method for configuring and scheduling batch tasks, including reading the configuration data of the batch tasks and generating an XML file; determining whether the code of the XML file contains a Cron expression; and if so, starting the batch tasks regularly through a scheduler.

[0005] The present invention provides a solution that can efficiently register and schedule any number of tasks. In addition to being able to choreograph and register business tasks, two additional meta-tasks are also set. Such tasks are not responsible for business logic processing, but are only responsible for dynamically registering tasks and dynamically scheduling tasks. One meta-task checks the set conditions at a specific time point according to the set conditions, and dynamically registers different numbers of tasks according to different conditions; the other meta-task is a daemon process that continuously checks the dynamically registered tasks in the background, and dynamically allocates tasks according to the number of machines in the task center, ensuring that the tasks are processed efficiently and safely, and can automatically correct the errors and automatically rerun the tasks when errors occur. Summary of the invention

[0006] In view of the defects in the prior art, the object of the present invention is to provide a batch scheduling method and system for efficiently registering and scheduling any number of tasks.

[0007] According to the present invention, a batch scheduling method for efficiently registering and scheduling any number of tasks includes:

[0008] Step S1: deploy the registration module, register regular tasks and task registration meta-tasks, define task steps, task frequency and task dependencies;

[0009] Step S2: deploying a task daemon process on a working machine, wherein the task registration meta-task dynamically registers any number of batch tasks according to preset conditions when it is started;

[0010] Step S3: The registration module scans the dynamically registered tasks and distributes the tasks to the working machines according to a certain number of concurrency;

[0011] Step S4: After the task execution machine obtains the assigned task, it obtains the corresponding execution program according to the preset step definition and repeatedly triggers steps S3 to S4 until the task is completed.

[0012] Preferably, the task steps are defined by setting breakpoints, waiting for manual confirmation before continuing execution, and each task step is a separate complete transaction. When one of the steps fails, breakpoint continuation is achieved.

[0013] Preferably, the task frequency is defined by: defining tasks of multiple frequencies, including a single execution type, a daily execution type, and a flexible configuration type; selecting a task frequency type, and setting the task execution frequency type in the task definition.

[0014] Preferably, the task dependency relationship is defined by: intuitively setting the dependency relationship between tasks through a dependency graph, and checking whether the predecessor task is successfully executed before executing the task with the configured dependency relationship.

[0015] Preferably, a monitoring interface for the task execution status is provided, and the interrupted task can be restarted through the monitoring interface.

[0016] Preferably, when the task is a total-division-total cross-processing, a checkpoint step is set in the task step, and a loop is waited on the step by means of file locks and / or database locks. After the summary step is completed, the separate execution continues.

[0017] According to the present invention, a batch processing scheduling system for efficiently registering and scheduling any number of tasks is provided, comprising:

[0018] Module M1: Deploy the registration module, register regular tasks and task registration meta-tasks, define task steps, task frequency and task dependencies;

[0019] Module M2: deploying task daemons on working machines, where the task registration meta-task dynamically registers any number of batch tasks according to preset conditions when it is started;

[0020] Module M3: The registration module scans the dynamically registered tasks and assigns the tasks to the working machines according to a certain number of concurrent tasks;

[0021] Module M4: After the task execution machine obtains the assigned task, it obtains the corresponding execution program according to the preset step definition and repeatedly triggers modules M3 to M4 until the task is completed.

[0022] Preferably, the task step is defined by: setting a breakpoint, waiting for manual confirmation before continuing execution, and each task step is a separate complete transaction, and when one of the steps fails, the breakpoint can be continued;

[0023] The task frequency definition adopts: defining tasks of multiple frequencies, including single execution type, daily execution type and flexible configuration type; selecting the task frequency type, and setting the task execution frequency type in the task definition;

[0024] The task dependency relationship is defined by intuitively setting the dependency relationship between tasks through a dependency graph, and checking whether the preceding task is successfully executed before executing the task with the configured dependency relationship.

[0025] Preferably, a monitoring interface for the task execution status is provided, and the interrupted task can be restarted at a breakpoint through the monitoring interface.

[0026] Preferably, when the task is a total-division-total cross-processing, a checkpoint step is set in the task step, and a loop is waited on the step by means of file locks and / or database locks. After the summary step is completed, the separate execution continues.

[0027] Compared with the prior art, the present invention has the following beneficial effects:

[0028] 1. The present invention provides a solution that can efficiently register and schedule any number of tasks. In addition to being able to arrange and register business tasks, two additional meta-tasks are also set. Such tasks are not responsible for business logic processing, but are only responsible for dynamic registration tasks and dynamic scheduling tasks;

[0029] 2. The present invention provides a meta-task that checks the set conditions at a set specific time point according to the set conditions, and dynamically registers different numbers of tasks according to different conditions;

[0030] 3. The present invention provides a meta-task as a daemon process, which continuously checks dynamically registered tasks in the background, and dynamically allocates tasks according to the number of machines in the task center to ensure that the tasks are processed efficiently and safely. When a task fails, it can automatically correct the error and automatically rerun the task from the breakpoint. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Other features, objects and advantages of the present invention will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:

[0032] Figure 1 Flowchart of a batch scheduling method for efficiently registering and scheduling any number of tasks. DETAILED DESCRIPTION

[0033] The present invention is described in detail below in conjunction with specific embodiments. The following embodiments will help those skilled in the art to further understand the present invention, but are not intended to limit the present invention in any form. It should be noted that, for those of ordinary skill in the art, several changes and improvements can also be made without departing from the concept of the present invention. These all belong to the protection scope of the present invention.

[0034] Example 1

[0035] According to the present invention, a batch scheduling method for efficiently registering and scheduling any number of tasks is provided, such as Figure 1 As shown, including:

[0036] Step S1: deploy the registration module, register regular tasks and task registration meta-tasks, define task steps, task frequency and task dependencies; among them, multiple types of tasks can be defined: 1) regular tasks, batch tasks that perform specific business functions; 2) task registration meta-tasks, dynamically register any number of batch tasks according to the set rules. It has great advantages when the sub-tasks are not fixed and the number is large. For example, in order to achieve mutual non-interference between products, it is necessary to isolate the batches of products and set a separate batch task for each product. Products are constantly created and exited every day, that is, the number of products is not fixed, and the specific products of the daily task run are constantly changing according to the actual situation and cannot be set in advance. Through this method, tasks can be flexibly registered and efficiently executed.

[0037] The task step definition depends on the task definition and is responsible for the specific implementation of the task. Breakpoints can be set and execution can continue after manual confirmation. Each step is a separate complete transaction, so if a step fails, breakpoints can be resumed.

[0038] Task frequency definition can define tasks with various frequencies: 1) single execution type; 2) daily execution type; 3) flexible configuration type. After setting the task frequency type, you can set the task execution frequency type in the task definition.

[0039] Task dependency definition can intuitively set the dependencies between tasks through the dependency graph. Before executing the task with the dependency configured, it will check whether the predecessor task is executed successfully.

[0040] Task monitoring provides a monitoring interface for task execution, and interrupted tasks can be resumed on this interface.

[0041] Step S2: deploying a task daemon process on a working machine, wherein the task registration meta-task dynamically registers any number of batch tasks according to preset conditions when it is started;

[0042] Step S3: The registration module scans the dynamically registered tasks and distributes the tasks to the working machines according to a certain number of concurrency;

[0043] Step S4: After the task execution machine obtains the assigned task, it obtains the corresponding execution program according to the preset step definition and repeatedly triggers steps S3 to S4 until the task is completed.

[0044] That is, the task center is a distributed architecture, which can be composed of any machines to form a cluster. A daemon meta-task is deployed on each machine, which scans the dynamic tasks to be processed in the background at regular intervals. According to the configuration of the local machine, a specific number of tasks are pulled up concurrently. After a certain execution is completed, a new task to be processed can be pulled up in the next cycle to fully utilize the performance of the machine and ensure the overall efficiency of batch processing. When the number of tasks is too large and the execution time is too long, you can simply add a task machine to expand the task center cluster.

[0045] Specifically, when the task is a total-specific-total cross-processing, for more complex dynamically registered tasks, it is usually not just an atomic, independent task, there may be intersections between them, that is, a total-specific-total structure. In order to meet this requirement, a special checkpoint step is set in the task step. Through file locks, database locks, etc., it loops and waits on the step. After the summary step is executed, it continues to run separately.

[0046] According to the present invention, a batch processing scheduling system for efficiently registering and scheduling any number of tasks is provided, comprising:

[0047] Module M1: Deployment registration module, register regular tasks and task registration meta-tasks, define task steps, task frequency and task dependencies; among them, multiple types of tasks can be defined: 1) Regular tasks, batch tasks that execute specific business functions; 2) Task registration meta-tasks, dynamically register any number of batch tasks according to the set rules. It has great advantages when the sub-tasks are not fixed and the number is large. For example, in order to achieve mutual non-interference of products, it is necessary to isolate the batches of products and set a separate batch task for each product. Products are constantly created and exited every day, that is, the number of products is not fixed, and the specific products of the daily task run are constantly changing according to the actual situation and cannot be set in advance. Through this method, tasks can be flexibly registered and efficiently executed.

[0048] The task step definition depends on the task definition and is responsible for the specific implementation of the task. Breakpoints can be set and execution can continue after manual confirmation. Each step is a separate complete transaction, so if a step fails, breakpoints can be resumed.

[0049] Task frequency definition can define tasks with various frequencies: 1) single execution type; 2) daily execution type; 3) flexible configuration type. After setting the task frequency type, you can set the task execution frequency type in the task definition.

[0050] Task dependency definition can intuitively set the dependencies between tasks through the dependency graph. Before executing the task with the dependency configured, it will check whether the predecessor task is executed successfully.

[0051] Task monitoring provides a monitoring interface for task execution, and interrupted tasks can be resumed on this interface.

[0052] Module M2: deploying task daemons on working machines, where the task registration meta-task dynamically registers any number of batch tasks according to preset conditions when it is started;

[0053] Module M3: The registration module scans the dynamically registered tasks and assigns the tasks to the working machines according to a certain number of concurrent tasks;

[0054] Module M4: After the task execution machine obtains the assigned task, it obtains the corresponding execution program according to the preset step definition and repeatedly triggers modules M3 to M4 until the task is completed.

[0055] That is, the task center is a distributed architecture, which can be composed of any machines to form a cluster. A daemon meta-task is deployed on each machine, which scans the dynamic tasks to be processed in the background at regular intervals. According to the configuration of the local machine, a specific number of tasks are pulled up concurrently. After a certain execution is completed, a new task to be processed can be pulled up in the next cycle to fully utilize the performance of the machine and ensure the overall efficiency of batch processing. When the number of tasks is too large and the execution time is too long, you can simply add a task machine to expand the task center cluster.

[0056] Specifically, when the task is a total-specific-total cross-processing, for more complex dynamically registered tasks, it is usually not just an atomic, independent task, there may be intersections between them, that is, a total-specific-total structure. In order to meet this requirement, a special checkpoint step is set in the task step. Through file locks, database locks, etc., it loops and waits on the step. After the summary step is executed, it continues to run separately.

[0057] Those skilled in the art know that, in addition to implementing the system, device and its various modules provided by the present invention in a purely computer-readable program code, it is entirely possible to implement the same program in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, the system, device and its various modules provided by the present invention can be considered as a hardware component, and the modules included therein for implementing various programs can also be considered as structures within the hardware component; the modules for implementing various functions can also be considered as both software programs for implementing the method and structures within the hardware component.

[0058] The above describes the specific embodiments of the present invention. It should be understood that the present invention is not limited to the above specific embodiments, and those skilled in the art can make various changes or modifications within the scope of the claims, which does not affect the essence of the present invention. In the absence of conflict, the embodiments of the present application and the features in the embodiments can be combined with each other arbitrarily.

Claims

1. A batch scheduling method for efficiently registering and scheduling any number of tasks, characterized in that: include: Step S1: deploy the registration module, register regular tasks and task registration meta-tasks, define task steps, task frequency and task dependencies; Step S2: deploying a task daemon process on a working machine, wherein the task registration meta-task dynamically registers any number of batch tasks according to preset conditions when it is started; Step S3: The registration module scans the dynamically registered tasks and distributes the tasks to the working machines according to a certain number of concurrency; Step S4: After the task execution machine obtains the assigned task, it obtains the corresponding execution program according to the preset step definition and repeatedly triggers steps S3 to S4 until the task is completed; The task center is a distributed architecture, consisting of any machines forming a cluster. A daemon meta-task is deployed on each machine. It scans the dynamic tasks to be processed in the background at regular intervals. According to the configuration of the local machine, a specific number of tasks are pulled up concurrently. After a task is completed, a new task to be processed can be pulled up in the next cycle. When the number of tasks is too large and the execution time is too long, a task machine is added to expand the task center cluster. When the task is a total, sub-total and cross-processing, set a checkpoint step in the task step, loop and wait on the step by means of file lock and database lock, and continue to run separately after the summary step is completed; Task step definition depends on task definition, is responsible for the specific implementation of the task, sets breakpoints, and waits for manual confirmation before continuing execution. Each step is a separate complete transaction, so if a step fails, it can be continued from the breakpoint. Task frequency definition, define tasks with various frequencies: 1) single execution type; 2) daily execution type; 3) flexible configuration type; After setting the task frequency type, set the task execution frequency type in the task definition.

2. The batch processing scheduling method for efficiently registering and scheduling any number of tasks according to claim 1 is characterized in that: The task dependency relationship is defined by intuitively setting the dependency relationship between tasks through a dependency graph, and checking whether the preceding task is successfully executed before executing the task with the configured dependency relationship.

3. The batch processing scheduling method for efficiently registering and scheduling any number of tasks according to claim 1 is characterized in that: Provides a monitoring interface for task execution status, and enables restarting interrupted tasks through the monitoring interface.

4. A batch processing scheduling system that efficiently registers and schedules any number of tasks, characterized in that: include: Module M1: Deploy the registration module, register regular tasks and task registration meta-tasks, define task steps, task frequency and task dependencies; Module M2: deploying task daemons on working machines, where the task registration meta-task dynamically registers any number of batch tasks according to preset conditions when it is started; Module M3: The registration module scans the dynamically registered tasks and assigns the tasks to the working machines according to a certain number of concurrent tasks; Module M4: After the task execution machine obtains the assigned task, it obtains the corresponding execution program according to the preset step definition and repeatedly triggers modules M3 to M4 until the task is completed; The task center is a distributed architecture, consisting of any machines forming a cluster. A daemon meta-task is deployed on each machine. It scans the dynamic tasks to be processed in the background at regular intervals. According to the configuration of the local machine, a specific number of tasks are pulled up concurrently. After a task is completed, a new task to be processed can be pulled up in the next cycle. When the number of tasks is too large and the execution time is too long, a task machine is added to expand the task center cluster. When the task is a total, sub-total and cross-processing, set a checkpoint step in the task step, loop and wait on the step by means of file lock and database lock, and continue to run separately after the summary step is completed; Task step definition depends on task definition, is responsible for the specific implementation of the task, sets breakpoints, and waits for manual confirmation before continuing execution. Each step is a separate complete transaction, so if a step fails, it can be continued from the breakpoint. Task frequency definition, define tasks with various frequencies: 1) single execution type; 2) daily execution type; 3) flexible configuration type; After setting the task frequency type, set the task execution frequency type in the task definition.

5. The batch processing scheduling system for efficiently registering and scheduling any number of tasks according to claim 4 is characterized in that: The task dependency relationship is defined by intuitively setting the dependency relationship between tasks through a dependency graph, and checking whether the preceding task is successfully executed before executing the task with the configured dependency relationship.

6. The batch processing scheduling system for efficiently registering and scheduling any number of tasks according to claim 4 is characterized in that: Provides a monitoring interface for task execution status, and enables restarting interrupted tasks at breakpoints through the monitoring interface.