Task scheduling method and device, electronic equipment and storage medium

By grouping AI tasks by type and assigning them to the same queue for execution, the problem of long processing time for AI tasks is solved, resulting in faster task processing and reduced user waiting time.

CN121636064APending Publication Date: 2026-03-10BAIDU ONLINE NETWORK TECH (BEIJIBG) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-28
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

In existing technologies, AI tasks take a long time to process, which increases the waiting time for users, especially when loading models and performing preprocessing.

Method used

By placing tasks of the same type into the same queue and determining the execution queue corresponding to the target computing node, the target computing node retrieves tasks from the queue and executes them, thus avoiding duplicate loading of models and preprocessing.

Benefits of technology

It speeds up task processing, reduces task time, and consequently reduces user waiting time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121636064A_ABST
    Figure CN121636064A_ABST
Patent Text Reader

Abstract

The invention discloses a task scheduling method and device, electronic equipment and a storage medium, and relates to the technical field of computers, in particular to the field of artificial intelligence such as cloud computing and big data. According to the specific implementation scheme, at least one task is obtained, and the type of each task is determined; determining tasks of the same type in the at least one task according to the type of each task; the tasks of the same type are put into the same queue to obtain at least one queue; determining a to-be-executed queue corresponding to the target computing node from the at least one queue; and the target computing node obtains the task from the queue to be executed and executes the obtained task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to the fields of artificial intelligence such as cloud computing and big data, specifically to task scheduling methods, devices, electronic devices and storage media. Background Technology

[0002] Task scheduling refers to the process of automatically allocating and managing tasks through certain strategies and algorithms. Reasonable task scheduling enables a system to execute various tasks efficiently, while ensuring system stability, responsiveness, and performance, thus meeting task execution requirements. Summary of the Invention

[0003] This application provides a task scheduling method, apparatus, electronic device, and storage medium.

[0004] According to one aspect of this application, a task scheduling method is provided, comprising:

[0005] Obtain at least one task and determine the type of each task;

[0006] Based on the type of each task, identify the tasks of the same type among the at least one tasks;

[0007] Place tasks of the same type into the same queue to obtain at least one queue;

[0008] Determine the queue to be executed corresponding to the target computing node from the at least one queue;

[0009] The target computing node retrieves a task from the queue to be executed and executes the retrieved task.

[0010] According to another aspect of this application, a task scheduling apparatus is provided, comprising:

[0011] The first determining module is used to acquire at least one task and determine the type of each task;

[0012] The second determining module is used to determine, based on the type of each task, tasks of the same type among the at least one tasks;

[0013] The acquisition module is used to put tasks of the same type into the same queue, so as to acquire at least one queue;

[0014] The third determining module is used to determine the queue to be executed corresponding to the target computing node from the at least one queue;

[0015] The scheduling and execution module is used by the target computing node to obtain tasks from the queue to be executed and execute the obtained tasks.

[0016] According to another aspect of this application, an electronic device is provided, comprising:

[0017] At least one processor; and

[0018] A memory communicatively connected to the at least one processor; wherein,

[0019] The memory stores instructions that can be executed by the at least one processor, which, when executed by the at least one processor, enables the at least one processor to perform the method described in the above embodiments.

[0020] According to another aspect of this application, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to perform the method described in the above embodiments.

[0021] According to another aspect of this application, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the method described in the above embodiments.

[0022] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0023] The accompanying drawings are provided for a better understanding of this solution and do not constitute a limitation of this application. Wherein:

[0024] Figure 1 A flowchart illustrating a task scheduling method provided in an embodiment of this application;

[0025] Figure 2 A flowchart illustrating a task scheduling method provided in another embodiment of this application;

[0026] Figure 3 A flowchart illustrating a task scheduling method provided in another embodiment of this application;

[0027] Figure 4 A schematic diagram illustrating a task scheduling strategy provided in an embodiment of this application;

[0028] Figure 5 This is a schematic diagram of the structure of a task scheduling device provided in an embodiment of this application;

[0029] Figure 6 This is a block diagram of an electronic device used to implement the task scheduling method of the embodiments of this application. Detailed Implementation

[0030] The following description, in conjunction with the accompanying drawings, illustrates exemplary embodiments of this application, including various details to aid understanding. These should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this application. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0031] The task scheduling method, apparatus, electronic device, and storage medium of this application are described below with reference to the accompanying drawings.

[0032] Figure 1 This is a flowchart illustrating a task scheduling method provided in an embodiment of this application.

[0033] For example, in the field of artificial intelligence, reasonable AI task scheduling can speed up the consumption of AI tasks, reduce the time spent on AI tasks, and reduce the waiting time for users.

[0034] Taking AI-generated image tasks as an example, in some embodiments, a model is loaded and some preprocessing is performed when processing each task. However, loading the model and preprocessing are actually very time-consuming, which makes the task processing time relatively long, resulting in a long waiting time for users.

[0035] The task scheduling method of this application embodiment can be executed by the task scheduling device of this application embodiment. The device can be configured in an electronic device to realize the task scheduling function.

[0036] Among them, electronic devices can be any device with computing capabilities, such as personal computers, mobile terminals, servers, etc. Mobile terminals can be hardware devices with various operating systems, touch screens and / or displays, such as in-vehicle devices, mobile phones, tablets, personal digital assistants, wearable devices, etc.

[0037] For example, the task scheduling method in this application embodiment can be executed by a computing node, a management node, or a task scheduling system, wherein the task scheduling system may include computing nodes, management nodes, etc.

[0038] like Figure 1 As shown, the task scheduling method includes:

[0039] Step 101: Obtain at least one task and determine the type of each task.

[0040] For example, the task can be an AI task, such as an AI-generated image task or an AI-generated video task, or it can be other tasks in the field of computer science.

[0041] In this application, tasks can be parsed to determine the type of task, or tasks can be classified using a pre-trained classifier to determine the type of task, or tasks can be identified to determine the model to be used to process the task, and the type of task can be determined according to the model to be used.

[0042] For example, tasks that need to be processed using the same model can be considered as tasks of the same type. A correspondence between the model and the task type can be established. The model can be used according to the needs of completing the task, and the correspondence can be queried to determine the type of task.

[0043] For example, Model 1 corresponds to Type 1, Model 2 corresponds to Type 2, and so on. If processing Task 1 requires using Model 1, we can determine that the type of Task 1 is Type 1. If processing Task 2 requires using Model 2, we can determine that the type of Task 2 is Type 2, and so on.

[0044] Step 102: Based on the type of each task, identify at least one task of the same type.

[0045] In this application, at least one task of the same type can be identified based on the type of each task, thereby classifying tasks of the same type into one category.

[0046] Step 103: Place tasks of the same type into the same queue to obtain at least one queue.

[0047] In this application, at least one task of the same type can be placed in the same queue, that is, tasks belonging to the same category can be placed in the same queue, so that the tasks in the same queue are of the same type, and at least one queue can be obtained.

[0048] In this system, at least one queue contains tasks of the same type, while different queues contain tasks of different types.

[0049] Step 104: Determine the queue to be executed corresponding to the target computing node from at least one queue.

[0050] The target computing node can be any computing node among all surviving computing nodes in the system, which can be a distributed system. A surviving computing node is a node that is currently in normal operation, capable of executing computing tasks, processing data, and responding to requests.

[0051] The queue to be executed for the target computing node can refer to the queue that the target computing node can execute. For example, if the queue to be executed is queue Q1, it means that the target computing node can execute the tasks in queue Q1.

[0052] For example, the weight of each queue can be determined, and the total weight of at least one queue can be determined based on the sum of the weights of each queue in at least one queue. For any queue, the ratio of the weight of the queue to the total weight can be multiplied by the number of all surviving computing nodes to obtain the number of nodes required for the queue. Then, based on the number of nodes required for each queue, the corresponding number of computing nodes can be allocated to each queue, so that the queue to be executed corresponding to the target computing node can be known, where each computing node can be allocated a queue.

[0053] The weight of the queue can be preset or determined based on the priority of the tasks in the queue. For example, the more high-priority tasks in the queue, the greater the weight of the queue. It should be noted that the weight of the queue can also be determined in other ways, and there are no restrictions on this.

[0054] For example, there are 3 queues: queue Q1 has a weight of 6, queue Q2 has a weight of 4, and queue Q3 has a weight of 2. There are 10 surviving computing nodes from n0 to n9. The sum of the weights of the three queues is 12. Then, queue Q1 needs to use (6 / 12)*10 = 5 computing nodes. For queue Q2, rounding down (4 / 12)*10 gives 3, meaning queue Q2 needs to use 3 computing nodes. Queue Q3 needs to use 2 computing nodes. Then, the corresponding number of computing nodes can be allocated to each queue from the 10 nodes. For example, queue Q1 is allocated computing nodes from n0 to n4, queue Q2 is allocated computing nodes from n5, n6, and n7, and queue Q3 is allocated computing nodes from n8 and n9.

[0055] Step 105: The target computing node retrieves a task from the queue to be executed and executes the retrieved task.

[0056] For example, the target computing node can retrieve and execute tasks in the order they appear in the execution queue. For example, each task has a priority, and the target computing node can retrieve and execute tasks in descending order of priority. For example, each task has a weight, and the target computing node can retrieve and execute tasks in descending order of weight.

[0057] For example, a target computing node can retrieve one task from the execution queue at a time, and retrieve the next task from the queue after completing the previous one. Alternatively, a target computing node can retrieve multiple tasks from the execution queue at once, and retrieve more tasks after processing all of them. Or, a target computing node can execute tasks while simultaneously retrieving tasks from the execution queue.

[0058] In the embodiments of this application, by determining the type of each task, tasks of the same type are placed in the same queue, and the execution queue corresponding to the target computing node is determined, so that the target computing node can consume tasks of the same type from the same queue. Since the tasks in the same queue are of the same type, when the same computing node executes a task in the queue for the first time, it loads the model and performs pre-processing. When executing tasks in the same queue again, since the same type of task has been processed before, the model has been loaded, and the pre-processing has been performed, there is no need to load the model and perform pre-processing again, thereby speeding up the task processing speed, reducing task consumption time, and thus reducing the user's waiting time.

[0059] Figure 2 This is a flowchart illustrating a task scheduling method provided in another embodiment of this application.

[0060] like Figure 2 As shown, the task scheduling method includes:

[0061] Step 201: Obtain at least one task and determine the type of each task.

[0062] In this application, step 201 can be implemented in any of the embodiments of this application, so it will not be described in detail here.

[0063] Step 202: Based on the type of each task, identify at least one task of the same type.

[0064] In this application, step 202 can be implemented in any of the embodiments of this application, so it will not be described in detail here.

[0065] Step 203: Place tasks of the same type into the same queue to obtain at least one queue.

[0066] In this application, step 203 can be implemented in any of the embodiments of this application, so it will not be described in detail here.

[0067] Step 204: Obtain the sequence number of the target computing node and the number of first nodes among all surviving computing nodes.

[0068] For example, the sequence number of the target computing node can refer to the node's serial number. For instance, if there are 10 surviving computing nodes, and these nodes are numbered starting from 0, with one node numbered 8, then that node's sequence number is 8. If new computing nodes are added or the number of computing nodes is reduced, the nodes can be renumbered.

[0069] For example, by calling the node management service, all surviving compute nodes can be sorted to obtain a node sequence. Then, the sequence number of the target compute node can be obtained based on its position in the node sequence. For instance, if the target compute node is the first compute node in the node sequence, its sequence number is 0; if it is the second compute node, its sequence number is 1.

[0070] For example, the computing nodes can be sorted according to their IP address or node name. Alternatively, they can be sorted based on their available resources, such as by order of available resources from most to least available.

[0071] Understandably, the index of each computing node in the node sequence is determined by its position within the sequence. For example, the index of the first computing node in the sequence is 0, the index of the second computing node is 1, the index of the third computing node is 2, and so on.

[0072] It should be noted that the index of the computed nodes in the node sequence can start from 0 or 1, without any restriction.

[0073] Therefore, obtaining the serial number of the target computing node by calling the node management service is simple and convenient.

[0074] In addition, if new computing nodes are added or the number of computing nodes is reduced, all computing nodes can be reordered, thereby redetermining the sequence number of each computing node.

[0075] Step 205: For any queue in at least one queue, determine the weight of any queue.

[0076] For example, the weight of a task in any queue and the number of tasks in that queue can be obtained. Based on the weight of the tasks in the queue and the number of tasks in the queue, the weight of the queue can be determined. Here, the number of tasks in the queue refers to the number of tasks in the queue.

[0077] For example, tasks in different queues may have different types, and each task type may have a corresponding weight. The weight of a task in any queue can be the weight corresponding to the type to which the task in that queue belongs. For example, a corresponding weight can be set for each task type, or the weight corresponding to each task type can be determined based on the complexity of each task type; for example, the higher the complexity, the greater the weight.

[0078] For example, if the weight of type 1 is set to 6 and the weight of type 2 is set to 4, and if queue 1 contains tasks of type 1 and queue 2 contains tasks of type 2, then the weight of the tasks in queue 1 is 6 and the weight of the tasks in queue 2 is 4.

[0079] For example, each task can be assigned a corresponding weight. Different tasks in the same queue may have different weights. For any queue, the average weight of each task in the queue can be calculated based on the weight of each task in the queue, and the average value can be used as the weight of the task in the queue.

[0080] For example, taking queue Q1 as an example, the weight Score of queue Q1 can be calculated using the following formula (1). Q1 :

[0081] Score Q1 =Weight Q1 +(1+Count Q1 (1)

[0082] Among them, Weight Q1 Represents the weight of the tasks in queue Q1, Count Q1 This indicates the number of tasks in queue Q1.

[0083] Therefore, determining the weight of a queue based on the weight of the tasks in the queue and the number of tasks in the queue not only considers the weight of the tasks themselves, but also the number of tasks in the queue, which can improve the accuracy of weight calculation.

[0084] Step 206: Sort at least one queue according to the weight of each queue in at least one queue to obtain a queue sorting list.

[0085] For example, at least one queue can be sorted in descending order of its weight, or in ascending order of its weight; there is no limitation on this. For instance, if the computing nodes are sorted in descending order of their idle resources, then the queues can be sorted in descending order of their weight; if the computing nodes are sorted in ascending order of their idle resources, then the queues can be sorted in ascending order of their weight.

[0086] For example, the queue sorting list can include queue identifiers and queue weights. For instance, there are three queues Q... A Q B Q C , where queue Q A The weight is 5, and the queue Q B The weight is 4, and the queue QC The weight is 7. Sort the queues according to their weights from highest to lowest, resulting in the sorted queue list [Q]. C 7, Q A :5, Q B :4).

[0087] Step 207: Based on the sequence number and the number of first nodes, determine whether the current queue is a queue to be executed according to the queue sorting list.

[0088] In this application, the cumulative weight can be determined based on the weights in the current queue and the weights of the iterated queues in the queue sorting list. The number of second nodes required by the current queue and the iterated queues can be determined based on the cumulative weight, the total weight of at least one queue, and the number of first nodes of all surviving computation nodes. If the index of the target computation node is less than the number of second nodes, the current queue can be determined as the queue to be executed corresponding to the target computation node. If the index of the target computation node is greater than the number of second nodes, it can continue to determine whether the next queue after the current queue is a queue to be executed, until there is a queue to be executed after the current queue or all queues in the queue sorting list have been traversed. If none of the queues in the queue sorting list are queues to be executed, the queue to be executed for the target computation node can be determined as the default queue, or the queue to be executed for the target computation node is empty.

[0089] The iterated queue is the queue that precedes the current queue in the queue sorting list. If the current queue is the first queue in the queue sorting list, then the cumulative weight is the weight of the first queue; if the current queue is the second queue in the queue sorting list, then the cumulative weight is the sum of the weights of the first and second queues, and so on.

[0090] In addition, the total weight of at least one queue is the sum of the weights of at least one queue.

[0091] For example, the number of second nodes can be determined based on the ratio of cumulative weight to total weight and the number of first nodes, as shown in formula (2) below:

[0092]

[0093] Where PnodeNum represents the number of second nodes, cumulativeScore represents the cumulative weight, TotalScore represents the total weight, and TotalNodeNum represents the number of first nodes.

[0094] As described above, when determining the queue to be executed, we can start with the first queue in the queue sorting list. The weight of the first queue is the cumulative weight. Based on this cumulative weight, the total weight, and the number of the first node, the number of the second node is determined. If the index of the target computation node is less than the number of the second node, the first queue can be determined as the queue to be executed for the target computation node, and the judgment is terminated. If the index is greater than or equal to the number of the second node, the weight of the first queue and the weight of the second queue are added together to obtain the cumulative weight, and the number of the second node is determined again. If the index is less than the number of the second node, then the second queue is the queue to be executed for the target computation node. If the index is greater than or equal to the number of the second node, the judgment is continued to determine whether the third queue is the queue to be executed, until a queue is found to be the queue to be executed or all queues in the queue sorting list have been traversed.

[0095] For example, consider a queue sorting list [Q1:6, Q2:4, Q3:2] with 10 computation nodes, numbered starting from 0. If the target computation node's index is 0, starting with queue Q1, the cumulative weight is 6. The second node count is 5. Since index 0 is less than 5, queue Q1 is confirmed as the queue to be executed. If the target computation node's index is 6, since index 6 is greater than 5, queue Q1 is not the queue to be executed. We can then check if queue Q2 is the queue to be executed. Adding the weights of queue Q1 and Q2 gives a cumulative weight of 10. The second node count is 8. Since index 6 is less than 8, queue Q2 is confirmed as the queue to be executed. If the target computation node's index is 9, since index 9 is less than 8, queue Q2 is not the queue to be executed. We then check if queue Q3 is the queue to be executed. The cumulative weight is 12, the second node count is 10, and since index 9 is less than 10, queue Q3 is confirmed as the queue to be executed.

[0096] According to the above judgment method, in the example above, the execution queues corresponding to the computing nodes with serial numbers 0, 1, 2, 3, and 4 are all queues Q1, the execution queues corresponding to the computing nodes with serial numbers 5, 6, and 7 are all queues Q2, and the execution queues corresponding to the computing nodes with serial numbers 8 and 9 are all queues Q3.

[0097] It should be noted that when the sequence number equals the number of the second node, the current queue can be designated as the queue to be executed, or the next queue can be further checked to determine if it is also a queue to be executed. This can be determined according to actual needs and is not limited in this regard. For example, if the sequence number of the computation node starts from 1, then when the sequence number of the target computation node is less than or equal to the number of the second node, the current queue can be designated as the queue to be executed.

[0098] Therefore, by calculating the cumulative weight based on the weight of the current queue and the weights of the queues that have been iterated over before the current queue, and by calculating the cumulative weight, the total weight, and the number of all surviving computing nodes, the number of nodes required for the current queue and the iterated queues is determined. Based on whether the sequence number of the target computing node is less than the number of nodes required for the current queue and the iterated queues, the queue to be executed by the target computing node is determined. This ensures that the number of computing nodes for the tasks in the execution queue matches the weight of the queue, and that the allocation of computing resources matches the weight of the queue, thereby improving resource utilization.

[0099] Furthermore, if the queues are sorted in descending order of their weights, and then each queue is checked for execution in descending order of its weight, computing resources can be allocated according to the weights. This allows for prioritizing tasks in high-weight queues and ensuring a reasonable allocation of computing resources, thus improving response speed.

[0100] If you want to prioritize a specific task or a task in a specific queue, you can adjust the queue's weight. For example, if the current queue is a specified queue, you can adjust the weight of the current queue to obtain the adjusted weight. Add the adjusted weight to the weight of the iterated queues to get the cumulative weight. Based on the cumulative weight, determine the number of second nodes, and then determine whether the current queue is a queue to be executed based on the number of second nodes.

[0101] The designated queue can be the queue to which the target task belongs, such as a task that needs to be prioritized, or a queue that can be specified as needed. Furthermore, the weight adjustment range can be a set value or determined as needed.

[0102] For example, if a designated queue contains task A that should be prioritized, its weight can be increased when the current queue is the designated queue. This increases the cumulative weight. Since the total weight and the number of computing nodes remain constant, the number of nodes with less than two nodes increases, leading to more computing nodes available to execute tasks in the designated queue. This allocates more computing resources to the designated queue, thereby increasing the processing speed of tasks in the designated queue and enabling priority processing of task A. Conversely, if a designated queue contains less demanding tasks, its weight can be decreased when the current queue is the designated queue. This reduces the number of computing nodes available to execute tasks in the designated queue, allowing more resources to be allocated to other queues and improving the processing speed of tasks in those queues.

[0103] Therefore, when the current queue is a specified queue, more computing resources can be allocated to the specified queue by adjusting the weight of the current queue, thereby improving the processing speed of tasks in the specified queue and meeting different task processing needs.

[0104] Step 208: The target computing node retrieves a task from the queue to be executed and executes the retrieved task.

[0105] In this application, step 208 can be implemented in any of the embodiments of this application, so it will not be described in detail here.

[0106] In this embodiment, by determining the weight of each queue, sorting the queues according to their weights to obtain a queue sorting list, and then determining whether the queues in the queue sorting list are the queues to be executed by the target computing node according to the sequence number of the target computing node and the number of all surviving computing nodes, computing resources are reasonably allocated to the queues. This not only improves resource utilization but also increases task processing speed and reduces time consumption.

[0107] Figure 3 This is a flowchart illustrating a task scheduling method provided in another embodiment of this application.

[0108] like Figure 3 As shown, the task scheduling method includes:

[0109] Step 301: Obtain at least one task and determine the type of each task.

[0110] In this application, step 301 can be implemented in any of the embodiments of this application, so it will not be described in detail here.

[0111] Step 302: Based on the type of each task, identify at least one task of the same type.

[0112] In this application, step 302 can be implemented in any of the embodiments of this application, so it will not be described in detail here.

[0113] Step 303: Place tasks of the same type into the same queue to obtain at least one queue.

[0114] In this application, step 303 can be implemented in any of the embodiments of this application, so it will not be described in detail here.

[0115] Step 304: For any queue in at least one queue, determine the weight of any queue.

[0116] In this application, step 304 can be implemented in any of the embodiments of this application, so it will not be described in detail here.

[0117] Step 305: Determine the queue to be executed based on the weight of each queue in at least one queue and the priority of the target computing node.

[0118] For example, the higher the priority of the target computing node, the more queues are allocated to it, or the more queues are allocated to it. The priority of the target computing node can be pre-set, determined based on its available resources (more available resources mean higher priority), or determined using other methods; there are no limitations on this.

[0119] For example, multiple weight ranges can be divided between the maximum and minimum weights in at least one queue, and a correspondence between weight ranges and priorities can be established. Based on this correspondence, the weight range corresponding to the priority of the target computing node can be determined, and the queues whose weights belong to that weight range can be determined. Then, the queues whose weights belong to the weight range corresponding to the priority of the target computing node can be used as the queues to be executed by the target computing node.

[0120] Step 306: The target computing node retrieves a task from the queue to be executed and executes the retrieved task.

[0121] In this application, step 306 can be implemented in any of the embodiments of this application, so it will not be described in detail here.

[0122] In this embodiment of the application, by determining the weight of each queue and determining the execution queue of the target computing node based on the weight of each queue and the priority of the target computing node, resources can be allocated reasonably and resource utilization can be improved.

[0123] Based on the above embodiments, in one embodiment of this application, the target computing node can register with the management node. After successful registration, the target computing node can report health status data to the management node. Thus, the management node can determine whether the target computing node is inactive based on the health status data. If the target computing node is inactive, it can perform inactive processing on the target computing node.

[0124] The health status data may include, but is not limited to, CPU utilization, memory usage, disk space, network connectivity, error messages in system logs, and specific health check indicators. For example, the target compute node may proactively send health status data to the management node, or the management node may periodically (e.g., every 30 seconds) send heartbeat requests to the target compute nodes to confirm whether they are still online and functioning normally. The target compute nodes respond to the heartbeat requests and send their health status data back to the management node.

[0125] Target computing node inactivity can refer to the target computing node being in an abnormal operating state, unable to execute computing tasks or respond to requests.

[0126] For example, the target computing node can be deactivated, such as by removing it from the pool of live nodes. Then, during task allocation, the deactivated node will no longer be considered. Alternatively, the target computing node can be marked as deactivated, or a deactivation alarm message can be sent to the target object. The deactivation alarm message can be used to notify the target object that the target computing node is deactivated, allowing the target object to restart the node or investigate the cause of the failure. The target object could be, for example, an administrator or maintenance personnel.

[0127] It should be noted that one or more of the above-mentioned deactivation processes can be applied to the target computing node, and there is no limitation on this.

[0128] Understandably, each compute node can register with the management node. A successfully registered compute node can report its health status data to the management node. The management node can then identify inactive compute nodes based on the reported health status data and deactivate them accordingly.

[0129] In this embodiment, each computing node can send health status data to the management node, so that the management node can determine the inactive computing nodes based on the health status, thereby promptly processing the inactive computing nodes and avoiding assigning tasks to the inactive computing nodes, which would affect task processing.

[0130] Based on the above embodiments, in one embodiment of this application, the target computing node can send load information to the management node. The management node can determine the load status of each computing node based on the load information received from each computing node, and increase or decrease the number of computing nodes based on the load status of each computing node and the total number of tasks in at least one queue.

[0131] For example, based on the load of each computing node, the idle resources of each computing node and the total number of tasks in all queues can be determined to determine whether each computing node can complete all tasks. If not, computing nodes can be added; if so, and there are many remaining idle resources, computing nodes can be reduced.

[0132] Therefore, each computing node can send load information to the management node. The management node can then add or reduce computing nodes based on the load reported by each computing node and the total number of tasks in all queues, thereby dynamically adjusting resources, improving resource utilization, and reducing costs.

[0133] To facilitate understanding, the following will be combined with... Figure 4 To explain, Figure 4This is a schematic diagram of a task scheduling strategy provided in an embodiment of this application.

[0134] like Figure 4 As shown, tasks can be input into a classifier, classified into task types, and then stored in the corresponding queues. For example, tasks of type T1 are placed in queue Queue1, tasks of type T2 are placed in queue Queue2, tasks of type T3 are placed in queue Queue3, tasks of type T4 are placed in queue Queue4, and tasks of type Tn are placed in queue QueueN.

[0135] N surviving computing nodes are obtained from the surviving node pool, and sorted to obtain the sequence number of each computing node. Then, using the method described in the above embodiment, the execution queue corresponding to each computing node is determined from the N queues, such as... Figure 4 As shown in the image.

[0136] In addition, N compute nodes can register with the management node. After successful registration, they can report health status data (i.e., liveness reporting) to the management node. The management node can determine the inactive compute nodes based on the health status data and remove the inactive compute nodes from the live node pool. The management node can also query the load status of each compute node.

[0137] The task scheduling method of this application embodiment can be used in scenarios that require a large amount of pre-calculation and where the pre-calculation can be reused, such as in scenarios where AI-generated images and AI-generated videos are generated in batches.

[0138] For example, the task scheduling method of this application embodiment can be applied to cloud computing platforms, big data processing, distributed systems, etc.

[0139] Applications on cloud computing platforms can distribute tasks across different virtual machines, ensuring that related tasks are assigned to the same or nearby computing nodes as much as possible, thereby reducing data transmission latency and resource overhead.

[0140] In big data processing, this application can ensure that related jobs are assigned to the same or similar nodes, reduce data transmission time, improve job execution efficiency, and rationally distribute data shards to different computing nodes, ensuring the locality of processing tasks and data, and reducing cross-node data transmission.

[0141] In distributed systems, distributed tasks can be assigned to different servers, ensuring that related tasks are assigned to adjacent or identical servers, reducing network communication overhead and improving overall system performance.

[0142] To implement the above embodiments, this application also proposes a task scheduling device. Figure 5 This is a schematic diagram of the structure of a task scheduling device provided in an embodiment of this application.

[0143] like Figure 5 As shown, the task scheduling device 500 includes:

[0144] The first determining module 510 is used to acquire at least one task and determine the type of each task;

[0145] The second determining module 520 is used to determine, based on the type of each task, tasks of the same type among the at least one tasks;

[0146] Module 530 is used to put tasks of the same type into the same queue in order to obtain at least one queue.

[0147] The third determining module 540 is used to determine the queue to be executed corresponding to the target computing node from the at least one queue;

[0148] The scheduling and execution module 550 is used for the target computing node to obtain tasks from the queue to be executed and to execute the obtained tasks.

[0149] Optionally, the third determining module 540 is configured to:

[0150] Obtain the sequence number of the target computing node and the number of first nodes among all surviving computing nodes;

[0151] For any queue in at least one queue, determine the weight of said queue;

[0152] The at least one queue is sorted according to the weight of each queue in the at least one queue to obtain a queue sorting list;

[0153] Based on the sequence number and the number of the first nodes, determine whether the current queue is the queue to be executed according to the queue sorting list.

[0154] Optionally, the third determining module 540 is configured to:

[0155] The cumulative weight is determined based on the weight of the current queue and the weight of the iterated queues in the queue sorting list; wherein the iterated queues are the queues in the queue sorting list that precede the current queue.

[0156] The number of second nodes required for the current queue and the iterated queues is determined based on the ratio of the cumulative weight to the total weight of the at least one queue and the number of the first nodes; wherein the total weight is the sum of the weights of the at least one queue.

[0157] In response to the sequence number being less than the number of the second nodes, the current queue is determined to be the queue to be executed;

[0158] In response to the sequence number being greater than or equal to the number of second nodes, it is further determined whether the next queue in the current queue in the queue sorting list is the queue to be executed.

[0159] Optionally, the third determining module 540 is configured to:

[0160] In response to the current queue being a specified queue, the weight of the current queue is adjusted to obtain the adjusted weight;

[0161] The adjusted weights are added to the weights of the iterated queue to obtain the cumulative weights.

[0162] Optionally, the third determining module 540 is configured to:

[0163] Obtain the weight of the task in any of the queues and the number of tasks in any of the queues;

[0164] The weight of any queue is determined based on the weight of the tasks in each queue and the number of tasks.

[0165] Optionally, the third determining module 540 is configured to:

[0166] By calling the node management service, all surviving compute nodes are sorted to obtain the node sequence;

[0167] The sequence number of the target computing node is obtained based on its position in the node sequence.

[0168] Optionally, the third determining module 540 is used for:

[0169] For any queue in at least one queue, determine the weight of said queue;

[0170] The queue to be executed is determined based on the weight of each queue in the at least one queue and the priority of the target computing node.

[0171] Optionally, the device may further include:

[0172] The sending module is used to send health status data from the target computing node to the management node, so that the management node can determine whether the target computing node is inactive based on the health status data, and perform inactive processing on the target computing node if it is inactive.

[0173] The deactivation process includes at least one of the following:

[0174] Remove the target computing node from the pool of live nodes;

[0175] Mark the target computing node as inactive;

[0176] Send an inactive alarm message to the target object.

[0177] Optionally, the device may further include:

[0178] The sending module is used to send load information from the target computing node to the management node, so that the management node can determine the load status of each computing node based on the load information received from each computing node, and increase or decrease the number of computing nodes based on the load status of each computing node and the total number of tasks in the at least one queue.

[0179] It should be noted that the explanation of the above-mentioned task scheduling method embodiment also applies to the task scheduling device of this embodiment, so it will not be repeated here.

[0180] In the embodiments of this application, by determining the type of each task, tasks of the same type are placed in the same queue, and the execution queue corresponding to the target computing node is determined, so that the target computing node can consume tasks of the same type from the same queue. Since the tasks in the same queue are of the same type, when the same computing node executes a task in the queue for the first time, it loads the model and performs pre-processing. When executing tasks in the same queue again, since the same type of task has been processed before, the model has been loaded, and the pre-processing has been performed, there is no need to load the model and perform pre-processing again, thereby speeding up the task processing speed, reducing task consumption time, and thus reducing the user's waiting time.

[0181] According to embodiments of this application, this application also provides an electronic device, a readable storage medium, and a computer program product.

[0182] Figure 6 A schematic block diagram of an example electronic device 600 that can be used to implement embodiments of this application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the application described and / or claimed herein.

[0183] like Figure 6As shown, device 600 includes a computing unit 601, which can perform various appropriate actions and processes based on a computer program stored in ROM (Read-Only Memory) 602 or a computer program loaded from storage unit 608 into RAM (Random Access Memory) 603. RAM 603 may also store various programs and data required for the operation of device 600. The computing unit 601, ROM 602, and RAM 603 are interconnected via bus 604. I / O (Input / Output) interface 605 is also connected to bus 604.

[0184] Multiple components in device 600 are connected to I / O interface 605, including: input unit 606, such as keyboard, mouse, etc.; output unit 607, such as various types of monitors, speakers, etc.; storage unit 608, such as disk, optical disk, etc.; and communication unit 609, such as network card, modem, wireless transceiver, etc. Communication unit 609 allows device 600 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0185] The computing unit 601 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 601 include, but are not limited to, CPUs (Central Processing Units), GPUs (Graphics Processing Units), various special-purpose AI (Artificial Intelligence) computing chips, various computing units running machine learning model algorithms, DSPs (Digital Signal Processors), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as task scheduling methods. For example, in some embodiments, the task scheduling method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and / or installed on device 600 via ROM 602 and / or communication unit 609. When the computer program is loaded into RAM 603 and executed by the computing unit 601, one or more steps of the task scheduling method described above may be performed. Alternatively, in other embodiments, computing unit 601 may be configured to perform a task scheduling method by any other suitable means (e.g., by means of firmware).

[0186] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, FPGAs (Field Programmable Gate Arrays), ASICs (Application-Specific Integrated Circuits), ASSPs (Application-Specific Standard Products), SOCs (System-on-Chips), CPLDs (Complex Programmable Logic Devices), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0187] The program code used to implement the methods of this application may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0188] In the context of this application, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, RAM, ROM, EPROM (Electrically Programmable Read-Only Memory) or flash memory, optical fiber, CD-ROM (Compact Disc Read-Only Memory), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0189] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (Cathode-Ray Tube) or LCD (Liquid Crystal Display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0190] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include LANs (Local Area Networks), WANs (Wide Area Networks), the Internet, and blockchain networks.

[0191] Computer systems can include clients and servers. Clients and servers are generally geographically separated and typically interact via communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. A server can be a cloud server, also known as a cloud computing server or cloud host, a hosting product within the cloud computing service system that addresses the shortcomings of traditional physical hosts and VPS (Virtual Private Server) services, such as high management difficulty and weak business scalability. Servers can also be servers for distributed systems or servers integrated with blockchain technology.

[0192] According to an embodiment of this application, this application also provides a computer program product that, when the instruction processor in the computer program product is executed, performs the task scheduling method proposed in the above embodiments of this application.

[0193] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this application can be achieved, and this is not limited herein.

[0194] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A task scheduling method, comprising: obtaining at least one task and determining the type of each task; determining tasks of the same type in the at least one task according to the type of each task; putting the tasks of the same type into the same queue to obtain at least one queue; determining a to-be-executed queue corresponding to a target computing node from the at least one queue; the target computing node obtaining a task from the to-be-executed queue and executing the obtained task.

2. The method of claim 1, wherein, The determining of the to-be-executed queue corresponding to the target computing node from the at least one queue comprises: obtaining the serial number of the target computing node and the first node number of all surviving computing nodes; determining the weight of any queue in the at least one queue; sorting the at least one queue according to the weight of each queue in the at least one queue to obtain a queue sorting list; determining whether the current queue is the to-be-executed queue according to the serial number, the first node number and the queue sorting list.

3. The method of claim 2, wherein, The determining of whether the current queue is the to-be-executed queue according to the serial number, the first node number and the queue sorting list comprises: determining the cumulative weight according to the weight of the current queue and the weight of the iterated queue in the queue sorting list; wherein the iterated queue is the queue before the current queue in the queue sorting list; determining the second node number required by the current queue and the iterated queue according to the ratio of the cumulative weight to the total weight of the at least one queue and the first node number; wherein the total weight is the sum of the weights of the at least one queue; in response to the serial number being less than the second node number, determining that the current queue is the to-be-executed queue; in response to the serial number being greater than or equal to the second node number, continuing to determine whether the next queue of the current queue in the queue sorting list is the to-be-executed queue.

4. The method of claim 3, wherein, The determining of the cumulative weight according to the weight of the current queue and the weight of the iterated queue in the queue sorting list comprises: in response to the current queue being a specified queue, adjusting the weight of the current queue to obtain an adjusted weight; adding the adjusted weight and the weight of the iterated queue to obtain the cumulative weight.

5. The method of claim 2, wherein, The determining of the weight of the any queue comprises: obtaining the weight of the task in the any queue and the task number of the any queue; determining the weight of the any queue according to the weight of the task in the any queue and the task number.

6. The method of claim 2, wherein, The obtaining of the serial number of the target computing node comprises: sorting all surviving computing nodes by calling a node management service to obtain a node sequence; obtaining the serial number of the target computing node according to the position of the target computing node in the node sequence.

7. The method of claim 1, wherein, The determining of the to-be-executed queue corresponding to the target computing node from the at least one queue comprises: determining the weight of any queue in the at least one queue; determine the to-be-executed queue according to the weight of each queue in the at least one queue and the priority of the target computing node.

8. The method of any one of claims 1-7, further comprising: sending, by the target computing node, health status data to a management node, so that the management node determines whether the target computing node is inactivated according to the health status data, and performs inactivation processing on the target computing node in the case that the target computing node is inactivated; wherein the inactivation processing comprises at least one of: excluding the target computing node from a pool of live nodes; marking the target computing node as inactivated; sending inactivation alarm information to a target object.

9. The method of any one of claims 1-7, further comprising: sending, by the target computing node, load information to a management node, so that the management node determines the load condition of each computing node according to the load information received from each computing node, and increases or reduces computing nodes according to the load condition of each computing node and the total amount of tasks in the at least one queue.

10. A task scheduling apparatus, comprising: a first determination module configured to obtain at least one task and determine the type of each task; a second determination module configured to determine tasks of the same type in the at least one task according to the type of each task; an obtaining module configured to place tasks of the same type into the same queue to obtain at least one queue; a third determination module configured to determine a to-be-executed queue corresponding to a target computing node from the at least one queue; a scheduling execution module configured to obtain tasks from the to-be-executed queue by the target computing node and execute the obtained tasks.

11. The apparatus of claim 10, wherein, The third determination module is configured to: obtain the serial number of the target computing node and a first node quantity of all live computing nodes; determine the weight of any queue in the at least one queue; sort the at least one queue according to the weight of each queue in the at least one queue to obtain a queue sorting list; determine whether a current queue is the to-be-executed queue in sequence according to the queue sorting list, according to the serial number and the first node quantity.

12. The apparatus of claim 11, wherein, The third determination module is configured to: determine an accumulated weight according to the weight of the current queue and the weight of an iterated queue in the queue sorting list, wherein the iterated queue is a queue located before the current queue in the queue sorting list; determine a second node quantity required by the current queue and the iterated queue according to the ratio of the accumulated weight to the total weight of the at least one queue and the first node quantity, wherein the total weight is the sum of the weights of the at least one queue; determine that the current queue is the to-be-executed queue in response to the serial number being less than the second node quantity; continue to determine whether a next queue of the current queue in the queue sorting list is the to-be-executed queue in response to the serial number being greater than or equal to the second node quantity.

13. The apparatus of claim 12, wherein, The third determination module is configured to: In response to the current queue being the specified queue, adjusting a weight of the current queue to obtain an adjusted weight; adding the adjusted weight to a weight of the iterated queue to obtain the accumulated weight.

14. The apparatus of claim 11, wherein, The third determining module is configured to: obtain a weight of a task in the any queue and a number of tasks in the any queue; determine the weight of the any queue according to the weight of the task in the any queue and the number of tasks.

15. The apparatus of claim 11, wherein, The third determining module is configured to: sort all live computing nodes by calling a node management service to obtain a node sequence; obtain a serial number of the target computing node according to a position of the target computing node in the node sequence.

16. The apparatus of claim 10, wherein, The third determining module is configured to: determine a weight of the any queue in the at least one queue; determine the to-be-executed queue according to the weight of each queue in the at least one queue and the priority of the target computing node.

17. The apparatus of any one of claims 10-16, further comprising: a sending module configured to send, by the target computing node, health state data to a management node, so that the management node determines whether the target computing node is inactivated according to the health state data, and performs inactivation processing on the target computing node in a case where the target computing node is inactivated; wherein the inactivation processing comprises at least one of the following: eliminating the target computing node from a live node pool; marking the target computing node as inactivated; sending inactivation alarm information to a target object.

18. The apparatus of any one of claims 10-16, further comprising: a sending module configured to send, by the target computing node, load information to a management node, so that the management node determines load conditions of the computing nodes according to the load information received from the computing nodes, and increases or reduces computing nodes according to the load conditions of the computing nodes and a total amount of tasks of the at least one queue.

19. An electronic device, comprising: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.

20. A non-transitory computer readable storage medium having stored thereon computer instructions, wherein, The computer instructions are used to enable the computer to perform the method of any one of claims 1-9.

21. A computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of any one of claims 1-9.