Task management method and device based on cluster, medium and electronic equipment

By identifying and updating the task status of temporarily downed nodes in the task queue, the problem of task failure after node failure is solved and the reliability of the cluster is improved.

CN118733318APending Publication Date: 2024-10-01NEUSOFT CORP
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410832935.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-25
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

The existing technology cannot effectively identify the temporary downtime of a node after a node failure, resulting in the inability to update the task status and the inability to complete unfinished tasks.

Method used

By determining the target task in the task queue, it is determined whether the node is temporarily down, and after the node is restarted, the local and remote task status is updated and set to the pending state for rescheduling.

Benefits of technology

Effectively identify and handle temporary node outages to ensure that tasks can be completed and improve the reliability of the cluster.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118733318A_ABST
    Figure CN118733318A_ABST
Patent Text Reader

Abstract

The invention relates to a cluster-based task management method and device, a medium and electronic equipment, and the method comprises the steps: determining an uncompleted first target task in a task queue, the first target task comprises a task of which the remote task state maintained by the scheduling center is in an execution state and the task execution starting moment is earlier than the node starting moment of the corresponding node; determining that a surviving node capable of processing the first target task exists in the cluster, notifying the node to set a local task state of the first target task as an error state, and maintaining the local task state of the task by executing the node of the corresponding task; according to the method, the far-end task state of the first target task is set as the to-be-scheduled state, and the transient downtime condition that the node is successfully restarted after downtime within the time interval when the node reports the node state is effectively identified, so that the task state of the task which cannot be continuously processed by the node is updated, and the task processing efficiency is improved. And rescheduling the task based on the updated task state.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a cluster-based task management method, device, medium and electronic device. Background Art

[0002] A cluster is a high-performance computing system that connects multiple computers and uses software and hardware to achieve resource sharing and task allocation to complete tasks together. Nodes are computing units in a cluster, usually composed of ordinary computers. They are connected and communicated through the network and use the same operating system and application programs. Nodes can collaborate with each other to complete computing tasks.

[0003] In a cluster consisting of multiple nodes, when one of the nodes goes down, other nodes need to take over the tasks being executed on the down node. In the prior art, after a node fails, the task status and node status are usually recorded to transfer and take over the tasks. Therefore, how to effectively identify node failures is an important basis for realizing task transfer and takeover. Summary of the invention

[0004] The purpose of the present disclosure is to provide a cluster-based task management method, device, medium and electronic device, which can effectively identify a short-term downtime situation in which a node crashes and then successfully restarts within the time interval for the node to report the node status, thereby updating the local task status and remote task status of the unfinished tasks in this situation, so that the tasks can be rescheduled based on the updated task status.

[0005] In order to achieve the above objectives, in a first aspect, the present disclosure provides a cluster-based task management method, comprising:

[0006] Determine a first target task in a task queue, the task queue indicating unfinished tasks, the first target task comprising a task whose remote task status maintained by a scheduling center is in an execution state and whose task execution start time is earlier than a node start time of a corresponding node;

[0007] Determine that there is a node in the cluster that is alive and can process the first target task, and notify the node to set the local task state of the first target task to an error state, and the local task state of the task is maintained by the node that executes the corresponding task;

[0008] The remote task state of the first target task is set to a waiting-to-be-scheduled state.

[0009] Optionally, before determining the first target task in the task queue, the method further includes:

[0010] It is determined that there are surviving nodes in the cluster.

[0011] Optionally, the method further comprises:

[0012] In the case where it is determined that there is no surviving node in the cluster, setting the remote task state of the second target task in the task queue to an error state, the second target task including the task whose remote task state is in an execution state;

[0013] Determine that there is a node in the cluster that is alive and can process the third target task in the task queue, and notify the node to set the local task state of the third target task to an error state, wherein the third target task includes the task whose remote task state is in the error state;

[0014] The remote task state of the third target task is set to a to-be-scheduled state.

[0015] Optionally, the method further comprises:

[0016] In the case of determining that there are surviving nodes in the cluster, determining whether a node corresponding to a second target task in the task queue is a surviving node, the second target task including a task whose remote task status is in an execution state;

[0017] When it is determined that the node corresponding to the second target task is not a surviving node, setting the remote task state of the second target task corresponding to the node to an error state;

[0018] Determine that there is a node in the cluster that is alive and can process the third target task in the task queue, and notify the node to set the local task state of the third target task to an error state, wherein the third target task includes the task whose remote task state is in the error state;

[0019] The remote task state of the third target task is set to a to-be-scheduled state.

[0020] Optionally, the method further comprises:

[0021] If it is not determined that there is a node in the cluster that is alive and capable of processing the first target task, setting the remote task state of the first target task to an error state;

[0022] When it is determined that there is a node in the cluster that is alive and can process the third target task in the task queue, the node is notified to set the local task state of the third target task to an error state, and the third target task includes the task in which the remote task state is in the error state;

[0023] The remote task state of the third target task is set to a to-be-scheduled state.

[0024] Optionally, the method further comprises:

[0025] In response to a task scheduling instruction after the completion of the enqueuing of the task queue, a fourth target task is obtained, and a maximum number of tasks that can be executed simultaneously by all surviving nodes is obtained, wherein the fourth target task includes the tasks in the task queue whose remote task status is in the to-be-scheduled state;

[0026] The fourth target task is scheduled according to the maximum number of tasks of all the nodes and the number of tasks being executed by all the nodes.

[0027] Optionally, scheduling the fourth target task according to the maximum number of tasks of all the nodes and the number of tasks being executed by all the nodes includes:

[0028] Determining a maximum number of fourth target tasks that can be scheduled according to a maximum number of tasks of all the nodes and a number of tasks being executed by all the nodes;

[0029] According to the maximum number of the fourth target tasks that can be scheduled, the fourth target tasks corresponding to the maximum number are scheduled;

[0030] The method further comprises:

[0031] The remaining unscheduled fourth target task is added back into the task queue.

[0032] In a second aspect, the present disclosure provides a cluster-based task management device, comprising:

[0033] A first determination module is configured to determine a first target task in a task queue, the task queue indicating unfinished tasks, the first target task comprising a task whose remote task status maintained by the scheduling center is in an execution state and whose task execution start time is earlier than a node start time of a corresponding node;

[0034] A first management module is configured to determine that there is a node in the cluster that is alive and can process the first target task, and to notify the node to set the local task state of the first target task to an error state, and the local task state of the task is maintained by the node executing the corresponding task;

[0035] The second management module is configured to set the remote task state of the first target task to a to-be-scheduled state.

[0036] In a third aspect, the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any one of the methods described in the first aspect.

[0037] In a fourth aspect, the present disclosure provides an electronic device, including:

[0038] a memory having a computer program stored thereon;

[0039] A processor is used to execute the computer program in the memory to implement the steps of any one of the methods in the first aspect.

[0040] Through the above technical scheme, the first target task among the unfinished tasks indicated in the task queue is determined, the first target task includes the task whose remote task status maintained by the scheduling center is in the execution state and the task start execution time is earlier than the node start time of the corresponding node, and effectively identifies the task whose task start execution time in the node is earlier than the node start time of the corresponding node in the case of a short downtime in which the node crashes and then successfully restarts within the time interval for the node to report the node status; then, it is determined that there is a node in the cluster that is alive and capable of processing the first target task, and the node is notified to set the local task status of the first target task to an error state, and set the remote task status of the first target task to a to-be-scheduled state, thereby realizing the update of the local task status and the remote task status of the first target task, and then facilitating the rescheduling of the task based on the updated task status to ensure that the task can be completed, thereby improving the reliability of the cluster.

[0041] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:

[0043] Figure 1 It is a schematic diagram of an implementation environment of a cluster-based task management method according to an exemplary embodiment of the present disclosure.

[0044] Figure 2 The figure is a flowchart of a cluster-based task management method according to an exemplary embodiment of the present disclosure.

[0045] Figure 3 The figure is a schematic diagram showing task transfer and takeover according to an exemplary embodiment of the present disclosure.

[0046] Figure 4The figure is a flowchart of a task queue scanning thread according to an exemplary embodiment of the present disclosure.

[0047] Figure 5 The figure is a flowchart of a task status monitoring thread according to an exemplary embodiment of the present disclosure.

[0048] Figure 6 The diagram is a schematic diagram of the structure of a cluster-based task management device according to an exemplary embodiment of the present disclosure.

[0049] Figure 7 It is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION

[0050] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0051] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.

[0052] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.

[0053] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.

[0054] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".

[0055] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.

[0056] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0057] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly prompt the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can autonomously choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.

[0058] As an optional but non-limiting implementation, in response to receiving an active request from the user, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0059] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet the relevant laws and regulations may also be applied to the implementation of the present disclosure.

[0060] At the same time, it is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and relevant provisions.

[0061] In the prior art, after a node fails, the corresponding node task is usually failed over and taken over by recording the task status. However, there is a time interval for the node to report the node status. During the time interval for reporting the node's own status, the node may have crashed and then restarted immediately. Therefore, the node is still normal when reporting its own status next time. As a result, there is a crash situation in which the node cannot be identified within the time interval and then successfully restarted. This kind of crash can be called a short-term crash of the node.

[0062] However, since the node's brief downtime cannot be identified, the task status of the unfinished tasks when the node crashed cannot be changed. Therefore, the scheduler believes that the unfinished tasks at the time of the node crash are still being processed by the node. However, in fact, the node has interrupted the execution of the task due to the crash. Even after the node is restored, the task cannot be processed, resulting in the inability to complete the task.

[0063] In addition, when all nodes in the cluster go down, the task status cannot be updated because there is no service to take over. As a result, after the nodes in the cluster resume operation, the unfinished tasks cannot be resumed.

[0064] In view of this, the embodiments of the present disclosure provide a cluster-based task scheduling method, device, medium and electronic device, which can effectively identify a short-term downtime situation in which a node crashes and then successfully restarts within the time interval for the node to report the node status, thereby updating the local task status and remote task status of the unfinished tasks in this situation, so that the tasks can be rescheduled based on the updated task status.

[0065] The present disclosure is further explained and illustrated below in conjunction with the accompanying drawings.

[0066] Figure 1 is a schematic diagram of an implementation environment of a cluster-based task management method according to an exemplary embodiment of the present disclosure. The implementation environment includes a scheduling center, a cluster and a terminal. The cluster includes multiple nodes, such as Figure 1 Node 1, node 2, ..., node N are shown, where N is a positive integer. The dispatch center is connected to the terminal and each node in the cluster. Each node can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.

[0067] The dispatch center maintains a task queue, which indicates unfinished tasks. Furthermore, the unfinished tasks in the task queue may be tasks that implement the functions of the application in the terminal. The dispatch center is used to distribute the tasks in the task queue that are in a waiting-to-be-scheduled state to each node in the cluster for processing, so as to complete the functions of the application on the terminal side.

[0068] Figure 2 is a flow chart of a cluster-based task management method according to an exemplary embodiment of the present disclosure. The cluster-based task management method can be applied to Figure 1 The dispatch center shown. Figure 2 , the cluster-based task management method may include the following steps:

[0069] Step 210, determining the first target task in the task queue, the task queue indicating unfinished tasks, the first target task including a remote task state maintained by the scheduling center in an execution state and a task start execution time earlier than a node start time of a corresponding node.

[0070] It is worth noting that after the task is assigned to each node for execution, each node will create a local execution record and local task status of the task locally, and the scheduling center also needs to record the node where each task is executed, the node status, and the remote task status, etc. When the task status changes, the local task status and the remote task status need to be updated.

[0071] Among them, each node in the cluster will regularly report its own node status, where the node status can include downtime status and non-downtime status, and a node in non-downtime status can also be understood as a surviving node, and a node in downtime status can be understood as a non-surviving node.

[0072] Among them, tasks in the execution state indicate that they are being processed by the node. The task start execution time is the time when the node records the start of the task execution. The node startup time can be understood as the time when the node is successfully started. Further, the node startup time is used to represent the time when the node can provide services normally. The task start execution time and node startup time recorded by the node will be synchronized to the scheduling center for recording. It is worth noting that the node startup time is the time when the node was last started.

[0073] Step 220, determine whether there is a node in the cluster that is alive and can process the first target task, and notify the node to set the local task state of the first target task to an error state. The local task state of the task is maintained by the node that executes the corresponding task.

[0074] From the above content, it can be known that the node executing the first target task is a node that has crashed and successfully restarted within the time interval for reporting the node status, and the node is in a non-crashed state after the successful restart.

[0075] The nodes that survive in the cluster and can process the first target task may be nodes that execute the first target task, or other nodes that can process tasks of the same task type as the first target task.

[0076] The local task status being an error status is used to indicate that the first target task has not been processed by the node.

[0077] Step 230: Set the remote task state of the first target task to a waiting-to-be-scheduled state.

[0078] It is worth noting that a task whose local task status is an error status and whose remote task status is a to-be-scheduled status needs to be rescheduled to complete the execution of the task.

[0079] Through the above technical scheme, the first target task among the unfinished tasks indicated in the task queue is determined, the first target task includes the task whose remote task status maintained by the scheduling center is in the execution state and the task start execution time is earlier than the node start time of the corresponding node, and effectively identifies the task whose task start execution time in the node is earlier than the node start time of the corresponding node in the case of a short downtime in which the node crashes and then successfully restarts within the time interval for the node to report the node status; then, it is determined that there is a node in the cluster that is alive and capable of processing the first target task, and the node is notified to set the local task status of the first target task to an error state, and set the remote task status of the first target task to a to-be-scheduled state, thereby realizing the update of the local task status and the remote task status of the first target task, and then facilitating the rescheduling of the task based on the updated task status to ensure that the task can be completed, thereby improving the reliability of the cluster.

[0080] Figure 3 FIG. 1 is a schematic diagram showing task transfer and takeover according to an exemplary embodiment of the present disclosure. Figure 3 , the cluster includes nodes A, B and C, and the unfinished tasks in the task queue include tasks 1, 2, 3, 4, 5, 6 and 7; based on the load balancing strategy, the dispatch center allocates tasks 1 and 2 to node A for processing, allocates tasks 3, 4 and 5 to node B for processing, and allocates tasks 6 and 7 to node C for processing. Node C reports the node status as non-downtime at time t0, and node C starts to execute tasks 6 and 7 at time t1, then the task execution start time of tasks 6 and 7 is time t1, node C crashes at time t2 and successfully restarts at time t3, and reports the node status to the dispatch center as non-downtime at time t4, wherein time t1 is before time t2, time t2 is before time t3, time t3 is before time t4, and time t1 is after the time corresponding to the last reported node status, and the time interval from time t0 to time t4 is the time interval for the node to report the node status.

[0081] It can be seen that node C experienced a brief downtime within the time interval for reporting the node status. As a result, the task execution start time (time t1) of task 6 and task 7 is earlier than the node start time (time t3) of node C, and task 6 and task 7 are still in the execution state. Therefore, task 6 and task 7 are determined as the first target tasks, and then the local task status of task 6 and task 7 maintained at the corresponding node C can be updated, and the remote task status of task 6 and task 7 maintained at the scheduling center can be updated, so that the scheduling center can re-schedule tasks 6 and 7 to nodes A and B respectively.

[0082] In some embodiments, before determining the first target task in the task queue, the method may further include: determining whether there are surviving nodes in the cluster.

[0083] It is worth noting that the update of the local task status of the node needs to be completed by the node. Therefore, before determining the first target task, it is possible to first detect whether there are surviving nodes in the cluster. If not, the update of the local task status cannot be achieved. Therefore, if there are surviving nodes in the cluster, executing the above step 210 can ensure that there are surviving nodes to complete the update of the local task status; on the contrary, when there are no surviving nodes in the cluster, there is no need to execute the above step 210, avoiding the ineffective use of the resources occupied by the first target task.

[0084] In some embodiments, before determining the first target task in the task queue, the above method may also include: when it is determined that there are no surviving nodes in the cluster, setting the remote task status of the second target task in the task queue to an error state, the second target task includes a task whose remote task status is in an execution state; determining that there are surviving nodes in the cluster that are capable of processing the third target task in the task queue, and notifying the node to set the local task status of the third target task to an error state, the third target task includes a task whose remote task status is in an error state; setting the remote task status of the third target task to a to-be-scheduled state.

[0085] It is worth noting that, when it is determined that there are no surviving nodes in the cluster, it means that all nodes in the cluster are down.

[0086] Continue to refer to Figure 3 In the cluster shown, if nodes A, B and C all crash and tasks 1-7 are still in execution, tasks 1-7 can all be used as second target tasks, and the remote task status of tasks 1-7 maintained by the scheduling center can be set to an error state.

[0087] In the case of a complete downtime, the remote task status of the unfinished task is marked with an error status. In this way, after determining that there is a surviving node in the cluster that can process the task, the local task status of the task with the marked remote task status in the error status is set to the error status, and the remote task status of the task is set to the waiting scheduling status, so that the task can be scheduled next time to complete the execution of the task.

[0088] In some embodiments, the above method may also include: in the case of determining that there are surviving nodes in the cluster, determining whether the node corresponding to the second target task in the task queue is a surviving node, the second target task includes a task whose remote task status is in an execution state; in the case of determining that the node corresponding to the second target task is not a surviving node, setting the remote task status of the second target task corresponding to the node to an error state; determining that there are surviving nodes in the cluster that are capable of processing the third target task in the task queue, notifying the node to set the local task status of the third target task to an error state, the third target task includes a task whose remote task status is in an error state; setting the remote task status of the third target task to a to-be-scheduled state.

[0089] It is worth noting that in the task being executed, there is also the situation that the node corresponding to the task is down. Therefore, the remote task status of the task can be updated to mark such tasks. In this way, when there is a node that can survive and process the task, the node can be notified to set the local task status of the task to an error state, and the remote task status of the task can be set to a waiting state, so that the task can be rescheduled based on the updated task status to ensure that the task can be completed, further improving the reliability of the cluster.

[0090] In some embodiments, the above method may also include: when it is not determined that there is a node in the cluster that is alive and capable of processing the first target task, setting the remote task status of the first target task to an error state; when it is determined that there is a node in the cluster that is alive and capable of processing the third target task in the task queue, notifying the node to set the local task status of the third target task to an error state, the third target task includes a task whose remote task status is in an error state; setting the remote task status of the third target task to a to-be-scheduled state.

[0091] It is worth noting that before determining the first target task in the task queue, although it is determined that there is a surviving node in the cluster, the node may not belong to the same type of node as the node corresponding to the first target task. Therefore, the surviving node cannot update the local task status of the first target task in the node corresponding to the first target task. Therefore, in order to fully ensure the normal execution of the task, after determining the first target task, the step of determining that there is a surviving node in the cluster that can process the first target task can be performed again. If it is not determined that there is a surviving node in the cluster that can process the first target task, the remote task status of the first target task is updated to an error status to mark the first target task, so as to facilitate the notification of the node to set the local task status of the third target task to an error status and set the remote task status of the third target task to a waiting-for-scheduling status when it is determined that there is a surviving node in the cluster that can process the third target task.

[0092] It is worth noting that nodes that can process the same task type can be called a class of nodes. After a node in a class of nodes goes down, the local task status of the task in the down node can be updated through the same class of nodes as the down node.

[0093] It is worth noting that, in the above embodiment, the third target tasks are all tasks in the task queue that have been marked with the remote task status set to an error status.

[0094] In some embodiments, the method further includes: in response to a task scheduling instruction after completion of enqueuing for a task queue, obtaining a fourth target task and obtaining the maximum number of tasks that all surviving nodes can execute simultaneously, the fourth target task including tasks in the task queue whose remote task status is in a waiting-to-be-scheduled state; scheduling the fourth target task according to the maximum number of tasks of all nodes and the number of tasks being executed by all nodes.

[0095] The task scheduling instruction may be triggered at a fixed time or when a new task is added to the task queue, which is not limited in this embodiment.

[0096] Among them, the maximum number of tasks of a node represents the parallelism of the node. Generally speaking, the number of instances (threads) that a node can execute in parallel can be called the parallelism of the node, and tasks are executed by instances (threads).

[0097] As an example, when the fourth target task is scheduled based on the maximum number of tasks of all nodes and the number of tasks being executed by all nodes, the fourth target task is scheduled based on the number of tasks being executed by each node not exceeding the maximum number of tasks of the node.

[0098] By utilizing the enqueue notification mechanism in the above manner, a dequeue operation is performed after each enqueue is completed, thereby reducing the resource waste of traditional dequeue operations based on a polling mechanism. In addition, when dequeuing, the parallelism of the node is dynamically identified through the maximum number of tasks of the node and the number of tasks being executed by the node, and the fourth target task is scheduled to the node according to the node parallelism, thereby reducing the probability of node downtime due to overload.

[0099] In some embodiments, the above-mentioned step of scheduling the fourth target task based on the maximum number of tasks of all nodes and the number of tasks being executed by all nodes can be implemented in the following manner: determine the maximum number of third target tasks that can be scheduled based on the maximum number of tasks of all nodes and the number of tasks being executed by all nodes; and schedule the third target tasks corresponding to the maximum number based on the maximum number of third target tasks that can be scheduled.

[0100] In this case, the above method may further include: re-adding the remaining unscheduled fourth target tasks to the task queue.

[0101] As an example, when scheduling the fourth target tasks corresponding to the maximum number, the fourth target tasks that entered the queue first can be preferentially selected for scheduling according to the time of entering the queue.

[0102] Among them, when the remaining unscheduled fourth target task is re-added to the task queue, the entry time of the fourth target task remains unchanged, thereby ensuring that the task can be dequeued in priority according to the entry time.

[0103] Through the above method, when scheduling the fourth target task, if the number of fourth target tasks that need to be scheduled exceeds the number that can be scheduled, the excess number of fourth target tasks can be re-added to the task queue. In this way, the task scheduling instruction can be triggered to ensure that the remaining fourth target tasks can be scheduled, thereby improving the reliability of the cluster.

[0104] In some embodiments, after a node completes a task, the node can update the local task status of the task to completed, and then the scheduling center can update the remote task status of the corresponding task to completed, and then the scheduling center can delete the completed task from the task queue based on the completion status of the task.

[0105] In some embodiments, the step of scheduling the fourth target task in response to the task scheduling instruction after the completion of the enqueuing to the task queue can be implemented by using a task queue scanning thread configured in the scheduling center. Figure 4 is a flowchart of a task queue scanning thread according to an exemplary embodiment of the present disclosure, referring to Figure 4, the scheduling center places all tasks to be executed in the task queue according to the execution plan, and the remote task status of all tasks in the task queue is set to WAITING. Among them, WAITING here is the above-mentioned waiting state. When the execution time of the task queue scanning thread is reached, the task queue scanning thread starts to execute. As an example, the execution time here can be the time of the task scheduling instruction received after completing the queue.

[0106] The task queue scanning thread implements at least the following steps: scanning the tasks in the task queue whose remote task status is WAITING, that is, obtaining the above-mentioned fourth target task, and then allocating the task to the active node for execution according to the load strategy. It is worth noting that in this embodiment, according to the load strategy, the task is allocated to the active node for execution. Specifically, the implementation method of the step of scheduling the fourth target task according to the maximum number of tasks of all nodes and the number of tasks being executed by all nodes can be referred to above. The active node can be understood as a surviving node.

[0107] Then, each active node receives the task, creates a local task state, sets the local task state to RUNNING, and synchronizes the message to the scheduling center so that the scheduling center updates the remote task state to RUNNING, where RUNNING here means the execution state.

[0108] Finally, after the node completes the execution of the task, the scheduling center can delete the corresponding task from the task queue.

[0109] In some embodiments, the above-mentioned steps regarding task status setting may be implemented using a task status monitoring thread configured in a scheduling center. Figure 5 is a flowchart of a task queue scanning thread according to an exemplary embodiment of the present disclosure, referring to Figure 5 When the execution time of the task status monitoring thread is reached, the task status monitoring thread starts to execute. As an example, the task status monitoring thread can be a thread that is executed at a scheduled time.

[0110] The task queue scanning thread implements at least the following steps: obtain the active node list NodeList in the cluster; obtain the task list TaskList in the task queue whose remote task status is RUNNING, and the tasks in TaskList are the tasks whose remote task status is in the execution state. It is worth noting that RUNNING indicates the execution state. Obtaining NodeList and TaskList here can facilitate the execution of the following steps, for example, determining whether a node is in NodeList, and thus determining whether the node is a live node.

[0111] Determine whether NodeList is an empty set to determine whether there are surviving nodes in the cluster.

[0112] If NodeList is an empty set, it means that all nodes in the cluster are down and there is no node that can update the local task status. At this time, the remote task status of all tasks in TaskList is set to FAULT, where FAULT means an error status.

[0113] If NodeList is not an empty set, it is further determined whether there is a first target task in TaskList, that is, the above step of determining the first target task in the task queue is implemented. If there is a first target task, it is further determined whether there is a node in the cluster that is alive and can process the first target task. If there is a node that is alive and can process the first target task, the node is notified, and the local task status of the corresponding task is set to FALUT. The scheduling center sets the remote task status of the corresponding task to WAITING. It can be understood that the task here is the first target task, and WAITING means the waiting to be scheduled state.

[0114] If there is no node that is alive and can process the first target task, the remote task state of the first target task is set to FAULT.

[0115] If NodeList is not an empty set, it is possible to further determine whether the node of the second target task in TaskList is alive. It is worth noting that the second target task is a task whose remote task status is in the execution state and is not a task of the first target task. If the node of the second target task is not alive, the remote task status of the second target task is set to FALUT.

[0116] Finally, determine whether there is a surviving node in the cluster that can process the task with the remote task status of FALUT in the task queue, notify the node to set the local task status of the corresponding task to FALUT, and the scheduling center sets the remote task status of the corresponding task to WAITING. It is worth noting that

[0117] Figure 6 FIG. 1 is a schematic diagram of a cluster-based task management device according to an exemplary embodiment of the present disclosure. Figure 6 , the device comprises:

[0118] The first determination module 601 is configured to determine a first target task in a task queue, the task queue indicating unfinished tasks, the first target task including a task whose remote task status maintained by the scheduling center is in an execution state and whose task execution start time is earlier than a node start time of a corresponding node;

[0119] The first management module 602 is configured to determine that there is a node in the cluster that is alive and can process the first target task, and notify the node to set the local task state of the first target task to an error state, and the local task state of the task is maintained by the node executing the corresponding task;

[0120] The second management module 603 is configured to set the remote task state of the first target task to a to-be-scheduled state.

[0121] In some embodiments, the apparatus further comprises:

[0122] The second determination module is configured to determine whether there are surviving nodes in the cluster before determining the first target task in the task queue.

[0123] In some embodiments, the apparatus further comprises:

[0124] A third management module is configured to set the remote task status of the second target task in the task queue to an error status when it is determined that there is no surviving node in the cluster, the second target task including the task whose remote task status is in an execution status;

[0125] a fourth management module, configured to determine that there is a node in the cluster that is alive and capable of processing the third target task in the task queue, and to notify the node to set the local task state of the third target task to an error state, wherein the third target task includes the task whose remote task state is in the error state;

[0126] The fifth management module is configured to set the remote task state of the third target task to a to-be-scheduled state.

[0127] In some embodiments, the apparatus further comprises:

[0128] A second determination module is configured to determine whether a node corresponding to a second target task in the task queue is a surviving node when it is determined that there is a surviving node in the cluster, wherein the second target task includes a task whose remote task status is in an execution state;

[0129] a sixth management module, configured to, when determining that the node corresponding to the second target task is not a surviving node, set the remote task state of the second target task corresponding to the node to an error state;

[0130] a seventh management module, configured to determine that there is a node in the cluster that is alive and can process the third target task in the task queue, and to notify the node to set the local task state of the third target task to an error state, wherein the third target task includes the task whose remote task state is in the error state;

[0131] The eighth management module is configured to set the remote task state of the third target task to a to-be-scheduled state.

[0132] In some embodiments, the apparatus further comprises:

[0133] a ninth management module, configured to set the remote task state of the first target task to an error state if no node in the cluster is determined to be alive and capable of processing the first target task;

[0134] a tenth management module, configured to, when determining that there is a node in the cluster that is alive and capable of processing the third target task in the task queue, notify the node to set the local task state of the third target task to an error state, wherein the third target task includes the task in which the remote task state is in the error state;

[0135] An eleventh management module is configured to set the remote task state of the third target task to a to-be-scheduled state.

[0136] In some embodiments, the apparatus further comprises:

[0137] A response module is configured to obtain a fourth target task in response to a task scheduling instruction after the task queue is completed, and obtain a maximum number of tasks that can be executed simultaneously by all surviving nodes, wherein the fourth target task includes the tasks in the task queue whose remote task status is in the to-be-scheduled state;

[0138] The scheduling module is configured to schedule the fourth target task according to the maximum number of tasks of all the nodes and the number of tasks being executed by all the nodes.

[0139] In some embodiments, the response module is further configured to: determine the maximum number of fourth target tasks that can be scheduled according to the maximum number of tasks of all the nodes and the number of tasks being executed by all the nodes; and schedule the fourth target tasks corresponding to the maximum number according to the maximum number of fourth target tasks that can be scheduled;

[0140] The device also includes:

[0141] The adding module is configured to re-add the remaining unscheduled fourth target task to the task queue.

[0142] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0143] The embodiment of the present disclosure further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the method described in the above method embodiment are implemented.

[0144] The embodiments of the present disclosure further provide a computer program product, including a computer program, which implements the steps of the method described in the above method embodiments when executed by a processor.

[0145] The present disclosure also provides an electronic device, including:

[0146] a memory having a computer program stored thereon;

[0147] A processor is used to execute the computer program in the memory to implement the steps of the method described in the above method embodiment.

[0148] Figure 7 7 is a schematic diagram of a structure of an electronic device according to an exemplary embodiment. For example, the electronic device 700 can be provided as a server. Figure 7 The electronic device 700 includes a processor 722, which may be one or more, and a memory 732 for storing a computer program executable by the processor 722. The computer program stored in the memory 732 may include one or more modules each corresponding to a set of instructions. In addition, the processor 722 may be configured to execute the computer program to perform the above-mentioned cluster-based task management method.

[0149] In addition, the electronic device 700 may further include a power supply component 726 and a communication component 750, wherein the power supply component 726 may be configured to perform power management of the electronic device 700, and the communication component 750 may be configured to implement communication of the electronic device 700, for example, wired or wireless communication. In addition, the electronic device 700 may further include an input / output (I / O) interface 758. The electronic device 700 may operate based on an operating system stored in the memory 732, such as Windows Server™, Mac OSX™, Unix™, Linux™, etc.

[0150] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned cluster-based task management method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 732 including program instructions, and the above-mentioned program instructions can be executed by the processor 722 of the electronic device 700 to complete the above-mentioned cluster-based task management method.

[0151] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.

[0152] It should also be noted that the various specific technical features described in the above specific implementation methods can be combined in any suitable manner without contradiction.

[0153] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.

Claims

1. A cluster-based task management method, It is characterized in that include: Determine a first target task in a task queue, the task queue indicating unfinished tasks, the first target task comprising a task whose remote task status maintained by a scheduling center is in an execution state and whose task execution start time is earlier than a node start time of a corresponding node; Determine that there is a node in the cluster that is alive and can process the first target task, and notify the node to set the local task state of the first target task to an error state, and the local task state of the task is maintained by the node that executes the corresponding task; The remote task state of the first target task is set to a to-be-scheduled state.

2. The method according to claim 1, It is characterized in that Before determining the first target task in the task queue, the method further includes: It is determined that there are surviving nodes in the cluster.

3. The method according to claim 2, It is characterized in that The method further comprises: In the case where it is determined that there is no surviving node in the cluster, setting the remote task state of the second target task in the task queue to an error state, the second target task including the task whose remote task state is in an execution state; Determine that there is a node in the cluster that is alive and can process the third target task in the task queue, and notify the node to set the local task state of the third target task to an error state, wherein the third target task includes the task whose remote task state is in the error state; The remote task state of the third target task is set to a to-be-scheduled state.

4. The method according to claim 2, It is characterized in that The method further comprises: In the case of determining that there are surviving nodes in the cluster, determining whether a node corresponding to a second target task in the task queue is a surviving node, the second target task including a task whose remote task status is in an execution state; When it is determined that the node corresponding to the second target task is not a surviving node, setting the remote task state of the second target task corresponding to the node to an error state; Determine that there is a node in the cluster that is alive and can process the third target task in the task queue, and notify the node to set the local task state of the third target task to an error state, wherein the third target task includes the task whose remote task state is in the error state; The remote task state of the third target task is set to a to-be-scheduled state.

5. The method according to claim 2, It is characterized in that The method further comprises: If it is not determined that there is a node in the cluster that is alive and capable of processing the first target task, setting the remote task state of the first target task to an error state; When it is determined that there is a node in the cluster that is alive and can process the third target task in the task queue, the node is notified to set the local task state of the third target task to an error state, and the third target task includes the task in which the remote task state is in the error state; The remote task state of the third target task is set to a to-be-scheduled state.

6. The method according to any one of claims 1 to 5, It is characterized in that The method further comprises: In response to a task scheduling instruction after the completion of the enqueuing of the task queue, a fourth target task is obtained, and a maximum number of tasks that can be executed simultaneously by all surviving nodes is obtained, wherein the fourth target task includes the tasks in the task queue whose remote task status is in the to-be-scheduled state; The fourth target task is scheduled according to the maximum number of tasks of all the nodes and the number of tasks being executed by all the nodes.

7. The method according to claim 6, It is characterized in that The scheduling of the fourth target task according to the maximum number of tasks of all the nodes and the number of tasks being executed by all the nodes includes: Determining a maximum number of fourth target tasks that can be scheduled according to a maximum number of tasks of all the nodes and a number of tasks being executed by all the nodes; According to the maximum number of the fourth target tasks that can be scheduled, the fourth target tasks corresponding to the maximum number are scheduled; The method further comprises: The remaining unscheduled fourth target task is added back into the task queue.

8. A cluster-based task management device, It is characterized in that include: A first determination module is configured to determine a first target task in a task queue, the task queue indicating unfinished tasks, the first target task comprising a task whose remote task status maintained by the scheduling center is in an execution state and whose task execution start time is earlier than a node start time of a corresponding node; A first management module is configured to determine that there is a node in the cluster that is alive and can process the first target task, and to notify the node to set the local task state of the first target task to an error state, and the local task state of the task is maintained by the node executing the corresponding task; The second management module is configured to set the remote task state of the first target task to a to-be-scheduled state.

9. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.

10. An electronic device, It is characterized in that include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 7.