Task management method, apparatus, device, medium, and program product

By detecting the type of faulty nodes in a distributed cluster and dynamically adjusting task allocation, the paralysis problem of the scheduled task management system when nodes fail is solved, and normal task execution and high system availability are achieved.

CN122173213APending Publication Date: 2026-06-09BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
BEIJING KINGSOFT CLOUD NETWORK TECH CO LTD
Filing Date
2024-12-06
Publication Date
2026-06-09

AI Technical Summary

Technical Problem

Existing scheduled task management systems are prone to failure when nodes fail, affecting business continuity and data integrity, and lack effective fault response capabilities.

Method used

In a distributed cluster, detect the type of faulty node, and when a slave node fails, assign tasks to other slave nodes for execution. When the master node fails, elect a new master node and reallocate tasks.

Benefits of technology

It improves the cloud computing platform's ability to cope with single points of failure, ensures the normal execution of scheduled tasks, and enhances the system's availability and fault tolerance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122173213A_ABST
    Figure CN122173213A_ABST
Patent Text Reader

Abstract

The present disclosure relates to a task management method, device, equipment, medium and program product. The method comprises: in response to detecting that there is a faulty node in a distributed cluster, determining the node type of the faulty node; when the node type is a slave node, assigning a first timing task running on a first slave node that will fail to a second slave node based on a current master node, so that the second slave node executes the first timing task; when the node type is a master node, electing a third slave node from at least two slave nodes, and determining the third slave node as a new master node, assigning a second timing task to be assigned to a fourth slave node based on the new master node, so that the fourth slave node executes the second timing task. The present disclosure improves the ability of the cloud computing platform to cope with single point failures by adopting a distributed cluster architecture. When the master node and the slave node fail, the normal execution of the timing task can still be guaranteed, and the availability and fault tolerance of the cloud computing platform are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of cloud computing technology, and in particular to a task management method, apparatus, device, medium, and program product. Background Technology

[0002] With the rapid development of cloud computing technology, more and more enterprises are choosing to deploy scheduled tasks on cloud computing platforms to optimize resource utilization and improve operational efficiency. However, most existing scheduled task management systems adopt a single-node architecture. While this architecture is simple and easy to implement, if the node fails—for example, due to hardware damage, network interruption, or software errors—the entire task management system may be paralyzed, causing scheduled tasks to fail to execute normally, thus affecting the enterprise's business continuity and data integrity. Therefore, improving the cloud computing platform's ability to handle failures to ensure the normal execution of scheduled tasks is a technical problem that needs to be solved. Summary of the Invention

[0003] To address the aforementioned technical problems, this disclosure provides a task management method, apparatus, device, medium, and program product.

[0004] A first aspect of this disclosure provides a task management method applicable to a distributed cluster, the distributed cluster comprising a current master node and at least two slave nodes, the method comprising:

[0005] In response to the detection of a faulty node in the distributed cluster, the node type of the faulty node is determined;

[0006] When the node type is a slave node, the first timed task running on the first slave node that has failed is assigned to the second slave node based on the current master node, so that the second slave node executes the first timed task. The second slave node is any one of the at least two slave nodes other than the first slave node.

[0007] When the node type is the master node, a third slave node is elected from the at least two slave nodes and the third slave node is determined as the new master node. Based on the new master node, the second scheduled task to be assigned is assigned to the fourth slave node so that the fourth slave node can execute the second scheduled task. The fourth slave node is any one of the at least two slave nodes other than the third slave node.

[0008] A second aspect of this disclosure provides a task management apparatus, the apparatus comprising:

[0009] The detection module is used to determine the node type of the faulty node in response to the detection of a faulty node in the distributed cluster.

[0010] The first allocation module is configured to, when the node type is a slave node, allocate a first timed task running on a first slave node that has failed to a second slave node based on the current master node, so that the second slave node executes the first timed task, wherein the second slave node is any one of the at least two slave nodes other than the first slave node;

[0011] The second allocation module is used to, when the node type is a master node, elect a third slave node from the at least two slave nodes, determine the third slave node as the new master node, and allocate the second timed task to be allocated to the fourth slave node based on the new master node, so that the fourth slave node executes the second timed task, wherein the fourth slave node is any one of the at least two slave nodes other than the third slave node.

[0012] A third aspect of this disclosure provides a computer device including a memory and a processor, and a computer program, wherein the memory stores the computer program, and when the computer program is executed by the processor, it implements the task management method of the first aspect described above.

[0013] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the task management method of the first aspect described above.

[0014] A fifth aspect of this disclosure provides a computer program product, including a computer program that, when executed by a processor, implements the task management method of the first aspect described above.

[0015] The technical solution provided in this disclosure has the following advantages compared with the prior art:

[0016] In the task management method, apparatus, device, medium, and program products provided in the embodiments of this disclosure, in response to the detection of a faulty node in a distributed cluster, the node type of the faulty node is determined. When the node type is a slave node, a first scheduled task running on the faulty first slave node is assigned to a second slave node based on the current master node, so that the second slave node executes the first scheduled task. The second slave node is any one of at least two slave nodes other than the first slave node. When the node type is a master node, a third slave node is elected from at least two slave nodes and determined as the new master node. Based on the new master node, the second scheduled task to be assigned is assigned to a fourth slave node, so that the fourth slave node executes the second scheduled task. The fourth slave node is any one of at least two slave nodes other than the third slave node. This can improve the cloud computing platform's ability to cope with single-point failures. When the master node fails, a new master node is switched and the scheduled tasks are assigned. When a slave node fails, the scheduled tasks running on the faulty slave node are assigned to other slave nodes for execution, thereby ensuring the normal execution of the scheduled tasks and improving the availability and fault tolerance of the cloud computing platform. Attached Figure Description

[0017] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.

[0018] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart of a task management method provided in an embodiment of this disclosure;

[0020] Figure 2 This is a flowchart of a method for allocating timed tasks provided in an embodiment of this disclosure;

[0021] Figure 3 This is a schematic diagram of the structure of a task management device provided in an embodiment of this disclosure;

[0022] Figure 4 This is a schematic diagram of the structure of a computer device provided in an embodiment of this disclosure. Detailed Implementation

[0023] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.

[0024] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.

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

[0026] Figure 1 This is a flowchart of a task management method provided in an embodiment of this disclosure. This method can be executed by a distributed cluster, which includes a current master node and at least two slave nodes. Figure 1 As shown, the task management method provided in this embodiment includes the following steps:

[0027] S101. In response to the detection of a faulty node in the distributed cluster, determine the node type of the faulty node.

[0028] The distributed cluster in this embodiment can be a cloud computing platform with a distributed cluster architecture built on distributed coordination service tools such as Zookeeper or Etcd. In the distributed cluster, the master node is responsible for task allocation and management, and the slave nodes are responsible for the actual task execution.

[0029] In this embodiment of the disclosure, the distributed cluster periodically checks the status of each node to determine whether there is a faulty node, and if there is a faulty node, determines the node type of the faulty node and whether the fault occurred in the master node or the slave node.

[0030] In one exemplary embodiment of this disclosure, each node in the distributed cluster periodically sends heartbeat messages to other nodes to confirm each other's liveness. If other nodes do not receive a heartbeat from a certain node within a specified time, it is determined that the node may have failed, and thus the node type of the failed node is determined.

[0031] In another exemplary embodiment of this disclosure, a monitoring tool may be set up in the distributed cluster to periodically detect whether there are faulty nodes in the distributed cluster, and determine the node type of the faulty node when a faulty node is found.

[0032] In another exemplary embodiment of this disclosure, the distributed cluster may include one or more sentinel nodes. The sentinel nodes can periodically obtain the status information of the current master node and at least two slave nodes, and determine whether the current master node and at least two slave nodes have failed based on the status information, thereby determining whether there are faulty nodes in the distributed cluster. If a faulty node exists, its node type is determined based on the status information. The sentinel node can be one or more nodes pre-selected from the master node and slave nodes. It is responsible for periodically sending health check requests to the current master node and each slave node, and determining whether the current master node and at least two slave nodes have failed based on the status information returned by the master node and each slave node. The status of the sentinel node itself is monitored by the current master node. When a sentinel node fails, the master node will reselect a sentinel node from the remaining slave nodes.

[0033] S102. When the node type is a slave node, the first timed task running on the first slave node that has failed is assigned to the second slave node based on the current master node, so that the second slave node can execute the first timed task. The second slave node is any one of the at least two slave nodes other than the first slave node.

[0034] In this embodiment of the disclosure, when it is determined that the node type of the faulty node in the distributed cluster is a slave node, the current master node will assign the first timed task running on the first faulty slave node to other slave nodes. Specifically, a second slave node can be selected from at least two other slave nodes in the distributed cluster besides the first slave node, and the first timed task can be assigned to the second slave node. The task parameters of the first timed task can be sent to the second slave node, and then the second slave node will execute the first timed task according to the task parameters.

[0035] In one exemplary embodiment of this disclosure, when a sentinel node is included in the distributed cluster, the sentinel node can report the fault information to the current master node when it is determined that there is a faulty slave node based on the status information of at least two slave nodes. The faulty slave node includes the identification information of the first slave node. When selecting the second slave node, the current master node can filter the slave nodes that have not failed from the at least two slave nodes included in the distributed cluster, obtain the load status of each slave node, and determine the slave node with the lowest load as the second slave node.

[0036] In another exemplary embodiment of this disclosure, each slave node is deployed with a scheduled task scheduling framework. The scheduled task scheduling framework executes scheduled tasks based on their corresponding execution methods, including parallel execution and serial execution. Specifically, the scheduled task scheduling framework determines the corresponding execution method based on the task parameters of the scheduled task and sets a label for the scheduled task according to the execution method. If the scheduled task does not require an execution order, its corresponding label is set to concurrent execution; if an execution order is required, it is set to serial execution. For example, during an upgrade, the startup of multiple servers requires pulling database data. Therefore, the task of upgrading the database data needs to be executed first, followed by restarting the server services. Thus, a serial execution label is set for the scheduled tasks of upgrading the database data and restarting the server services. The scheduled task scheduling framework can be APScheduler (Advanced Python Scheduler) or other task scheduling frameworks, which are not limited here.

[0037] Optionally, the current master node can periodically perform a node check task to determine whether the number of slave nodes is the same as the number of slave nodes in the last check. Based on the node's fault information, it can determine whether to add or remove a slave node. If there is a removed slave node, the timed task running on the removed slave node will be assigned to at least two slave nodes that have not been removed and have not experienced a fault. If there is a newly added slave node, the current master node will identify the newly added slave node as a candidate slave node for allocating timed tasks in the next time timed task is assigned, and assign the corresponding task to the corresponding slave node according to the preset task allocation rules.

[0038] S103. When the node type is the master node, a third slave node is elected from at least two slave nodes and the third slave node is determined as the new master node. Based on the new master node, the second scheduled task to be assigned is assigned to the fourth slave node so that the fourth slave node can execute the second scheduled task. The fourth slave node is any one of the at least two slave nodes other than the third slave node.

[0039] In this embodiment of the disclosure, when determining the node type of the faulty node in the distributed cluster as the master node, a third slave node can be elected from at least two slave nodes included in the distributed cluster, and the third slave node is determined as the new master node. The new master node takes over the allocation of the timed tasks from the faulty original master node (i.e., the current master node). If there is a second timed task to be allocated, the new master node will allocate the second timed task to a fourth slave node. Specifically, a fourth slave node can be selected from at least two other slave nodes included in the distributed cluster besides the third slave node (i.e., the new master node), and the second timed task can be allocated to the fourth slave node. The task parameters of the second timed task can be sent to the fourth slave node, and the fourth slave node will execute the second timed task according to the task parameters.

[0040] In one exemplary embodiment of this disclosure, when electing a new master node from at least two slave nodes, the new master node can be elected based on a distributed consensus algorithm.

[0041] In another exemplary embodiment of this disclosure, when the distributed cluster includes one or more sentinel nodes, the node performance parameters of at least two slave nodes can be compared based on the sentinel nodes, and the slave node with the highest overall performance can be determined as the third slave node. The node performance parameters include at least one of the performance parameters of the central processing unit (CPU) and storage capacity. The CPU performance parameters may include the number of CPU cores, CPU utilization, etc. Specifically, for each slave node, the sentinel node can perform a weighted average calculation on the various node performance parameters according to their corresponding weights to obtain the overall performance of the slave node, and then determine the slave node with the highest overall performance as the third slave node.

[0042] This embodiment of the disclosure improves the cloud computing platform's ability to handle single-point failures by responding to the detection of a faulty node in the distributed cluster. When the node type is a slave node, a first scheduled task running on the faulty first slave node is assigned to a second slave node based on the current master node, so that the second slave node can execute the first scheduled task. The second slave node can be any one of the at least two slave nodes other than the first slave node. When the node type is a master node, a third slave node is elected from the at least two slave nodes and determined as the new master node. Based on the new master node, the second scheduled task to be assigned is assigned to a fourth slave node, so that the fourth slave node can execute the second scheduled task. The fourth slave node can be any one of the at least two slave nodes other than the third slave node. When the master node fails, a new master node is switched and the scheduled task is assigned. When a slave node fails, the scheduled task running on the faulty slave node is assigned to other slave nodes for execution, thereby ensuring the normal execution of the scheduled task and improving the availability and fault tolerance of the cloud computing platform.

[0043] Figure 2 This is a flowchart of a method for allocating timed tasks provided in an embodiment of this disclosure, such as... Figure 2 As shown, based on the above embodiments, timed tasks can be assigned using the following method.

[0044] S201. Obtain the task number of the first scheduled task and the number of slave nodes that have not experienced a failure based on the current master node.

[0045] In this embodiment of the disclosure, the current master node can obtain the task number of the first scheduled task and the number of non-faulty slave nodes in the distributed cluster that can be assigned scheduled tasks when it is necessary to reallocate the first scheduled task.

[0046] In one exemplary embodiment of this disclosure, the current master node can maintain a task allocation table, which contains the correspondence information between the task number of the scheduled task and the identifier of the slave node. After determining the information of the first slave node that has failed, the current master node can look up the task number of the first scheduled task running on the first slave node based on the task allocation table, and obtain the number of slave nodes that have not failed by periodically executing the node check task.

[0047] S202. Hash the task number and perform a modulo operation on the hash result based on the number of nodes. Determine the slave node corresponding to the operation result as the second slave node.

[0048] In this embodiment, the current master node can hash the task number of the first scheduled task after obtaining it, using a preset hash algorithm, and perform a modulo operation on the hash result based on the number of nodes to obtain a result less than the number of nodes. Each slave node corresponds to a node number whose value is less than the number of nodes. For example, when the number of nodes is 3, the slave node numbers of each slave node can be 0, 1, or 2. Based on the node numbers of each slave node, the slave node with the node number of the operation result is determined as the second slave node. The specific operation process can be represented as follows: node_id = hash(job_id) mod node_num, where node_id is the node number of the finally determined second slave node, hash is the preset hash algorithm, job_id is the task number of the first scheduled task, and node_num is the number of nodes.

[0049] S203. Assign the first scheduled task to the second slave node.

[0050] In this embodiment of the disclosure, the current master node can assign the first timed task to the second slave node after determining the second slave node.

[0051] Optionally, when the current master node reallocates the first timed task, it may also use other task allocation algorithms, such as the consistent hashing algorithm, to determine the second slave node; this is not limited here.

[0052] Optionally, in S103, the allocation method of the new master node when allocating the second timed task is similar to that in S201-S203. Specifically, the task number of the second timed task and the number of slave nodes that have not failed can be obtained. The task number of the second timed task is hashed, and the hash result is moduloed based on the number of nodes. The slave node corresponding to the result is determined as the fourth slave node. Alternatively, other task allocation algorithms, such as consistent hashing, can be used to determine the fourth slave node. The task number of the second timed task can be obtained by incrementing the task number of the previously allocated timed task.

[0053] This embodiment of the disclosure obtains the task number of the first scheduled task based on the current master node and the number of slave nodes that have not failed, performs hash processing on the task number, and performs a modulo operation on the hash result based on the number of nodes. The slave node corresponding to the operation result is determined as the second slave node, and the first scheduled task is assigned to the second slave node. This ensures that each scheduled task can be uniquely assigned to a slave node for execution during reallocation, while avoiding the situation where some slave nodes are overloaded while other nodes are idle, thus improving the balance of task allocation.

[0054] In some embodiments, a target interface is deployed on the current master node. The target interface is used to receive script files uploaded by users. The script files contain at least one of the task content of the scheduled task and management commands. After the third slave node is determined as the new master node, the target interface can be redeployed on the new master node.

[0055] The distributed cluster can be built using an open-source cloud computing management platform project, such as OpenStack. While this platform provides pre-defined content and execution methods for scheduled tasks, it doesn't support user-defined settings. Deploying a target interface on the master node allows the acquisition of user-uploaded script files containing the task content and / or management commands for scheduled tasks. This target interface can be a RESTful (Representational State Transfer) interface, allowing users to write their own Python and Shell scripts. These scripts contain the task content, enabling users to customize task logic and configure execution methods to describe specific tasks such as data processing, file operations, and system management. For example, if a user wants to periodically clean up temporary files on the server, they can write a Python or Shell script containing the commands and logic for cleaning up temporary files. This script can then be configured as a scheduled task, triggering execution at a preset time. Users can customize the cleanup rules, frequency, and file paths, rather than relying on fixed system functions, thus managing scheduled tasks more flexibly. In addition, the script file can also contain management commands for scheduled tasks. Users can create, manage, and delete scheduled tasks programmatically, and can also view the task status and execution results in real time. After the third slave node is designated as the new master node, the target interface can be redeployed on the new master node to continue receiving and processing user-uploaded script files, thereby ensuring the normal execution of scheduled tasks and management commands. Even if the master node is switched, the overall functionality and performance of the distributed cluster will not be affected, thus ensuring the flexibility of task management.

[0056] Figure 3 This is a schematic diagram of the structure of a task management device provided in an embodiment of this disclosure. Figure 3As shown, the task management device 300 includes: a detection module 310, a first allocation module 320, and a second allocation module 330. The detection module 310 is used to determine the node type of the faulty node in response to detecting a faulty node in the distributed cluster. The first allocation module 320 is used to, when the node type is a slave node, allocate a first timed task running on the faulty first slave node to a second slave node based on the current master node, so that the second slave node executes the first timed task. The second slave node is any one of the at least two slave nodes other than the first slave node. The second allocation module 330 is used to, when the node type is a master node, elect a third slave node from the at least two slave nodes, determine the third slave node as the new master node, and allocate a second timed task to be allocated to a fourth slave node based on the new master node, so that the fourth slave node executes the second timed task. The fourth slave node is any one of the at least two slave nodes other than the third slave node.

[0057] Optionally, the distributed cluster further includes a sentinel node. The detection module 310 is specifically used to obtain the status information of the current master node and the at least two slave nodes based on the sentinel node, and to determine whether there is a faulty node in the distributed cluster based on the status information. If there is a faulty node, the node type of the faulty node is determined based on the status information.

[0058] Optionally, the second allocation module 330 is specifically used to compare the node performance parameters of the at least two slave nodes based on the sentinel node, and determine the slave node with the highest overall performance as the third slave node, wherein the node performance parameters include at least one of the performance parameters of the central processing unit and the storage capacity.

[0059] Optionally, the first allocation module 320 includes: an acquisition unit, configured to acquire the task number of the first timed task and the number of slave nodes that have not failed based on the current master node; a calculation unit, configured to perform hash processing on the task number and perform a modulo operation on the hash result based on the number of nodes, and determine the slave node corresponding to the operation result as the second slave node; and an allocation unit, configured to allocate the first timed task to the second slave node.

[0060] Optionally, a target interface is deployed on the current master node. The target interface is used to receive script files uploaded by users. The script files contain at least one of the task content of a scheduled task and management commands. The task management device 300 further includes a deployment module for redeploying the target interface on the new master node.

[0061] Optionally, each slave node is deployed with a scheduled task scheduling framework, which is used to execute scheduled tasks based on the execution method corresponding to the scheduled task. The execution method includes parallel execution and serial execution.

[0062] The task management device provided in this embodiment can execute the method described in any of the above embodiments. Its execution method and beneficial effects are similar, and will not be repeated here.

[0063] Figure 4 This is a schematic diagram of the structure of a computer device provided in an embodiment of this disclosure.

[0064] like Figure 4 As shown, the computer device may include a processor 410 and a memory 420 storing computer program instructions.

[0065] Specifically, the processor 410 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0066] Memory 420 may include mass storage for information or instructions. For example, and not limitingly, memory 420 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 420 may include removable or non-removable (or fixed) media. Where appropriate, memory 420 may be internal or external to the integrated gateway device. In a particular embodiment, memory 420 is non-volatile solid-state memory. In a particular embodiment, memory 420 includes read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (Electrically Programmable ROM, EPROM), an electrically erasable programmable PROM (EEPROM), an electrically alterable ROM (EAROM), or flash memory, or a combination of two or more of these.

[0067] The processor 410 reads and executes computer program instructions stored in the memory 420 to perform the steps of the task management method provided in the embodiments of this disclosure.

[0068] In one example, the computer device may also include a transceiver 430 and a bus 440. Wherein, as... Figure 4 As shown, the processor 410, memory 420 and transceiver 430 are connected via bus 440 and communicate with each other.

[0069] Bus 440 may include hardware, software, or both. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 440 may include one or more buses. Although specific buses are described and illustrated in the embodiments of this application, this application considers any suitable bus or interconnection.

[0070] This disclosure also provides a computer-readable storage medium that can store a computer program, which, when executed by a processor, enables the processor to implement the task management method provided in this disclosure.

[0071] The aforementioned storage medium may, for example, include a memory 420 for computer program instructions, which can be executed by the processor 410 of the task management device to complete the task management method provided in the embodiments of this disclosure. Optionally, the storage medium may be a non-transitory computer-readable storage medium, such as a ROM, random access memory (RAM), compact disc ROM (CD-ROM), magnetic tape, floppy disk, and optical data storage device. The aforementioned computer program may be written in any combination of one or more programming languages ​​to perform the operations of the embodiments of this disclosure. The programming languages ​​include object-oriented programming languages ​​such as Java and C++, as well as conventional procedural programming languages ​​such as C or similar languages. The program code may be executed entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0072] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, causes the processor to implement the task management method provided in this disclosure.

[0073] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0074] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A task management method, characterized in that, The method is applicable to a distributed cluster, the distributed cluster comprising a current master node and at least two slave nodes, the method comprising: In response to the detection of a faulty node in the distributed cluster, the node type of the faulty node is determined; When the node type is a slave node, the first timed task running on the first slave node that has failed is assigned to the second slave node based on the current master node, so that the second slave node executes the first timed task. The second slave node is any one of the at least two slave nodes other than the first slave node. When the node type is the master node, a third slave node is elected from the at least two slave nodes and the third slave node is determined as the new master node. Based on the new master node, the second scheduled task to be assigned is assigned to the fourth slave node so that the fourth slave node can execute the second scheduled task. The fourth slave node is any one of the at least two slave nodes other than the third slave node.

2. The method according to claim 1, characterized in that, The distributed cluster also includes sentinel nodes. In response to detecting a faulty node in the distributed cluster, the node type of the faulty node is determined, including: The sentinel node obtains the status information of the current master node and the at least two slave nodes, and determines whether there is a faulty node in the distributed cluster based on the status information. If there is a faulty node, the node type of the faulty node is determined based on the status information.

3. The method according to claim 2, characterized in that, The process of electing a third slave node from the at least two slave nodes includes: The sentinel node compares the node performance parameters of the at least two slave nodes and determines the slave node with the highest overall performance as the third slave node. The node performance parameters include at least one of the performance parameters of the central processing unit and the storage capacity.

4. The method according to claim 1, characterized in that, The step of allocating the first scheduled task running on the first failed slave node to the second slave node based on the current master node includes: Based on the current master node, obtain the task number of the first timed task and the number of slave nodes that have not experienced a failure. The task number is hashed, and the hash result is moduloed based on the number of nodes. The slave node corresponding to the result is determined as the second slave node. The first scheduled task is assigned to the second slave node.

5. The method according to claim 1, characterized in that, The current master node is deployed with a target interface, which is used to receive script files uploaded by users. The script files contain at least one of the task content of the scheduled task and management commands. After determining the third slave node as the new master node, the method further includes: The target interface is redeployed on the new master node.

6. The method according to claim 1, characterized in that, Each slave node is equipped with a scheduled task scheduling framework, which is used to execute scheduled tasks based on the execution methods corresponding to the scheduled tasks. The execution methods include parallel execution and serial execution.

7. A task management device, characterized in that, The apparatus is suitable for a distributed cluster, the distributed cluster comprising a current master node and at least two slave nodes, the apparatus comprising: The detection module is used to determine the node type of the faulty node in response to the detection of a faulty node in the distributed cluster. The first allocation module is configured to, when the node type is a slave node, allocate a first timed task running on a first slave node that has failed to a second slave node based on the current master node, so that the second slave node executes the first timed task, wherein the second slave node is any one of the at least two slave nodes other than the first slave node; The second allocation module is used to, when the node type is a master node, elect a third slave node from the at least two slave nodes, determine the third slave node as the new master node, and allocate the second timed task to be allocated to the fourth slave node based on the new master node, so that the fourth slave node executes the second timed task, wherein the fourth slave node is any one of the at least two slave nodes other than the third slave node.

8. A computer device, characterized in that, include: Memory; processor; And a computer program; wherein the computer program is stored in the memory and configured to be executed by the processor to implement the task management method as described in any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the task management method as described in any one of claims 1-6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the task management method as described in any one of claims 1-6.