A task scheduling method, device, computer program product and storage medium

By establishing directed acyclic graphs on the cloud computing platform and dynamically adjusting task sorting and processing unit allocation, the problem of excessively long task scheduling is solved, and the overall time-consuming optimization of tasks and efficient utilization of resources is achieved.

CN120066741BActive Publication Date: 2025-07-08JINAN INSPUR DATA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510534900.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-07-08
Estimated Expiration
2045-04-27

AI Technical Summary

Technical Problem

When scheduling tasks, it is difficult for existing cloud computing platforms to effectively reduce the overall time-consuming task operation, especially in consideration of task relevance and resource utilization.

Method used

By establishing a directed acyclic graph, determining the sorting value and scheduling value of the task, dynamically adjusting the allocation of processing units, and optimizing the task execution order with the shortest overall time-consuming goal, and redetermining the task sorting value in the event of resource conflicts to adjust the execution order.

Benefits of technology

It effectively shortens the overall operation time of tasks, improves resource utilization and user experience, and reduces energy consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120066741B_ABST
    Figure CN120066741B_ABST
Patent Text Reader

Abstract

The present application discloses a task scheduling method, device, computer program product and storage medium, relating to the technical field of cloud services, including: establishing a directed acyclic graph including multiple tasks and determining the sorting values of each task; sorting each task based on the sorting values to obtain a task sorting result; before executing any task according to the task sorting result, taking the task as a target task and determining the scheduling values of each processing unit in the processing unit set for the target task respectively; taking the processing unit with the lowest scheduling value among the processing units that can support the execution of the target task by the available processing resources as the optimal processing unit for executing the target task, and when it is not the processing unit with the lowest scheduling value among all the processing units, re-determining the sorting value of the target task; adjusting the execution order of the target task based on the re-determined sorting value of the target task. Applying the solution of the present application can effectively achieve task scheduling and reduce the overall running time of tasks.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of cloud services, and in particular, to a task scheduling method, device, computer program product, and storage medium. Background Art

[0002] With the continuous development of technologies such as deep learning, cloud computing has been widely applied in various industries and its popularity is still increasing. Through cloud computing, computing resources can be provided to users in the form of network services, enabling users not to provide computing resources by themselves, but to obtain the required computing resources and services at any time and any place. Therefore, more and more tasks with large computing amounts and high complexities are arranged on cloud computing platforms.

[0003] The running of user tasks not only consumes a large amount of computing resources, but also has extremely strict requirements for time. If user tasks can be run quickly, it can not only improve the user experience, but also increase resource utilization and reduce energy consumption. Currently, different cloud computing providers have various deployment schemes when selecting nodes for user task deployment, with different focuses, but in terms of quickly completing user tasks, they all need to be improved. For example, some schemes obtain an approximate optimal solution in the direction of improving resource utilization, and some schemes, although considering the quick completion of tasks, obtain a local optimal solution for the task itself, that is, they do not consider the correlation between different tasks, resulting in the overall task execution time not being optimal.

[0004] In summary, how to effectively implement task scheduling and reduce the overall running time of tasks is a technical problem that urgently needs to be solved by those skilled in the art in the current field. Summary of the Invention

[0005] This application provides a task scheduling method, device, computer program product, and storage medium to effectively implement task scheduling and reduce the overall running time of tasks.

[0006] In a first aspect, this application provides a task scheduling method, including:

[0007] Establish a directed acyclic graph including multiple tasks, and determine the sorting values of each task in the directed acyclic graph;

[0008] Sort each task in the directed acyclic graph based on the sorting values to obtain a task sorting result, and sequentially execute each task according to the task sorting result;

[0009] Before executing any one of the tasks according to the task sorting result, set the task as the target task, and determine the scheduling value of each processing unit in the processing unit set for the target task; wherein, the scheduling value represents the time taken for all tasks in each task path containing the target task to be completed when the corresponding processing unit executes the target task in the directed acyclic graph.

[0010] Select the processing unit with the lowest scheduling value among the processing units that support the execution of the target task with available processing resources as the optimal processing unit for executing the target task. And when the optimal processing unit is not the processing unit with the lowest scheduling value among all processing units, re-determine the sorting value of the target task.

[0011] For the unexecuted part of the task sorting result, adjust the execution order of the target task based on the re-determined sorting value of the target task.

[0012] On the other hand, establish a directed acyclic graph including multiple tasks, and determine the sorting value of each task in the directed acyclic graph, including:

[0013] Establish a directed acyclic graph including multiple tasks, and determine the initial sorting value of each task in the directed acyclic graph through a preset sorting rule.

[0014] Adjust the initial sorting value of the corresponding task according to the weight coefficient of each task to obtain the sorting value of each task in the directed acyclic graph.

[0015] On the other hand, establish a directed acyclic graph including multiple tasks, and determine the initial sorting value of each task in the directed acyclic graph through a preset sorting rule, including:

[0016] Establish a directed acyclic graph including multiple tasks, and determine the initial sorting value of each task in the directed acyclic graph through a preset sorting rule. And for any one task, the initial sorting value of the task is the time taken for all tasks remaining after removing the predecessor tasks of the task to be completed in each task path containing the task in the directed acyclic graph.

[0017] On the other hand, adjust the initial sorting value of the corresponding task according to the weight coefficient of each task to obtain the sorting value of each task in the directed acyclic graph, including:

[0018] For any one task, use the out-degree of the task as the weight coefficient of the task, and use the product of the weight coefficient and the initial sorting value of the task as the obtained sorting value of the task.

[0019] On the other hand, before executing any task according to the task sorting result, taking the task as a target task, and determining the scheduling value of each processing unit in the processing unit set for the target task, including:

[0020] Before executing any task according to the task sorting result, taking the task as a target task;

[0021] For any processing unit in the processing unit set, determining the earliest completion time of the target task when the target task is executed by the processing unit, and using it as the forward-looking evaluation time of the processing unit for the target task;

[0022] Determining the time from the completion of the execution of the target task to the completion of all subsequent tasks of the target task in each task path containing the target task in the directed acyclic graph when the target task is executed by the processing unit, and using it as the backward-looking evaluation time of the processing unit for the target task;

[0023] Taking the sum of the forward-looking evaluation time and the backward-looking evaluation time as the determined scheduling value of the processing unit for the target task.

[0024] On the other hand, for any processing unit in the processing unit set, determining the earliest completion time of the target task when the target task is executed by the processing unit, and using it as the forward-looking evaluation time of the processing unit for the target task, including:

[0025] For any processing unit in the processing unit set, determining the execution time of the target task when the target task is executed by the processing unit;

[0026] Determining the earliest start time of the target task when the target task is executed by the processing unit;

[0027] Adding the execution time of the target task and the earliest start time of the target task to obtain the earliest completion time of the target task, and using it as the forward-looking evaluation time of the processing unit for the target task.

[0028] On the other hand, determining the earliest start time of the target task when the target task is executed by the processing unit, including:

[0029] Determining each parent task in the directed acyclic graph that points to the target task;

[0030] For any one of the parent tasks, determine the communication time consumed between the parent task and the target task when the target task is executed by the processing unit, and sum the communication time consumed with the actual completion time of the parent task to obtain the earliest start time of the target task corresponding to the parent task; wherein, the actual completion time of the parent task represents: in the directed acyclic graph, among the task paths containing the parent task, the time consumed when the parent task and all its predecessor tasks are executed.

[0031] Among the earliest start times of the target task corresponding to each parent task obtained, select the maximum value as the earliest start time of the target task determined when the target task is executed by the processing unit.

[0032] On the other hand, determine the time consumed from the completion of the execution of the target task to the completion of the execution of all the successor tasks of the target task in the task paths containing the target task in the directed acyclic graph when the target task is executed by the processing unit, and use it as the backward evaluation time of the processing unit for the target task, including:

[0033] By way, perform recursion in the way of recursing from the exit task in the directed acyclic graph to the target task to obtain the backward evaluation time of the processing unit for the target task.

[0034] Among them, represents the exit task, represents the k-th processing unit, represents the task execution time when the exit task is executed by the k-th processing unit time, represents the exit task corresponding to the k-th processing unit overhead; represents the i-th round of recursive task in the recursive process and is not the exit task, represents the task is the sub-task of the task sub-task, represents the task the set of overheads composed of the overheads corresponding to each processing unit, represents the task and the task communication time consumed between, represents the task execution time when the task is executed by the k-th processing unit time, max represents taking the maximum value, represents the task The overhead corresponding to the k-th processing unit represents the time taken for the k-th processing unit to perform a backward evaluation for the task ; both k and i are positive integers.

[0035] On the other hand, when the optimal processing unit is not the processing unit with the lowest scheduling value among all processing units, re-determining the sorting value of the target task includes:

[0036] When the optimal processing unit is not the processing unit with the lowest scheduling value among all processing units, re-determine the time taken for the backward evaluation of the target task;

[0037] Add the re-determined time taken for the backward evaluation of the target task to the time taken for the target task to be executed by the optimal processing unit, and adjust the obtained result according to the weight coefficient of the target task to obtain the re-determined sorting value of the target task.

[0038] On the other hand, it further includes:

[0039] Receiving a directed acyclic graph update instruction;

[0040] Based on the directed acyclic graph update instruction, perform a structural update on the established directed acyclic graph, and determine whether the update result meets the set constraints;

[0041] If not, cancel the structural update of the directed acyclic graph this time and output a prompt message.

[0042] On the other hand, determining whether the update result meets the set constraints includes:

[0043] For any task in the update result, if after passing through several tasks, it returns to the task starting from the task, it is determined that the update result does not meet the set constraints.

[0044] On the other hand, it further includes:

[0045] Obtain the processing resource usage of each processing unit in the processing unit set;

[0046] When the processing resource usage of any one processing unit meets the set reminder rule, output a prompt message carrying the processing resource usage of the processing unit.

[0047] On the other hand, the reminder rule includes:

[0048] The average usage of any processing resource of the processing unit exceeds the upper limit threshold set for this processing resource, or is lower than the lower limit threshold set for this processing resource.

[0049] On the other hand, taking the processing unit with the lowest scheduling value among the processing units that support the execution of the target task with available processing resources as the optimal processing unit for executing the target task includes:

[0050] Arrange each processing unit in ascending order of the scheduling value to obtain a processing unit selection list for the target task;

[0051] Judge whether the available processing resources of the x-th processing unit in the processing unit selection list of the target task support the execution of the target task;

[0052] If not, add 1 to x and return to execute the operation of judging whether the available processing resources of the x-th processing unit in the processing unit selection list support the execution of the target task;

[0053] If so, take the processing unit corresponding to the x-th scheduling value as the optimal processing unit;

[0054] Wherein, x is a preset parameter and the initial value is 1.

[0055] On the other hand, judging whether the available processing resources of the x-th processing unit in the processing unit selection list of the target task support the execution of the target task includes:

[0056] Judge whether the central processor resources, memory resources, and hard disk resources of the x-th processing unit in the processing unit selection list of the target task all support the execution of the target task;

[0057] If all support the execution of the target task, determine that the processing unit supports the execution of the target task, otherwise determine that the processing unit does not support the execution of the target task.

[0058] On the other hand, after it is judged that the available processing resources of the x-th processing unit in the processing unit selection list do not support the execution of the target task, it further includes:

[0059] Overlay the waiting duration of the target task with the overhead corresponding to the x-th processing unit of the target task, and judge whether the overlay result is less than or equal to the overhead corresponding to the (x + 1)-th processing unit of the target task;

[0060] If so, place the target task in the waiting queue of the x-th processing unit, and take the x-th processing unit as the optimal processing unit;

[0061] If not, add 1 to x and return to execute the operation of judging whether the available processing resources of the x-th processing unit in the processing unit selection list support the execution of the target task;

[0062] Among them, the overhead corresponding to the target task for the x-th processing unit means that when the target task is executed by the x-th processing unit, the time consumption from the start of the execution of the target task to the completion of the execution of all the subsequent tasks of the target task in each task path containing the target task in the directed acyclic graph is represented.

[0063] On the other hand, for the unexecuted part of the task sorting result, based on the sorting value re-determined for the target task, the adjustment of the execution order of the target task is performed, including:

[0064] For the unexecuted part of the task sorting result, a task set participating in the adjustment is determined;

[0065] Based on the sorting value re-determined for the target task, the execution order of the target task is adjusted, and all the tasks participating in the adjustment are tasks in the task set;

[0066] Among them, the task set participating in the adjustment includes the target task, and each task in the task set participating in the adjustment is continuously arranged in the task sorting result, and each task in the task set participating in the adjustment is at the same level in the directed acyclic graph.

[0067] In a second aspect, the present invention provides a task scheduling device, including:

[0068] A memory for storing a computer program;

[0069] A processor for implementing the steps of the task scheduling method as described above when executing the computer program.

[0070] In a third aspect, the present invention provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of the task scheduling method as described above are implemented.

[0071] In a fourth aspect, the present invention provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the task scheduling method as described above are implemented.

[0072] Applying the technical solution provided by the embodiments of the present invention, on the basis of arranging the tasks in order, the processing units are allocated with the goal of minimizing the overall task execution time. Further, the task order will be dynamically feedback-adjusted to effectively shorten the overall running time of the tasks. Specifically, there are correlation relationships between tasks, so a directed acyclic graph including multiple tasks needs to be established to reflect such correlation relationships, and the sorting values of each task in the directed acyclic graph are determined to achieve preliminary sorting, so that all DAG tasks can be executed compactly, reducing the execution time. The DAG tasks described here are also the tasks in the directed acyclic graph. After sorting each task in the directed acyclic graph based on the sorting values and obtaining the task sorting result, each task can be executed in sequence according to the task sorting result. Before executing any task according to the task sorting result, task scheduling is required, that is, determining the most suitable processing unit. And in the solution of the present application, when determining the most suitable processing unit for it, not only the task itself is considered, but the processing units are allocated with the goal of minimizing the overall task execution time. Specifically, the scheduling values of each processing unit for the target task are determined. The scheduling value represents the time consumed when all tasks in each task path including the target task in the directed acyclic graph are executed by the corresponding processing unit. Therefore, the processing unit with the lowest scheduling value is the most suitable processing unit for the target task, which can minimize the overall execution time of the DAG tasks.

[0073] Moreover, the present application further considers the possible situation of resource conflicts. Therefore, after obtaining the scheduling values of each processing unit for the target task, the processing unit with the lowest scheduling value among the processing units that can support the execution of the target task with the available processing resources needs to be used as the optimal processing unit for executing the target task. It can be understood that if the optimal processing unit is the processing unit with the lowest scheduling value among all processing units, then directly use the processing unit with the lowest scheduling value among all processing units as the optimal processing unit and execute the target task. However, when the optimal processing unit is not the processing unit with the lowest scheduling value among all processing units due to resource conflicts, the solution of the present application takes into account this change in the processing unit, which may affect the scheduling of subsequent tasks. Therefore, the sorting value of the target task will be re-determined, and then for the unexecuted part of the task sorting result, based on the re-determined sorting value of the target task, the execution order of the target task is adjusted to achieve the optimization of the task sorting and effectively shorten the overall running time of the tasks. In summary, the solution of the present application can effectively implement task scheduling and reduce the overall running time of the tasks. Brief Description of the Drawings

[0074] To more clearly illustrate the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0075] Figure 1 The flowchart of an embodiment of a task scheduling method provided by an embodiment of the present application;

[0076] Figure 2 A directed acyclic graph established in an embodiment of the present application;

[0077] Figure 3 Another directed acyclic graph established in an embodiment of the present application;

[0078] Figure 4 A schematic diagram of the processing unit selection list of the target task obtained in an embodiment of the present application;

[0079] Figure 5 A schematic diagram of the task sorting result obtained in an embodiment of the present application;

[0080] Figure 6 A schematic diagram of the structure of a task scheduling device provided by an embodiment of the present application;

[0081] Figure 7 A schematic diagram of the structure of a computer-readable storage medium according to the present invention. Detailed implementation manners

[0082] The following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the protection scope of the present application.

[0083] It should be noted that in the description of the present application, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such a process, method, article or device. The terms "first", "second", etc. in the present application are used to distinguish similar objects, rather than to describe a specific order or sequence.

[0084] To enable those skilled in the art of the present technology to better understand the solution of the present application, the following will further describe the present application in detail in conjunction with the accompanying drawings and specific implementation manners. Refer toFigure 1 , which is the implementation flowchart of a task scheduling method provided by an embodiment of this application. The task scheduling method may include the following steps:

[0085] Step S101: Establish a directed acyclic graph including multiple tasks, and determine the sorting values of each task in the directed acyclic graph.

[0086] A DAG (Directed Acyclic Graph) is a graph theory data structure. If a directed graph cannot return to a vertex after passing through several edges starting from any vertex, then this graph is a directed acyclic graph. For easy understanding, refer to Figure 2 , which is a directed acyclic graph including multiple tasks established in a specific scenario, Figure 2 In the example of , 1 to 6 respectively represent Task 1 to Task 6, and it can be seen that the DAG graph consists of multiple tasks with a sequential execution order. The subsequent tasks must perform relevant operations only after all the preceding tasks are completed. For example, Figure 2 in the example of , Task 2 can be executed only after Task 1 is completed, Task 4 can be executed only after Task 3 is completed, and Task 6 can be executed only after both Task 2 and Task 5 are completed.

[0087] When establishing a directed acyclic graph including multiple tasks, it can be established based on the instructions of the staff or automatically established through relevant establishment procedures, which does not affect the implementation of the present invention. And it can be understood that the structure of the established directed acyclic graph should conform to the actual association relationship between relevant tasks.

[0088] After establishing the directed acyclic graph, it is necessary to determine the sorting values of each task in the directed acyclic graph. The sorting values of the tasks determine the execution order of the tasks. There are various specific ways to determine the sorting values. For example, the HEFT (Heterogeneous Earliest Finish Time) scheduling algorithm can be used to determine the sorting values of each task in the directed acyclic graph. The HEFT scheduling algorithm is well applied in task compactness, can constrain multiple tasks according to the execution cost, obtain the sorting values of each task, and thus determine the execution order of each task.

[0089] Step S102: Sort each task in the directed acyclic graph based on the sorting values to obtain a task sorting result, so as to execute each task in sequence according to the task sorting result.

[0090] After obtaining the sorting values of the tasks in the directed acyclic graph, the tasks in the directed acyclic graph can be sorted to obtain the task sorting result. Generally speaking, the task with a larger sorting value is executed first. Then, the tasks in the directed acyclic graph can be sorted in descending order of the sorting values to obtain the task sorting result. In practical applications, the task sorting result is usually presented in the form of a list. After obtaining the task sorting result, each task can be executed in sequence according to the task sorting result.

[0091] Step S103: Before executing any task according to the task sorting result, take the task as the target task and determine the scheduling values of each processing unit in the processing unit set for the target task; among them, the scheduling value represents the time consumed when the corresponding processing unit executes the target task and all tasks in each task path containing the target task in the directed acyclic graph are executed.

[0092] Before executing any task according to the task sorting result, it is necessary to select a suitable processing unit to perform the scheduling of the task, that is, select a suitable processing unit to execute the task. The processing unit described in this application is a unit that can process specific tasks based on its processing resources and can be one or more physical devices of a specific type.

[0093] In the solution of this application, when determining the most suitable processing unit for a task, it is not only considered the speed of the task itself, but the processing unit is allocated with the goal of the shortest overall task execution time, so that the overall execution time of the DAG task is the shortest.

[0094] Take the task that currently needs to allocate a processor as the current target task, and determine the scheduling values of each processing unit in the processing unit set for the target task. In the solution of this application, the scheduling value of a certain processing unit for the target task reflects the time consumed when all tasks in each task path containing the target task are executed. Therefore, it can be seen that the lower the scheduling value, the more conducive to ensuring that the DAG task can be executed quickly as a whole. Of course, there can be various specific implementation methods for calculating the scheduling value, as long as the calculation of the scheduling value can be effectively implemented.

[0095] Step S104: Take the processing unit with the lowest scheduling value among the processing units that can support the execution of the target task by the available processing resources as the optimal processing unit for executing the target task. And when the optimal processing unit is not the processing unit with the lowest scheduling value among all processing units, re-determine the sorting value of the target task.

[0096] If there is no resource conflict, it is understandable that for the target task, the target task can be directly executed using the processing unit with the lowest scheduling value among all processing units. However, in practical applications, due to various reasons such as the emergence of time fragments during task execution, abnormal task execution that occupies the resources of a certain processing unit for a long time, a resource conflict situation may occur. That is, for the processing unit with the lowest scheduling value among all processing units, its current available processing resources cannot support the execution of the target task. Therefore, in the solution of this application, the processing unit with the lowest scheduling value among the processing units whose current available processing resources can support the execution of the target task can be used as the optimal processing unit for the target task.

[0097] Moreover, the solution of this application also takes into account that if the optimal processing unit of the finally determined target task is not the processing unit with the lowest scheduling value among all processing units, it means that a situation of processing unit change due to available processing resource conflict has occurred. That is, the processing unit for executing some tasks is not the most ideal processing unit originally planned. Such a situation may also affect the scheduling of subsequent tasks. Therefore, in order to effectively shorten the overall running time of tasks, for such a situation, the solution of this application will re-determine the sorting value of the target task, so that for the unexecuted part of the task sorting result, the execution order of the target task will be adjusted based on the re-determined sorting value of the target task, realizing the optimization of task sorting.

[0098] Step S105: For the unexecuted part of the task sorting result, adjust the execution order of the target task based on the re-determined sorting value of the target task.

[0099] It is understandable that the tasks in the task sorting result are executed sequentially. When a certain task is used as the target task and the aforementioned situation of processing unit change occurs, no matter how the execution order of the target task is adjusted, the execution order of the target task cannot be adjusted to before the tasks that have been executed in the task sorting result. Therefore, the adjustment in this step is for the unexecuted part of the task sorting result. Specifically, it is to adjust the execution order of the target task based on the re-determined sorting value of the target task. That is, the target task uses the re-determined sorting value, and other tasks use the sorting value obtained in the aforementioned step S101. By adjusting the execution order of the target task, the optimization of task sorting is realized to effectively shorten the overall running time of tasks.

[0100] In a specific embodiment of the present invention, step S101 may include:

[0101] Establish a directed acyclic graph including multiple tasks, and determine the initial sorting values of the tasks in the directed acyclic graph through a preset sorting rule;

[0102] According to the weight coefficient of each task, adjust the initial sorting value of the corresponding task to obtain the sorting value of each task in the directed acyclic graph.

[0103] In this implementation, the initial sorting value of each task in the directed acyclic graph will be determined through a preset sorting rule. The specific setting of the preset sorting rule can be set according to needs. For example, the HEFT scheduling algorithm can be used as the preset sorting rule, or the PEFT (Parameter-Efficient Fine-Tuning) scheduling algorithm can be used as the preset sorting rule, and it can be selected according to actual needs.

[0104] After determining the initial sorting value of each task in the directed acyclic graph through the preset sorting rule, in this implementation, the initial sorting value of the corresponding task will be further adjusted according to the weight coefficient of each task. The result after adjustment will be used as the sorting value of each task in the directed acyclic graph obtained in step S101. This implementation takes into account that the execution of different tasks has different degrees of influence on the execution of subsequent tasks. Therefore, in order to make the obtained sorting more reasonable and more conducive to ensuring the overall execution efficiency of DAG tasks, it is supported to adjust the initial sorting value of the corresponding task according to the weight coefficient of each task. It can be seen that such a method also improves flexibility, that is, through the setting of the weight coefficient, if necessary in practical applications, the task sorting can be adjusted through the weight coefficient.

[0105] When adjusting the initial sorting value of the corresponding task according to the weight coefficient of each task, the specific adjustment method can be set according to needs. For example, in a specific implementation of the present invention, adjusting the initial sorting value of the corresponding task according to the weight coefficient of each task to obtain the sorting value of each task in the directed acyclic graph may specifically include:

[0106] For any task, take the out-degree of the task as the weight coefficient of the task, and take the product of the weight coefficient and the initial sorting value of the task as the obtained sorting value of the task.

[0107] This implementation takes into account that the larger the out-degree of a task, the greater the influence of the task on the execution of subsequent tasks. Therefore, the out-degree of the task can be used as the weight coefficient of the task, that is, the out-degree of the task is used to measure the influence of the task on the execution of subsequent tasks, and then the initial sorting value of the task is adjusted. Currently, scheduling algorithms such as HEFT usually do not consider the influence of tasks on the execution of subsequent tasks.

[0108] Specifically, the out-degree of a task is also the number of subtasks of the task. For easy understanding, refer to Figure 3 , for exampleFigure 3 It is a DAG schematic diagram in a specific scenario. Figure 3 The numbers 1 to 6 in it represent Task 1 to Task 6. In this example, Task 2 has 3 subtasks, namely Task 4, Task 5, and Task 6.

[0109] In this implementation, the obtained sorting value of a task can be expressed as f_Rank(t i ) = Rank(t i ) × out(t i ). Here, Rank(t i ) represents the initial sorting value of task t i , and out(t i ) represents the out-degree of task t i , that is, its weight coefficient. For example, Figure 3 the out-degree of Task 2 in it is 3. And f_Rank(t i ) represents the sorting value of task t i in the obtained directed acyclic graph. Task t i can be any task in the directed acyclic graph.

[0110] In a specific implementation of the present invention, establishing a directed acyclic graph including multiple tasks and determining the initial sorting value of each task in the directed acyclic graph through a preset sorting rule may specifically include:

[0111] Establish a directed acyclic graph including multiple tasks and determine the initial sorting value of each task in the directed acyclic graph through a preset sorting rule. And for any one task, the initial sorting value of this task is the time consumed when all the remaining tasks except the pre-task of this task are completed in each task path including the task in the directed acyclic graph.

[0112] This implementation takes into account that when calculating the sorting value of each task in the directed acyclic graph in step S101, the sorting value calculation principle used should be the same as the sorting value calculation principle used when recalculating the sorting value of the target task in step S104. And the goal of the solution of this application is to effectively shorten the overall running time of the tasks. Therefore, when calculating the sorting value of a certain task, it should also be calculated with this goal in mind, so that the tasks in the directed acyclic graph can be reasonably sorted and the overall running time can be shortened.

[0113] In this implementation, for any task, its initial sorting value refers to the time taken for all the remaining tasks in each task path in the directed acyclic graph that contains this task to be completed, excluding the prerequisite tasks of this task. That is, in this implementation, the initial sorting value of a task examines the subsequent tasks, such that the longer the time taken for all the subsequent tasks of this task in each task path that contains this task to be completed, the higher the priority of this task. Taking Figure 3 task 9 in Figure 3 as an example, the task paths that contain task 9 are: task 1 to task 2 to task 6 to task 9 to task 10 to task 11, and task 3 to task 7 to task 8 to task 9 to task 10 to task 11, a total of 2. Among them, task 1, task 2, task 6, task 3, task 7, and task 8 constitute all the prerequisite tasks of task 9, and task 10 and task 11 constitute all the subsequent tasks of task 9. In this example, the time taken for task 9, task 10, and task 11 to be completed is the initial sorting value of task 9.

[0114] In addition, it should be noted that when performing step S101, if a scheme of first calculating the initial sorting value and then adjusting the initial sorting value based on the weight coefficient is adopted, then when performing step S104, the same principle needs to be used for calculating the sorting value. For example, when performing step S101, the time described in this implementation is used as the initial sorting value of the task, and it is multiplied by the out-degree of the task to obtain the sorting value of the task. Then, when performing step S104 to re-determine the sorting value of the target task, the same principle needs to be used to first calculate the time taken for all the subsequent tasks in each task path that contains the target task to be completed, and multiply it by the out-degree of the task to obtain the re-determined sorting value of the target task. Similarly, for example, when performing step S101, the out-degree of the task is not introduced, but the time described in this implementation is directly used as the sorting value of the task. Then, when performing step S104, the same principle needs to be used to calculate the time taken for all the subsequent tasks in each task path that contains the target task to be completed, and then directly use it as the sorting value of the target task. In short, when calculating the sorting value of a task in the solution of this application, the calculation logic is pre-determined and the same calculation logic is used for each task. If it needs to be multiplied by the out-degree during the calculation process, the sorting value calculation of each task should be operated in this way.

[0115] In a specific implementation of the present invention, step S103 may specifically include:

[0116] Before executing any task according to the task sorting result, take this task as the target task;

[0117] For any one of the processing units in the processing unit set, determine the earliest completion time of the target task when the target task is executed by this processing unit, and use it as the forward-looking evaluation time of the processing unit for the target task;

[0118] Determine the time from the completion of the target task to the completion of all subsequent tasks of the target task in each task path containing the target task in the directed acyclic graph when the target task is executed by this processing unit, and use it as the backward-looking evaluation time of the processing unit for the target task;

[0119] Take the sum of the forward-looking evaluation time and the backward-looking evaluation time as the scheduling value of the determined processing unit for the target task.

[0120] This implementation mode takes into account that the scheduling value of the target task can be measured based on the forward-looking evaluation time and the backward-looking evaluation time of the target task, and can effectively reflect the overall execution situation of the DAG task.

[0121] Specifically, the forward-looking evaluation time aims to determine the earliest completion time of the target task. This process advances along with the execution order of the tasks, so as to easily track the exact completion time of the preceding tasks. The backward-looking evaluation time aims to ensure that all subsequent tasks of the target task can be executed quickly, and its evaluation basis can be the farthest distance data from the final exit task. Through the forward-looking evaluation time and the forward-looking evaluation time, it can effectively reflect the time-consuming situation of the overall execution of the DAG task when a certain processing unit executes the target task.

[0122] The specific method for calculating the earliest completion time of the target task can be set according to actual needs. Usually, considering the earliest start time of the target task and the computing consumption of the target task on different processing units, the earliest completion time of the target task can be conveniently deduced.

[0123] In this regard, in a specific implementation mode of the present invention, for any one of the processing units in the processing unit set, determining the earliest completion time of the target task when the target task is executed by this processing unit and using it as the forward-looking evaluation time of the processing unit for the target task may specifically include:

[0124] For any one of the processing units in the processing unit set, determine the execution time of the target task when the target task is executed by this processing unit;

[0125] Determine the earliest start time of the target task when the target task is executed by this processing unit;

[0126] Sum the execution time of the target task and the earliest start time of the target task to obtain the earliest completion time of the target task, and use it as the forward-looking evaluation time of this processing unit for the target task.

[0127] In this implementation manner, the earliest completion time of the target task can be conveniently determined, which can be expressed as . In this formula, represents the k-th processing unit, represents the task , which can be the i-th task among all tasks, and here it also refers to the target task. refers to the task execution time when the k-th processing unit executes the task , while is the earliest start time of the task is the forward-looking evaluation time of the k-th processing unit for the task , that is, when the k-th processing unit executes the target task, is the earliest completion time of the task.

[0128] When the target task is executed by different processing units, the execution time of the target task will be different. The earliest start time of the target task refers to the time required for all the prerequisite tasks of the target task to be executed, so that the target task can start to be executed. In this implementation manner, by summing the execution time of the target task and the earliest start time of the target task, the earliest completion time of the target task can be conveniently obtained, that is, the forward-looking evaluation time of the corresponding processing unit for the target task is obtained. In addition, it should be noted that the task execution time of a task in different processing units, as well as the communication time between different processing units when the task is transferred between processing units, can be determined in advance through experimental statistics, theoretical analysis, etc.

[0129] There are multiple specific implementation manners for determining the earliest start time of the target task. For example, in a specific implementation manner of the present invention, to determine the earliest start time of the target task when the target task is executed by this processing unit, it may specifically include:

[0130] Determine each parent task in the directed acyclic graph that points to the target task;

[0131] For any parent task, determine the communication time between the parent task and the target task when the target task is executed by this processing unit, and sum the communication time and the actual completion time of the parent task to obtain the earliest start time of the target task corresponding to the parent task; among them, the actual completion time of the parent task represents: in the directed acyclic graph, among the task paths including the parent task, the time when the parent task and all its prerequisite tasks are executed;

[0132] Among the earliest start times of the target task corresponding to each parent task obtained, select the maximum value as the earliest start time of the target task determined when the target task is executed by this processing unit.

[0133] Still taking the task that is the current target task as an example for illustration. In this implementation, it is obtained in the way of to get the earliest start time consumption. In this formula, refers to the actual completion time consumption of task , that is, from the start of the execution of the first task in the directed acyclic graph to the completion of the execution of task , the elapsed time, and is the communication time consumption between task and task . represents that task is the parent node of task . is the earliest start time consumption of task when executed by the k-th processing unit for task .

[0134] Refer to Figure 2 . When task 1 is the current target task, for task 1 in Figure 2 , since it has no parent task, the earliest start time consumption ESP (Earliest Start time Point) of task 1 can be directly determined to be 0.

[0135] When task 2 is the current target task, for task 2 in Figure 2 , it has only 1 parent task, that is, task 1. For example, the total number of processing units is 10, and taking the forward-looking evaluation time consumption of the 1st processing unit in it for the target task as an example. When determining the earliest start time consumption ESP of task 2, the communication time consumption between task 1 as the parent task and task 2 when the 1st processing unit executes task 2 can be determined. Adding this communication time consumption to 0, the earliest start time consumption of task 2 corresponding to task 1 when the 1st processing unit executes task 2 is obtained. Since task 2 has only 1 parent task, this value is also the earliest start time consumption of task 2 determined when the 1st processing unit executes task 2. Since there are 10 processing units in this example, it can be understood that in the example of Figure 2 , for task 2, for each of the 10 processing units, the earliest start time consumption of task 2 can be obtained. Combining with the task execution time consumption when the corresponding processing unit executes task 2, the forward-looking evaluation time consumption of each of the 10 processing units for task 2 can be obtained. That is, in this example, when task 2 is the target task, a total of 10 forward-looking evaluation time consumptions of task 2 can be obtained, corresponding to different processing units.

[0136] Taking Figure 2 Task 6 in [Example] as an example, it has 2 parent tasks, namely Task 2 and Task 5. Still taking the total number of processing units as 10, and taking the look-ahead evaluation time consumed by the No. 1 processing unit for the target task as an example. When determining the earliest start time ESP of Task 6, when it is determined that Task 6 is executed by the No. 1 processing unit, the communication time consumed between Task 2, which is the parent task, and Task 6 can be determined. The sum of this communication time and the AFP of Task 2 gives the earliest start time of Task 6 corresponding to Task 2 when Task 6 is executed by the No. 1 processing unit. The AFP of Task 2 described here, that is, the actual completion time of Task 2, includes the task execution time of Task 1, the task execution time of Task 2, and the communication time between Task 1 and Task 2.

[0137] Similarly, when it is determined that Task 6 is executed by the No. 1 processing unit, the communication time consumed between Task 5, which is the parent task, and Task 6 needs to be determined. The sum of this communication time and the AFP of Task 5 gives the earliest start time of Task 6 corresponding to Task 5 when Task 6 is executed by the No. 1 processing unit. The AFP of Task 5 described here, that is, the actual completion time of Task 5, includes the task execution time of Task 3, the task execution time of Task 4, the task execution time of Task 5, the communication time between Task 3 and Task 4, and the communication time between Task 4 and Task 5.

[0138] In the above example, the earliest start time of Task 6 corresponding to Task 2 and the earliest start time of Task 6 corresponding to Task 5 are obtained, and the maximum value can be selected as the earliest start time of Task 6 when it is determined that Task 6 is executed by Processing Unit 1. Similarly to the above, since there are 10 processing units in this example, it can be understood that in Figure 2 the example, for Task 6, for each of the 10 processing units, the earliest start time of Task 6 can be obtained. Combining with the task execution time when the corresponding processing unit executes Task 6, the look-ahead evaluation time consumed by each of the 10 processing units for Task 6 can be obtained. That is, in this example, when Task 6 is the target task, a total of 10 look-ahead evaluation times of Task 6 can be obtained, corresponding to different processing units.

[0139] In this implementation, among the earliest start times of the target task corresponding to each parent task, the maximum value is selected as the earliest start time of the target task determined when the target task is executed by the processing unit. It can be seen that in a multi-task processing scenario, it is often the task with the longest time consumption that determines the final end time of the entire batch of tasks. Therefore, for the target task, its earliest start time needs to consider all its preceding nodes. And in practical applications, when the task execution times of individual tasks are generally the same, it is usually the longest task path that determines the earliest start time of the target task. Moreover, in this implementation, when calculating the earliest start time of the target task, the communication time consumption between the parent task and the child task is considered. In summary, this implementation can conveniently determine the earliest start time of the target task, and the obtained earliest start time of the target task is also relatively accurate.

[0140] In a specific implementation of the present invention, when it is determined that the target task is executed by the processing unit, the time consumption from the completion of the execution of the target task to the completion of the execution of all subsequent tasks of the target task in each task path including the target task in the directed acyclic graph is used as the backward evaluation time consumption of the processing unit for the target task, including:

[0141] By way, recursively calculate in the way of pushing forward from the exit task in the directed acyclic graph to the target task to obtain the backward evaluation time consumption of the processing unit for the target task;

[0142] Among them, represents the exit task, represents the kth processing unit, represents the task execution time consumption when the exit task is executed by the kth processing unit, represents the exit task corresponding to the kth processing unit overhead; represents the task which can be the i-th round recursive task in the recursive process and is not the exit task, the task represented by is the subtask of the task , represents the task the set of overheads composed of the overheads corresponding to each processing unit, represents the task and the task communication time consumption between, represents the task execution time consumption when the task is executed by the kth processing unit, It represents the task corresponding to the overhead of the k-th processing unit. max means taking the maximum value, represents the backward-looking evaluation time of the k-th processing unit for the task . Both k and i are positive integers.

[0143] Specifically, the backward-looking evaluation time of this implementation is represented by LDD (Longest Distance Data). For the sake of easy understanding, still taking Figure 2 as an example. For example, if task 6 is the current target task, then for task 6, it belongs to the exit task, that is, task 6 has no subtasks. Therefore, the set of overheads corresponding to each processing unit for task 6 can be directly calculated through . Still taking a total of 10 processing units as an example, the set of overheads (rank set) of task 6 includes 10 values, corresponding to 10 different processing units. And LDD reflects the longest overhead from the target task to the exit task, and does not include the target task execution time of the target task itself. Therefore, for task 6, the backward-looking evaluation time LDD of each processing unit for task 6 is 0.

[0144] Taking again Figure 2 task 2 in as the current target task as an example. For task 2, there is only 1 task path including task 2, and task 2 does not belong to the exit task. Then, starting from the exit task task 6 and recursively calculating from bottom to top through , the set of overheads of task 2 can be obtained. Specifically, taking the 1st processing unit among 10 processing units as an example, and for the sake of easy description, when performing the calculation, the result obtained is called the rank value corresponding to the 1st processing unit. If task 2 is executed by the 1st processing unit, based on the set of overheads of task 6 (including 10 values, corresponding to 10 different processing units), combined with the task execution time of different processing units when executing task 6, and the communication time between task 2 and task 6 (the communication time between each processing unit when executing task 6 and the 1st processing unit executing task 2), 10 different rank values in the case of task 2 being executed by the 1st processing unit can be obtained. Taking the maximum value among them is the finally determined rank value in the case of task 2 being executed by the 1st processing unit. Since there are a total of 10 processing units as an example, the set of overheads (rank set) of task 2 also includes 10 values, that is, the respective overheads (rank values) of task 2 corresponding to 10 processing units.

[0145] Similarly, if Figure 2If Task 1 in is the current target task, then for Task 1, if Task 1 is executed by Processing Unit No. 1, based on the overhead set of Task 2 determined above (including 10 values corresponding to 10 different processing units), combined with the task execution time of Task 1 when different processing units execute Task 1, and the communication time between Task 1 and Task 2 (the communication time between each processing unit executing Task 2 and Processing Unit No. 1 executing Task 1), 10 different rank values in the case of Processing Unit No. 1 executing Task 1 can be obtained. Taking the maximum value among them is the finally determined rank value in the case of Processing Unit No. 1 executing Task 2. In addition, it can be understood that Figure 2 In the example of , Task 1 has only 1 subtask. If Task 1 has other subtasks, the rank values of the corresponding subtasks can also be obtained through recursion, and by taking the maximum value, the rank value in the case of Processing Unit No. 1 executing Task 1 can be finally obtained. Since there are 10 processing units as an example, calculations for other processing units are performed based on the same principle, and finally the overhead set (rank set) of Task 1 can be obtained. This overhead set also includes 10 rank values, corresponding to 10 different processing units respectively, that is, the overheads (rank values) of Task 1 corresponding to each of the 10 processing units.

[0146] After obtaining the overhead set (rank set) of the target task, for any one processing unit, subtracting the target task execution time of the target task when this processing unit executes the target task from the rank value corresponding to this processing unit can obtain the backward-looking evaluation time of this processing unit for the target task, that is, the backward-looking evaluation time LDD when this processing unit executes the target task.

[0147] In a specific embodiment of the present invention, when the optimal processing unit is not the processing unit with the lowest scheduling value among all processing units, re-determine the sorting value of the target task, including:

[0148] When the optimal processing unit is not the processing unit with the lowest scheduling value among all processing units, re-determine the backward-looking evaluation time of the target task;

[0149] Add the re-determined backward-looking evaluation time of the target task to the target task execution time of the target task when the optimal processing unit executes the target task, and adjust the obtained result according to the weight coefficient of the target task to obtain the re-determined sorting value of the target task.

[0150] For the case where the sorting value of the target task needs to be re-determined, this implementation manner considers that the sorting value can be calculated based on the rank value. Specifically, based on the above description, for a certain processing unit, adding the backward evaluation time LDD when the processing unit executes the target task to the target task execution time when the processing unit executes the target task can obtain the overhead (rank value) in the case where the processing unit executes the target task. Determining the execution order of tasks based on the magnitude of this rank value can effectively ensure the compactness of task execution and reduce the overall execution time of DAG tasks. Therefore, in this implementation manner, the calculation of the sorting value is achieved according to the rank value when the processing unit executes the target task.

[0151] It should be noted that in some cases, the rank value when the processing unit executes the target task can be directly used as the sorting value of the target task. However, this implementation manner considers that in order to ensure flexibility and the rationality of the obtained sorting value, it can be further adjusted in combination with a weight coefficient, and the result after adjustment is used as the sorting value of the target task. For example, referring to the above description, the weight coefficient here can specifically use the out-degree of the target task. And as described above, if the out-degree of the target task is used to calculate the sorting value, then for each task, whether the sorting value is calculated in step S101 or step S104, the out-degree of the target task will be used to calculate the sorting value.

[0152] In a specific implementation manner of the present invention, it may further include:

[0153] Receiving a directed acyclic graph update instruction;

[0154] Based on the directed acyclic graph update instruction, performing a structural update on the established directed acyclic graph, and determining whether the update result meets the set constraints;

[0155] If not, cancel the structural update of the directed acyclic graph this time and output a prompt message.

[0156] This implementation manner considers that due to reasons such as business adjustment, it may be necessary to update the directed acyclic graph. Therefore, based on the directed acyclic graph update instruction, a structural update can be performed on the established directed acyclic graph. And this implementation manner further considers that the directed acyclic graph update instruction is usually output by the staff and may be incorrect, that is, based on the directed acyclic graph update instruction, performing a structural update on the established directed acyclic graph may result in a directed acyclic graph with errors. Therefore, in this implementation manner, it will be determined whether the update result meets the set constraints. If not, it can be determined that the update of the directed acyclic graph this time is incorrect, for example, caused by a staff member's misoperation. Therefore, the structural update of the directed acyclic graph this time will be cancelled, and in order to remind the staff, a prompt message will be output.

[0157] In a specific embodiment of the present invention, determining whether the update result meets the set constraints may include: for any task in the update result, when starting from the task and returning to the task after several tasks, it is determined that the update result does not meet the set constraints.

[0158] When determining whether the update result meets the set constraints, the specific constraint rules used can be set and adjusted according to actual needs, and may include one or more constraint rules. This embodiment takes into account that for any task in the update result, when starting from the task and returning to the task after several tasks, it indicates that it is no longer a directed acyclic graph but a cyclic graph. Therefore, it can be determined that the update result does not meet the set constraints. In other specific scenarios, other constraints can also be set according to actual needs. For example, it can be constrained that a certain task must follow another specified task immediately, or it can be constrained that a certain task must be the starting task, etc.

[0159] In a specific embodiment of the present invention, it may further include:

[0160] Obtain the processing resource usage of each processing unit in the processing unit set;

[0161] When the processing resource usage of any processing unit meets the set reminder rule, output a reminder message carrying the processing resource usage of the processing unit.

[0162] The solution of this application can effectively implement task scheduling. Moreover, in an ideal situation, the fewer resource conflict situations occur, the better. That is to say, in an ideal situation, the resources of each processing unit should be reasonably utilized. In this embodiment, the processing resource usage of each processing unit in the processing unit set will be obtained. If the processing resource usage of any processing unit meets the set reminder rule, it means that the processing resource usage of this processing unit may be abnormal. Therefore, a reminder message carrying the processing resource usage of this processing unit can be output to remind the staff to pay attention to this processing unit. For example, the staff can then check whether the processing unit is not assigned tasks because the processing resources of this processing unit are set unreasonably, or is often assigned too many tasks. Of course, it can also be checked whether there are other reasons for the abnormal processing resource usage, such as checking whether the communication time consumption between this processing unit and other processing units is normal, etc.

[0163] In a specific embodiment of the present invention, the reminder rule includes:

[0164] The average usage of any one of the processing resources of the processing unit exceeds the upper threshold set for this processing resource, or is lower than the lower threshold set for this processing resource.

[0165] If the usage of the processing resources of any one processing unit conforms to the set reminder rule, it indicates that the usage of the processing resources of this processing unit may be abnormal. Therefore, when setting the reminder rule, it should be able to effectively reflect that the usage of the processing resources of the processing unit is abnormal. In this implementation, it is considered that the processing resources of the processing unit may include one or more processing resources, such as CPU resources, memory resources, network resources, hard disk resources, etc. The processing resources of different processing units may also be different. In this regard, in this implementation, when the average usage of any one processing resource exceeds the upper threshold set for this processing resource or is lower than the lower threshold set for this processing resource, it indicates that the average usage of this processing resource is too high or too low, and then it can be regarded as the usage of the processing resources of this processing unit being abnormal, that is, it is determined that the usage of the processing resources of this processing unit conforms to the set reminder rule. Of course, in other specific implementations, other reminder rules can also be added according to actual needs, as long as it can effectively reflect that the usage of the processing resources of the processing unit is abnormal.

[0166] In a specific implementation of the present invention, in step S104, the processing unit with the lowest scheduling value among the processing units that support the execution of the target task with available processing resources is used as the optimal processing unit for executing the target task, which may specifically include:

[0167] Arrange each processing unit in ascending order of the scheduling value to obtain a processing unit selection list for the target task;

[0168] Judge whether the available processing resources of the x-th processing unit in the processing unit selection list of the target task support the execution of the target task;

[0169] If not, add 1 to x and return to execute the operation of judging whether the available processing resources of the x-th processing unit in the processing unit selection list support the execution of the target task;

[0170] If so, use the processing unit corresponding to the x-th scheduling value as the optimal processing unit;

[0171] Wherein, x is a preset parameter and the initial value is 1.

[0172] For easy understanding, refer to Figure 4 , taking Task 1 as the current target task as an example, after determining the scheduling values of each processing unit in the processing unit set for Task 1 respectively, for example, the value of the 1st processing unit P1 is , that is, the scheduling value of processing unit P1 for task 1, is the minimum among the scheduling values of all processing units for task 1. Therefore, processing unit P1 is at the top of the processing unit selection list for task 1. And so on, the scheduling value of processing unit P2 for task 1 is the second smallest value. Therefore, processing unit P2 is at the second position in the processing unit selection list for task 1.

[0173] For the remaining tasks other than task 1, before executing the task, it can be regarded as the current target task, and based on the order of the scheduling values from low to high, a processing unit selection list can be obtained. Of course, the processing unit selection lists corresponding to different tasks can be different. For example Figure 4 In the example of task 9, processing unit P2 is at the top of its processing unit selection list, and processing unit P5 is at the second position in its processing unit selection list.

[0174] In this example, for the processing unit selection list of task 1, first, it is necessary to determine whether the available processing resources of the first processing unit in the processing unit selection list (that is, processing unit P1 in this example) support the execution of the target task (that is, task 1 in this example). If it supports, it means that the current available processing resources of processing unit P1 are sufficient. Therefore, the first processing unit in the processing unit selection list of task 1 (that is, processing unit P1 in this example) can be directly used as the optimal processing unit for task 1. At this time, there is no need to change the optimal processing unit.

[0175] If the available processing resources of processing unit P1 do not support the execution of the target task, then x needs to be incremented by 1, and then return to the operation of determining whether the available processing resources of the xth processing unit in the processing unit selection list support the execution of the target task. In this example, after incrementing x by 1, it is equal to 2. Then, it is necessary to determine whether the available processing resources of the processing unit corresponding to the second scheduling value in the processing unit selection list of task 1 (that is, processing unit P2 in this example) support the execution of task 1. And so on, finally, among the processing units whose available processing resources support the execution of task 1, the processing unit with the lowest scheduling value can be determined. In this implementation, by sequentially judging the processing units in the processing unit selection list of the target task, it is possible to simply and conveniently determine the processing unit with the lowest scheduling value among the processing units whose available processing resources support the execution of the target task, that is, it is possible to simply and conveniently determine the optimal processing unit of the target task.

[0176] In a specific implementation of the present invention, determining whether the available processing resources of the xth processing unit in the processing unit selection list of the target task support the execution of the target task may specifically include:

[0177] Determine whether the CPU resources, memory resources, and hard disk resources of the x-th processing unit in the processing unit selection list for the target task all support the execution of the target task;

[0178] If all support the execution of the target task, determine that the processing unit supports the execution of the target task; otherwise, determine that the processing unit does not support the execution of the target task.

[0179] This implementation mode takes into account that the available processing resources of the processing unit can be mainly measured by the CPU resources, memory resources, and hard disk resources. Therefore, when judging whether the available processing resources of the x-th processing unit in the processing unit selection list support the execution of the target task, specifically, the judgment of these three resources is carried out, and it can be more convenient and accurate to determine whether the processing unit supports the execution of the target task. Of course, in other specific implementation modes, the judgment criteria can be adjusted according to needs.

[0180] In a specific implementation mode of the present invention, after it is determined that the available processing resources of the x-th processing unit in the processing unit selection list do not support the execution of the target task, it may further include:

[0181] Add the waiting duration of the target task to the overhead corresponding to the x-th processing unit of the target task, and judge whether the added result is less than or equal to the overhead corresponding to the (x + 1)-th processing unit of the target task;

[0182] If so, place the target task in the waiting queue of the x-th processing unit, and take the x-th processing unit as the optimal processing unit;

[0183] If not, increment x by 1 and return to execute the operation of judging whether the available processing resources of the x-th processing unit in the processing unit selection list support the execution of the target task;

[0184] Among them, the overhead corresponding to the x-th processing unit of the target task means: when the target task is executed by the x-th processing unit, from the start of the execution of the target task to the completion of the execution of all subsequent tasks of the target task in each task path containing the target task in the directed acyclic graph.

[0185] This implementation further takes into account that after it is determined that the available processing resources of the x-th processing unit in the processing unit selection list do not support the execution of the target task, in addition to directly judging the next processing unit in the processing unit selection list, the target task can also be selected to wait. This is because the available processing resources of the processing unit are dynamically changing. If the waiting duration of the target task is added to the overhead of the target task corresponding to the x-th processing unit and the result is less than or equal to the overhead of the target task corresponding to the (x + 1)-th processing unit, it means that compared with switching to the (x + 1)-th processing unit to execute the target task, the target task should still wait. After the processing resources of the x-th processing unit are released, the x-th processing unit is used as the optimal processing unit to execute the target task, which is beneficial to reducing the overall time consumption of the DAG task. That is to say, even if the waiting duration of the target task is included, the x-th processing unit is still the most suitable processing unit for the target task. Therefore, in this implementation, in such a situation, the x-th processing unit will be used as the optimal processing unit.

[0186] It can be seen that this implementation needs to evaluate whether to switch the processing unit for executing the target task based on the waiting duration of the target task, that is, it needs to judge whether it holds. This formula takes the task as an example of the target task. is the waiting duration of the target task, and this waiting duration can be obtained by summing the remaining time of the task currently being executed by the x-th processing unit and the task execution durations of the tasks not executed in the waiting queue of the x-th processing unit. That is, the overhead of the target task corresponding to the x-th processing unit in the processing unit selection list is equivalent to the rank value described above, which represents the time consumption from the start of the execution of the target task until all the subsequent tasks of the target task in each task path in the directed acyclic graph that contains the target task are executed. Simply put, the rank value of a task corresponding to a certain processing unit refers to the task execution duration of the task executed by this processing unit and the maximum time consumption until all the subsequent tasks of this task are executed. As described in an implementation above, it can be specifically calculated recursively from the exit task from bottom to top. That is, the overhead of the target task corresponding to the (x + 1)-th processing unit in the processing unit selection list represents the time consumption from the start of the execution of the target task until all the subsequent tasks of the target task in each task path in the directed acyclic graph that contains the target task are executed when the (x + 1)-th processing unit in the processing unit selection list executes the target task.

[0187] In a specific embodiment of the present invention, it may further include: counting the change situation of the processing unit to obtain the occurrence times of the change situation of the processing unit within a unit time length, and the occurrence probability of the change situation of each processing unit within the unit time length.

[0188] The change situation of the processing unit described in this embodiment, that is, the optimal processing unit of the determined target task, is not the processing unit with the lowest scheduling value. The occurrence of the change situation of the processing unit indicates that a resource conflict has occurred. Ideally, the resource conflict situation should not be excessive. Therefore, in this embodiment, the change situation of the processing unit will be counted to obtain the occurrence times of the change situation of the processing unit within a unit time length. For example, the occurrence times of the change situation of the processing unit within 1 day are obtained. If the occurrence times of the change situation of the processing unit within the unit time length are excessive, the staff can be reminded for analysis and processing. In addition, this embodiment will also count the occurrence probability of the change situation of each processing unit within the unit time length. If the occurrence probability of a certain processing unit having a change situation of the processing unit is very high, the staff can also be reminded for analysis and processing. For example, the staff can subsequently check whether the processing resources of this processing unit are set unreasonably, and can check whether the communication time consumption between this processing unit and other processing units is normal, etc.

[0189] In a specific embodiment of the present invention, for the unexecuted task part in the task sorting result, based on the sorting value re-determined for the target task, the execution order of the target task is adjusted, including:

[0190] For the unexecuted task part in the task sorting result, a task set participating in the adjustment is determined;

[0191] Based on the sorting value re-determined for the target task, the execution order of the target task is adjusted, and all tasks participating in the adjustment are tasks in the task set.

[0192] Among them, the task set participating in the adjustment includes the target task, and each task in the task set participating in the adjustment is continuously arranged in the task sorting result, and each task in the task set participating in the adjustment is at the same level in the directed acyclic graph.

[0193] This embodiment further considers that, in view of the DAG task, the subsequent task must wait for the previous task to be completed before it can be started. Therefore, after re-determining the sorting value of the target task, when adjusting the execution order of the target task, it can be restricted that only tasks at the same level can be sorted and adjusted, so as to avoid the situation that the adjusted task sorting is unreasonable due to the adjustment of tasks at different levels.

[0194] And it can be understood that for tasks that have been completed, their execution order must be before the current target task. Therefore, when adjusting the execution order of the target task, it is for the unexecuted part of the task sorting result to determine the set of tasks participating in the adjustment, and then based on the sorting value re-determined for the target task, adjust the execution order of the target task, and the tasks participating in the adjustment are all tasks in the task set. That is to say, it is equivalent to adjusting the execution order of the target task in the task set.

[0195] And this implementation also takes into account that after establishing a directed acyclic graph including multiple tasks and determining the sorting values of each task in the directed acyclic graph, the sorting values of tasks in the same level are usually relatively close, that is, tasks in the same level will be in relatively close positions in the task sorting result obtained in step S101. And if some tasks in the same level are not close to the tasks in the same level in the task sorting result, for example Figure 5 in the example of, is a schematic diagram of the task sorting result obtained in the embodiment of the present application, Figure 5 the left side is the directed acyclic graph, and the right side is the task sorting result. For Figure 5 in the example of, after determining the sorting values of each task in the directed acyclic graph, in the obtained task sorting result, task 5 is not close to tasks 2 to 4, that is, tasks 2 to 4 are consecutive, but not consecutive with task 5. For such a situation, if the execution order of any task among tasks 2 to 4 is adjusted, task 5 will not participate in the adjustment. For example, if task 2 is the target task and its execution order needs to be adjusted, then since the tasks in the task set participating in the adjustment need to be consecutive tasks in the task sorting result and need to be tasks in the same level in the directed acyclic graph, therefore, the task set participating in the adjustment in this example includes task 2, task 3, and task 4. Such a design takes into account that for tasks in the same level, due to large differences in execution costs and communication costs and other reasons, there may be a situation as shown in Figure 5 where they are not consecutively arranged in the task sorting result. At this time, when adjusting the execution order of the target task, if non-consecutively arranged tasks are also placed in the task set participating in the adjustment, it may lead to a situation where the target task crosses levels, that is, an abnormal situation where subsequent tasks are placed before their preceding tasks. In summary, this implementation effectively reduces the error probability when adjusting the execution order of the target task by reasonably setting the task set participating in the adjustment.

[0196] Applying the technical solution provided by the embodiments of the present invention, on the basis of arranging the tasks in order, the processing units are allocated with the goal of minimizing the overall task execution time. Further, the task order will be dynamically feedback-adjusted to effectively shorten the overall running time of the tasks. Specifically, there is an association relationship between tasks, so a directed acyclic graph including multiple tasks needs to be established to reflect such an association relationship, and the sorting values of each task in the directed acyclic graph are determined to achieve preliminary sorting, so that all DAG tasks can be executed compactly, reducing the execution time. The DAG tasks described here are also the tasks in the directed acyclic graph. After sorting each task in the directed acyclic graph based on the sorting values and obtaining the task sorting result, each task can be executed in sequence according to the task sorting result. Before executing any task according to the task sorting result, task scheduling is required, that is, determining the most suitable processing unit. And in the solution of the present application, when determining the most suitable processing unit for it, not only the task itself is considered, but the processing units are allocated with the goal of minimizing the overall task execution time. Specifically, the scheduling values of each processing unit for the target task are determined. The scheduling value represents the time consumed when all tasks in each task path including the target task in the directed acyclic graph are executed by the corresponding processing unit. Therefore, the processing unit with the lowest scheduling value is the most suitable processing unit for the target task, which can minimize the overall execution time of the DAG tasks.

[0197] Moreover, the present application further takes into account the possible situation of resource conflicts. Therefore, after obtaining the scheduling values of each processing unit for the target task, the processing unit with the lowest scheduling value among the processing units that can support the execution of the target task with the available processing resources needs to be used as the optimal processing unit for executing the target task. It can be understood that if the optimal processing unit is the processing unit with the lowest scheduling value among all processing units, then directly use the processing unit with the lowest scheduling value among all processing units as the optimal processing unit and execute the target task. However, when the optimal processing unit is not the processing unit with the lowest scheduling value among all processing units due to resource conflicts, the solution of the present application takes into account this change in the processing unit, which may affect the scheduling of subsequent tasks. Therefore, the sorting value of the target task will be re-determined, and then for the unexecuted part of the task sorting result, based on the re-determined sorting value of the target task, the execution order of the target task is adjusted to achieve the optimization of the task sorting and effectively shorten the overall running time of the tasks. In summary, the solution of the present application can effectively achieve task scheduling and reduce the overall running time of the tasks.

[0198] Corresponding to the above method and system embodiments, the embodiments of the present invention also provide a task scheduling device, a computer-readable storage medium, and a computer program product, which can be correspondingly referred to above.

[0199] See Figure 6 as shown, the device may include:

[0200] A memory 601 for storing computer programs;

[0201] A processor 602 for executing the computer program to implement the steps of the task scheduling method in any of the above embodiments.

[0202] The computer program product includes computer programs / instructions, and when the computer programs / instructions are executed by the processor, the steps of the task scheduling method in any of the above embodiments are implemented.

[0203] Refer to Figure 7 , a computer program 71 is stored on the computer-readable storage medium 70, and when the computer program 71 is executed by the processor, the steps of the task scheduling method in any of the above embodiments are implemented. The computer-readable storage medium 70 mentioned here includes RAM (Random Access Memory), memory, ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), registers, hard disks, removable disks, or any other form of storage medium well-known in the technical field.

[0204] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation method. For the description of the features in the corresponding embodiments of the task scheduling device, reference can be made to the relevant descriptions in the corresponding embodiments of the task scheduling method, which will not be elaborated here one by one.

[0205] Those skilled in the art may further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of this application. Specific examples are used in this article to elaborate on the principles and implementation manners of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of this application, several improvements and modifications can still be made to this application, and these improvements and modifications also fall within the protection scope of this application.

Claims

1. A task scheduling method, characterized in that, Including: Construct a directed acyclic graph including multiple tasks, and determine the sorting values of each task in the directed acyclic graph; Sort each task in the directed acyclic graph based on the sorting values to obtain a task sorting result, so as to execute each task in sequence according to the task sorting result; Before executing any task according to the task sorting result, take the task as the target task, and determine the scheduling values of each processing unit in the processing unit set for the target task; wherein, the scheduling value represents the time consumed when the corresponding processing unit executes the target task and all tasks in each task path including the target task in the directed acyclic graph are executed; Take the processing unit with the lowest scheduling value among the processing units that can support the execution of the target task by the available processing resources as the optimal processing unit for executing the target task, and when the optimal processing unit is not the processing unit with the lowest scheduling value among all processing units, re-determine the sorting value of the target task; For the unexecuted task part in the task sorting result, adjust the execution order of the target task based on the re-determined sorting value of the target task.

2. The task scheduling method according to claim 1, wherein Construct a directed acyclic graph including multiple tasks, and determine the sorting values of each task in the directed acyclic graph, including: Construct a directed acyclic graph including multiple tasks, and determine the initial sorting values of each task in the directed acyclic graph through a preset sorting rule; Adjust the initial sorting value of the corresponding task according to the weight coefficient of each task to obtain the sorting value of each task in the directed acyclic graph.

3. The task scheduling method according to claim 2, wherein Construct a directed acyclic graph including multiple tasks, and determine the initial sorting values of each task in the directed acyclic graph through a preset sorting rule, including: Construct a directed acyclic graph including multiple tasks, and determine the initial sorting values of each task in the directed acyclic graph through a preset sorting rule, and for any one task, the initial sorting value of the task is the time consumed when all tasks remaining after removing the predecessor tasks of the task in each task path including the task in the directed acyclic graph are executed; 4. The task scheduling method according to claim 2, characterized in that Adjust the initial sorting value of the corresponding task according to the weight coefficient of each task to obtain the sorting value of each task in the directed acyclic graph, including: For any one task, take the out-degree of the task as the weight coefficient of the task, and take the product of the weight coefficient and the initial sorting value of the task as the obtained sorting value of the task.

5. The task scheduling method according to claim 1, wherein Before executing any task according to the task sorting result, take the task as the target task, and determine the scheduling values of each processing unit in the processing unit set for the target task, including: Before executing any task according to the task sorting result, take the task as the target task; For any one processing unit in the processing unit set, determine the earliest completion time of the target task when the processing unit executes the target task as the forward-looking evaluation time of the processing unit for the target task; Determine the time taken from the completion of the target task to the completion of all subsequent tasks of the target task in each task path containing the target task in the directed acyclic graph when the target task is executed by the processing unit, as the backward evaluation time of the processing unit for the target task; Take the sum of the forward evaluation time and the backward evaluation time as the scheduling value of the processing unit for the target task determined.

6. The task scheduling method according to claim 5, wherein, For any processing unit in the set of processing units, determine the earliest completion time of the target task when the target task is executed by the processing unit, as the forward evaluation time of the processing unit for the target task, including: For any processing unit in the set of processing units, determine the execution time of the target task when the target task is executed by the processing unit; Determine the earliest start time of the target task when the target task is executed by the processing unit; Sum the execution time of the target task and the earliest start time of the target task to obtain the earliest completion time of the target task, and use it as the forward evaluation time of the processing unit for the target task.

7. The task scheduling method according to claim 6, wherein, Determine the earliest start time of the target task when the target task is executed by the processing unit, including: Determine each parent task in the directed acyclic graph that points to the target task; For any one of the parent tasks, determine the communication time between the parent task and the target task when the target task is executed by the processing unit, and sum the communication time and the actual completion time of the parent task to obtain the earliest start time of the target task corresponding to the parent task; wherein, the actual completion time of the parent task represents the time taken from the completion of the parent task and all its preceding tasks in each task path containing the parent task in the directed acyclic graph; Select the maximum value among the earliest start times of the target task corresponding to each of the parent tasks obtained as the earliest start time of the target task determined when the target task is executed by the processing unit.

8. The task scheduling method according to claim 5, wherein Determine the time taken from the completion of the target task to the completion of all subsequent tasks of the target task in each task path containing the target task in the directed acyclic graph when the target task is executed by the processing unit, as the backward evaluation time of the processing unit for the target task, including: By way, perform recursion in the way of recursing from the exit task in the directed acyclic graph to the target task, and obtain the backward evaluation time-consuming of the processing unit for the target task; Among them, represents the export task, represents the k-th processing unit, represents the time taken to execute the export task when executed by the k-th processing unit ; represents the export task corresponding to the overhead of the k-th processing unit ; represents the i-th round of recursive task in the recursive process and is not an export task, the task represented by is a subtask of the task represents the set of overheads composed of the overheads corresponding to each processing unit for the task ; represents the communication time between the task and the task ; represents the time taken to execute the task when executed by the k-th processing unit for the task , where max represents taking the maximum value, represents the overhead corresponding to the k-th processing unit for the task ; represents the backward-looking evaluation time of the k-th processing unit for the task ; both k and i are positive integers.

9. The task scheduling method according to claim 8, wherein When the optimal processing unit is not the processing unit with the lowest scheduling value among all processing units, re-determine the sorting value of the target task, including: When the optimal processing unit is not the processing unit with the lowest scheduling value among all processing units, re-determine the backward evaluation time of the target task; Add the re-determined backward evaluation time of the target task to the execution time of the target task when the target task is executed by the optimal processing unit, and adjust the obtained result according to the weight coefficient of the target task to obtain the re-determined sorting value of the target task.

10. The task scheduling method according to claim 1, characterized in that, Also include: Receive a directed acyclic graph update instruction; Based on the directed acyclic graph update instruction, perform a structure update on the established directed acyclic graph, and determine whether the update result meets the set constraints; If not, cancel the structure update for the directed acyclic graph this time and output a prompt message.

11. The task scheduling method according to claim 10, wherein Determining whether the update result meets the set constraints includes: For any task in the update result, if starting from the task and returning to the task after several tasks, it is determined that the update result does not meet the set constraints.

12. The task scheduling method according to claim 1, wherein It also includes: Obtain the processing resource usage of each processing unit in the processing unit set; When the processing resource usage of any processing unit meets the set reminder rule, output a prompt message carrying the processing resource usage of the processing unit.

13. The task scheduling method according to claim 12, characterized in that The reminder rule includes: The average usage of any one of the processing resources of the processing unit exceeds the upper threshold set for this processing resource, or is lower than the lower threshold set for this processing resource.

14. The task scheduling method according to claim 1, characterized in that, Regarding the processing unit with the lowest scheduling value among the processing units that can support the execution of the target task with available processing resources as the optimal processing unit for executing the target task, it includes: Arrange each processing unit in ascending order of the scheduling value to obtain a processing unit selection list for the target task; Judge whether the available processing resources of the x-th processing unit in the processing unit selection list of the target task support the execution of the target task; If not, increment x by 1 and return to execute the operation of judging whether the available processing resources of the x-th processing unit in the processing unit selection list support the execution of the target task; If so, use the processing unit corresponding to the x-th scheduling value as the optimal processing unit; Wherein, x is a preset parameter and the initial value is 1.

15. The task scheduling method according to claim 14, characterized in that Judging whether the available processing resources of the x-th processing unit in the processing unit selection list of the target task support the execution of the target task includes: Judge whether the central processing unit resources, memory resources, and hard disk resources of the x-th processing unit in the processing unit selection list of the target task all support the execution of the target task; If all support the execution of the target task, it is determined that the processing unit supports the execution of the target task, otherwise it is determined that the processing unit does not support the execution of the target task.

16. The task scheduling method according to claim 15, wherein After determining that the available processing resources of the x-th processing unit in the processing unit selection list do not support the execution of the target task, it also includes: Overlay the waiting duration of the target task with the overhead of the target task corresponding to the x-th processing unit, and judge whether the overlay result is less than or equal to the overhead of the target task corresponding to the (x + 1)-th processing unit; If so, place the target task in the waiting queue of the x-th processing unit, and use the x-th processing unit as the optimal processing unit; If not, increment x by 1 and return to execute the operation of judging whether the available processing resources of the x-th processing unit in the processing unit selection list support the execution of the target task; Among them, the overhead corresponding to the target task for the x-th processing unit means that when the target task is executed by the x-th processing unit, the time consumption from the start of the execution of the target task to the completion of the execution of all the post-tasks of the target task in each task path in the directed acyclic graph that includes the target task.

17. The task scheduling method according to any one of claims 1 to 16, characterized in that, For the unexecuted part of the task sorting result, based on the sorting value re-determined for the target task, the adjustment of the execution order of the target task includes: For the unexecuted part of the task sorting result, determine the set of tasks participating in the adjustment; Based on the sorting value re-determined for the target task, adjust the execution order of the target task, and all the tasks participating in the adjustment are tasks in the set of tasks; Among them, the set of tasks participating in the adjustment includes the target task, and each task in the set of tasks participating in the adjustment is arranged continuously in the task sorting result, and each task in the set of tasks participating in the adjustment is at the same level in the directed acyclic graph.

18. A task scheduling device, characterized in that, Including: A memory for storing a computer program; A processor for implementing the steps of the task scheduling method according to any one of claims 1 to 17 when executing the computer program.

19. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein the computer program implements the steps of the task scheduling method according to any one of claims 1 to 17 when executed by a processor.

20. A computer program product comprising a computer program, characterized in that, The computer program implements the steps of the task scheduling method according to any one of claims 1 to 17 when executed by a processor.

Citation Information

Patent Citations

  • DAG structure-based cluster monitoring task scheduling method and apparatus, and electronic device

    CN119690628A

  • Intelligent workload scheduling using a ranking of sequences of tasks of a workload

    US20220261278A1