A task scheduling method, device, medium, and computer program product
By dynamically scheduling tasks with dependencies in a distributed system, and optimizing task allocation using task dependencies and resource node state information, the problem of insufficient availability of distributed scheduling in the existing technology is solved, and more efficient task execution and fault-tolerant processing is achieved.
Patent Information
- Application Number
- CN202411946544.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-27
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2044-12-27
AI Technical Summary
The prior art has insufficient availability of distributed scheduling schemes when dealing with tasks with dependencies, especially when the network environment and device state changes are complex.
By obtaining the task dependency between multiple subtasks of the target task, determining the currently parallel subtasks to be allocated, and calculating the execution cost of the subtasks to be allocated based on the status information of each resource node in the target distributed system. The optimization goal is to minimize the execution cost of the parallel task, and the target resource nodes corresponding to each subtask to be allocated are performed to obtain the target resource nodes corresponding to each subtask to be allocated.
Improve the availability and execution efficiency of dynamic scheduling for complex tasks, ensure the executability of the next stage of subtasks, and perform fault-tolerant processing when a resource node fails.
Smart Images

Figure CN119376898B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a task scheduling method, device, medium and computer program product. Background Art
[0002] As technology develops, the complexity of application scenarios continues to increase, and business tasks become more complex and diverse. More and more work begins to focus on changing the task model, splitting the original monolithic application into a group of microservices with input and output dependencies to achieve more flexible business expansion capabilities. However, this model also leads to more challenges in task scheduling, namely the complex scheduling problem of how to allocate multiple tasks with dependencies to multiple resource nodes.
[0003] In response to this complex scheduling problem, the relevant technical field mainly proposes two solutions: static scheduling and dynamic scheduling. Among them, static scheduling is to generate a scheduling strategy for multiple subtasks of a business task at one time, but with the changing network environment and device status, the availability of static scheduling is extremely poor. Dynamic scheduling is to schedule the subtasks to be executed in real time as the task progresses, which can improve the availability of the scheduling strategy to a certain extent. However, due to the increasingly complex changes in the network environment and device status, the current dynamic scheduling strategy still has the problem of insufficient availability.
[0004] How to improve the availability of a distributed scheduling solution for tasks with dependencies is a technical problem that those skilled in the art need to solve. Summary of the invention
[0005] The object of the present invention is to provide a task scheduling method, device, medium and computer program product for improving the availability of a distributed scheduling solution for tasks with dependencies.
[0006] In order to solve the above technical problems, the present invention provides a task scheduling method, comprising:
[0007] Get the task dependencies between multiple subtasks of the target task;
[0008] According to the task dependency, determine the subtasks to be assigned that can be currently performed in parallel;
[0009] Determine, according to the status information of each resource node in the target distributed system, a first task execution cost of the subtask to be assigned after the subtask to be assigned is assigned to the resource node and a second task execution cost of the next subtask of the subtask to be assigned;
[0010] Determine the parallel task execution cost according to the first task execution cost of each to-be-allocated subtask, with the optimization goal of minimizing the parallel task execution cost and the constraint condition that the second task execution cost of each next subtask meets the cost constraint condition, and perform optimization calculation to obtain the target resource node corresponding to each to-be-allocated subtask;
[0011] Allocate the to-be-allocated subtask to the target resource node for execution.
[0012] On the one hand, the first task execution cost is the sum of the first time for the resource node to obtain the calculation parameters required for the to-be-allocated subtask and the second time for the resource node to execute the to-be-allocated subtask.
[0013] On the other hand, the parallel task execution cost is the sum value of the first task execution costs of each to-be-allocated subtask.
[0014] On the other hand, the parallel task execution cost is the maximum value among the first task execution costs of each to-be-allocated subtask.
[0015] On the other hand, if the resource node has the task parameters of the to-be-allocated subtask, the first time is the time for the resource node to obtain the input data of the to-be-allocated subtask;
[0016] If the resource node does not have the task parameters of the to-be-allocated subtask, the first time is determined according to the time for the resource node to obtain the task parameters of the to-be-allocated subtask and the time for the resource node to obtain the input data of the to-be-allocated subtask.
[0017] On the other hand, the second task execution cost is the sum of the third time for the resource node to execute the next subtask to obtain the calculation parameters of the next subtask and the fourth time for the resource node to execute the next subtask.
[0018] On the other hand, according to the status information of each resource node in the target distributed system, determine the first task execution cost of the to-be-allocated subtask and the second task execution cost of the next subtask of the to-be-allocated subtask after allocating the to-be-allocated subtask to the resource node, including:
[0019] According to the status information of each resource node, determine the first task execution cost of the to-be-allocated subtask after allocating the to-be-allocated subtask to the resource node;
[0020] Determine the first first-numbered resource nodes as the candidate resource nodes corresponding to the to-be-allocated subtask in ascending order of the first task execution cost corresponding to the to-be-allocated subtask;
[0021] Determine the second task execution cost of the next sub-task after allocating the to-be-allocated sub-task to the candidate resource node.
[0022] On the other hand, it further includes:
[0023] Determine the first number of resource nodes in ascending order of the first task execution cost corresponding to the to-be-allocated sub-task as the candidate resource nodes corresponding to the to-be-allocated sub-task;
[0024] After allocating the to-be-allocated sub-task to the target resource node for execution, if the target resource node fails, migrate the to-be-allocated sub-task to another candidate resource node corresponding to the to-be-allocated sub-task.
[0025] On the other hand, migrating the to-be-allocated sub-task to another candidate resource node corresponding to the to-be-allocated sub-task includes:
[0026] Perform an availability assessment on multiple other candidate resource nodes corresponding to the to-be-allocated sub-task to obtain the availability assessment values corresponding to each candidate resource node;
[0027] Migrate the to-be-allocated sub-task to the candidate resource node with the maximum availability.
[0028] On the other hand, performing an availability assessment on multiple other candidate resource nodes corresponding to the to-be-allocated sub-task to obtain the availability assessment values corresponding to each candidate resource node includes:
[0029] Perform an availability assessment on the candidate resource node according to the resources required by the to-be-allocated sub-task, the available resources of the candidate resource node, and the historical failure data of the candidate resource node to obtain the availability assessment value of the candidate resource node.
[0030] On the other hand, the target distributed system is an edge computing system;
[0031] The to-be-allocated sub-task is the sub-task that currently needs to be offloaded from the terminal device to the target edge computing device in the edge computing system.
[0032] On the other hand, obtaining the task dependency relationship between multiple sub-tasks of the target task includes:
[0033] Obtain a directed acyclic graph corresponding to the target task, where the graph nodes in the directed acyclic graph correspond to the sub-tasks one by one, and the directed edges in the directed acyclic graph are used to represent the dependency relationship between the sub-tasks.
[0034] To solve the above technical problems, the present invention also provides a task scheduling device, including:
[0035] A memory for storing a computer program;
[0036] A processor for executing the computer program, and when the computer program is executed by the processor, the steps of the task scheduling method described in any one of the above are implemented.
[0037] To solve the above technical problems, the present invention also provides a non-volatile storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the task scheduling method described in any one of the above are implemented.
[0038] To solve the above technical problems, the present invention also 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 described in any one of the above are implemented.
[0039] The task scheduling method provided by the present invention has the beneficial effect that when dynamically scheduling according to the task dependency relationship between multiple subtasks of a target task, according to the status information of each resource node in the target distributed system, determine the first task execution cost corresponding to the to-be-allocated subtask that can be parallelized currently after allocating the to-be-allocated subtask to the resource node and the second task execution cost corresponding to the next subtask of the to-be-allocated subtask; determine the parallel task execution cost according to the first task execution cost corresponding to each to-be-allocated subtask, take minimizing the parallel task execution cost as the optimization goal, and take that the second task execution cost corresponding to each next subtask satisfies the cost constraint condition as the constraint condition, and perform optimization calculation to obtain the target resource node corresponding to each to-be-allocated subtask, so as to optimize the scheduling of the currently parallelizable subtasks with the improvement of parallelism as the orientation and the guarantee of the executability of the subtasks in the next stage as the constraint, and improve the usability and execution efficiency of the dynamic scheduling for complex tasks.
[0040] The task scheduling device, non-volatile storage medium and computer program product provided by the present invention have the above beneficial effects, which will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions of the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0042] Figure 1 It is a flowchart of a task scheduling method provided by an embodiment of the present invention;
[0043] Figure 2Schematic diagram of a directed acyclic graph for a target task provided by an embodiment of the present invention;
[0044] Figure 3 Schematic diagram of a mapping relationship of candidate resource nodes provided by an embodiment of the present invention;
[0045] Figure 4 Schematic diagram of a mapping relationship of target resource nodes provided by an embodiment of the present invention;
[0046] Figure 5 Schematic diagram of the structure of a task scheduling device provided by an embodiment of the present invention. Detailed implementation manners
[0047] The core of the present invention is to provide a task scheduling method, device, medium and computer program product for improving the availability of a distributed scheduling scheme for tasks with dependency relationships.
[0048] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0049] To facilitate the understanding of the technical solutions provided by the embodiments of the present invention, some key nouns and concepts used in the embodiments of the present invention are explained here first.
[0050] A distributed system is a system formed by interconnecting multiple computers through communication lines. Therefore, each node in the distributed system contains its own processor and memory and has the function of independently processing data. A large task can be divided into several subtasks, which can be executed on different nodes in the distributed system respectively. Usually, for users, a distributed system is a unified whole, and its intelligent agent is used for task scheduling when executing user tasks.
[0051] According to different design goals, a distributed system can be designed as a distributed storage system or a distributed computing system, etc. The distributed storage system is mainly used to process storage service tasks, aiming to store and manage a large amount of data, and provide data persistence, reliability and accessibility. The distributed computing system is mainly used to provide computing service tasks, aiming to process large-scale computing tasks in a distributed manner to improve computing efficiency and processing capabilities.
[0052] In the task scheduling solution provided by the embodiments of the present invention, since the nodes in the distributed system provide the resources required to execute business tasks, these nodes are referred to as resource nodes. A resource node is usually a computer or a server, and is configured as a computing resource node, a storage resource node, or other resource nodes with a particular emphasis according to business requirements.
[0053] The distributed system involved in the embodiments of the present invention may include an edge computing system.
[0054] Edge computing is a distributed computing scenario that locates computing, storage, and network services closer to the data source or the user to reduce latency, improve response speed, and relieve the burden on the central data center. The data generated by mobile terminal users is showing an exponential upward trend, and the requirements for the operating environment of various applications are also constantly increasing, including higher computing intensity and lower latency requirements. In addition, processing private data requires that applications and services do not overly access the user device and upload it to the server for processing. In recent years, edge computing technology has developed rapidly in such a context and has gradually been adopted by various industries and fields. It reduces latency by performing calculations closer to the data source and provides scalability by distributing the workload to multiple edge devices. In addition, since the edge is closer to the user, the risk of privacy data leakage can be reduced. The main feature of edge computing is that it allows nearby users to offload tasks, making the computing closer to the data source.
[0055] The task scheduling solution provided by the embodiments of the present invention is a scheduling solution for allocating complex tasks to a distributed system for processing. With the development of technology, the complexity of application scenarios is constantly increasing. More and more services are being decoupled. Through technologies such as containers, the original monolithic applications are split into a group of microservices with input-output dependencies. The subtasks obtained by splitting the complex tasks are scheduled to multiple target resources to achieve the best mapping between the complex tasks and a group of resources and improve the ability to serve end users.
[0056] In the embodiments of the present invention, a complex task refers to a task that can be split into multiple subtasks with input-output dependencies. Different subtasks can be assigned to the same or different resource nodes for execution, and there is a dependency relationship between the subtasks, that is, the input data of some subtasks is the output data of other subtasks.
[0057] The input-output relationships between multiple subtasks belonging to the same complex task can be represented by a Directed Acyclic Graph (DAG). Therefore, the above complex task can also be referred to as a directed acyclic graph task. In a directed acyclic graph, "directed" means that each edge in the graph has a direction, that is, from one graph node to another graph node, and "acyclic" means that there are no cycles in the graph, that is, there is no path that starts from a graph node, passes through a series of graph nodes, and then returns to the original graph node. In the embodiments of the present invention, a graph node of a directed acyclic graph can be used to represent a subtask, and a directed edge of the directed acyclic graph can be used to represent the input-output dependency relationship between two subtasks. The direction of the edge represents the data transmission direction, that is, the execution order between subtasks.
[0058] Currently, the scheduling technology for directed acyclic graph tasks focuses on task dependencies, that is, static scheduling. Before the first subtask starts, a fixed scheduling strategy is formulated according to the current available resource set of the distributed system, and the robustness is poor. This is because in a real distributed system, computing power resources and network resources usually have certain dynamic characteristics and will be updated continuously over time. In addition, resource nodes may also experience a decline in their ability to execute tasks due to task overload or other sudden failures.
[0059] Another more flexible scheduling scheme is dynamic scheduling, that is, not only considering the task structure, but also scheduling the subtasks to be executed in real time as the task progresses. In this way, the problem of poor subtask scheduling performance can be effectively avoided. However, in the face of today's increasingly complex distributed system environment and increasingly complex tasks, the current dynamic scheduling schemes for directed acyclic graph tasks still have problems of insufficient flexibility and poor usability.
[0060] To improve the usability of the distributed scheduling scheme for tasks with dependency relationships, the task scheduling scheme provided by the embodiments of the present invention, when performing dynamic scheduling according to the task dependency relationships between multiple subtasks of a target task, determines the first task execution cost corresponding to the subtask to be allocated after the subtask to be allocated that can be parallelized currently is allocated to a resource node and the second task execution cost corresponding to the next subtask of the subtask to be allocated according to the status information of each resource node in the target distributed system; determines the parallel task execution cost according to the first task execution cost corresponding to each subtask to be allocated, takes minimizing the parallel task execution cost as the optimization goal, and takes that the second task execution costs corresponding to each next subtask satisfy the cost constraint conditions as the constraint conditions, and performs optimization calculations to obtain the target resource node corresponding to each subtask to be allocated, so as to optimize the scheduling of the currently parallelizable subtasks with the orientation of improving parallelism and the constraint of ensuring the executability of the subtasks in the next stage, and improve the usability and execution efficiency of the dynamic scheduling for complex tasks.
[0061] The task scheduling method provided by the embodiments of the present invention will be described below.
[0062] Figure 1 It is a flowchart of a task scheduling method provided by the embodiments of the present invention; Figure 2 It is a schematic diagram of a directed acyclic graph of a target task provided by the embodiments of the present invention.
[0063] As Figure 1 shown, the task scheduling method provided by the embodiments of the present invention includes:
[0064] S101: Obtain the task dependencies among multiple subtasks of the target task;
[0065] S102: Determine the to-be-allocated subtasks that can be parallelized currently according to the task dependencies;
[0066] S103: According to the status information of each resource node in the target distributed system, determine the first task execution cost of the to-be-allocated subtasks after the to-be-allocated subtasks are allocated to the resource nodes and the second task execution cost of the next subtasks of the to-be-allocated subtasks;
[0067] S104: Determine the parallel task execution cost according to the first task execution cost of each to-be-allocated subtask, take minimizing the parallel task execution cost as the optimization goal, and take that the second task execution costs of each next subtask meet the cost constraint conditions as the constraint conditions, and perform optimization calculations to obtain the target resource nodes corresponding to each to-be-allocated subtask;
[0068] S105: Allocate the to-be-allocated subtasks to the target resource nodes for execution.
[0069] In the embodiments of the present invention, as introduced by the above concept, the target distributed system can be any type of distributed system, such as a distributed computing system, a distributed storage system, an edge computing system, etc.
[0070] The task scheduling method provided by the embodiments of the present invention can be applied to one or more resource nodes in the target distributed system, or can also be applied to one or more computing devices outside the target distributed system.
[0071] In the embodiments of the present invention, each subtask of the target task can all be a subtask for the target distributed system, or some of the subtasks are subtasks for the target distributed system, and the other subtasks are executed on the terminal device. Then, in an application scenario of the embodiments of the present invention, the target distributed system is an edge computing system; the to-be-allocated subtasks are the subtasks that currently need to be offloaded from the terminal device to the target edge computing device in the edge computing system.
[0072] In a specific implementation, for S101, obtaining the task dependency relationships among multiple subtasks of the target task includes at least the information of each subtask of the target task and the input-output dependency relationships among the subtasks. As introduced in the above embodiments, the task dependency relationships among the subtasks can be represented by a directed acyclic graph. Then, obtaining the task dependency relationships among multiple subtasks of the target task in S101 can include: obtaining the directed acyclic graph corresponding to the target task, where the graph nodes in the directed acyclic graph correspond to the subtasks one by one, and the directed edges in the directed acyclic graph are used to represent the dependency relationships among the subtasks.
[0073] The directed acyclic graph of the target task can be represented as . Among them, represents the subtasks in the target task, represents the dependency relationships among the subtasks. The meaning represented by each edge can be: the output of the previous subtask will be used as the necessary input of the subsequent subtask, otherwise the subsequent subtask cannot be executed smoothly.
[0074] The task scheduling method provided by the embodiments of the present invention also adopts a dynamic scheduling method, that is, scheduling the subsequent subtasks to be executed in real time as the execution progress of the target task proceeds. Different from the related technologies, when the task scheduling method provided by the embodiments of the present invention schedules the target task for the target distributed system, it first determines the subtasks that can be parallelized according to the task dependency relationships among the subtasks as the subtasks to be allocated in the current stage.
[0075] Task splitting can be achieved by splitting the directed acyclic graph corresponding to the target task in two dimensions. In the embodiments of the present invention, the task splitting in the first dimension can be defined as horizontal splitting, which means starting from the first subtask in the directed acyclic graph and traversing the set C of all task paths that can reach the last subtask. The subtasks in this set C have strong dependency relationships and are expected to have relatively high data exchange costs. The task splitting in the second dimension can be defined as vertical splitting, which means in the directed acyclic graph, according to the forward and backward dependency relationships of the subtasks, the subsequent subtasks connected to the same previous subtask are included in the set L, and the subtasks in this set L can be executed concurrently in the same time stage.
[0076] Assume that the target task can be split into 9 subtasks, and the dependency relationships among these subtasks can be as Figure 2As shown in the figure, subtask 6 among them requires the output data of subtask 3 and the output data of subtask 5 as inputs, subtask 8 requires the output data of subtask 6 and the output data of subtask 7 as inputs, and so on; after subtask 1 is executed, subtask 2, subtask 4, and subtask 7 all require the output data of subtask 1 as inputs but have no dependency relationship with each other. Therefore, taking the moment when subtask 1 is executed as the start of the current stage, subtask 2, subtask 4, and subtask 7 can be regarded as subtasks to be allocated that can be executed in parallel.
[0077] Then, in some alternative embodiments of the present invention, in S102, determining the subtasks to be allocated that can be executed in parallel according to the task dependency relationship may include: determining all task paths from the first subtask to the last subtask according to the directed acyclic graph corresponding to the target task; listing the first subtasks corresponding to the current stage in each task path as the subtasks to be allocated in the current stage. Taking Figure 2 as an example, the subtask 1 → subtask 2 → subtask 3 → subtask 6 → subtask 8 → subtask 9 can be regarded as a task path, the subtask 1 → subtask 4 → subtask 5 → subtask 6 → subtask 8 → subtask 9 can be regarded as a task path, and the subtask 1 → subtask 7 → subtask 8 → subtask 9 can be regarded as a task path. If the current stage is when subtask 1 is executed, subtask 2, subtask 4, and subtask 7 can be listed as the subtasks to be allocated in the current stage.
[0078] By observing, it can be seen that the number of subtasks on each task path of the directed acyclic graph task may be different, and for other subtasks except the first subtask, they usually need to wait for all their previous subtasks to be executed before they can be executed. Then, in some other alternative embodiments of the present invention, in S102, determining the subtasks to be allocated that can be executed in parallel according to the task dependency relationship may further include: after the first subtask is executed, determining the second subtask according to the directed acyclic graph corresponding to the target task, where the first subtask and the second subtask are both subtasks belonging to multiple task paths; listing the subtasks belonging to the same task path between the first subtask and the second subtask into the same subtask group to be allocated, and determining each subtask group to be allocated as the subtasks that can be executed in parallel in the current stage. That is to say, taking the subtasks at the intersection of multiple task paths as the nodes for dynamic scheduling execution, first performing parallel scheduling in units of subtask groups to be allocated, and then performing sequential scheduling on the subtasks within the subtask groups to be allocated. Taking Figure 2For example, if the current stage is the completion of subtask 1, subtask 1 can be regarded as the first subtask, and subtask 6 can also be regarded as the first subtask. Then, subtasks 2 and 3 are included in a group of subtasks to be assigned, and subtasks 4 and 5 are included in another group of subtasks to be assigned. If the current stage is the completion of subtask 1, subtask 8 can also be regarded as the second subtask. Then, subtasks 2, 3, and 6 can be included in the first group of subtasks to be assigned, subtasks 4, 5, and 6 can be included in the second group of subtasks to be assigned, and subtask 7 can be included in the third group of subtasks to be assigned.
[0079] For S103, the real-time status information of the target distributed system can be collected through the software and hardware detection devices deployed in the target distributed system to determine the resources that can be provided for the subtasks to be assigned at the current stage.
[0080] In the embodiments of the present invention, the status information of the resource node may include, but is not limited to, one of the basic environment status information and the fault information.
[0081] Among them, the basic environment status information may include the network topology information of the target distributed system, the resource status information of the resource nodes, and the network status information between the resource nodes.
[0082] The network topology information may include the connection relationships between the resource nodes and between the resource nodes in the target distributed system, and can be represented by a relationship graph wherein, represents the resource nodes in the target distributed system, represents the edges formed by the interconnection of the resource nodes.
[0083] The resource status information of the resource node may include the information of the computing resources and the storage resources on the resource node. Among them, the storage resources may include memory resources and persistent storage resources. Then, the resource status information of the resource node may be as follows:
[0084] ;
[0085] wherein, , , respectively represent the total amount of computing resources, the available amount of computing resources, and the occupied amount of computing resources of the resource node at present, , , respectively represent the total amount of memory resources, the available amount of memory resources, and the occupied amount of memory resources of the resource node at present, , , respectively represent resource nodes in the current total amount of persistent storage resources, the available amount of persistent storage resources, and the occupied amount of persistent storage resources.
[0086] The network status information between resource nodes is used to represent the interconnection status between resource nodes. For the interconnection between resource nodes, can be used to represent resource nodes and resource nodes the interconnection status information between them, where represents resource node to resource node the actual bandwidth between them, represents the average latency level. The actual bandwidth capacity represents the data transmission capacity, while the latency level is affected by the position in the network topology between resource nodes, the link distance, and data transceiver latency caused by other external interferences. Therefore, varies dynamically with the system.
[0087] The fault information can include the fault type that occurs in the resource node and the fault duration. The fault information of resource node can be expressed as:
[0088] ;
[0089] where represents the fault type, The status quantity of can include that the resource node has no fault (which can be represented by 0), the resource node has a fault (which can be represented by n, and the specific value of n represents the specific fault type), and the network related to the resource node has a fault (which can be represented by e, and the specific value of e represents the specific network or resource node pointed to). Among them, the network related to the resource node can include the network composed of all resource nodes with a connection relationship with the resource node. For other resource nodes directly connected to the resource node, other resource nodes interconnected with the resource node and other resource nodes unidirectionally pointed to by the resource node can be included in the network related to the resource node; for other resource nodes not directly connected to the resource node, a hop count threshold can be preset, and other resource nodes with a connection to the resource node less than or equal to the hop count threshold can be included in the network related to the resource node, while other resource nodes with a connection to the resource node greater than the hop count threshold are not considered.
[0090] represents the fault duration, The state quantities may include the predicted fault duration (which can be represented by T, and the specific value of T can be a specific duration) and the unknown fault duration (which can be represented by TE). The unknown fault duration indicates that the current fault occurring in the resource node cannot be recovered, and the fault duration cannot be determined.
[0091] By statistically analyzing the historical data of each resource node, the pattern of the fault duration corresponding to various fault types can be obtained. In the embodiments of the present invention, can be used to represent the set of actual fault types occurring on the resource node , and is used to represent the probability distribution model of the fault duration corresponding to the actual fault type occurring on the resource node . The latter can be obtained by statistically analyzing historical data.
[0092] Then, in S103, by sensing the above state information, quantified sensed target data can be obtained. Among them, represents the network topology information of the target distributed system, represents the resource state information of the resource node , represents the resource node and the resource node the interconnection state information between them, represents the resource node the fault information.
[0093] The above sensing step can be performed periodically and obtain the most recently obtained state information when scheduling the sub-tasks to be assigned. The above sensing step can also be executed when scheduling the sub-tasks to be assigned.
[0094] Then, according to the state information of each resource node in the target distributed system, the first task execution cost of the sub-task to be assigned after the sub-task to be assigned is assigned to the resource node is determined. The first task execution cost may include the cost for the resource node to obtain the task parameters and input data of the sub-task to be assigned and the cost for the resource node to execute the sub-task to be assigned. Assuming that after the sub-task to be assigned is assigned to a certain resource node, the second task execution cost of the next sub-task of the sub-task to be assigned can be determined according to the state information of each resource node in the target distributed system. The second task execution cost may include the cost for obtaining the task parameters and input data of the next sub-task and the cost for executing the next sub-task.
[0095] The first task execution cost can be determined according to at least one of the time cost, energy consumption cost, and service quality parameter.
[0096] The second task execution cost can be determined according to at least one of the time cost, the energy consumption cost, and the service quality parameter.
[0097] In S104, determining the parallel task execution cost according to the first task execution cost of each to-be-allocated subtask in the current stage may include: using the sum of the first task execution costs of each to-be-allocated subtask as the parallel task execution cost. Among them, if the first task execution cost includes the time cost, when counting the parallel task execution time cost, the maximum value among the time costs corresponding to each to-be-allocated subtask may be used as the parallel task execution time cost.
[0098] In the embodiments of the present invention, in addition to minimizing the parallel task execution cost for the parallelizable to-be-allocated subtasks, the feasibility of the dynamic scheduling scheme also needs to be considered, and this feasibility guarantee at least includes the constraint on the executability of the next subtask of the to-be-allocated subtask. Therefore, in the embodiments of the present invention, at least the constraint condition that the second task execution costs of each next subtask all meet the cost constraint condition is used as the constraint condition. According to the determination method of the second task execution cost, the cost constraint condition may be a constraint condition of at least one of the time cost, the energy consumption cost, and the service quality parameter.
[0099] After determining the optimization objective and the constraint conditions, optimization calculation is performed, and a dynamic scheduling scheme for allocating each to-be-allocated subtask to the target resource node can be solved. This dynamic scheduling scheme has a lower task execution cost and obtains a higher reliability guarantee.
[0100] In S105, execute the dynamic scheduling scheme obtained in S104. If there are still subsequent subtasks for the target task, then return to S102 for the subsequent subtasks.
[0101] The task scheduling method provided by the embodiments of the present invention, when performing dynamic scheduling according to the task dependency relationship among multiple subtasks of the target task, determines the first task execution cost corresponding to the to-be-allocated subtask after allocating the currently parallelizable to-be-allocated subtasks to the resource node and the second task execution cost corresponding to the next subtask of the to-be-allocated subtask according to the status information of each resource node in the target distributed system; determines the parallel task execution cost according to the first task execution cost corresponding to each to-be-allocated subtask, takes minimizing the parallel task execution cost as the optimization objective, and takes the constraint condition that the second task execution costs corresponding to each next subtask all meet the cost constraint condition as the constraint condition, performs optimization calculation, and obtains the target resource node corresponding to each to-be-allocated subtask, so as to optimize the scheduling of the currently parallelizable subtasks with the improvement of parallelism as the orientation and the guarantee of the executability of the subtasks in the next stage as the constraint, and improves the usability and execution efficiency of the dynamic scheduling for complex tasks.
[0102] Based on the above embodiments, the embodiments of the present invention further illustrate the establishment of the optimization objective and constraints, as well as the optimization calculation steps.
[0103] In the above embodiments of the present invention, it is introduced that the first task execution cost can be the task execution cost determined according to at least one of the time cost, energy consumption cost, and service quality parameter.
[0104] Then, in some alternative embodiments of the embodiments of the present invention, the first task execution cost is the sum of the first time for the resource node to obtain the calculation parameters required for the to-be-allocated subtask and the second time for the resource node to execute the to-be-allocated subtask.
[0105] On this basis, the parallel task execution cost is the sum of the first task execution costs of each to-be-allocated subtask. That is to say, the sum of the execution times of each to-be-allocated subtask (or to-be-allocated subtask group) can be adopted, because the execution time can also reflect the resource occupancy situation, so the time sum value is used to represent the parallel task execution cost at the current stage.
[0106] Alternatively, the parallel task execution cost is the maximum value among the first task execution costs of each to-be-allocated subtask. That is to say, if the first task execution cost only considers the execution time, then the maximum execution time among the to-be-allocated subtasks can be used as the parallel task execution cost.
[0107] When determining the first task execution cost according to the above method, if the resource node has the task parameters of the to-be-allocated subtask, the first time is the time for the resource node to obtain the input data of the to-be-allocated subtask; if the resource node does not have the task parameters of the to-be-allocated subtask, the first time is determined according to the time for the resource node to obtain the task parameters of the to-be-allocated subtask and the time for the resource node to obtain the input data of the to-be-allocated subtask. That is to say, whether to consider the time for obtaining the task parameters is distinguished according to whether the resource node has the task parameters of the to-be-allocated subtask. Determining the first time according to the time for the resource node to obtain the task parameters of the to-be-allocated subtask and the time for the resource node to obtain the input data of the to-be-allocated subtask can be to use the sum of the time for the resource node to obtain the task parameters of the to-be-allocated subtask and the time for the resource node to obtain the input data of the to-be-allocated subtask as the first time, or to use the larger value between the time for the resource node to obtain the task parameters of the to-be-allocated subtask and the time for the resource node to obtain the input data of the to-be-allocated subtask as the first time.
[0108] In some other alternative embodiments of the embodiments of the present invention, if the first task execution cost is determined according to the time cost, energy consumption cost, and service quality parameter, the energy consumption cost can be determined according to the data transmission process of the calculation parameters required for the to-be-allocated subtask and the calculation resources, storage resources, network resources, and power consumption required during the execution of the to-be-allocated subtask. The service quality parameter can estimate the execution result of the to-be-allocated subtask by the resource node according to the historical data of the resource node. If the to-be-allocated subtask is a model calculation task, the service quality parameter can be the model accuracy.
[0109] In the above embodiments of the present invention, it is introduced that the second task execution cost can be the task execution cost determined according to at least one of the time cost, energy consumption cost, and service quality parameter.
[0110] Then, in some alternative embodiments of the embodiments of the present invention, the second task execution cost can be the sum of the third time for the resource node executing the next subtask to obtain the calculation parameters of the next subtask and the fourth time for the resource node to execute the next subtask. The cost constraint conditions can be determined for each next subtask respectively, and the second task execution cost corresponding to the next subtask can be compared with its cost constraint conditions.
[0111] Based on the above embodiments, in S103, determining the first task execution cost of the to-be-allocated subtask and the second task execution cost of the next subtask of the to-be-allocated subtask after allocating the to-be-allocated subtask to the resource node according to the status information of each resource node in the target distributed system may further include: determining the first task execution cost of the to-be-allocated subtask after allocating the to-be-allocated subtask to the resource node according to the status information of each resource node; determining the first N number of resource nodes as the candidate resource nodes corresponding to the to-be-allocated subtask in ascending order of the first task execution cost corresponding to the to-be-allocated subtask; determining the second task execution cost of the next subtask after allocating the to-be-allocated subtask to the candidate resource nodes.
[0112] In the embodiments of the present invention, to further simplify the determination steps of the first task execution cost and the second task execution cost and improve the interpretability of the dynamic scheduling strategy generation process, a method of generating a task scheduling strategy in stages is adopted. That is to say, in the task scheduling and offloading strategy considering performance and reliability, first, the vertical segmentation set L is used as the decision target for each stage. Because the to-be-allocated subtasks belonging to the same group in this set L have a high degree of parallelism and basically do not need to consider the mutual influence. Therefore, this problem can be expressed as how to schedule all the to-be-allocated subtasks in the set L to a set of resource nodes N, and ensure that the set of to-be-allocated subtasks has a lower task execution cost and obtains a higher reliability guarantee. This step determines the set of candidate resource nodes corresponding to each to-be-allocated subtask.
[0113] Denote the th subtask to be assigned on the path as , which has predecessor subtasks, successor subtasks. The amount of data to be transmitted for the predecessor subtasks of this subtask to be assigned is , and it is expected to generate an amount of data of . Then, when considering scheduling the subtask to be assigned to the resource node , the corresponding first task execution cost can be expressed by the following formula:
[0114] ;
[0115] Among them, represents the maximum value calculation, represents the time cost required to transmit the task parameters of the subtask to be assigned from the resource node to the resource node (for example, in the edge offloading scenario, it can be the time to offload the subtask to be assigned from the terminal device to the resource node in the target edge computing system), represents the time cost required to transmit the required input data of the subtask to be assigned from the resource node (that is, the resource node where the predecessor subtask of the subtask to be assigned is located) to the resource node , represents the maximum time required to transmit input data to the resource node , represents the second time for the resource node to execute the subtask to be assigned .
[0116] Then, in ascending order of the first task execution cost corresponding to the subtask to be assigned, determine the first number of resource nodes as the candidate resource nodes corresponding to the subtask to be assigned. To improve availability, it is also possible to first verify the task requirements for assigning the subtask to be assigned to the resource node, and then use the first K resource nodes that meet the task requirements as the candidate resource nodes for the subtask to be assigned:
[0117] , ;
[0118] Among them, represents the minimum value calculation, Indicates the cost threshold corresponding to the first task execution cost. K can be 3.
[0119] Aggregate the candidate resource nodes corresponding to each sub-task to be allocated, and obtain the set of candidate resource nodes for all sub-tasks to be allocated at the current node , since there is a many-to-many mapping relationship between multiple sub-tasks and multiple resource nodes, considering the principle of optimal system total cost, when a resource node corresponds to multiple sub-tasks to be allocated, if all sub-tasks to be allocated cannot be satisfied in the same stage, then it is deleted from the candidate resource nodes of some sub-tasks to be allocated. The deletion method is: delete the sub-task to be allocated that occupies the least resources, so as to ensure that the sub-tasks to be allocated with higher resource requirements can be executed optimally as much as possible. Obtain the set of candidate resource nodes after the first round of screening .
[0120] Figure 3 It is a schematic diagram of the mapping relationship of candidate resource nodes provided by an embodiment of the present invention.
[0121] As Figure 3 shown, assume that the sub-tasks to be allocated at the current node include , , , , and there are 8 resource nodes in the candidate resource node set. Then in Figure 3 , the candidate resource nodes of the sub-task to be allocated are resource nodes 1, 3, and 6, and so on. All resource nodes marked with " " are candidate resource nodes.
[0122] Then, on the basis of the first stage, it is necessary to determine the target resource nodes of all sub-tasks to be allocated from the set of candidate resource nodes. At this time, for each sub-task to be allocated, consider the execution status of its pre-order dependent sub-tasks belonging to the same horizontal segmentation set C, and the subsequent dependent sub-tasks should be as consistent as possible with the execution position of the sub-task to be allocated to reduce the data transmission cost.
[0123] However, due to the dynamic characteristics of the environment, the current optimal resource node may not be able to meet the task requirements of the next stage. Therefore, further sorting and screening are performed on the set of candidate resource nodes obtained in the previous step, and consider how to obtain a system decision that can generate the minimum cost and can ensure that the sub-tasks of the next stage can obtain sufficient resources as much as possible. Then the optimization objective function can be constructed as:
[0124] ;
[0125] The constraint condition is: .
[0126] Among them, represents the total cost generated by the scheduling of resource nodes for all sub-tasks to be allocated. The constraint condition means that after the selected resource node executes the sub-task to be allocated, the time cost required for the resource node to continue to execute the next sub-task or the transmission time cost required to transmit the output data of the sub-task to be allocated to the resource node that executes the next sub-task shall not exceed the cost constraint condition of the next sub-task .
[0127] This optimization calculation problem is a combinatorial optimization problem and belongs to the typical NP-hard problem. A heuristic search algorithm can be used to find a solution that can meet the approximate optimal cost. The resource node obtained by selecting the search algorithm is used as the target resource node corresponding to the sub-task to be allocated.
[0128] Figure 4 FIG. is a schematic diagram of the mapping relationship of a target resource node provided by an embodiment of the present invention.
[0129] As Figure 4 shown, the target resource node of the sub-task to be allocated is the resource node 3, and so on. All resource nodes marked with " " are target resource nodes.
[0130] To further improve the availability of the distributed scheduling scheme for tasks with dependencies, the task scheduling method provided by the embodiment of the present invention may further include: when a faulty resource node is detected in the target distributed system, performing fault tolerance processing on the sub-tasks in the faulty resource node.
[0131] In some optional implementation manners of the embodiment of the present invention, the task scheduling method provided by the embodiment of the present invention may further include: determining the first number of resource nodes in ascending order of the first task execution cost corresponding to the sub-task to be allocated as the candidate resource nodes corresponding to the sub-task to be allocated; after allocating the sub-task to be allocated to the target resource node for execution, if the target resource node fails, migrating the sub-task to another candidate resource node corresponding to the sub-task to be allocated.
[0132] That is to say, in the obtained candidate resource node set in the above steps, the unselected candidate resource nodes of each sub-task to be allocated can be used as the fault tolerance resource node set, and the resource nodes in the fault tolerance resource node set are used to provide migration nodes for fault tolerance processing of the faulty resource node.
[0133] In the embodiments of the present invention, migrating the to-be-allocated subtask to another candidate resource node corresponding to the to-be-allocated subtask may include: performing an availability evaluation on multiple other candidate resource nodes corresponding to the to-be-allocated subtask to obtain the availability evaluation values corresponding to the candidate resource nodes; migrating the to-be-allocated subtask to the candidate resource node with the highest availability. That is to say, an availability evaluation function can be designed to measure the availability of multiple other candidate resource nodes corresponding to the to-be-allocated subtask, so as to select the candidate resource node with the highest availability.
[0134] In the embodiments of the present invention, performing an availability evaluation on multiple other candidate resource nodes corresponding to the to-be-allocated subtask to obtain the availability evaluation values corresponding to the candidate resource nodes may include: performing an availability evaluation on the candidate resource nodes according to the resources required by the to-be-allocated subtask, the available resources of the candidate resource nodes, and the historical failure data of the candidate resource nodes to obtain the availability evaluation values of the candidate resource nodes.
[0135] Denote the subtask being executed by the failed resource node as the to-be-processed subtask.
[0136] In some optional embodiments of the embodiments of the present invention, the availability evaluation function can be expressed by the following formula:
[0137] ;
[0138] wherein, 、 、 respectively represent the computing resources, storage resources, and network resources required by the to-be-processed subtask , 、 、 respectively represent the corresponding computing, storage, and network resources that the resource node to be evaluated can provide within the most recent time interval, and the smaller these ratios are, the better. represents the mean time between failures of the resource node statistically in the near future, represents the mean time between failures statistically for all resource nodes in the target distributed system in the near future. The smaller this ratio is, the lower the failure rate of the resource node is compared to the average level of the target distributed system.
[0139] 、 represent real numbers between 0 and 1, used to adjust the weights of different parts in the availability evaluation function.
[0140] Evaluate all resource nodes in the fault-tolerant resource node set, and select the availability evaluation value The highest resource node is used as the migration node for fault tolerance processing of the subtasks to be processed and perform task migration.
[0141] In the task scheduling method provided by the embodiments of the present invention, when dynamically scheduling tasks with dependencies, resource nodes not selected when determining the set of candidate resource nodes are also used as fault tolerance resource nodes to further improve the availability of distributed scheduling of complex tasks.
[0142] In addition to the fault tolerance processing scheme introduced in the above embodiments, in some other optional embodiments of the embodiments of the present invention, fault tolerance processing of subtasks in a faulty resource node may further include: using a trained fault tolerance processing action generation model to generate multiple fault tolerance processing actions for the subtasks to be processed according to the state information of the target distributed system at the current moment, performing an availability evaluation on each fault tolerance processing action, determining the actual fault tolerance processing action according to the availability evaluation result, and performing the actual fault tolerance processing action on the subtasks to be processed.
[0143] In the embodiments of the present invention, the state information may include but is not limited to basic environment state information, task state information, and fault information. At the current moment, there may be multiple faulty resource nodes in the target distributed system, and there may be multiple subtasks to be processed on one faulty resource node. According to the device scheduling ability and system design, the subtasks to be processed can be scheduled one by one, or multiple subtasks to be processed can be scheduled at one time and the scheduling can be completed in multiple batches. Therefore, it is necessary to determine the priority of the subtasks to be processed and perform fault tolerance processing on the subtasks to be processed in the order from high to low priority. The way to determine the priority of the subtasks to be processed can be to determine according to at least one of the task type, workload, and user-set parameters of the subtasks to be processed.
[0144] The fault tolerance processing action generation model can be trained by means of reinforcement learning or deep reinforcement learning. The trained fault tolerance processing action generation model is used to generate multiple fault tolerance processing actions for the subtasks to be processed according to the state information at the current moment. During operation, the parameters of the fault tolerance processing action generation model can also be fine-tuned according to the running state of the target distributed system.
[0145] To improve the availability of the fault tolerance scheduling result, in the embodiments of the present invention, an action filter is designed to screen the multiple fault tolerance processing actions output by the fault tolerance processing action generation model, and based on the pre-configured availability evaluation index, to ensure that the actual fault tolerance processing action available in the target distributed system at the current moment is screened and executed.
[0146] In an embodiment of the present invention, the method for determining the priority of a sub-task to be processed may include: determining a fault impact degree parameter of a faulty resource node according to the fault type of the faulty resource node; determining a task evaluation parameter of the sub-task to be processed according to the load status of the sub-task to be processed on the faulty resource node; and determining a priority score of the sub-task to be processed according to the fault impact degree parameter and the task evaluation parameter.
[0147] In an embodiment of the present invention, the priority of the sub-task to be processed is measured from two aspects: the fault impact degree of the faulty resource node and the load status of the sub-task to be processed on the faulty resource node.
[0148] Among them, determining the fault impact degree parameter of the faulty resource node according to the fault type of the faulty resource node may include: determining a predicted value of the fault duration of the faulty resource node according to the historical operation data of the faulty resource node; and using the predicted value of the fault duration as the fault impact degree parameter.
[0149] In the above embodiment of the present invention, it is introduced that by statistically analyzing the historical data of each resource node, the law of the fault duration corresponding to various fault types can be obtained. Then, determining the predicted value of the fault duration of the faulty resource node according to the historical data corresponding to the fault type of the faulty resource node may include: determining the expected value of the fault duration of the faulty resource node according to the fault type of the faulty resource node and the corresponding probability distribution model of the fault duration; using the expected value of the fault duration as the predicted value of the fault duration; where the probability distribution model of the fault duration corresponding to the fault type is determined according to the historical operation data of the resource node.
[0150] In an embodiment of the present invention, the expected value of the fault duration can be obtained through calculation, that is, under the condition of the actual fault type that occurs on the resource node at a given time, the expected value of the fault duration of the resource node is determined according to the probability distribution model of the fault duration corresponding to these fault types.
[0151] In some alternative embodiments of the present invention, determining the task evaluation parameter of the sub-task to be processed according to the load status of the sub-task to be processed on the faulty resource node may include: using the resource occupancy parameter of the sub-task to be processed on the faulty resource node and the remaining execution time of the sub-task to be processed on the faulty resource node as the load status of the sub-task to be processed on the faulty resource node, and determining the task evaluation parameter according to the resource occupancy parameter and the remaining execution time. That is to say, the task evaluation parameter of the sub-task to be processed can be determined only by considering the workload.
[0152] Among them, the steps for determining the resource occupancy parameter may include: determining the resource occupancy parameter according to the resource amounts of multiple types of resources occupied by the subtask to be processed on the faulty resource node. Determining the task evaluation parameter according to the resource occupancy parameter and the remaining execution time may include: using the ratio of the resource occupancy parameter to the remaining execution time as the task evaluation parameter. Then, the task evaluation parameter of the subtask to be processed can be calculated by the following formula:
[0153] ;
[0154] Among them, 、 、 respectively represent the computing resource amount, memory resource amount, and persistent storage resource amount occupied by a single copy of the business task . represents the number of copies of the business task running in the resource node where it is located, represents the occupation period of the business task for the current resource. Among them, is in the same unit, 、 、 、 、 can all be parameters after normalization processing. Then can be used to represent the average value of resources consumed by the subtask to be processed on the faulty resource node per unit time.
[0155] Then, in the embodiment of the present invention, the fault impact degree parameter can be the prediction of the fault duration of the faulty resource node, and the task evaluation parameter can be the resource consumption value per unit time of the subtask to be processed on the faulty resource node. Then, determining the priority score of the subtask to be processed according to the fault impact degree parameter and the task evaluation parameter may include: using the ratio of the resource consumption value per unit time to the predicted value of the fault duration as the priority score. Then, the priority score of the subtask to be processed can be calculated by the following formula:
[0156] ;
[0157] Among them, represents the priority score of the subtask to be processed on the faulty resource node at time .
[0158] When comparing the priority scores, all subtasks to be processed on all faulty resource nodes in the target distributed system can be sorted uniformly, or they can be grouped according to the parallel ability of fault tolerance scheduling, and the priority scores can be sorted within the groups.
[0159] In some other alternative embodiments of the embodiments of the present invention, determining the task evaluation parameter of the to-be-processed subtask according to the load status of the to-be-processed subtask on the faulty resource node may further include: determining the task evaluation parameter according to the load status of the to-be-processed subtask on the faulty resource node and the task type priority parameter of the to-be-processed subtask. That is to say, when determining the priority score of the to-be-processed subtask, the task type priority of the to-be-processed subtask may also be combined. Specifically, the task type priority score of the to-be-processed subtask may be added to the priority score calculation formula of the to-be-processed subtask.
[0160] The training steps of the fault tolerance processing action generation model may include: inputting the sample status information into the fault tolerance processing action generation model to output the sample fault tolerance processing action for the sample status information; after executing the sample fault tolerance processing action, obtaining the updated sample status information; determining the environmental reward value according to the updated sample status information and the reward function; using a set of sample fault tolerance processing actions, sample fault tolerance processing actions, updated sample status information, and environmental reward values as a training sample; and updating the model parameters of the fault tolerance processing action generation model by using the training sample.
[0161] In the embodiments of the present invention, the environmental reward value may adopt the fault tolerance cost of executing the fault tolerance processing action. In some alternative embodiments of the embodiments of the present invention, the fault tolerance cost of executing the fault tolerance processing action may be measured from the perspective of the time cost required to execute the fault tolerance processing action. Then the reward function may be a function of the fault tolerance processing time of the task.
[0162] The fault tolerance processing actions may be divided into three categories, namely task migration actions, task waiting actions, and task scaling actions. The time cost required to execute the fault tolerance processing action may be determined in combination with the service interruption time and transmission time caused by executing the fault tolerance processing action. Then for the above three types of actions:
[0163] Task migration action: Migrate the to-be-processed subtask on the current faulty resource node to a resource node that is running normally. The main time cost generated in this process includes data transmission time and service recovery time.
[0164] Task waiting action: When the fault can be recovered in a short time, migration may not be performed, and the to-be-processed subtask is interrupted until the fault of the faulty resource node is recovered. The main cost of this process is the waiting time of service interruption.
[0165] Task scaling action: If there are identical copies of the to-be-processed subtask on other resource nodes, the service on other resource nodes may be scaled, and the service on the faulty resource node is immediately terminated. This process does not generate data migration, and the main cost is the service recovery time.
[0166] The fault tolerance processing time may include a first processing time for task migration actions, a second processing time for task waiting actions, and a third processing time for task scaling actions; wherein, the task migration action is to migrate the sub-task to be processed from the faulty resource node to the first resource node, and the first processing time includes data transmission time and service recovery time at the first resource node; the task waiting action is to set the sub-task to be processed to the service interruption state at the faulty resource node, and the second processing time is the service interruption waiting time; the task scaling action is to start the sub-task to be processed at the second resource node where there is a copy of the sub-task to be processed and terminate the sub-task to be processed at the faulty resource node, and the third processing time is the service recovery time at the second resource node.
[0167] According to the training steps of the fault tolerance processing action generation model and the types of fault tolerance processing actions introduced in the embodiments of the present invention, a specific training step of the fault tolerance processing action generation model is introduced below.
[0168] Let the state parameters of the target distributed system observed at time be where represents the basic environmental state information of the target distributed system at time including network topology information, resource state information of resource nodes, and network state information between resource nodes, represents the set of various business tasks running on all resource nodes in the target distributed system at time and represents the fault information of all faulty resource nodes in the target distributed system at time
[0169] Let the decision variable at time be where represents the task migration action, represents the task waiting action, and represents the task scaling action.
[0170] Among them, it can be configured that when and are both 0, it means migrating the sub-task to be processed to the resource node When and are both 0, it means keeping the sub-task to be processed on the faulty resource node for waiting without performing other operations. When and are both 0, it means scaling the sub-task to be processed on another resource node .
[0171] After performing the fault tolerance handling action, collect the state information in the target distributed system again, and the obtained environmental reward value , which represents the time cost required to execute the fault tolerance handling action to restore the service of the sub-task to be processed. Among them, , represents the first processing time of the task migration action, represents the second processing time of the task waiting action, represents the third processing time of the task scaling action. Usually, since the decision variable is only one type of fault tolerance handling action can be executed within a period of time, and the time costs of the three types of fault tolerance handling actions are mutually exclusive.
[0172] Construct an online decision-making generation network for deep reinforcement learning, that is, an initial fault tolerance handling action generation model. The fault tolerance handling action generation model can adopt a deep Q-learning model (DQN). Denote the initial fault tolerance handling action generation model as , is the model parameter of the fault tolerance handling action generation model. Input the state parameter into the fault tolerance handling action generation model, output the fault tolerance handling action and execute it. Then, calculate the environmental reward value of the current stage through the reward function, and the system enters the next observation state .
[0173] Collect multiple training samples in the above manner and store them in the cache pool D. When the number of training samples stored in the cache pool D reaches the preset sample number, enter the parameter update step of the fault tolerance handling action generation model.
[0174] During the parameter update process of the fault tolerance handling action generation model, randomly select M training samples from the cache pool D, and calculate the target Q value according to the following formula:
[0175] ;
[0176] Among them, is a real coefficient between 0 and 1.
[0177] The loss function of the fault tolerance handling action generation model can be:
[0178] .
[0179] Update the network parameters according to the gradient backpropagation until the network converges. After convergence, the fault tolerance processing action generation model outputs a decision-making action, i.e., a fault tolerance processing action, according to the obtained state information of the target distributed system at the current moment, and makes scheduling management decisions for the sub-tasks to be processed on the fault resource nodes in different stages.
[0180] To ensure the availability of the actually executed fault tolerance processing actions, the embodiments of the present invention first use the fault tolerance processing action generation model to generate multiple fault tolerance processing actions, and then use an action filter to screen out the available actual fault tolerance processing actions from them.
[0181] In the embodiments of the present invention, the availability of each fault tolerance processing action is evaluated, and the actual fault tolerance processing action is determined according to the availability evaluation result, which may include: evaluating the availability of the fault tolerance processing actions in the order from the largest corresponding environmental reward value to the smallest until a fault tolerance processing action that meets the availability evaluation conditions is obtained as the actual fault tolerance processing action. That is to say, the fault tolerance processing action with the largest environmental reward value can be selected from the available fault tolerance processing actions as the actual fault tolerance processing action.
[0182] In a specific implementation, using the action filter to evaluate the availability of the fault tolerance processing actions may include evaluating the security of the fault tolerance processing actions. If the fault tolerance processing action meets the preset security conditions, it is determined that the fault tolerance processing action meets the availability evaluation conditions. Then, the indicating security action indicator at time, first sort the fault tolerance processing actions output by the fault tolerance processing action generation model in the order from the largest environmental reward value to the smallest, select the first K fault tolerance processing actions, and then check one by one in the order from the largest environmental reward value to the smallest whether they meet the availability evaluation conditions. If they do not meet, then until the fault tolerance processing action is selected as the actual fault tolerance processing action and executed.
[0183] The task scheduling method provided by the embodiments of the present invention also provides a sustainable fault tolerance processing solution for the resource nodes executing sub-tasks when dynamically scheduling tasks with dependencies, thereby further improving the availability of the distributed scheduling solution.
[0184] It should be noted that, in the embodiments of each task scheduling method of the present invention, some of the steps or features may be ignored or not executed. The divided hardware or software functional modules for convenience of description are not the only implementation forms for implementing the task scheduling method provided by the embodiments of the present invention.
[0185] The above details the respective embodiments corresponding to the task scheduling method. On this basis, the present invention also discloses a task scheduling device, a device, a non-volatile storage medium, and a computer program product corresponding to the above method.
[0186] The task scheduling device provided by an embodiment of the present invention may include:
[0187] An obtaining unit, configured to obtain the task dependency relationships among multiple subtasks of a target task;
[0188] A determining unit, configured to determine the to-be-allocated subtasks that can be parallelized currently according to the task dependency relationships; and determine the first task execution cost of the to-be-allocated subtasks and the second task execution cost of the next subtasks of the to-be-allocated subtasks after allocating the to-be-allocated subtasks to resource nodes according to the status information of each resource node in the target distributed system;
[0189] An optimization calculation unit, configured to determine the parallel task execution cost according to the first task execution cost of each to-be-allocated subtask, perform optimization calculation with minimizing the parallel task execution cost as the optimization objective and with the second task execution cost of each next subtask satisfying the cost constraint condition as the constraint condition, so as to obtain the target resource node corresponding to each to-be-allocated subtask;
[0190] A control unit, configured to allocate the to-be-allocated subtasks to the target resource nodes for execution.
[0191] It should be noted that in each implementation manner of the task scheduling device provided by the embodiment of the present invention, the division of the units is only a logical functional division, and other division methods may be adopted. The connection manners between different units may be electrical, mechanical or other connection manners. The separated units may be located at the same physical location or distributed on multiple network nodes. Each unit may be implemented in the form of hardware or in the form of a software functional unit. That is, some or all of the units provided by the embodiment of the present invention may be selected according to actual needs and the corresponding connection manners or integration manners may be adopted to achieve the purpose of the solution of the embodiment of the present invention.
[0192] Since the embodiments of the device part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the device part, and details are not described herein again.
[0193] Figure 5 It is a schematic structural diagram of a task scheduling device provided by an embodiment of the present invention.
[0194] As Figure 5 shown, the task scheduling device provided by an embodiment of the present invention includes: a memory 510, configured to store a computer program 511; and a processor 520, configured to execute the computer program 511, and when the computer program 511 is executed by the processor 520, the steps of the task scheduling method provided by any one of the above embodiments are implemented.
[0195] Among them, the processor 520 may include one or more processing cores, such as a 3-core processor, an 8-core processor, etc. The processor 520 may be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array. The processor 520 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the wake state, also known as the central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 520 may be integrated with a graphics processing unit (GPU), and the graphics processor is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 520 may further include an artificial intelligence (AI) processor, and the artificial intelligence processor is used to process computational operations related to machine learning.
[0196] The memory 510 may include one or more non-volatile storage media, and the non-volatile storage media may be non-transitory. The memory 510 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash storage devices. In this embodiment, the memory 510 is at least used to store the following computer program 511. After the computer program 511 is loaded and executed by the processor 520, it can implement the relevant steps in the task scheduling method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 510 may also include an operating system 512 and data 513, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 512 may be Windows or other types of operating systems. The data 513 may include, but is not limited to, the data involved in the above method.
[0197] In some embodiments, the task scheduling device may further include a display screen 530, a power supply 540, a communication interface 550, an input / output interface 560, a sensor 570, and a communication bus 580.
[0198] Those skilled in the art can understand that Figure 5 the structure shown in
[0199] The task scheduling device provided by an embodiment of the present invention includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the steps of the task scheduling method provided in the above embodiment, and the effect is the same as above.
[0200] An embodiment of the present invention provides a non-volatile storage medium, on which a computer program is stored. When the computer program is executed by a processor, it can implement the steps of the task scheduling method provided in any one of the above embodiments.
[0201] The non-volatile storage medium may include: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc.
[0202] For the introduction of the non-volatile storage medium provided by an embodiment of the present invention, please refer to the above method embodiment, and the effect it achieves is the same as the task scheduling method provided by an embodiment of the present invention. The present invention will not elaborate here.
[0203] An embodiment of the present invention provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the steps of the task scheduling method provided in any one of the above embodiments.
[0204] For the introduction of the computer program product provided by an embodiment of the present invention, please refer to the above method embodiment, and the effect it achieves is the same as the task scheduling method provided by an embodiment of the present invention. The present invention will not elaborate here.
[0205] The above has provided a detailed introduction to a task scheduling method, device, medium, and computer program product provided by the present invention. The embodiments in the specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other. For the devices, equipment, non-volatile storage media, and computer program products disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple. For the relevant parts, please refer to the description of the method part. It should be noted that for those of ordinary skill in the art in this technical field, without departing from the principle of the present invention, several improvements and modifications can still be made to the present invention, and these improvements and modifications also fall within the protection scope of the present invention.
[0206] It should also be noted that in this specification, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising that element.
Claims
1. A task scheduling method, characterized in that: include: Get the task dependencies between multiple subtasks of the target task; According to the task dependency, determine the subtasks to be assigned that can be currently performed in parallel; According to the status information of each resource node in the target distributed system, after the subtask to be assigned is assigned to the resource node, the maximum value of the sum of the maximum value of the transmission time of the input data of the subtask to be assigned from the resource node where the previous subtask is located to the resource node that executes the subtask to be assigned and the transmission time of the task parameter of the subtask to be assigned from another resource node to the resource node that executes the subtask to be assigned is calculated, and the execution time of the subtask to be assigned on the resource node is added to obtain the first task execution cost; Determine, in ascending order of the execution cost of the first task, a first number of the resource nodes as candidate resource nodes corresponding to the subtask to be assigned; Determine a second task execution cost of the next subtask after allocating the to-be-allocated subtask to the candidate resource node; Determine the parallel task execution cost according to the first task execution cost of each of the subtasks to be assigned, take minimizing the parallel task execution cost as the optimization goal, take the second task execution cost of each of the next subtasks satisfying the cost constraint as the constraint condition, perform optimization calculation, and obtain the target resource node corresponding to each of the subtasks to be assigned; Allocate the subtask to be assigned to the target resource node for execution, and if the target task still has subsequent subtasks, execute the subsequent subtasks according to the task dependency relationship to determine the subtask to be assigned that can be currently executed in parallel; Among them, the execution cost of the second task of each next subtask satisfies the cost constraint condition, including: after the resource node executes the subtask to be assigned, the time cost of the resource node where the subtask to be assigned is located to execute the next subtask or the time cost of transmitting the output data of the subtask to be assigned to the resource node of the next subtask does not exceed the cost constraint condition.
2. The task scheduling method according to claim 1, characterized in that: The first task execution cost is the sum of a first time for the resource node to acquire the calculation parameters required for the subtask to be assigned and a second time for the resource node to execute the subtask to be assigned.
3. The task scheduling method according to claim 2, characterized in that: The parallel task execution cost is the sum of the first task execution costs of the subtasks to be assigned.
4. The task scheduling method according to claim 2, characterized in that: The parallel task execution cost is the maximum value of the first task execution costs of the subtasks to be assigned.
5. The task scheduling method according to claim 2, characterized in that: If the resource node has the task parameters of the subtask to be assigned, the first time is the time when the resource node obtains the input data of the subtask to be assigned; If the resource node does not have the task parameters of the subtask to be assigned, the first time is determined according to the time when the resource node obtains the task parameters of the subtask to be assigned and the time when the resource node obtains the input data of the subtask to be assigned.
6. The task scheduling method according to claim 1, characterized in that: The second task execution cost is the sum of a third time for the resource node executing the next subtask to obtain the calculation parameters of the next subtask and a fourth time for the resource node to execute the next subtask.
7. The task scheduling method according to claim 1, characterized in that: Also includes: Determine a first number of resource nodes as candidate resource nodes corresponding to the subtasks to be assigned according to the order of the execution costs of the first tasks corresponding to the subtasks to be assigned from small to large; After the subtask to be assigned is assigned to the target resource node for execution, if the target resource node fails, the subtask to be assigned is migrated to another candidate resource node corresponding to the subtask to be assigned.
8. The task scheduling method according to claim 7, characterized in that: Migrating the to-be-assigned subtask to another of the candidate resource nodes corresponding to the to-be-assigned subtask includes: Performing availability evaluation on the other multiple candidate resource nodes corresponding to the subtask to be assigned, and obtaining an availability evaluation value corresponding to each candidate resource node; Migrate the subtask to be assigned to the candidate resource node with the greatest availability.
9. The task scheduling method according to claim 8, characterized in that: Performing availability evaluation on the other multiple candidate resource nodes corresponding to the subtask to be assigned to obtain an availability evaluation value corresponding to each candidate resource node, including: The availability of the candidate resource node is evaluated according to the resources required by the to-be-assigned subtask, the available resources of the candidate resource node, and the historical failure data of the candidate resource node to obtain the availability evaluation value of the candidate resource node.
10. The task scheduling method according to claim 1, characterized in that: The target distributed system is an edge computing system; The subtask to be assigned is the subtask that currently needs to be offloaded from the terminal device to the target edge computing device in the edge computing system.
11. The task scheduling method according to claim 1, characterized in that: Get the task dependencies between multiple subtasks of the target task, including: A directed acyclic graph corresponding to the target task is obtained, wherein the graph nodes in the directed acyclic graph correspond to the subtasks one-to-one, and the directed edges in the directed acyclic graph are used to represent the dependency relationship between the subtasks.
12. A task scheduling device, characterized in that: include: Memory for storing computer programs; A processor is used to execute the computer program, and when the computer program is executed by the processor, the steps of the task scheduling method according to any one of claims 1 to 11 are implemented.
13. A non-volatile storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the task scheduling method according to any one of claims 1 to 11 are implemented.
14. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the task scheduling method according to any one of claims 1 to 11 are implemented.
Citation Information
Patent Citations
Scheduling method for directed acyclic graph tasks in heterogeneous multi-core processor system
CN112817708A
Task scheduling method, device and system, server and storage medium
CN118093126A