A task scheduling method and system
By using the main scheduler and execution nodes to work together in financial business scenarios, the problem of insufficient granularity, real-timeness and flexibility of task scheduling in financial business in the existing technology is solved, and high availability and refinement are achieved. Task scheduling management.
Patent Information
- Application Number
- CN202410917932.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2044-07-10
AI Technical Summary
The existing distributed scheduling framework has the problems of large task scheduling processing granularity, poor real-time performance, and poor flexibility in financial business scenarios, especially in the transaction business where the amount of transaction data is large and the frequency of task scheduling is high. Down.
Load and distribute pending tasks by running the main scheduler on the master node, obtain and execute tasks by multiple execution nodes, return task execution status to adjust the initial task scheduling strategy, configure task execution queues and result queues to improve scheduling efficiency and flexibility It uses the main scheduler to adjust the scheduling strategy according to the execution node status to achieve data fault tolerance and task monitoring.
It improves the high availability and real-time nature of financial services, improves the degree of intelligent and refined task scheduling, and enhances the efficiency and flexibility of task scheduling management for financial services.
Smart Images

Figure CN118467140B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of financial technology, and in particular to a task scheduling method and system. Background Art
[0002] With the widespread application of distributed framework applications, the requirements for task processing and scheduling of distributed services are becoming increasingly higher. Currently, existing distributed scheduling frameworks (such as xxl-job, elastic-job, etc.) are usually used to perform task scheduling.
[0003] However, for business scenarios in the financial field, there are usually complex transactions, large amounts of transaction data, and a high frequency of task scheduling for transactions. Applying the existing scheduling framework to financial business scenarios results in large processing granularity of task scheduling, poor scheduling real-time performance, and poor flexibility. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a task scheduling method and system, which can use the main scheduling program run by the main node to load the tasks to be processed and distribute the tasks to be processed; the tasks to be processed are tasks for processing new transaction data; multiple execution nodes are used to respectively obtain and execute the tasks distributed by the main scheduling program, and return the task execution status; the main scheduling program is used to determine whether to adjust the initial task scheduling strategy based on the task execution status returned by each of the execution nodes; the embodiment of the present invention improves the high availability and real-time performance of processing financial business, and improves the degree of intelligent task scheduling for financial business and the degree of refinement of task scheduling.
[0005] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a task scheduling method is provided, characterized in that it includes: determining a main node from multiple execution nodes that execute tasks; in response to the triggering of an initial task scheduling strategy, using a main scheduling program run by the main node to load tasks to be processed and distribute the tasks to be processed; wherein the tasks to be processed are tasks for processing newly added transaction data; using multiple execution nodes to respectively obtain and execute the tasks distributed by the main scheduling program, and return the task execution status; using the main scheduling program to determine whether to adjust the initial task scheduling strategy according to the task execution status returned by each of the execution nodes.
[0006] Optionally, the task scheduling method further includes: configuring a task execution queue independent of the main node and the multiple execution nodes; using the main scheduling program to distribute pending tasks includes: using the main scheduling program to distribute pending tasks to the task execution queue; the multiple execution nodes respectively execute and process the pending tasks, including: the multiple execution nodes obtain the pending tasks from the task execution queue and execute them by setting strategies.
[0007] Optionally, the task scheduling method further includes: configuring a task result queue independent of the main node and the multiple execution nodes; the multiple execution nodes return the task execution status, including: the multiple execution nodes send the task execution status obtained by processing the task to the task result queue; using the main scheduler to determine whether to adjust the initial task scheduling strategy according to the task execution status returned by each of the execution nodes, including: the main scheduler obtains the task execution status returned by each of the execution nodes from the task result queue.
[0008] Optionally, the task scheduling method further includes: the main scheduler sends a control message to the task execution queue indicating control of one or more tasks; after the execution node obtains the control message from the task execution queue, it obtains the target interface matched by the task indicated by the control message; and calls the target interface to execute processing matching the control message.
[0009] Optionally, the task scheduling method further includes: when one or more of the execution nodes execute the task distributed by the main scheduling program and determine that the task execution status is abnormal, the execution node executes the data fault tolerance operation corresponding to the task.
[0010] Optionally, the task scheduling method further includes: the initial task scheduling strategy for the task to be processed includes managing the task trigger time in the task trigger time queue based on time sorting, wherein the task trigger time indicates one or more tasks included in the task to be processed; the time sorting is determined according to any one or more time types among a set time interval, multiple types of task trigger frequencies, and multiple set time periods.
[0011] Optionally, the main scheduling program is used to determine whether to adjust the initial task scheduling policy based on the task execution status returned by each of the execution nodes, including: when the main scheduling program is used to determine that the task execution status returned by each of the execution nodes is normal, determining not to adjust the initial task scheduling policy; when the main scheduling program is used to determine that there is an abnormality in the task execution status returned by one or more of the execution nodes, re-determining the next round of business scheduling trigger time for the execution nodes with the abnormality to adjust the initial task scheduling policy.
[0012] Optionally, re-determining the next round of business scheduling trigger time for the execution node with the abnormality includes: calculating the next round of task scheduling trigger time of the execution node with the abnormality based on the current timestamp, and adding the next round of business scheduling trigger time to the task trigger time queue, wherein the task trigger time queue contains task trigger times sorted based on time.
[0013] Optionally, the task scheduling method further includes: providing a task execution monitoring page for displaying the execution status of multiple tasks; receiving user control messages for tasks through the task execution monitoring page; and executing the step of sending control messages to the task execution queue through the main scheduling program.
[0014] To achieve the above-mentioned purpose, according to the second aspect of an embodiment of the present invention, a task scheduling system is provided, comprising: a master node and an execution node, wherein the master node is used to respond to the triggering of an initial task scheduling strategy, load pending tasks using a main scheduling program run by the master node, and distribute the pending tasks; wherein the pending tasks are tasks for processing newly added transaction data; the execution nodes respectively obtain and execute the tasks distributed by the main scheduling program, and return the task execution status; the master node is determined from a plurality of execution nodes that execute the business; the master node uses the main scheduling program to determine whether to adjust the initial task scheduling strategy according to the task execution status returned by each of the execution nodes.
[0015] Optionally, the task scheduling system is further configured with a task execution queue independent of the main node and the multiple execution nodes; the use of the main scheduling program to distribute pending tasks includes: using the main scheduling program to distribute pending tasks to the task execution queue; the multiple execution nodes respectively execute and process the pending tasks, including: the multiple execution nodes obtain the pending tasks from the task execution queue and execute them by setting strategies.
[0016] Optionally, the task scheduling system is further configured with a task result queue independent of the main node and the multiple execution nodes; the multiple execution nodes return the task execution status, including: the multiple execution nodes send the task execution status obtained by processing the task to the task result queue; the main scheduling program is used to determine whether to adjust the initial task scheduling strategy according to the task execution status returned by each of the execution nodes, including: the main scheduling program obtains the task execution status returned by each of the execution nodes from the task result queue.
[0017] Optionally, the main scheduler included in the master node sends a control message to the task execution queue indicating control of one or more tasks; after the execution node obtains the control message from the task execution queue, it obtains the target interface matching the task indicated by the control message; and calls the target interface to execute processing matching the control message.
[0018] Optionally, when one or more of the execution nodes execute a task distributed by the main scheduler and determine that the task execution status is abnormal, the execution node performs a data fault-tolerant operation corresponding to the task.
[0019] Optionally, the task scheduling system further includes an initial task scheduling strategy for the tasks to be processed, including managing the task trigger time in the task trigger time queue based on time sorting, wherein the task trigger time indicates one or more tasks included in the tasks to be processed; the time sorting is determined according to any one or more time types among a set time interval, multiple types of task trigger frequencies, and multiple set time periods.
[0020] Optionally, the master node uses the main scheduling program to determine whether to adjust the initial task scheduling policy based on the task execution status returned by each of the execution nodes, including: when the main scheduling program is used to determine that the task execution status returned by each of the execution nodes is normal, determining not to adjust the initial task scheduling policy; when the main scheduling program is used to determine that there is an abnormality in the task execution status returned by one or more of the execution nodes, re-determining the next round of business scheduling trigger time for the execution nodes with the abnormality to adjust the initial task scheduling policy.
[0021] Optionally, the master node re-determines the next round of business scheduling trigger time for the execution node with the abnormality, including: calculating the next round of task scheduling trigger time of the execution node with the abnormality based on the current timestamp, and adding the next round of business scheduling trigger time to the task trigger time queue, wherein the task trigger time queue contains task trigger times sorted based on time.
[0022] Optionally, the task scheduling system is further provided with a task execution monitoring page displaying the execution status of multiple tasks; receiving user control messages for tasks through the task execution monitoring page; and executing the step of sending control messages to the task execution queue through the main scheduling program.
[0023] To achieve the above-mentioned purpose, according to the third aspect of an embodiment of the present invention, there is provided an electronic device for task scheduling, characterized in that it includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement any of the methods described in the above-mentioned task scheduling methods.
[0024] To achieve the above-mentioned purpose, according to a fourth aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored, characterized in that when the program is executed by a processor, any method as described in the above-mentioned task scheduling method is implemented.
[0025] An embodiment of the above invention has the following advantages or beneficial effects: it is capable of using the main scheduling program run by the main node to load tasks to be processed and distribute the tasks to be processed; the tasks to be processed are tasks for processing newly added transaction data; multiple execution nodes are used to respectively obtain and execute the tasks distributed by the main scheduling program, and return the task execution status; the main scheduling program is used to determine whether to adjust the initial task scheduling strategy based on the task execution status returned by each of the execution nodes; the embodiments of the present invention improve the high availability and real-time performance of processing financial business, and improve the degree of intelligent task scheduling for financial business and the degree of refinement of task scheduling.
[0026] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.
[0028] Figure 1 It is a flowchart of a task scheduling method provided by an embodiment of the present invention;
[0029] Figure 2 is a flowchart of another task scheduling method provided by an embodiment of the present invention;
[0030] Figure 3 It is a structural diagram of a method for implementing task scheduling provided by an embodiment of the present invention;
[0031] Figure 4It is a structural diagram of a task scheduling system provided by an embodiment of the present invention;
[0032] Figure 5 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;
[0033] Figure 6 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.
[0035] It should be noted that in the technical solution of the present invention, the collection, use, storage, sharing and transfer of user personal information involved are in compliance with the provisions of relevant laws and regulations, and it is necessary to inform the user and obtain the user's consent or authorization. When applicable, the user's personal information is de-identified and / or anonymized and / or encrypted.
[0036] like Figure 1 As shown, an embodiment of the present invention provides a task scheduling method, which may include the following steps:
[0037] Step S101: Determine a master node from a plurality of execution nodes that execute tasks.
[0038] Specifically, the embodiment of the present invention takes multiple service computing nodes in a distributed environment as an example, and the multiple service computing nodes are execution nodes that execute tasks. Furthermore, a master node (i.e., Leader) is selected from the execution nodes, and the strategy for selecting the master node can be set according to the actual application scenario, such as according to the resource situation of each execution node, randomly selecting according to the number of the execution node, etc.; it can be understood that a main scheduling program is set in each execution node, and after the direct point is selected, the main scheduling program running in the master node is used to perform centralized task scheduling.
[0039] Step S102: In response to the triggering of the initial task scheduling strategy, the main scheduling program running on the master node is used to load the tasks to be processed and distribute the tasks to be processed; wherein the tasks to be processed are tasks for processing newly added transaction data.
[0040] Specifically, the main scheduler running in the master node includes multiple custom interfaces such as task loading, task execution, task failure, timeout notification, etc. Compared with the prior art which only includes manual execution interfaces, the embodiments of the present invention can achieve multiple beneficial effects such as controlling the granularity of task scheduling, controlling the data flow of processing tasks, and fault-tolerant processing of tasks through multiple interfaces, thereby improving the flexibility and efficiency of task scheduling.
[0041] In an embodiment of the present invention, the processed tasks are related to transaction business in the financial field; tasks in the financial field have characteristics such as high trigger frequency and large amount of processed data; therefore, by using the embodiment of the present invention, the refinement and scheduling efficiency of task scheduling in the financial field can be improved by controlling the flow and trigger time of processing financial data.
[0042] Furthermore, an embodiment of the present invention can load tasks to be processed through a task loading interface (such as the LoadTasks function), wherein the tasks to be processed are businesses that process newly added transaction data. It can be seen that the task loading interface can be used to control the data range (i.e., data flow) processed by the task, thereby controlling the processing time of the task and improving the real-time performance of new data processing for financial data.
[0043] Furthermore, the master node distributes tasks to each execution node through the master scheduler, so that each execution node runs its own task respectively.
[0044] In an embodiment of the present invention, a task execution queue is configured, and the task execution queue is a component independent of the master node and multiple execution nodes, and is used to store tasks distributed by the master node, and tasks acquired by the execution nodes from the task execution queue for execution, wherein the execution nodes can acquire tasks from the task execution queue through strategies such as preemption or ID-hash load balancing; the task execution queue improves the management efficiency of tasks, as well as the degree of automatic scheduling of tasks distributed by the master node and executed by the execution nodes. That is, a task execution queue independent of the master node and multiple execution nodes is configured; the use of the main scheduler to distribute pending tasks includes: using the main scheduler to distribute pending tasks to the task execution queue; the multiple execution nodes respectively execute and process the pending tasks, including: multiple execution nodes acquire pending tasks from the task execution queue and execute them by setting strategies.
[0045] Step S103: using a plurality of execution nodes to respectively obtain and execute the tasks distributed by the main scheduler, and return the task execution status.
[0046] Specifically, each execution node for executing tasks respectively executes the tasks distributed by the main scheduler and returns the task execution status.
[0047] Furthermore, an embodiment of the present invention is configured with a task result queue, which is a component independent of the main node and multiple execution nodes, and is used to save the status of the execution node executing the business, and the main node obtains the task execution status from the task result queue; that is, a task result queue independent of the main node and the multiple execution nodes is configured; the multiple execution nodes return the task execution status, including: the multiple execution nodes send the task execution status obtained by processing the task to the task result queue; use the main scheduler to determine whether to adjust the initial task scheduling strategy according to the task execution status returned by each of the execution nodes, including: the main scheduler obtains the task execution status returned by each of the execution nodes from the task result queue.
[0048] Furthermore, when one or more of the execution nodes execute the tasks distributed by the main scheduling program and determine that the task execution status is abnormal, the execution node executes the data fault-tolerant operation corresponding to the task. Among them, the data fault-tolerant operation includes data rollback, reporting of abnormalities, etc. Thus, strong consistency, decentralization, and high availability for financial business processing are achieved, and the problem of task execution timeout alarm caused by physical time errors of different nodes is overcome through unified scheduling and task management of the main scheduling level of the master node.
[0049] Combine the following Figure 3 The schematic diagram of the embodiment of the present invention describes the structure between the master node, the execution node, the task execution queue, and the task result queue, such as Figure 3 As shown:
[0050] The main scheduler (JobScheduler) runs in the master node 301, which loads and dispatches tasks (loading / dispatching) to the task execution queue (TaskExecQueue) contained in the task queue 302. The task executors (TaskExecutor1, TaskExecutor2, etc.) running in the multiple execution nodes 303 obtain tasks from the task execution queue and send the task execution status to the task result queue (TaskResultQueue) contained in the task queue 302;
[0051] Furthermore, the main scheduler maintains the job timing queue and performs task scheduling and adjustment based on the Job&Task data model and data such as the considered execution status.
[0052] In the embodiment of the present invention, the job timing queue (i.e., the task trigger time queue) belongs to the initial task scheduling strategy, and the task departure time of each task is sorted by time. The time sorting can have different types of sorting strategies, for example: the set time interval for holidays is different from that for non-holidays, and different task trigger frequencies such as high, medium, and low corresponding to different time periods of non-holidays (high frequency is, for example, at the second level, such as an interval of 5 seconds, 15 seconds, etc., medium frequency is, for example, at the minute level, and low frequency is, for example, at the hour level, etc.). It can be understood that the initial task scheduling strategy is the task scheduling strategy before adjustment. That is, the initial task scheduling strategy for the pending task includes managing the task trigger time based on time sorting in the task trigger time queue, wherein the task trigger time indicates one or more tasks included in the pending task; the time sorting is determined according to the set time interval, multiple types of task trigger frequencies, and any one or more time types in multiple set time periods. The customization degree of the scheduling for financial business processing is improved through multiple task trigger times, while the computing resource utilization efficiency of distributed nodes is improved.
[0053] according to Figure 3 In the system structure shown, the cluster where the execution node (TaskExecutor) is located can perform dynamic expansion and reduction, further improving the scalability and flexibility of processing financial data business using a distributed structure.
[0054] Step S104: using the main scheduling program to determine whether to adjust the initial task scheduling strategy according to the task execution status returned by each execution node.
[0055] Specifically, the scheduler running on the master node can obtain the execution status of each task from the task result queue. If it is determined that there is an exception in the task execution status (such as failure, error, etc.), the task failure, timeout notification and other interfaces (such as failureNotity interface) can be called to determine the status of the task and recalculate the next round of task scheduling trigger time. For example, the nextCronTrigger interface is used to re-determine the next round of task scheduling trigger time, so that the scheduling strategy for the task can be automatically adjusted.
[0056] That is, the main scheduling program is used to determine whether to adjust the initial task scheduling policy according to the task execution status returned by each of the execution nodes, including: when the main scheduling program is used to determine that the task execution status returned by each of the execution nodes is normal, determining not to adjust the initial task scheduling policy; when the main scheduling program is used to determine that there is an abnormality in the task execution status returned by one or more of the execution nodes, re-determining the next round of business scheduling trigger time for the execution nodes with the abnormality to adjust the initial task scheduling policy.
[0057] Furthermore, when adjusting the initial task scheduling strategy, the next round of task trigger time is calculated according to the current time (the calculation method can be determined based on comprehensive factors such as different time periods such as holidays and non-holidays, different frequencies, etc. included in the initial task scheduling strategy), and the tasks in the task trigger time queue are readjusted, that is, the next round of business scheduling trigger time is re-determined for the execution node with the abnormality, including: calculating the next round of task scheduling trigger time of the execution node with the abnormality according to the current timestamp, and adding the next round of business scheduling trigger time to the task trigger time queue, wherein the task trigger time queue contains task trigger times sorted based on time.
[0058] In another embodiment of the present invention, the SpringCloud microservice framework and the distributed coordination service Zookeeper are used to collaborate to build a high-frequency polling batch scheduling system framework for financial business transactions, including the following steps:
[0059] 1. Define transaction scheduling tasks in the application service node and determine trigger conditions such as holiday rules, that is, configure the initial task scheduling strategy.
[0060] 2. The scheduling time of each node is coordinated by Zookeeper.
[0061] 3. The master node where the main scheduler is located is determined by the Zookeeper coordination service through leader election.
[0062] 4. The main scheduler first calls the task loading interface of the task, and distributes the returned batch transaction data (i.e., newly added transaction data) to each task execution node for execution according to a certain load balancing strategy.
[0063] 5. Each execution node executes the task through the task execution interface and returns the result to the main scheduler.
[0064] 6. The main scheduler determines whether the next scheduling strategy of the task needs to be adjusted based on the return status of each task execution node.
[0065] 7. Check the execution status of each task in the task monitoring interface.
[0066] According to the characteristics of financial fund transaction processing, the embodiment of the present invention constructs asynchronous batch processing transaction tasks for transaction tasks with high trigger frequency, and uses multiple nodes to improve distributed computing capabilities. The task scheduling system provided by the embodiment of the present invention provides interfaces such as task loading, task execution, task failure, and timeout notification to perform fine-grained scheduling control and support transaction characteristic scheduling, such as distinguishing time zones, holidays, frequencies, etc., and can schedule the streaming incremental processing of newly added transaction data at high frequency to speed up transaction processing. By managing the task scheduling and computing capabilities of each service computing node in a distributed environment, the efficiency of computing resource utilization is improved.
[0067] like Figure 2 As shown, an embodiment of the present invention provides another task scheduling method, which may include the following steps:
[0068] Step S201: receiving a user's control message for a task through the task execution monitoring page.
[0069] Step S202: the main scheduler sends a control message instructing to control one or more tasks to the task execution queue.
[0070] Step S203: After the execution node reads the control message from the task execution queue, it obtains the target interface matched by the task indicated by the control message.
[0071] Step S204: calling the target interface to execute processing matching the control message.
[0072] Specifically, in an embodiment of the present invention, a main scheduler running on a master node can also be used to send a control message to a task execution queue; the control message is, for example, timeout, pause, stop, etc.; further, the control message sent to the master node can be sent by a user through a component of a task monitoring page according to an actual scenario; so that a user can manage task scheduling by sending control messages in some scenarios, further improving the flexibility of task scheduling management. That is, a task execution monitoring page is provided to display the execution status of multiple tasks; a user's control message for a task is received through the task execution monitoring page; and the step of sending a control message to the task execution queue is executed through the main scheduler.
[0073] Furthermore, the main scheduler sends a control message indicating control of one or more tasks to the task execution queue; after the execution node reads the control message from the task execution queue, it obtains the target interface matched by the task indicated by the control message; and calls the target interface to execute the processing matched by the control message. Specifically, after receiving the control message (timeout, pause, stop, etc.), the main scheduler calls the target interface that matches the control message, for example, calling the timeout interface for the timeout message (timeout message), calling the pause interface for the pause message (pause message), etc.; by calling the interface (i.e., the target interface) to execute the timeout, pause, stop, etc. of the task, it is possible to directly manage the task scheduling in some scenarios through the task execution monitoring page that displays the execution status of multiple tasks, thereby improving the flexibility and maintainability of managing task scheduling.
[0074] like Figure 4 As shown, an embodiment of the present invention provides a task scheduling system, including a master node 401 and an execution node 402; wherein,
[0075] The master node 401 is used to respond to the triggering of the initial task scheduling strategy, load the pending tasks using the main scheduling program running on the master node, and distribute the pending tasks; wherein the pending tasks are tasks for processing newly added transaction data;
[0076] The execution nodes 402 respectively obtain and execute the tasks distributed by the main scheduler, and return the task execution status;
[0077] The master node 401 is determined from a plurality of execution nodes 402 that execute services;
[0078] The master node 401 uses the master scheduling program to determine whether to adjust the initial task scheduling strategy according to the task execution status returned by each of the execution nodes 402 .
[0079] An embodiment of the present invention also provides an electronic device for task scheduling, comprising: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the method provided in any of the above embodiments.
[0080] An embodiment of the present invention further provides a computer-readable medium on which a computer program is stored. When the program is executed by a processor, the method provided in any of the above embodiments is implemented.
[0081] Figure 5An exemplary system architecture 500 is shown to which a task scheduling method or a task scheduling system according to an embodiment of the present invention can be applied.
[0082] like Figure 5 As shown, system architecture 500 may include terminal devices 501, 502, 503, a network 504 and a server 505. Network 504 is used to provide a medium for communication links between terminal devices 501, 502, 503 and server 505. Network 504 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0083] Users can use terminal devices 501, 502, 503 to interact with server 505 through network 504 to receive or send messages, etc. Various client applications can be installed on terminal devices 501, 502, 503, such as e-commerce client applications, web browser applications, search applications, instant messaging tools, and email clients.
[0084] The terminal devices 501 , 502 , and 503 may be various electronic devices having a display screen and supporting various client applications, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0085] The server 505 may be a server that provides various services, including a master node and an execution node, etc. The server may be a background management server that supports the client applications used by the user using the terminal devices 501, 502, and 503. The background management server may process the received financial data service request and provide the result of processing the financial data to the terminal device.
[0086] It should be noted that the task scheduling method provided in the embodiment of the present invention is generally executed by the server 505 , and accordingly, the task scheduling system is generally set in the server 505 .
[0087] It should be understood that Figure 5 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0088] Reference below Figure 6 , which shows a schematic diagram of the structure of a computer system 600 of a terminal device suitable for implementing an embodiment of the present invention. Figure 6 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0089] like Figure 6As shown, the computer system 600 includes a central processing unit (CPU) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage part 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the system 600 are also stored. The CPU 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0090] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as needed. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as needed, so that a computer program read therefrom is installed into the storage section 608 as needed.
[0091] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 609, and / or installed from the removable medium 611. When the computer program is executed by the central processing unit (CPU) 601, the above-mentioned functions defined in the system of the present invention are executed.
[0092] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0093] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0094] The modules and / or units involved in the embodiments of the present invention may be implemented in software or hardware, and the modules and / or units described may also be arranged in a processor.
[0095] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by one of the devices, the device includes: determining a master node from multiple execution nodes that execute tasks; in response to the triggering of the initial task scheduling strategy, using the master scheduling program running on the master node to load the tasks to be processed and distribute the tasks to be processed; wherein the tasks to be processed are tasks for processing newly added transaction data; using multiple execution nodes to respectively obtain and execute the tasks distributed by the master scheduling program, and return the task execution status; using the master scheduling program to determine whether to adjust the initial task scheduling strategy according to the task execution status returned by each of the execution nodes.
[0096] The embodiments of the present invention can utilize the main scheduling program run by the master node to load the tasks to be processed and distribute the tasks to be processed; the tasks to be processed are tasks for processing newly added transaction data; multiple execution nodes are utilized to respectively obtain and execute the tasks distributed by the main scheduling program, and return the task execution status; the main scheduling program is utilized to determine whether to adjust the initial task scheduling strategy based on the task execution status returned by each of the execution nodes; the embodiments of the present invention improve the high availability and real-time performance of processing financial business, and improve the degree of intelligent task scheduling for financial business and the degree of refinement of task scheduling.
[0097] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A task scheduling method, characterized in that: include: Determine a master node from among multiple execution nodes that execute tasks; In response to the triggering of the initial task scheduling strategy, the main scheduling program running on the master node is used to load the tasks to be processed and distribute the tasks to be processed; wherein the tasks to be processed are tasks for processing newly added transaction data; Utilize multiple execution nodes to respectively obtain and execute the tasks distributed by the main scheduler, and return the task execution status; Determine whether to adjust the initial task scheduling strategy according to the task execution status returned by each of the execution nodes by using the main scheduling program; The method also includes: configuring a task execution queue independent of the main node and the multiple execution nodes; the main scheduler sends a control message indicating control of one or more tasks to the task execution queue; after the execution node obtains the control message from the task execution queue, it obtains the target interface matched by the task indicated by the control message; calling the target interface to execute processing matching the control message; wherein the target interface is any one of a timeout interface, a pause interface, and a stop interface; and the control message is any one of a timeout message, a pause message, and a stop message.
2. The method according to claim 1, characterized in that Further including: The method of distributing the tasks to be processed by the main scheduling program includes: Distributing pending tasks to the task execution queue using the main scheduling program; The multiple execution nodes respectively execute and process the tasks to be processed, including: The plurality of execution nodes obtain pending tasks from the task execution queue and execute them by setting a strategy.
3. The method according to claim 1, characterized in that Further including: A task result queue is configured which is independent of the master node and the plurality of execution nodes; The multiple execution nodes return the task execution status, including: The plurality of execution nodes send the task execution status obtained by processing the task to the task result queue; Determining whether to adjust the initial task scheduling strategy according to the task execution status returned by each of the execution nodes using the main scheduling program includes: The main scheduler obtains the task execution status returned by each execution node from the task result queue.
4. The method according to claim 1, characterized in that Further including: When one or more of the execution nodes execute the task distributed by the main scheduler and determine that the task execution status is abnormal, the execution node performs the data fault tolerance operation corresponding to the task.
5. The method according to claim 1, characterized in that Further including: The initial task scheduling strategy for the pending tasks includes managing task triggering times in a task triggering time queue based on time sorting, wherein the task triggering time indicates one or more tasks included in the pending tasks; The time sequence is determined according to any one or more time types among a set time interval, multiple types of task triggering frequencies, and multiple set time periods.
6. The method according to claim 1, characterized in that The using the main scheduling program to determine whether to adjust the initial task scheduling strategy according to the task execution status returned by each of the execution nodes includes: When the main scheduling program is used to determine that the task execution status returned by each of the execution nodes is normal, determining not to adjust the initial task scheduling strategy; When the main scheduling program is used to determine that there is an abnormality in the task execution status returned by one or more of the execution nodes, the next round of service scheduling trigger time is re-determined for the execution node with the abnormality to adjust the initial task scheduling strategy.
7. The method according to claim 6, characterized in that The re-determining the next round of service scheduling triggering time for the abnormal execution node includes: According to the current timestamp, the next round of task scheduling trigger time of the execution node with the exception is calculated, and the next round of business scheduling trigger time is added to the task trigger time queue, wherein the task trigger time queue contains task trigger times based on time sorting.
8. The method according to claim 1, characterized in that: Further including: A task execution monitoring page is provided to display the execution status of multiple tasks; Receiving a control message from a user regarding a task through the task execution monitoring page; And the step of sending a control message to the task execution queue is executed by the main scheduling program.
9. A task scheduling system, characterized in that: include: Master node and execution node, where The master node is used to load the pending tasks and distribute the pending tasks in response to the triggering of the initial task scheduling strategy by using the main scheduling program running on the master node; wherein the pending tasks are tasks for processing newly added transaction data; The execution nodes respectively obtain and execute the tasks distributed by the main scheduler, and return the task execution status; The master node is determined from a plurality of execution nodes that execute services; The master node determines whether to adjust the initial task scheduling strategy according to the task execution status returned by each of the execution nodes by using the master scheduling program; The system is also configured with a task execution queue independent of the main node and multiple execution nodes; the main scheduler sends a control message indicating the control of one or more tasks to the task execution queue; after the execution node obtains the control message from the task execution queue, it obtains the target interface matched by the task indicated by the control message; the target interface is called to execute the processing matched by the control message; wherein the target interface is any one of a timeout interface, a pause interface, and a stop interface; and the control message is any one of a timeout message, a pause message, and a stop message.
10. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 8.
11. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
