Timing cycle task scheduling method and device

Through the timed circular task scheduling method, personalized configuration and merge job tasks, and multi-threaded processing, the problem of many job nodes and complex configuration in the batch scheduling system is solved, and the flexibility and efficiency of business scheduling are improved.

CN119473556APending Publication Date: 2025-02-18AGRICULTURAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411724953.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

When the existing batch scheduling system increases its business, there are many job nodes, complex configurations, and difficult planning management, which lacks flexibility and convenience.

Method used

The timed loop task scheduling method is adopted, and the job is personalized to be configured, and it is converted into multiple tasks and merged into a unified timed loop task. Multi-threading tasks are used to achieve unified task scheduling and hosting jobs.

Benefits of technology

It significantly improves the flexibility and convenience of business scheduling, simplifies job management, improves the system throughput and processing efficiency, and solves problems such as many job nodes and complex configurations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473556A_ABST
    Figure CN119473556A_ABST
Patent Text Reader

Abstract

The invention discloses a timed cycle task scheduling method and device, and the method comprises the steps: carrying out the personalized configuration of a plurality of jobs corresponding to a business demand when the business demand is received, triggering a timed cycle job according to a timed cycle rule, and enabling the timed cycle rule to be a rule for carrying out the timed cycle job based on a minimum time interval, and in the process of executing the timed cycle operation, converting the plurality of operations subjected to personalized configuration into a plurality of tasks, merging the plurality of tasks into a unified timed cycle task, and processing each task in the unified timed cycle task through multiple threads.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of task scheduling, and more specifically, to a method and device for scheduling timed cyclic tasks. Background Art

[0002] With the rapid development of information technology, the data processing needs of enterprises and organizations are growing day by day. Batch scheduling systems are used to meet complex and changing business needs. Batch scheduling systems can provide unified management, scheduling and monitoring for batch processing. Usually, the business processing logic of the job is implemented in the program, the job plan is managed in the batch scheduling system, and the batch scheduling system calls the job processing business according to the settings.

[0003] However, as the number of businesses increases, the number of job nodes that need to be configured also increases accordingly. Batch scheduling systems are usually highly complex, with many configuration options, and it is easy to make mistakes when adding new job nodes. Similar businesses also need to configure different job nodes if the scheduling frequency is different, and job scheduling lacks flexibility.

[0004] Therefore, how to improve the flexibility and convenience of business scheduling is an urgent problem to be solved in this application. Summary of the invention

[0005] In view of this, the present application discloses a timed cyclic task scheduling method and device, which aims to effectively solve the problems of multiple job nodes, complex job configuration, difficult job plan management, job merging, etc., and significantly improve the flexibility and convenience of business scheduling.

[0006] In order to achieve the above purpose, the disclosed technical solution is as follows:

[0007] The first aspect of the present application discloses a timed cyclic task scheduling method, the method comprising:

[0008] When receiving a business requirement, performing personalized configuration on multiple jobs corresponding to the business requirement;

[0009] Triggering a timed cycle job according to a timed cycle rule; wherein the timed cycle rule is a rule for performing a timed cycle job based on a minimum time interval;

[0010] In the process of executing the timed cyclic job, the multiple jobs after the personalized configuration are converted into multiple tasks, and the multiple tasks are merged into a unified timed cyclic task;

[0011] Each task in a unified timed loop task is processed through multithreading.

[0012] Preferably, when receiving a business requirement, performing personalized configuration on a plurality of jobs corresponding to the business requirement includes:

[0013] When receiving a business requirement, parsing the business requirement to obtain information to be configured;

[0014] Acquire multiple jobs corresponding to the business requirements;

[0015] The information to be configured is used to perform personalized configuration on the multiple jobs; wherein the personalized configuration at least includes execution time, frequency and job content.

[0016] Preferably, the process of triggering the timing cycle job according to the timing cycle rule includes:

[0017] Perform timed cyclic operations with minimum time intervals;

[0018] For all tasks under the timed cyclic job, determine whether the task status of the task is a newly created state;

[0019] If the task state of the task is not a newly created state, the process of the timed cyclic operation is terminated, and the process returns to the step of performing the timed cyclic operation at the minimum time interval, and waits for the next call of the job;

[0020] If the task status of the task is a newly created state, mark the task status as being processed, and determine whether the task has reached the execution start time;

[0021] If the task has not reached the execution start time, the task state is marked as a new state, the process of the timed cyclic operation is ended, and the execution returns to the step of performing the timed cyclic operation with the minimum time interval, waiting for the next call of the job;

[0022] If the task reaches the execution start time, perform business processing and determine whether the business processing is successful;

[0023] If the business processing fails, failure error information is obtained, the failure error information is recorded in the database, and the task state of the marked task is determined to be a new state or a failed state according to the pre-configured number of failure restarts;

[0024] If the business processing is successful, determine whether the task type of the task is a timed cycle;

[0025] If the task type of the task is not a timed loop, mark the task status as a success status, and return to the step of performing a timed loop job with a minimum time interval, waiting for the next call of the job;

[0026] If the task type of the task is a timed loop, update the next execution time of the task, mark the task state as a newly created state, and return to the step of performing a timed loop job with a minimum time interval, waiting for the next call of the job.

[0027] Preferably, in the process of executing the timed cyclic job, the multiple jobs after the personalized configuration are converted into multiple tasks, and the multiple tasks are merged into a unified timed cyclic task, including:

[0028] In the process of executing the timed cyclic job, the business type and calling frequency of multiple jobs after personalized configuration are determined;

[0029] Determining corresponding conversion methods according to the business types of the multiple jobs and the calling frequencies;

[0030] According to the conversion method, the multiple jobs after the personalized configuration are converted into multiple tasks, and the multiple tasks are merged into a unified timed cycle task.

[0031] Preferably, after processing each task in the unified timing cycle task by multithreading, the method further includes:

[0032] If the processing is abnormal, determine the exception type of the processing exception; wherein the exception type at least includes failure to call an external interface, database exception and / or program error;

[0033] If the exception type is a failure to call an external interface, the execution process of the task is logged; wherein the log record is used to track the execution history of the task, providing a basis for troubleshooting and performance optimization;

[0034] If the abnormality type is the database abnormality, a monitoring alarm mechanism is triggered;

[0035] If the exception type is the program error, the system automatically restarts according to the pre-configured number of failed restarts and re-executes the task.

[0036] The second aspect of the present application discloses a timing cycle task scheduling device, the device comprising:

[0037] A configuration unit, configured to, when receiving a business requirement, perform personalized configuration on a plurality of jobs corresponding to the business requirement;

[0038] A trigger unit, used to trigger the timing cycle operation according to the timing cycle rule; wherein the timing cycle rule is a rule for performing the timing cycle operation based on a minimum time interval;

[0039] A conversion unit, used for converting a plurality of jobs after personalized configuration into a plurality of tasks during the execution of a timed cyclic job, and merging the plurality of tasks into a unified timed cyclic task;

[0040] The processing unit is used to process each task in a unified timing cycle task through multi-threading.

[0041] Preferably, the configuration unit includes:

[0042] The parsing module is used to parse the business requirements when receiving the business requirements and obtain the information to be configured;

[0043] A first acquisition module, used to acquire multiple jobs corresponding to the business requirements;

[0044] A configuration module is used to perform personalized configuration on the multiple jobs using the information to be configured; wherein the personalized configuration at least includes execution time, frequency and job content.

[0045] Preferably, the trigger unit comprises:

[0046] The timing loop module is used to perform timing loop operations with a minimum time interval;

[0047] The first judgment module is used to judge whether the task status of all tasks under the timed cycle job is a new state;

[0048] A first execution module is used for terminating the process of the timed cyclic operation if the task state of the task is not the newly created state, and returning to the step of performing the timed cyclic operation at the minimum time interval, and waiting for the next call of the job;

[0049] The second judgment module is used to mark the task status as being in process if the task status of the task is a newly created status, and to judge whether the task has reached the execution start time;

[0050] The second execution module is used for marking the task state as a new state if the task has not reached the execution start time, ending the process of the timed cyclic operation, and returning to the step of performing the timed cyclic operation at the minimum time interval, waiting for the next call of the job;

[0051] A business processing module, used to perform business processing if the task reaches the execution start time, and determine whether the business processing is successful;

[0052] A first recording module is used to obtain failure error information if the business processing fails, record the failure error information in a database, and determine whether the task state of the marked task is a new state or a failed state according to a pre-configured number of failed restarts;

[0053] A third judgment module is used to judge whether the task type of the task is a timed cycle if the business processing is successful;

[0054] The third execution module is used for marking the task status as a success status if the task type of the task is not a timed cycle, and returning to the step of performing the timed cycle operation with a minimum time interval, and waiting for the next call of the job;

[0055] The fourth execution module is used to update the next execution time of the task if the task type is a timed loop, mark the task status as a new status, and return to the step of performing a timed loop job with a minimum time interval, and wait for the next call of the job.

[0056] Preferably, the conversion unit comprises:

[0057] A first determination module is used to determine the business types and calling frequencies of multiple jobs after personalized configuration during the execution of the timed cyclic job;

[0058] A second determination module, configured to determine corresponding conversion methods according to the business types of the plurality of jobs and the calling frequencies;

[0059] The conversion module is used to convert the multiple jobs after personalized configuration into multiple tasks according to the conversion method, and merge the multiple tasks into a unified timed cycle task.

[0060] Preferably, it also includes:

[0061] A third determination module is used to determine the exception type of the processing exception if the processing exception occurs; wherein the exception type at least includes failure to call an external interface, database exception and / or program error;

[0062] A second recording module is used to log the execution process of the task if the exception type is a failure to call an external interface; wherein the log record is used to track the execution history of the task to provide a basis for troubleshooting and performance optimization;

[0063] A trigger module, used for triggering a monitoring alarm mechanism if the abnormality type is the database abnormality;

[0064] The restart module is used to automatically restart and re-execute the task according to a pre-configured number of failed restarts if the exception type is the program error.

[0065] Through the above technical scheme, it can be known that the present application discloses a method and device for scheduling timed cyclic tasks. When receiving business needs, multiple jobs corresponding to the business needs are personalized configured, and the timed cyclic jobs are triggered according to the timed cyclic rules, wherein the timed cyclic rules are rules for performing timed cyclic jobs based on the minimum time interval. In the process of executing the timed cyclic jobs, the multiple jobs after personalized configuration are converted into multiple tasks, and the multiple tasks are merged into a unified timed cyclic task, and each task in the unified timed cyclic task is processed by multithreading. Through the above scheme, the task mechanism is introduced in the batch scheduling process to realize unified task scheduling, managed jobs, and trigger the timed cyclic job according to the timed cyclic rules, that is, through a timed cyclic batch job with a minimum time interval, multiple tasks with different businesses and different frequencies are scheduled, which improves the throughput and processing efficiency of the system. Through multithreading, each task in the unified timed cyclic task is processed, which can effectively solve the problems of multiple job nodes, complex job configuration, difficult job plan management, and job merging, and significantly improve the flexibility and convenience of business scheduling. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0067] Figure 1 A flowchart of a timed cyclic task scheduling method disclosed in an embodiment of the present application;

[0068] Figure 2 A schematic diagram of the scheduling process of the job disclosed in the embodiment of the present application;

[0069] Figure 3 A schematic diagram of the task status flow disclosed in the embodiment of the present application;

[0070] Figure 4 A schematic diagram of the process of scheduling a timed cyclic task disclosed in an embodiment of the present application;

[0071] Figure 5 A schematic diagram of merging multiple tasks into a unified timing cycle task disclosed in an embodiment of the present application;

[0072] Figure 6 A schematic diagram of the structure of a timing cycle task scheduling device disclosed in an embodiment of the present application;

[0073] Figure 7 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0074] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0075] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.

[0076] As can be seen from the background technology, when the number of businesses increases, the number of job nodes that need to be configured also increases accordingly. The batch scheduling system is usually highly complex, with many configuration options, and it is easy to make mistakes when adding new job nodes. If similar businesses have different scheduling frequencies, they also need to configure different job nodes, and job scheduling lacks flexibility. Therefore, how to improve the flexibility and convenience of business scheduling is a problem that this application urgently needs to solve.

[0077] In order to solve the above problems, the present application discloses a method and device for scheduling timed cyclic tasks, which introduces a task mechanism in the batch scheduling process, realizes unified task scheduling, manages jobs, and triggers timed cyclic jobs according to the timed cyclic rules, that is, through a timed cyclic batch job with a minimum time interval, multiple tasks with different businesses and different frequencies are scheduled, thereby improving the throughput and processing efficiency of the system. By processing each task in a unified timed cyclic task through multi-threading, it is possible to effectively solve the problems of multiple job nodes, complex job configuration, difficult job plan management, and job merging, and significantly improve the flexibility and convenience of business scheduling. The specific implementation method is specifically described through the following embodiments.

[0078] refer to Figure 1 As shown, a timing cycle task scheduling method disclosed in an embodiment of the present application is shown, and the timing cycle task scheduling method mainly includes the following steps:

[0079] S101: When a business requirement is received, a plurality of jobs corresponding to the business requirement are personalized configured.

[0080] Among them, personalized configuration includes execution time, frequency, job content, etc.

[0081] A job, also known as a batch job, refers to an executable unit, such as a program or script, which is used to complete specific business logic processing.

[0082] Specifically, when a business requirement is received, a process of performing personalized configuration on multiple jobs corresponding to the business requirement is shown in A1-A3.

[0083] A1: When receiving a business requirement, the business requirement is parsed to obtain the information to be configured.

[0084] A2: Get multiple jobs corresponding to business requirements.

[0085] A3: Perform personalized configuration on multiple jobs using the information to be configured; wherein the personalized configuration at least includes execution time, frequency and job content.

[0086] S102: triggering a timed cycle operation according to a timed cycle rule; wherein the timed cycle rule is a rule for performing a timed cycle operation based on a minimum time interval.

[0087] This application introduces tasks into job execution based on the timed cyclic task scheduling method (i.e., timed cyclic rule) of the batch scheduling system, which is used to host jobs and realize unified task scheduling management. Task scheduling management mainly includes task management, timed cyclic task scheduling, business processing and log monitoring modules.

[0088] The batch scheduling system is responsible for batch program scheduling and the management of the entire batch scheduling life cycle, including unified management, scheduling and monitoring of jobs, and supports end-of-day batches, online batches and timed cycle batches.

[0089] End-of-day batch refers to batch jobs that the system schedules to run once a day.

[0090] Online batch refers to the batch jobs submitted by the external system to the scheduling system for execution during the online period.

[0091] Task management is responsible for the creation, configuration and management of tasks;

[0092] Timed loop task scheduling is used to trigger task scheduling according to the timed loop rules;

[0093] Business processing is responsible for the actual execution of the work;

[0094] The log monitoring module is used to record task execution logs and monitor task status. After the task mechanism is introduced, the job scheduling process is as follows: Figure 2 shown.

[0095] 1) Task Management:

[0096] Except for some inseparable businesses (such as tasks that are executed only once, tasks whose execution interval is less than the minimum time interval, etc.), which are defined separately in jobs and directly scheduled and started by the batch scheduling system, the rest of the businesses are managed by tasks.

[0097] Task definition and creation: In a batch environment, downstream tasks are created by special tasks. In addition to supporting batch environments, users are allowed to define and create tasks based on business needs. Each task includes attributes such as task type, task object, execution date, task status, task end time, creator information, and notes.

[0098] Task configuration: Users can configure different execution strategies for tasks, including execution frequency (such as single, hourly, daily, weekly, monthly, etc.), start time, number of restarts after failure, etc. Before each task is executed, it is first determined whether the start time has been reached. After the task is completed, the next start time is updated. In addition, it also supports the configuration of dependencies between tasks to ensure that tasks are executed in the correct order.

[0099] Task status: There are four statuses for tasks: New, Processing, Successful, and Failed. Each scheduled cyclic job only calls the newly added status task for execution, and the execution changes to the Processing status. Then, based on the execution result and the task configuration strategy, the Processing status changes to Success, Failed, or New. The cyclically executed task automatically returns to the New status after processing. It supports the pre-configured number of failed restarts for failed tasks, and can also be manually restarted after failure. The task status flow is as follows: Figure 3 shown. Figure 3 A schematic diagram showing the task state flow.

[0100] Task storage and management: Store the created tasks in the database and support operations such as adding, deleting, modifying, and checking tasks. At the same time, it provides a task status monitoring function, which can display the running status, execution progress, and other information of the task in real time.

[0101] Permission management: The system adopts a strict permission management mechanism to ensure that only users with corresponding permissions can create, modify and delete tasks. At the same time, sensitive data and operations are encrypted and audited to ensure the security of system data.

[0102] 2) Scheduled cyclic task scheduling:

[0103] Through the timed cycle operation with the minimum time interval, all tasks under the job are called up each time to determine whether the task is in the new state;

[0104] If it is not a new state, skip the current task;

[0105] If it is a new state, mark the task status as being processed and determine whether the task has reached the execution start time;

[0106] If the execution start time has not been reached, the task status will be marked back to New;

[0107] If the execution start time is reached, the business processing is performed. After the business processing is successful, the next execution time is updated according to the configured execution frequency and the status is set to the new status. A single task is directly set to success.

[0108] If the business processing fails, the failure error information will be recorded in the database, and reminder information (in-site information, email, etc.) will be sent to the user. The task will be marked as a new state based on the pre-configured number of failed restarts. The user can also manually update it to a new state after the failure, and wait for the next job to be called. The timing cycle task scheduling diagram is shown in Figure 4.

[0109] Figure 4 In the process, the job starts and the timed cycle operation is performed with the minimum time interval;

[0110] For all tasks under the timed loop job, determine whether the task status of the task is the new status;

[0111] If the task status of the task is not the new status, the process of the timed cyclic operation is terminated, and the process returns to the step of performing the timed cyclic operation with the minimum time interval, waiting for the next call of the job;

[0112] If the task status of the task is a newly created status, mark the task status as being in progress, and determine whether the task has reached the execution start time;

[0113] If the task has not reached the execution start time, mark the task status as the new status, end the process of the timed loop job, and return to the step of performing the timed loop job with the minimum time interval, waiting for the next call of the job;

[0114] If the task reaches the execution start time, business processing is performed and whether the business processing is successful is determined;

[0115] If the business processing fails, a failure error message is obtained, the failure error message is recorded in the database, and the task status of the marked task is determined to be a new state or a failed state according to the pre-configured number of failure restarts;

[0116] If the business processing is successful, determine whether the task type of the task is a timed cycle;

[0117] If the task type is not a timed loop, mark the task status as a success status, and return to the step of performing a timed loop job with a minimum time interval, waiting for the next call of the job;

[0118] If the task type is a timed loop, update the next execution time of the task, mark the task status as a new state, and return to the step of performing a timed loop job with a minimum time interval, waiting for the next call of the job.

[0119] S103: In the process of executing the timed cyclic job, the multiple jobs after the personalized configuration are converted into multiple tasks, and the multiple tasks are merged into a unified timed cyclic task.

[0120] In the process of merging multiple tasks into a unified timed loop task, the unified timed loop task aligns the different tasks.

[0121] A unified timed loop task is a fixed timed loop with a minimum time interval, such as every 5 minutes.

[0122] It should be noted that the time intervals of all other tasks (ie, the multiple tasks called) are greater than or equal to the minimum time interval of the timed loop task.

[0123] Specifically, in the process of executing the timed cyclic job, the process of converting multiple jobs after personalized configuration into multiple tasks and merging the multiple tasks into a unified timed cyclic task is shown in C1-C3 below.

[0124] C1: During the execution of a scheduled cyclic job, determine the business type and calling frequency of multiple jobs after personalized configuration.

[0125] C2: Determine the corresponding conversion method based on the business type and calling frequency of multiple jobs.

[0126] C3: Convert multiple jobs after personalized configuration into multiple tasks according to the conversion method, and merge multiple tasks into a unified timed cycle task.

[0127] The specific process of merging multiple tasks into a unified timed loop task is as follows: Figure 5 shown.

[0128] Figure 5 In the process of executing the timed loop job, multiple jobs with different services and frequencies are converted into multiple tasks through the timed loop, and merged into a unified timed loop task. Figure 5 The left side of the diagram shows the various jobs. Figure 5 The right side is a unified timed loop task.

[0129] Figure 5For jobs with similar business but different calling frequencies, for example, job 3-1 and job 3-2 have similar business logic, but the only difference is the different pre-data processing. Job 3-1 is called by job 1, and job 3-2 is called by job 2. Before the introduction of tasks, two jobs are needed to process different data. After the introduction of tasks, under the unified task scheduling scheme, only two different tasks need to be added. After task 1 is processed and the data processing of the original job 1 is completed, task 3 can be directly called, or task 3 can be created and called at the next job execution time. The same is true for task 2.

[0130] When the job is executed to task 3, the data is processed differently according to the parameters created by different tasks. Jobs with different businesses and different call frequencies can also be configured as different tasks under a unified task scheduling scheme. The task start time is used to determine whether to execute the task, and the next execution time and other information are updated. This directly reduces the creation of job nodes, simplifies the complexity of job management, and reduces the management of job plans.

[0131] S104: Processing each task in the unified timing cycle task through multithreading.

[0132] For jobs that need to call up multiple tasks at the same time, multiple tasks need to be called up during the unified scheduling process. At this time, consider using multithreading for processing. Through multithreading, the original single-threaded processing logic is implemented using multithreading. After the job is started, the tasks are distributed to the corresponding threads for processing. Pseudocode for multithreading (Java 8). By using a unified timed loop scheduling, repeated data processing can be fundamentally avoided, and multithreading processing can be more convenient.

[0133] The code for multi-threaded execution of multiple tasks is as follows:

[0134]

[0135]

[0136] In the process of processing each task in a unified timed cycle task through multithreading, if a processing exception occurs, the exception type of the processing exception is determined; wherein the exception type at least includes failure to call an external interface, database exception and / or program error.

[0137] Batch programs encounter the following situations:

[0138] (1) Calling the external interface fails;

[0139] (2) Database anomaly;

[0140] (3) Program errors and application defects.

[0141] In view of the above situation, the following methods are used to monitor and handle exceptions:

[0142] If the exception type is failure to call an external interface, the execution process of the task is logged.

[0143] Logging: The system keeps detailed logs of the task execution process, including task start time, execution duration, execution results, etc. Logging helps track the execution history of tasks and provides a basis for troubleshooting and performance optimization.

[0144] If the exception type is a database exception, the monitoring alarm mechanism is triggered.

[0145] Monitoring and alarm mechanism: The system provides real-time monitoring functions, and displays the running status and execution status of tasks through reports. When the task execution is abnormal or exceeds the preset threshold (the preset threshold is set according to the actual situation and is not specifically limited in this application), the system can automatically trigger the alarm mechanism and notify relevant personnel to handle it through emails, text messages, etc.

[0146] If the exception type is a program error, it will automatically restart according to the pre-configured number of failed restarts and re-execute the task.

[0147] Fault-tolerance processing: The system has a complete fault-tolerance processing mechanism. When a task fails or the system is abnormal, it can automatically restart according to the pre-configured number of failed restarts and re-execute the task. At the same time, it supports task rollback and retry mechanisms to ensure that the task can be executed correctly.

[0148] The advantages of this application are as follows:

[0149] 1. High flexibility: This application is aimed at end-of-day batches and timed cycle batches. By introducing the task mechanism, tasks of different businesses and frequencies can be flexibly defined and managed. Each task can be personalized according to actual needs, including execution time, frequency, job content, etc., to meet various complex business needs.

[0150] 2. Unified Scheduling: This application implements unified task scheduling and job hosting, integrating job management and scheduling into one system. This greatly simplifies the complexity of job management, reduces management costs, and improves system stability and reliability.

[0151] 3. Efficient use of resources: Through the timed cyclic batch jobs with the minimum time interval (the system executes batch jobs multiple times a day according to the timed cyclic rules), this method can make full use of system resources and reduce resource waste. At the same time, it can schedule multiple tasks with different businesses and frequencies, thereby improving the system's throughput and processing efficiency.

[0152] 4. Simplified logic: The timing loop method simplifies the logic of task scheduling, making task scheduling more intuitive and easy to understand. This reduces the complexity and error rate in the scheduling process and improves the stability and maintainability of the system.

[0153] 5. Strong scalability: This application has good scalability and can adapt to batch processing scenarios of different scales and needs. As the business develops, new tasks can be easily added or the configuration of tasks can be adjusted to meet the changing business needs.

[0154] 6. Easy to monitor and maintain: This application provides detailed logging and monitoring functions, which can track the execution status, execution history and performance data of tasks in real time. This makes system monitoring and maintenance easier and more efficient, and helps to find and solve problems in a timely manner.

[0155] The beneficial effects of the embodiments of the present application are as follows: a task mechanism is introduced into the batch scheduling process to realize unified task scheduling, managed jobs, and timed cyclic jobs are triggered according to the timed cycle rules, that is, a timed cyclic batch job with a minimum time interval is used to schedule multiple tasks of different businesses and different frequencies, thereby improving the throughput and processing efficiency of the system. By processing each task in a unified timed cyclic task through multi-threading, it is possible to effectively solve the problems of multiple job nodes, complex job configuration, difficult job plan management, and job merging, and significantly improve the flexibility and convenience of business scheduling. The present application has the characteristics of simple principle, strong operability, flexible design, high reliability, and wide applicability.

[0156] Based on the timed cyclic task scheduling method disclosed in the above embodiment, the embodiment of the present application also discloses a timed cyclic task scheduling device, such as Figure 6 As shown, the timing cycle task scheduling device includes:

[0157] The configuration unit 601 is used to perform personalized configuration on multiple jobs corresponding to the business requirements when receiving the business requirements;

[0158] A trigger unit 602 is used to trigger a timed cycle operation according to a timed cycle rule; wherein the timed cycle rule is a rule for performing a timed cycle operation based on a minimum time interval;

[0159] The conversion unit 603 is used to convert the multiple jobs after personalized configuration into multiple tasks during the execution of the timed cyclic job, and merge the multiple tasks into a unified timed cyclic task;

[0160] The processing unit 604 is used to process each task in the unified timing cycle task through multi-threading.

[0161] Furthermore, the configuration unit 601 includes:

[0162] The parsing module is used to parse the business requirements when receiving the business requirements and obtain the information to be configured;

[0163] A first acquisition module is used to acquire multiple jobs corresponding to business requirements;

[0164] The configuration module is used to perform personalized configuration of multiple jobs using the information to be configured; wherein the personalized configuration at least includes execution time, frequency and job content.

[0165] Furthermore, the trigger unit 602 includes:

[0166] The timing loop module is used to perform timing loop operations with a minimum time interval;

[0167] The first judgment module is used to judge whether the task status of all tasks under the timed cycle job is a new state;

[0168] The first execution module is used for terminating the process of the timed cyclic operation if the task state of the task is not the newly created state, and returning to the step of performing the timed cyclic operation at the minimum time interval, and waiting for the next call of the job;

[0169] The second judgment module is used to mark the task status as being in process if the task status of the task is a newly created status, and to judge whether the task has reached the execution start time;

[0170] The second execution module is used for marking the task state as a new state if the task does not reach the execution start time, and ending the process of the timed cyclic operation, and returning to the step of performing the timed cyclic operation at the minimum time interval, waiting for the next call of the job;

[0171] The business processing module is used to perform business processing if the task reaches the execution start time and determine whether the business processing is successful;

[0172] The first recording module is used to obtain failure error information if the business processing fails, record the failure error information in the database, and determine whether the task state of the marked task is a new state or a failed state according to the pre-configured number of failure restarts;

[0173] The third judgment module is used to judge whether the task type of the task is a timed cycle if the business processing is successful;

[0174] The third execution module is used for marking the task status as a success status if the task type of the task is not a timed loop, and returning to the step of performing the timed loop job with the minimum time interval, and waiting for the next call of the job;

[0175] The fourth execution module is used to update the next execution time of the task if the task type is a timed loop, mark the task status as a new status, and return to the step of performing a timed loop job with a minimum time interval, waiting for the next call of the job.

[0176] Furthermore, the conversion unit 603 includes:

[0177] A first determination module is used to determine the business types and calling frequencies of multiple jobs after personalized configuration during the execution of the timed cyclic job;

[0178] The second determination module is used to determine the corresponding conversion method according to the business type and calling frequency of multiple jobs;

[0179] The conversion module is used to convert multiple jobs after personalized configuration into multiple tasks according to the conversion method, and merge the multiple tasks into a unified timed cycle task.

[0180] Furthermore, it also includes:

[0181] A third determination module is used to determine the exception type of the processing exception if the processing exception occurs; wherein the exception type at least includes failure to call an external interface, database exception and / or program error;

[0182] The second recording module is used to log the execution process of the task if the exception type is a failure to call an external interface; wherein the log record is used to track the execution history of the task to provide a basis for troubleshooting and performance optimization;

[0183] A trigger module, used to trigger a monitoring alarm mechanism if the abnormality type is the database abnormality;

[0184] The restart module is used to automatically restart and re-execute the task according to a pre-configured number of failed restarts if the exception type is the program error.

[0185] The beneficial effects of the embodiments of the present application are as follows: a task mechanism is introduced into the batch scheduling process to realize unified task scheduling, managed jobs, and timed cyclic jobs are triggered according to the timing cycle rules, that is, a timed cyclic batch job with a minimum time interval is used to schedule multiple tasks of different businesses and different frequencies, thereby improving the throughput and processing efficiency of the system. By processing each task in a unified timed cyclic task through multi-threading, it is possible to effectively solve the problems of multiple job nodes, complex job configuration, difficult job plan management, and job merging, and significantly improve the flexibility and convenience of business scheduling.

[0186] An embodiment of the present application further provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the above-mentioned timing cycle task scheduling method.

[0187] The present application also provides an electronic device, whose structural diagram is as follows: Figure 7 As shown, it specifically includes a memory 701 and one or more instructions 702, wherein the one or more instructions 702 are stored in the memory 701 and are configured to be executed by one or more processors 703 to execute the one or more instructions 702 to perform the above-mentioned timing cycle task scheduling method.

[0188] For the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0189] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0190] The steps in the methods of the embodiments of the present application can be adjusted in order, combined, and deleted according to actual needs.

[0191] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.

[0192] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

[0193] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A timed cyclic task scheduling method, characterized in that: The method comprises: When receiving a business requirement, performing personalized configuration on multiple jobs corresponding to the business requirement; Triggering a timed cycle job according to a timed cycle rule; wherein the timed cycle rule is a rule for performing a timed cycle job based on a minimum time interval; In the process of executing the timed cyclic job, the multiple jobs after the personalized configuration are converted into multiple tasks, and the multiple tasks are merged into a unified timed cyclic task; Each task in a unified timed loop task is processed through multithreading.

2. The method according to claim 1, characterized in that When receiving a business requirement, performing personalized configuration on multiple jobs corresponding to the business requirement includes: When receiving a business requirement, parsing the business requirement to obtain information to be configured; Acquire multiple jobs corresponding to the business requirements; The plurality of jobs are personalized configured using the information to be configured; wherein the personalized configuration at least includes execution time, frequency and job content.

3. The method according to claim 1, characterized in that The process of triggering a timed loop job according to the timed loop rule includes: Perform timed cyclic operations with minimum time intervals; For all tasks under the timed cyclic job, determine whether the task status of the task is a newly created state; If the task state of the task is not a newly created state, the process of the timed cyclic operation is terminated, and the process returns to the step of performing the timed cyclic operation at the minimum time interval, and waits for the next call of the job; If the task status of the task is a newly created state, mark the task status as being processed, and determine whether the task has reached the execution start time; If the task has not reached the execution start time, the task state is marked as a new state, the process of the timed cyclic operation is ended, and the execution returns to the step of performing the timed cyclic operation with the minimum time interval, waiting for the next call of the job; If the task reaches the execution start time, perform business processing and determine whether the business processing is successful; If the business processing fails, failure error information is obtained, the failure error information is recorded in the database, and the task state of the marked task is determined to be a new state or a failed state according to the pre-configured number of failure restarts; If the business processing is successful, determine whether the task type of the task is a timed cycle; If the task type of the task is not a timed loop, mark the task status as a success status, and return to the step of performing a timed loop job with a minimum time interval, waiting for the next call of the job; If the task type of the task is a timed loop, update the next execution time of the task, mark the task state as a newly created state, and return to the step of performing a timed loop job with a minimum time interval, waiting for the next call of the job.

4. The method according to claim 1, characterized in that: In the process of executing the timing cycle job, the multiple jobs after the personalized configuration are converted into multiple tasks, and the multiple tasks are merged into a unified timing cycle task, including: In the process of executing the timed cyclic job, the business type and calling frequency of multiple jobs after personalized configuration are determined; Determining corresponding conversion methods according to the business types of the multiple jobs and the calling frequencies; According to the conversion method, the multiple jobs after the personalized configuration are converted into multiple tasks, and the multiple tasks are merged into a unified timed cycle task.

5. The method according to claim 1, characterized in that After processing each task in the unified timing cycle task through multithreading, the method further includes: If the processing is abnormal, determine the exception type of the processing exception; wherein the exception type at least includes failure to call an external interface, database exception and / or program error; If the exception type is a failure to call an external interface, the execution process of the task is logged; wherein the log record is used to track the execution history of the task, providing a basis for troubleshooting and performance optimization; If the abnormality type is the database abnormality, a monitoring alarm mechanism is triggered; If the exception type is the program error, the system automatically restarts according to the pre-configured number of failed restarts and re-executes the task.

6. A timed cyclic task scheduling device, characterized in that: The device comprises: A configuration unit, configured to, when receiving a business requirement, perform personalized configuration on a plurality of jobs corresponding to the business requirement; A trigger unit, used to trigger the timing cycle operation according to the timing cycle rule; wherein the timing cycle rule is a rule for performing the timing cycle operation based on a minimum time interval; A conversion unit, used for converting a plurality of jobs after personalized configuration into a plurality of tasks during the execution of a timed cyclic job, and merging the plurality of tasks into a unified timed cyclic task; The processing unit is used to process each task in a unified timing cycle task through multi-threading.

7. The device according to claim 6, characterized in that The configuration unit comprises: The parsing module is used to parse the business requirements when receiving the business requirements and obtain the information to be configured; A first acquisition module, used to acquire multiple jobs corresponding to the business requirements; A configuration module is used to perform personalized configuration on the multiple jobs using the information to be configured; wherein the personalized configuration at least includes execution time, frequency and job content.

8. The device according to claim 6, characterized in that The trigger unit comprises: The timing loop module is used to perform timing loop operations with a minimum time interval; The first judgment module is used to judge whether the task status of all tasks under the timed cycle job is a new state; A first execution module is used for terminating the process of the timed cyclic operation if the task state of the task is not the newly created state, and returning to the step of performing the timed cyclic operation at the minimum time interval, and waiting for the next call of the job; The second judgment module is used to mark the task status as being in process if the task status of the task is a newly created status, and to judge whether the task has reached the execution start time; The second execution module is used for marking the task state as a new state if the task has not reached the execution start time, ending the process of the timed cyclic operation, and returning to the step of performing the timed cyclic operation at the minimum time interval, waiting for the next call of the job; A business processing module, used to perform business processing if the task reaches the execution start time, and determine whether the business processing is successful; A first recording module is used to obtain failure error information if the business processing fails, record the failure error information in a database, and determine whether the task state of the marked task is a new state or a failed state according to a pre-configured number of failed restarts; A third judgment module is used to judge whether the task type of the task is a timed cycle if the business processing is successful; The third execution module is used for marking the task status as a success status if the task type of the task is not a timed cycle, and returning to the step of performing the timed cycle operation with a minimum time interval, and waiting for the next call of the job; The fourth execution module is used to update the next execution time of the task if the task type is a timed loop, mark the task status as a new status, and return to the step of performing a timed loop job with a minimum time interval, and wait for the next call of the job.

9. The device according to claim 6, characterized in that The conversion unit comprises: A first determination module is used to determine the business types and calling frequencies of multiple jobs after personalized configuration during the execution of the timed cyclic job; A second determination module, configured to determine corresponding conversion methods according to the business types of the plurality of jobs and the calling frequencies; The conversion module is used to convert the multiple jobs after personalized configuration into multiple tasks according to the conversion method, and merge the multiple tasks into a unified timed cycle task.

10. The device according to claim 6, characterized in that Also includes: A third determination module is used to determine the exception type of the processing exception if the processing exception occurs; wherein the exception type at least includes failure to call an external interface, database exception and / or program error; A second recording module is used to log the execution process of the task if the exception type is a failure to call an external interface; wherein the log record is used to track the execution history of the task to provide a basis for troubleshooting and performance optimization; A trigger module, used for triggering a monitoring alarm mechanism if the abnormality type is the database abnormality; The restart module is used to automatically restart and re-execute the task according to a pre-configured number of failed restarts if the exception type is the program error.