A distributed task scheduling method and device

By judging the task order based on the task batch number and execution status in the distributed task scheduling system, the compactness of task scheduling is solved, and the problems of not compact scheduling and delayed waiting are achieved, achieving more efficient task processing.

CN111782366BActive Publication Date: 2024-12-06INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010615362.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-30
Publication Date
2024-12-06
Estimated Expiration
2040-06-30

AI Technical Summary

Technical Problem

When the distributed task scheduling system schedules two adjacent job tasks, the scheduling is not compact, resulting in a delay in waiting.

Method used

By receiving the start task scheduling message request sent by the client, based on the task batch number and the current batch task execution status, determine whether it is the first batch of tasks or the previous batch task has been completed. If so, perform the task scheduling operation and The client sends notifications for execution of tasks and creates execution nodes if necessary to ensure smooth task scheduling.

Benefits of technology

The compactness of the distributed task scheduling system when scheduling two adjacent job tasks is realized, and the waiting delay is shortened.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111782366B_ABST
    Figure CN111782366B_ABST
Patent Text Reader

Abstract

A distributed task scheduling method and device, the method comprising: receiving a message request for starting task scheduling sent by a client; performing a task scheduling operation according to a task batch number in the message request or according to the task batch number and the current batch task execution status. The application enables a distributed task scheduling system to schedule two adjacent job tasks more compactly and shorten waiting delays.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to computer application technology, and specifically to a distributed task scheduling method and device. Background Art

[0002] Distributed task scheduling systems are widely favored for their many advantages, such as strong resource sharing, fast computing speed, high reliability, and convenient and quick application. They can realize long-distance communication and data transmission between different nodes, and can coordinate system resources and perform distributed processing of job tasks submitted by users, which greatly facilitates information exchange between people and the completion of various computing tasks.

[0003] However, in many cases, when a distributed task scheduling system schedules two adjacent tasks, the scheduling is not compact and the waiting time is prolonged. Summary of the invention

[0004] In view of the problems existing in the prior art, the present application provides a distributed task scheduling method and device, which can solve the problems of loose scheduling and large waiting delay when a distributed task scheduling system schedules two adjacent job tasks.

[0005] In order to solve the above technical problems, this application provides the following technical solutions:

[0006] In a first aspect, the present application provides a distributed task scheduling method, comprising:

[0007] Receive a message request for starting task scheduling sent by the client;

[0008] The task scheduling operation is performed according to the task batch number in the start task scheduling message request or according to the task batch number and the current batch task execution status.

[0009] Further, performing the task scheduling operation according to the task batch number in the start task scheduling message request or according to the task batch number and the current batch task execution status includes:

[0010] Determine whether the task batch number is 1;

[0011] If yes, perform the task scheduling operation and send a task execution notification to the client.

[0012] Further, the performing of the task scheduling operation according to the task batch number in the start task scheduling message request or according to the task batch number and the current batch task execution status also includes:

[0013] If the task batch number is not 1;

[0014] Determine whether the task scheduling operation of the client of the current batch of tasks can be executed according to the execution status of the current batch of tasks;

[0015] If yes, the task scheduling operation is performed, and a task execution notification is sent to the client.

[0016] Furthermore, before sending the task execution notification to the client, the method further includes:

[0017] Determine whether there is an execution node in the current task batch;

[0018] If not, create an execution node for the current task batch and perform task scheduling operations.

[0019] Furthermore, the distributed task scheduling method further includes:

[0020] Receive a message request for ending task scheduling sent by the client;

[0021] The task execution status of the corresponding node is modified to completed according to the task batch number in the end task scheduling message request.

[0022] Furthermore, the task scheduling operation of the client that determines whether the current batch of tasks can be executed according to the execution status of the current batch of tasks includes:

[0023] Whether the task scheduling operation of the client of the current batch of tasks can be executed is determined according to the batch number in the end task scheduling message request received from the client corresponding to the previous batch of tasks.

[0024] In a second aspect, a distributed task scheduling device includes:

[0025] A start message receiving unit, used for receiving a start task scheduling message request sent by a client;

[0026] The scheduling unit is used to perform task scheduling operations according to the task batch number in the message request for starting task scheduling or according to the task batch number and the current batch task execution status.

[0027] Furthermore, the scheduling unit includes:

[0028] A batch determination module is used to determine whether the task batch number is 1;

[0029] The execution module is used to execute the task scheduling operation corresponding to the task batch with batch number 1, and send a task execution notification to the client.

[0030] Furthermore, the scheduling unit further includes:

[0031] A status judgment module, used to judge whether the task scheduling operation of the client of the current batch of tasks whose task batch number is not 1 can be executed according to the execution status of the current batch of tasks;

[0032] The execution module is further used to execute the task scheduling operation and send a task execution notification to the client.

[0033] Furthermore, the distributed task scheduling device further includes:

[0034] The node judgment unit is used to judge whether there is an execution node in the current task batch; the scheduling unit is also used to create an execution node for the current task batch that does not have an execution node and perform task scheduling operations.

[0035] Furthermore, the distributed task scheduling device further includes:

[0036] The end message receiving unit is used to receive the end task scheduling message request sent by the client;

[0037] The status modification unit is used to modify the task execution status of the corresponding node to completed according to the task batch number in the end task scheduling message request.

[0038] Furthermore, the execution module includes:

[0039] The judgment module is used to judge whether the task scheduling operation of the client of the current batch of tasks can be executed according to the batch number in the end task scheduling message request received from the client corresponding to the previous batch of tasks.

[0040] In a third aspect, the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the distributed task scheduling method when executing the program.

[0041] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the distributed task scheduling method when executed by a processor.

[0042] It can be seen from the above technical solution that the present application provides a distributed task scheduling method and device, which initiates a task execution request from the client to the server, and based on the task batch number corresponding to the task execution request and the task execution status set by the server, enables the distributed task scheduling system to schedule two adjacent job tasks more compactly and shorten the waiting delay. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] 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 some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0044] Figure 1 This is one of the overall flow diagrams of the distributed task scheduling method in the embodiment of the present application;

[0045] Figure 2 This is one of the flowcharts of executing task scheduling operations in the distributed task scheduling method in the embodiment of the present application;

[0046] Figure 3 The second flowchart of executing the task scheduling operation in the distributed task scheduling method in the embodiment of the present application;

[0047] Figure 4 This is the second overall flow diagram of the distributed task scheduling method in the embodiment of the present application;

[0048] Figure 5 This is the third overall flow diagram of the distributed task scheduling method in the embodiment of the present application;

[0049] Figure 6 This is one of the general structural diagrams of the distributed task scheduling device in the embodiment of the present application;

[0050] Figure 7 This is one of the structural diagrams of the scheduling unit in the embodiment of the present application;

[0051] Figure 8 This is the second structural diagram of the scheduling unit in the embodiment of the present application;

[0052] Fig. 9 This is the second overall structural diagram of the distributed task scheduling device in the embodiment of the present application;

[0053] Fig.10 This is the third overall structural diagram of the distributed task scheduling device in the embodiment of the present application;

[0054] Fig.11 It is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0055] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are 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.

[0056] The scheme described in this application can be applied to the following scenarios: a distributed task scheduling system includes multiple clients and a zookeeper scheduling server. The client is used to execute tasks sent to the client by the remote system, and these tasks can be divided into multiple batches. Since the programs loaded in each client are different, the functions of the client are also different, so there is a binding relationship between the task batch and the client, that is, the tasks of one batch are fixedly executed by several clients, and the tasks of another batch are fixedly executed by another several clients, and there is a sequence between the tasks of the previous batch and the next batch, that is, the tasks of the next batch must be executed after the tasks of the previous batch are executed. Based on the above scenario, the zookeeper scheduling server needs to complete the scheduling of several clients in the batch and the scheduling of each client between batches.

[0057] In order to solve the problem that the distributed task scheduling system is not compact and the waiting time is prolonged when scheduling two adjacent job tasks, the present application provides a distributed task scheduling method. Figure 1 , the distributed task scheduling method includes:

[0058] S101: receiving a message request for starting task scheduling sent by a client;

[0059] It is understandable that in the above application scenario, when the client receives a task from a remote system that corresponds to the task batch of the client, the client must first send a start task scheduling message request to the server to inform the server that the client has a need to execute the task. The start task scheduling message request is named StartSchedule. When the client initiates a start task execution request to the server, the server calls the StartScheduleHandle processor for processing.

[0060] S102: Execute a task scheduling operation according to the task batch number in the message request for starting task scheduling or according to the task batch number and the current batch task execution status.

[0061] It is understandable that the server side first needs to determine whether the task in the start task scheduling message request is the first batch of tasks, and the judgment basis is the task batch number carried in the start task scheduling message request. If it is the first batch of tasks, the server side can immediately schedule it to be executed on the client side, because there is no previous batch for the first batch of tasks, and it can be executed without waiting for the execution result of the previous batch. If it is not the first batch of tasks, it is necessary to continue to determine the execution status of the current batch of tasks. Since there is an execution order between the current batch and the next batch of tasks, the next batch of tasks can only be executed after the current batch of tasks are executed. Therefore, before scheduling the client corresponding to the next batch to execute the next batch of tasks, it is necessary to determine whether the execution status of the current batch of tasks is completed. The task scheduling operation refers to the operation of scheduling tasks.

[0062] From the above description, it can be seen that the distributed task scheduling method provided in the present application receives the start task scheduling message request sent by the client through the server side, and performs task scheduling operations according to the task batch number in the start task scheduling message request or according to the task batch number and the current batch task execution status. This enables the distributed task scheduling system to make scheduling more compact and shorten waiting delays when scheduling two adjacent job tasks.

[0063] In one embodiment, in order to enable the distributed task scheduling system to schedule two adjacent job tasks more compactly and shorten the waiting delay, the server side is set up as follows: a new ServerCnxnFactory subclass is added to the zookeeper server side, and a connection between the client and the server is established based on SofaBolt.

[0064] First, the server starts a thread, which establishes a listener on the port ClientPort responsible for client connection to listen for any client initiating a connection request. Then, the server registers the adaptation layer for handling client connection events and disconnection events, that is, when the client requests to establish a connection with the server, the server receives the CONNECT event; and when the client requests to disconnect from the server, the server receives the CLOSE event. For the CONNECT event, the server needs to cache the client's connection information in order to identify the client; for the CLOSE event, the server closes the client connection and cleans up the relevant non-persistent data written by the client to the server. Finally, the client task scheduling start processor StartScheduleHandle and end processor EndScheduleHandle are registered on the server. After the client establishes a connection with the server, the client can send two types of messages to the server, namely, the start task scheduling message and the end task scheduling message. The message type is distinguished by the message header sent by the client.

[0065] After the client establishes a connection with the server, when the server receives the start task scheduling message request from the client, the server is ready to call the StartScheduleHandle processor to process the start task scheduling message request. But before that, the server first needs to determine whether the server has cached the connection of the client that sent the message.

[0066] If it is not cached, the task execution request initiated by the client corresponding to the message is rejected;

[0067] If it has been cached, determine whether the request message corresponding to the task execution request initiated by the client carries the task batch number of the client participating in the task scheduling. If it does not carry the task batch number or the task batch number carried is not a number, reject the task execution request initiated by the client corresponding to the message;

[0068] If the task batch number carried in the request message corresponding to the task execution request initiated by the client is a number and has been cached, the client is allowed to execute the tasks of the corresponding batch. However, before executing the task, it is necessary to determine whether the task to be executed initiated by the client is the first batch of tasks based on the task batch number. If it is the first batch of tasks, it can be executed; otherwise, it is necessary to determine whether the previous batch of tasks corresponding to the task to be executed initiated by the client has been completed. If it has been completed, that is, the execution status of the current batch of tasks scheduled by the server is completed, then the server can schedule the client corresponding to the task batch to execute the task, otherwise the scheduling is rejected.

[0069] In another embodiment, in order to solve the problem that the distributed task scheduling system is not compact and the waiting time is extended when scheduling two adjacent job tasks, the modified zookeeper server and client can establish a network connection based on SofaBolt. After the network connection is established, different clients agree with each other to write the directory and format of the execution node to the zookeeper server. These directories and formats will play a role in the subsequent scheduling process and can be used to determine whether a batch of tasks has started to execute and whether it has been completed.

[0070] These directories and formats are for example:

[0071] The path for the first batch of clients to execute tasks to establish execution nodes is: / rwdd / task / p0001;

[0072] The path for the second batch of clients to establish execution nodes for tasks is: / rwdd / task / p0002.

[0073] After completing the above settings, the execution of the first batch of tasks and the second batch of tasks is now described as an example. The execution principles of other batches are similar and will not be repeated here. In one embodiment, first, the N clients corresponding to the first batch of tasks request the zookeeper server to create an execution node for them according to the agreed directory and format in a competitive and exclusive manner, and the server can execute the task for the only client that successfully creates the execution node. For the other N-1 clients, the competition fails, that is, when another N-1 client attempts to create an execution node on the server, it will be found that the execution node of the corresponding batch already exists, that is, the tasks of the task batch are being executed, and there is no need to repeat the execution, and there is no need to create an execution node, that is, the execution node creation fails.

[0074] Then, when the M clients responsible for executing the second batch of tasks want to execute the second batch of tasks, they must first listen to the execution node created by the client corresponding to the current batch of tasks (the first batch of tasks) on the zookeeper server to find out whether the task execution status of the current batch of tasks is completed.

[0075] When the clients corresponding to the first batch of tasks have completed their tasks, the M clients corresponding to the second batch of tasks request the zookeeper server to create execution nodes for them according to the agreed directory and format. The server only schedules the clients that have successfully created the execution nodes so that they can execute the second batch of tasks. The scheduling process is similar to the process of scheduling N clients when executing the first batch of tasks, so it will not be repeated here.

[0076] In order to perform the task scheduling operation of the first batch of tasks in the distributed task scheduling system, in one embodiment of the distributed task scheduling method provided by the present application, see Figure 2 , performing the task scheduling operation according to the task batch number in the start task scheduling message request or according to the task batch number and the current batch task execution status, includes:

[0077] S201: Determine whether the task batch number is 1;

[0078] It is understandable that, since the task scheduling start message request carries the task batch number, the server can determine whether the task batch number is 1, that is, whether the batch of tasks is the first batch of tasks.

[0079] S202: If yes, execute the task scheduling operation and send a task execution notification to the client.

[0080] It is understandable that if the task batch number is 1, it means that the task batch is the first batch of tasks to be executed, that is, there is no previous batch. At this time, the server can schedule one of the several clients corresponding to the first batch of tasks to execute the first batch of tasks. During scheduling, the server sends a task execution notification to one of the several clients.

[0081] From the above description, it can be seen that the distributed task scheduling method provided in this application can determine whether the batch number of the task is 1 to determine whether the batch task is the first batch of tasks to be executed, and then create an execution node for the client corresponding to the batch task, and finally complete the task.

[0082] To perform task scheduling operations for non-first batch tasks in a distributed task scheduling system, see Figure 3 In one embodiment of the distributed task scheduling method provided by the present application, the task scheduling operation is performed according to the task batch number in the start task scheduling message request or according to the task batch number and the current batch task execution status, and further includes:

[0083] S301: If the task batch number is not 1;

[0084] It is understandable that, since the task scheduling start message request carries the task batch number, the server can determine whether the task batch number is 1, that is, whether the batch task is not the first batch of tasks.

[0085] S302: judging whether the task scheduling operation of the client of the current batch of tasks can be executed according to the execution status of the current batch of tasks;

[0086] It is understandable that if the batch number of the task to be executed is not 1, it means that there is a previous batch for this batch, so it must wait for the previous batch to be completed before it can be executed. In order to determine whether the previous batch of the batch to be executed, that is, whether the tasks of the current batch have been completed, it is necessary to check whether the task execution status of the execution node corresponding to the current task batch is set to the completed state.

[0087] S303: If yes, execute the task scheduling operation and send a task execution notification to the client.

[0088] It is understandable that if the execution status of the previous batch corresponding to the task batch to be executed is completed, the server side can schedule one of the several servers corresponding to the batch to execute the batch of tasks.

[0089] From the above description, it can be seen that the distributed task scheduling method provided in this application can determine whether the task batch number is not 1 to determine whether the batch task is not the first batch of tasks to be executed, and then combine the task execution status of the current batch on the server to create an execution node for the client corresponding to the task, and finally complete the task.

[0090] To execute client tasks in a distributed task scheduling system, see Figure 4 The distributed task scheduling method provided in the present application, before sending a task execution notification to the client, further includes:

[0091] S401: Determine whether there is an execution node in the current task batch;

[0092] It is understandable that, taking the second batch of tasks as an example, assuming that there are L clients corresponding to the second batch of tasks, these L clients all want to execute the second batch of tasks, so they all compete to request the server to create an execution node for them, but according to the order, only one client's execution node can be created successfully. Therefore, before the L clients are ready to create a node on the server, it is necessary to determine whether there is an execution node for the second batch of tasks, that is, to determine whether the execution node / rwdd / task / p0002 corresponding to the second batch of tasks already exists. If it already exists, it means that the second batch of tasks has already been executed by a client and there is no need to repeat it. The execution principles of other batches are similar and will not be repeated.

[0093] S402: If not, create an execution node for the current task batch and perform task scheduling operations.

[0094] It can be understood that, still taking the second batch of tasks as an example, if the / rwdd / task / p0002 node does not exist yet, an execution node can be created for the client corresponding to the current task batch (the second task batch) and the task scheduling operation can be performed, that is, one of the L clients will execute the second batch of tasks. The execution principles of other batches are similar and will not be repeated.

[0095] From the above description, it can be seen that the distributed task scheduling method provided in the present application can realize the rapid notification scheduling of the client's tasks in the distributed task scheduling system by judging whether there is an execution node in the current task batch, thereby reducing the waiting delay.

[0096] See also Figure 5 In order to end the task executed by the client, the distributed task scheduling method further includes:

[0097] S501: receiving a message request for ending task scheduling sent by a client;

[0098] It is understandable that when the client completes the execution of the task of the task batch corresponding to the client, it needs to send a message request to the server to end the task scheduling. The server receives the message to know that the task of the task batch corresponding to the client has been completed and can schedule the tasks of the new task batch. The message request to end the task scheduling is named EndSchedule. When the message type received by the server is EndSchedule, the server schedules the EndScheduleHandle processor to process it.

[0099] S502: Modify the task execution status of the corresponding node to completed according to the task batch number in the end task scheduling message request.

[0100] It is understandable that the server can end the task scheduling operation according to the task batch number carried in the task scheduling end message request. If the task execution of the client corresponding to the current batch task is completed, the client corresponding to the current batch task will initiate a request to change the task execution status to completed, and the server will make changes accordingly, and all clients listening to the execution node can quickly receive the notification.

[0101] The so-called monitoring process means that in order to know whether the tasks of the previous batch have been completed, several clients corresponding to the task batch to be executed need to establish a monitoring mechanism on the server side. That is, several clients corresponding to the task batch to be executed actively inform the server side which batch (that is, the batch number of the previous task batch) they want to monitor the task execution node corresponding to. When the execution of the previous batch task is completed, the task execution status corresponding to the previous batch task will be modified to completed. Based on this, several clients corresponding to the task batch to be executed can send a message request to the server side to start task scheduling.

[0102] From the above description, it can be seen that the distributed task scheduling method provided in the present application utilizes an end task scheduling message request, and in combination with the task batch number and the current batch task execution status in the end task scheduling message request, it can end the task scheduling operation so that the server side can start scheduling new batch tasks.

[0103] In order to determine whether the task scheduling operation of the client of the current batch of tasks can be executed, the determining whether the task scheduling operation of the client of the current batch of tasks can be executed according to the execution status of the current batch of tasks includes:

[0104] Whether the task scheduling operation of the client of the current batch of tasks can be executed is determined according to the batch number in the end task scheduling message request received from the client corresponding to the previous batch of tasks.

[0105] It is understandable that, still taking the second batch of tasks as an example, since only one of the L clients corresponding to the second batch of tasks can successfully create a node, when the other L-1 clients are ready to create a node on the server side, they will find that the execution node corresponding to the second batch of tasks already exists, that is, the second batch of tasks is already being executed. At this time, the server can return a message to inform the L-1 clients that the tasks corresponding to this task batch do not need to be processed. The execution principle of other batches is similar and will not be repeated.

[0106] In addition, still taking the second batch of tasks as an example, before scheduling the second batch of tasks, it is necessary to check whether the first batch of tasks has been completed. If the path / rwdd / task / p0001 corresponding to the execution node corresponding to the task batch with task batch number 1 does not exist, it is considered that the first batch of tasks has not started to execute. At this time, a message is returned to inform the client corresponding to the second batch of tasks to wait. The execution principle of other batches is similar and will not be repeated.

[0107] If the path / rwdd / task / p0001 corresponding to the execution node corresponding to the first batch of tasks already exists, but its set task execution status is incomplete, then a monitoring of the / rwdd / task / p0001 node is established for the client corresponding to the second batch of tasks. When the task execution status marked in the / rwdd / task / p0001 node is modified to completed by the server, the L clients corresponding to the second batch of tasks will receive a notification from the server, informing them that the first batch of tasks have been completed and they can send a start task scheduling message to request the server to create an execution node for the second batch of tasks for them.

[0108] From the above description, it can be seen that the distributed task scheduling method provided in the present application can modify the task execution status of the corresponding execution node to completed according to the batch number in the end task scheduling message request received from the client corresponding to the previous batch of tasks, and determine whether the task scheduling operation of the client of the current batch of tasks can be executed.

[0109] Based on the same inventive concept, the embodiments of the present application also provide a distributed task scheduling device, which can be used to implement the method described in the above embodiments, as described in the following embodiments. Since the principle of solving the problem by the distributed task scheduling device is similar to that of the distributed task scheduling method, the implementation of the distributed task scheduling device can refer to the implementation of the method based on software performance benchmark determination, and the repetitions will not be repeated. As used below, the term "unit" or "module" can be a combination of software and / or hardware that implements a predetermined function. Although the system described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.

[0110] From the hardware level, in order to solve the problem that the distributed task scheduling system is not compact and the waiting time is extended when scheduling two adjacent job tasks, the present application provides an embodiment of an electronic device that includes all or part of the contents of the distributed task scheduling method, and the electronic device specifically includes the following contents:

[0111] See also Figure 6 , the present application provides a distributed task scheduling device, including a start message receiving unit 601 and a scheduling unit 602:

[0112] The start message receiving unit 601 is used to receive a message request for starting task scheduling sent by a client;

[0113] The scheduling unit 602 is used to perform a task scheduling operation according to the task batch number in the message request for starting task scheduling or according to the task batch number and the current batch task execution status.

[0114] See also Figure 7 , the distributed task scheduling device, the scheduling unit, includes a batch determination module 701 and an execution module 702:

[0115] The batch determination module 701 is used to determine whether the task batch number is 1;

[0116] The execution module 702 is used to execute the task scheduling operation corresponding to the task batch with batch number 1, and send a task execution notification to the client.

[0117] See also Figure 8 The scheduling unit further includes a state determination module 801 and an execution module 702:

[0118] The status judgment module 801 is used to judge whether the task scheduling operation of the client of the current batch of tasks whose task batch number is not 1 can be executed according to the execution status of the current batch of tasks;

[0119] The execution module 702 is further configured to execute the task scheduling operation and send a task execution notification to the client.

[0120] See also Fig. 9 , the distributed task scheduling device further comprises:

[0121] A node determination unit 901 is used to determine whether there is an execution node in the current task batch;

[0122] The scheduling unit 602 is further configured to create an execution node for a current task batch for which no execution node exists and perform a task scheduling operation.

[0123] See also Fig.10, the distributed task scheduling device further includes an end message receiving unit 1001 and a state modifying unit 1002:

[0124] The end message receiving unit 1001 is used to receive the end task scheduling message request sent by the client;

[0125] The state modification unit 1002 is used to modify the task execution state of the corresponding node to completed according to the task batch number in the end task scheduling message request.

[0126] Processor, memory, communication interface and bus; wherein the processor, memory and communication interface communicate with each other through the bus; the communication interface is used to realize information transmission between the distributed task scheduling device and related devices such as the core business system, user terminal and related database; the logic controller can be a desktop computer, a tablet computer and a mobile terminal, etc., but the present embodiment is not limited thereto. In the present embodiment, the logic controller can be implemented with reference to the embodiment of the distributed task scheduling method and the embodiment of the distributed task scheduling device in the embodiment, and the contents thereof are incorporated herein, and the repeated parts are not repeated.

[0127] It is understandable that the user terminal may include a smart phone, a tablet electronic device, a network set-top box, a portable computer, a desktop computer, a personal digital assistant (PDA), a vehicle-mounted device, a smart wearable device, etc. Among them, the smart wearable device may include smart glasses, a smart watch, a smart bracelet, etc.

[0128] In practical applications, part of the distributed task scheduling method can be executed on the electronic device side as described above, or all operations can be completed in the client device. The specific selection can be based on the processing capability of the client device and the limitations of the user's usage scenario. This application does not limit this. If all operations are completed in the client device, the client device may also include a processor.

[0129] The client device may have a communication module (i.e., a communication unit) that can communicate with a remote server to achieve data transmission with the server. The server may include a server on the task scheduling center side, and other implementation scenarios may also include a server on an intermediate platform, such as a server on a third-party server platform that has a communication link with the task scheduling center server. The server may include a single computer device, or a server cluster consisting of multiple servers, or a server structure of a distributed device.

[0130] Fig.11FIG. 9 is a schematic block diagram of the system structure of the electronic device 9600 according to an embodiment of the present application. Fig.11 As shown, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. It is worth noting that Fig.11 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.

[0131] In one embodiment, the distributed task scheduling method function may be integrated into the central processing unit 9100. The central processing unit 9100 may be configured to perform the following control:

[0132] S101: receiving a message request for starting task scheduling sent by a client;

[0133] S102: Execute a task scheduling operation according to the task batch number in the start message request or according to the task batch number and the current batch task execution status.

[0134] From the above description, it can be seen that the electronic device provided in the embodiment of the present application initiates a task execution request to the server through the client, and based on the task batch number corresponding to the task execution request and the task execution status set by the server, enables the distributed task scheduling system to schedule two adjacent job tasks more compactly and shorten the waiting delay.

[0135] In another embodiment, the distributed task scheduling device can be configured separately from the central processing unit 9100. For example, the distributed task scheduling device can be configured as a chip connected to the central processing unit 9100, and the distributed task scheduling method function is implemented through the control of the central processing unit.

[0136] like Fig.11 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Fig.11 In addition, the electronic device 9600 may also include Fig.11 For components not shown, reference may be made to the prior art.

[0137] like Fig.11 As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device. The central processing unit 9100 receives input and controls the operation of various components of the electronic device 9600.

[0138] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.

[0139] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.

[0140] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.

[0141] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).

[0142] The communication module 9110 is a transmitter / receiver 9110 that sends and receives signals via an antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.

[0143] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module, etc. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.

[0144] The embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps of the distributed task scheduling method in the above embodiment in which the execution subject is a server or a client. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, all the steps of the distributed task scheduling method in the above embodiment in which the execution subject is a server or a client are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0145] S101: receiving a message request for starting task scheduling sent by a client;

[0146] S102: Execute a task scheduling operation according to the task batch number in the start message request or according to the task batch number and the current batch task execution status.

[0147] From the above description, it can be seen that the electronic device provided in the embodiment of the present application initiates a task execution request to the server through the client, and based on the task batch number corresponding to the task execution request and the task execution status set by the server, enables the distributed task scheduling system to schedule two adjacent job tasks more compactly and shorten the waiting delay.

[0148] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0149] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0150] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0151] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0152] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A distributed task scheduling method, characterized in that: include: Receive a message request for starting task scheduling sent by the client; The task scheduling operation is performed according to the task batch number in the start task scheduling message request and the current batch task execution status; wherein the distributed task scheduling method further includes: receiving an end task scheduling message request sent by the client; modifying the task execution status of the corresponding node to completed according to the task batch number in the end task scheduling message request; specifically, if the task execution of the client corresponding to the current batch task is completed, the client corresponding to the current batch task initiates a request to modify the task execution status to completed, and the server makes a modification accordingly, and all clients monitoring the execution node receive a notification; Among them, the zookeeper server and the client establish a network connection based on SofaBolt; after the network connection is established, different clients agree with each other to write the directory and format of the execution node to the zookeeper server; among them, the zookeeper server is used to complete the scheduling of several clients in a batch and the scheduling of each client between batches.

2. The distributed task scheduling method according to claim 1, characterized in that: The performing of the task scheduling operation according to the task batch number in the start task scheduling message request and the current batch task execution status includes: Determine whether the task batch number is 1; If yes, perform the task scheduling operation and send a task execution notification to the client.

3. The distributed task scheduling method according to claim 2, characterized in that: The step of performing the task scheduling operation according to the task batch number in the start task scheduling message request and the current batch task execution status also includes: If the task batch number is not 1; Determine whether the task scheduling operation of the client of the current batch of tasks can be executed according to the execution status of the current batch of tasks; If yes, the task scheduling operation is performed, and a task execution notification is sent to the client.

4. The distributed task scheduling method according to claim 2 or 3, characterized in that: Before sending the task execution notification to the client, the method further includes: Determine whether there is an execution node in the current task batch; If not, create an execution node for the current task batch and perform task scheduling operations.

5. The distributed task scheduling method according to claim 1, characterized in that: The task scheduling operation of the client that determines whether the current batch of tasks can be executed according to the execution status of the current batch of tasks includes: Whether the task scheduling operation of the client of the current batch of tasks can be executed is determined according to the batch number in the end task scheduling message request received from the client corresponding to the previous batch of tasks.

6. A distributed task scheduling device, characterized in that: include: A start message receiving unit, used for receiving a start task scheduling message request sent by a client; A scheduling unit, used to perform task scheduling operations according to the task batch number in the start task scheduling message request and the current batch task execution status; wherein the distributed task scheduling device further includes: an end message receiving unit, used to receive the end task scheduling message request sent by the client; a status modification unit, used to modify the task execution status of the corresponding node to completed according to the task batch number in the end task scheduling message request; specifically, if the task execution of the client corresponding to the current batch task is completed, the client corresponding to the current batch task initiates a request to modify the task execution status to completed, and the server makes modifications accordingly, and all clients monitoring the execution node receive a notification; Among them, the zookeeper server and the client establish a network connection based on SofaBolt; after the network connection is established, different clients agree with each other to write the directory and format of the execution node to the zookeeper server; among them, the zookeeper server is used to complete the scheduling of several clients in a batch and the scheduling of each client between batches.

7. The distributed task scheduling device according to claim 6, characterized in that: The scheduling unit comprises: A batch determination module is used to determine whether the task batch number is 1; The execution module is used to execute the task scheduling operation corresponding to the task batch with batch number 1, and send a task execution notification to the client.

8. The distributed task scheduling device according to claim 7, characterized in that: The scheduling unit further includes: A status judgment module, used to judge whether the task scheduling operation of the client of the current batch of tasks whose task batch number is not 1 can be executed according to the execution status of the current batch of tasks; The execution module is further used to execute the task scheduling operation and send a task execution notification to the client.

9. The distributed task scheduling device according to claim 7 or 8, characterized in that: Also includes: A node judgment unit is used to judge whether there is an execution node in the current task batch; The scheduling unit is also used to create an execution node for a current task batch for which no execution node exists and perform a task scheduling operation.

10. The distributed task scheduling device according to claim 7, characterized in that: The execution module comprises: The judgment module is used to judge whether the task scheduling operation of the client of the current batch of tasks can be executed according to the batch number in the end task scheduling message request received from the client corresponding to the previous batch of tasks.

11. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the distributed task scheduling method described in any one of claims 1 to 5 are implemented.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the distributed task scheduling method described in any one of claims 1 to 5 are implemented.