Task scheduling method and device based on directed acyclic graph

By building a directed acyclic graph in task scheduling, determining the target key link and calculating the optimized time, the problem of difficulty in finding the optimal task scheduling time in the prior art is solved, and efficient and accurate task scheduling is achieved.

CN119440758APending Publication Date: 2025-02-14SHENZHEN YISHIHUOLALA TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411484928.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-23
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

Existing task scheduling methods are difficult to find the optimal task scheduling time when dealing with scenarios where the latest data is needed at a specific time, especially when there are dependencies between tasks.

Method used

Using a task scheduling method based on directed acyclic graph (DAG), by constructing a directed acyclic graph with task dependencies, assigning each task waiting parameters and weight parameters, determining the target key link, calculating the optimization time, and recursively Adjust task scheduling time.

Benefits of technology

It realizes efficient and accurate adjustment of the set time of unreasonable tasks in the task link, so as to achieve the optimal task scheduling time and meets the customer's need to see the latest data at a specific time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440758A_ABST
    Figure CN119440758A_ABST
Patent Text Reader

Abstract

The invention discloses a task scheduling method and device based on a directed acyclic graph, and the method comprises the steps: firstly constructing the directed acyclic graph based on tasks, and then endowing each node with a corresponding waiting parameter according to the waiting time of each task, endowing each node with a corresponding weight parameter according to the execution time of each task; then determining a target key link of the directed acyclic graph, and calculating to obtain an optimizable duration; and finally, performing upward recursion from the terminal task, calculating to obtain the optimizable time length of the current node according to the optimizable time length and the waiting parameter of the current node, and obtaining the optimizable time length of each node until the last node of the upper layer of the directed acyclic graph. Through the above mode, after the directed acyclic graph is constructed based on the task, the optimizable duration is calculated through the target key link of the directed acyclic graph, and then the set time of the unreasonable task in the task link can be efficiently and accurately adjusted, so that the optimal task scheduling time is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of task scheduling, and in particular to a task scheduling method and device based on a directed acyclic graph. Background Art

[0002] Mainstream big data platforms are still developed and designed with batch processing engines such as hive, a data warehouse tool based on Hadoop, and spark, an open source distributed fast computing framework, as their core. One issue that often needs to be considered when designing such platforms is when these data processing tasks should be scheduled.

[0003] The current mainstream task scheduling is that there is a dependency between tasks. When the upstream task is finished, the downstream task will start the dependency scheduling, which allows data processing tasks to be carried out one after another without waiting time between tasks. However, when a scenario occurs, such as when a customer needs to see the latest data at 4 pm, the dependency scheduling solution does not meet the needs.

[0004] Therefore, how to find the optimal task scheduling time is a technical problem that needs to be solved urgently. Summary of the invention

[0005] In view of this, the present application provides a task scheduling method and device based on a directed acyclic graph, which aims to efficiently and accurately adjust the setting time of unreasonable tasks in a task chain, so as to achieve the optimal task scheduling time.

[0006] In a first aspect, the present application provides a task scheduling method based on a directed acyclic graph, the method comprising:

[0007] Constructing a directed acyclic graph based on the tasks, wherein the nodes of the directed acyclic graph are tasks, and the edges of the directed acyclic graph are tasks with dependencies;

[0008] Assign a corresponding waiting parameter to each node according to the waiting time of each task, and assign a corresponding weight parameter to each node according to the execution time of each task;

[0009] Determine a target critical link of the directed acyclic graph, wherein the target critical link is a link in the task link with the longest sum of weight parameters to the terminal task, and the terminal task is an end node of the directed acyclic graph;

[0010] Calculate the optimizable duration according to the sum of the weight parameters and the task completion time of the terminal task;

[0011] Recursively upward from the terminal task, the optimizable duration of the current node is calculated according to the optimizable duration and the waiting parameter of the current node, until the last node of the upper layer of the directed acyclic graph, to obtain the optimizable duration of each node.

[0012] Optionally, the method further comprises:

[0013] If the waiting parameter of the current node is less than the waiting boundary value, the task scheduling time of the current node is not adjusted.

[0014] Optionally, after calculating the optimizable time length of the current node according to the optimizable time length and the waiting parameter of the current node, the method further includes:

[0015] If the waiting parameter of the current node is greater than the waiting boundary value, calculating a first difference between the optimizable time length and the waiting parameter of the current node;

[0016] If the first difference is greater than a preset threshold, the first difference is used as the optimizable duration of the current node.

[0017] Optionally, the method further includes: if the first difference is smaller than a preset threshold, the task scheduling time of the current node is not adjusted.

[0018] Optionally, the method further comprises:

[0019] A second difference between the optimizable duration and the first difference is used as a remaining optimizable duration of a node next to the current node.

[0020] Optionally, the method further comprises:

[0021] When the terminal task output is delayed, a problem node of the target key link is determined according to the target key link.

[0022] Optionally, determining a problem node of the target key link according to the target key link includes:

[0023] According to the target key link and the key links of the historical directed acyclic graph, the problem node of the target key link is determined.

[0024] In a second aspect, the present application provides a task scheduling device based on a directed acyclic graph, the device comprising:

[0025] A construction module, used to construct a directed acyclic graph based on tasks, wherein the nodes of the directed acyclic graph are tasks, and the edges of the directed acyclic graph are tasks with dependencies;

[0026] The assignment module is used to assign corresponding waiting parameters to each node according to the waiting time of each task, and to assign corresponding weight parameters to each node according to the execution time of each task;

[0027] A determination module, used to determine a target critical link of the directed acyclic graph, wherein the target critical link is a link in the task link with the longest sum of weight parameters to the terminal task, and the terminal task is an end node of the directed acyclic graph;

[0028] A calculation module, used for calculating the optimizable duration according to the sum of the weight parameters and the task completion time of the terminal task;

[0029] The recursive module is used to recursively upward from the terminal task, calculate the optimizable time of the current node according to the optimizable time and the waiting parameter of the current node, until the last node of the upper layer of the directed acyclic graph, and obtain the optimizable time of each node.

[0030] Optionally, the device further comprises:

[0031] The adjustment module is used for not adjusting the task scheduling time of the current node if the waiting parameter of the current node is less than the waiting boundary value.

[0032] Optionally, after the optimizable time length of the current node is calculated according to the optimizable time length and the waiting parameter of the current node;

[0033] The calculation module is further configured to calculate a first difference between the optimizable duration and the waiting parameter of the current node if the waiting parameter of the current node is greater than the waiting boundary value;

[0034] The adjustment module is further configured to use the first difference as the optimizable duration of the current node if the first difference is greater than a preset threshold.

[0035] Optionally, the adjustment module is further configured to: if the first difference is less than a preset threshold, not adjust the task scheduling time of the current node.

[0036] Optionally, the adjustment module is further configured to use a second difference between the optimizable duration and the first difference as a remaining optimizable duration of a next node of the current node.

[0037] Optionally, the determination module is further configured to determine a problem node of the target critical link according to the target critical link when the output of the terminal task is delayed.

[0038] Optionally, the determination module is specifically configured to determine a problem node of the target critical link according to the target critical link and the critical links of the historical directed acyclic graph.

[0039] In a third aspect, an embodiment of the present application provides an electronic device, the electronic device comprising:

[0040] A memory for storing one or more programs;

[0041] Processor; when the one or more programs are executed by the processor, the task scheduling method based on the directed acyclic graph described in any one of the first aspects above is implemented.

[0042] In a fourth aspect, an embodiment of the present application provides a computer storage medium, in which a program is stored. When the program is executed by a processor, the task scheduling method based on a directed acyclic graph as described in any one of the first aspects above is implemented.

[0043] The above technical solution has the following beneficial effects:

[0044] The present application provides a task scheduling method and device based on a directed acyclic graph. When executing the method, a directed acyclic graph is first constructed based on tasks, wherein the nodes of the directed acyclic graph are tasks, and the edges of the directed acyclic graph are tasks with dependencies; then, a corresponding waiting parameter is assigned to each node according to the waiting time of each task, and a corresponding weight parameter is assigned to each node according to the execution time of each task; then, a target critical link of the directed acyclic graph is determined, wherein the target critical link is the link with the longest sum of weight parameters to a terminal task in the task link, and the terminal task is the end node of the directed acyclic graph; then, the optimizable duration is calculated based on the sum of the weight parameters and the task completion time of the terminal task; finally, recursively upward from the terminal task, the optimizable duration of the current node is calculated based on the optimizable duration and the waiting parameter of the current node, until the last node of the upper layer of the directed acyclic graph is reached, and the optimizable duration of each node is obtained. Through the above method, after constructing a directed acyclic graph based on tasks, the optimizable duration is calculated through the target key link of the directed acyclic graph, and then the setting time of unreasonable tasks in the task link can be adjusted efficiently and accurately, so as to achieve the optimal task scheduling time. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in this embodiment or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0046] Figure 1 A flow chart of a task scheduling method based on a directed acyclic graph provided in an embodiment of the present application;

[0047] Figure 2 Another flow chart of a task scheduling method based on a directed acyclic graph provided in an embodiment of the present application;

[0048] Figure 3 A structural schematic diagram of a task scheduling device based on a directed acyclic graph provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] The technical scheme in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only a part of the embodiment of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0050] In order to facilitate further understanding of the technical solution provided by this application, the background technology involved in this application will be explained below.

[0051] Mainstream big data platforms are still developed and designed with batch processing engines such as hive, a data warehouse tool based on Hadoop, and spark, an open source distributed fast computing framework, as their core. One issue that often needs to be considered when designing such platforms is when these data processing tasks should be scheduled.

[0052] There are currently two mainstream scheduling methods:

[0053] Dependency scheduling: There are dependencies between tasks. When the upstream task is finished, the downstream task will start.

[0054] Scheduled scheduling: The task starts running after the set time arrives.

[0055] These two types of scheduling methods have their own advantages and disadvantages. The first scheduling method allows data processing tasks to be performed one after another in sequence without any waiting time between tasks. However, when a scenario occurs, such as a customer needs to see the latest data at 4 pm, the first scheduling solution will not meet the needs and a scheduled scheduling method is required.

[0056] Therefore, how to find the optimal task scheduling time is a technical problem that needs to be solved urgently.

[0057] In order to overcome the above technical problems, an embodiment of the present application provides a task scheduling method based on a directed acyclic graph, firstly, a directed acyclic graph is constructed based on the tasks, wherein the nodes of the directed acyclic graph are tasks, and the edges of the directed acyclic graph are tasks with dependencies; then, a corresponding waiting parameter is assigned to each node according to the waiting time of each task, and a corresponding weight parameter is assigned to each node according to the execution time of each task; then, the target critical link of the directed acyclic graph is determined, the target critical link is the link with the longest sum of weight parameters to the terminal task in the task link, and the terminal task is the end node of the directed acyclic graph; then, the optimizable duration is calculated based on the sum of the weight parameters and the task completion time of the terminal task; finally, recursively upward from the terminal task, the optimizable duration of the current node is calculated based on the optimizable duration and the waiting parameter of the current node, until the last node of the upper layer of the directed acyclic graph, the optimizable duration of each node is obtained. Through the above method, after constructing a directed acyclic graph based on tasks, the optimizable duration is calculated through the target key link of the directed acyclic graph, and then the setting time of unreasonable tasks in the task link can be adjusted efficiently and accurately, so as to achieve the optimal task scheduling time.

[0058] See also Figure 1 , Figure 1 A flowchart of a task scheduling method based on a directed acyclic graph provided in an embodiment of the present application. The method in the embodiment of the present application can be executed by a task scheduling device, which can be implemented in software and / or hardware and can generally be integrated in a server or terminal device.

[0059] The method may include:

[0060] Step S101: constructing a directed acyclic graph based on tasks, wherein the nodes of the directed acyclic graph are tasks, and the edges of the directed acyclic graph are tasks with dependencies.

[0061] A directed acyclic graph (DAG) is a directed graph consisting of vertices and edges. The edges are directed and there are no cycles in the graph. Each edge points from one vertex to another and does not form a closed loop.

[0062] In this step, a directed acyclic graph is first constructed based on the tasks. Specifically, the directed acyclic graph is constructed with the tasks as nodes of the directed acyclic graph and the dependencies between the tasks as edges of the directed acyclic graph.

[0063] Step S102: assigning a corresponding waiting parameter to each node according to the waiting time of each task, and assigning a corresponding weight parameter to each node according to the execution time of each task.

[0064] After the directed acyclic graph is constructed based on the tasks in step S101, a corresponding wait parameter and a weight parameter are assigned to each node according to the waiting time and execution time of each task, so as to facilitate the subsequent calculation of the target key link.

[0065] Step S103: determining a target critical link of the directed acyclic graph, wherein the target critical link is a link in the task link with the longest sum of weight parameters to the terminal task, and the terminal task is the end node of the directed acyclic graph.

[0066] In this embodiment, after assigning corresponding wait parameters and weight parameters to each node according to each task waiting time and execution time in step S102, the target critical link of the directed acyclic graph is further determined. Wherein, the target critical link is the link with the longest sum of weight parameters to the terminal task in the task link, that is, the link with the longest sum of weight parameters to the terminal task in the task link of the directed acyclic graph is calculated as the critical link, and the terminal task is the end node of the directed acyclic graph.

[0067] It should be noted that this application achieves efficient analysis and problem location of complex overall links by disassembling and analyzing the key links in all branch links.

[0068] Step S104: Calculate the optimizable duration according to the sum of the weight parameters and the task completion time of the terminal task.

[0069] After determining the target critical link of the directed acyclic graph, the optimizable duration may be calculated based on the sum of the weight parameters and the task completion time of the terminal task.

[0070] Specifically, the optimizable duration gap is obtained by comparing the total weight parameter weight and the terminal task completion time, in minutes.

[0071] Step S105: recursively upward from the terminal task, and calculate the optimizable duration of the current node according to the optimizable duration and the waiting parameter of the current node, until the last node of the upper layer of the directed acyclic graph, to obtain the optimizable duration of each node.

[0072] Specifically, after the optimizable time is calculated, recursion is performed upward from the terminal node to refresh the remaining optimizable time of the current node. The remaining optimizable time is refreshed by subtracting the waiting parameter of the current node from the optimizable time of the current node.

[0073] It can be seen from the above technical scheme that the embodiment of the present application first constructs a directed acyclic graph based on tasks, wherein the nodes of the directed acyclic graph are tasks, and the edges of the directed acyclic graph are tasks with dependencies; then, a corresponding waiting parameter is assigned to each node according to the waiting time of each task, and a corresponding weight parameter is assigned to each node according to the execution time of each task; then, the target critical link of the directed acyclic graph is determined, and the target critical link is the link with the longest sum of weight parameters to the terminal task in the task link, and the terminal task is the end node of the directed acyclic graph; then, the optimizable duration is calculated based on the sum of the weight parameters and the task completion time of the terminal task; finally, recursively upward from the terminal task, the optimizable duration of the current node is calculated based on the optimizable duration and the waiting parameter of the current node, until the last node of the upper layer of the directed acyclic graph, the optimizable duration of each node is obtained. Through the above method, after constructing a directed acyclic graph based on tasks, the optimizable duration is calculated through the target key link of the directed acyclic graph, and then the setting time of unreasonable tasks in the task link can be adjusted efficiently and accurately, so as to achieve the optimal task scheduling time.

[0074] In a possible implementation, the method further includes:

[0075] If the waiting parameter of the current node is less than the waiting boundary value, the task scheduling time of the current node is not adjusted.

[0076] Specifically, when the waiting parameter of the current node is less than the waiting boundary value, it means that the task has no extra waiting time except for the task dispatch scheduling at the platform level, and the task scheduling time of the current node is not adjusted.

[0077] It is understandable that the waiting boundary value can be set according to actual needs and is not limited here.

[0078] Further, in a possible implementation manner, after the optimizable time length of the current node is calculated according to the optimizable time length and the waiting parameter of the current node, the method further includes:

[0079] If the waiting parameter of the current node is greater than the waiting boundary value, calculating a first difference between the optimizable time length and the waiting parameter of the current node;

[0080] If the first difference is greater than a preset threshold, taking the first difference as the optimizable duration of the current node;

[0081] If the first difference is smaller than a preset threshold, the task scheduling time of the current node is not adjusted.

[0082] Specifically, if the waiting parameter of the current node is greater than the waiting boundary value, it means that in addition to the task dispatch scheduling at the platform level, the task has extra waiting time. If it is confirmed that the waiting is caused by task dispatch.

[0083] Therefore, the first difference between the optimizable duration and the waiting parameter of the current node is further calculated. When the first difference is greater than the preset threshold, the first difference is used as the optimizable duration of the current node. When the first difference is less than the preset threshold, the task scheduling time of the current node is not adjusted.

[0084] It is understandable that the preset threshold can be set according to actual needs, such as 0.

[0085] Furthermore, in a possible implementation, the method further includes:

[0086] A second difference between the optimizable duration and the first difference is used as a remaining optimizable duration of a node next to the current node.

[0087] In this embodiment, after calculating the optimizable duration of the current node, the second difference between the optimizable duration and the first difference is used as the remaining optimizable duration of the next node of the current node.

[0088] In the specific implementation, it is determined whether the current node is the last node of the upper layer of the directed acyclic graph. When the current node is the last node of the upper layer of the directed acyclic graph, the scheduling loop is stopped to obtain the optimizable duration of each node.

[0089] In a possible implementation manner, the method further includes: when the terminal task output is delayed, determining a problem node of the target critical link according to the target critical link.

[0090] Specifically, in a possible implementation manner, determining the problem node of the target critical link according to the target critical link includes:

[0091] According to the target key link and the key links of the historical directed acyclic graph, the problem node of the target key link is determined.

[0092] Specifically, when the output of a terminal task is delayed, by analyzing the difference between the key links of the day and the key links of the historical directed acyclic graph, for example, analyzing the difference between the key links of the directed acyclic graph of the day and the key links of the directed acyclic graph of the previous day, it is possible to quickly locate which link of the entire link has a problem.

[0093] Furthermore, analyzing and breaking down the daily changes in key links can help understand whether there are any delays in the scheduling time of the entire link.

[0094] In order to further understand the technical solution of this application, Figure 2 The embodiments of the present application are described as follows:

[0095] See also Figure 2 , which is another flow chart of the task scheduling method based on directed acyclic graph provided in an embodiment of the present application.

[0096] like Figure 2 As shown, 01: Get the weight parameter weight and waiting parameter wait of all nodes in the task link of the day, where the running time is the task start time-task end time, and the waiting parameter is the task start time-the completion time of the last upstream task. The units of wait and weight are both minutes.

[0097] 02: Calculate the link with the longest total weight parameter weight to the terminal task in the directed acyclic graph as the key link, and compare the total weight duration with the terminal task completion time on the day to obtain the optimizable duration gap in minutes.

[0098] 03: Starting from the terminal node, update the remaining optimizable time of the current node. The remaining optimizable time of the current node is updated by subtracting the waiting parameter of the current node from the remaining optimizable time of the current node.

[0099] It can be understood that 01 to 03 are data preparation work before starting a layer of recursive comparison, and obtaining the key parameters weight, wait and gap used for subsequent comparison.

[0100] According to the waiting parameter wait of the current node, it can be determined whether the node has unnecessary scheduling waiting. Usually, we set a waiting boundary value. A value higher than the waiting boundary value means that in addition to the task dispatch scheduling at the platform level, the task has extra waiting time. If it is confirmed that the waiting is caused by task dispatch, go to step 04, otherwise go to step 06.

[0101] 04 and 05: Calculate the gap-wait of the node and determine whether it is less than or equal to 0. If it is less than or equal to 0, no optimization is required at the node. If it is greater than 0, the calculated result is the duration of the task adjustment forward.

[0102] 06: If the task waiting time does not reach the waiting boundary value, or the time required for adjustment is less than or equal to 0, the task does not need any adjustment or optimization because the task has reached the optimal scheduling time.

[0103] 07 and 08: These two steps determine whether the top layer of the link has been reached. If it has been reached, step 08 is entered to stop the scheduling loop, and then step 09 outputs the scheduling optimization time of each node. If it has not reached the top layer, step 03 is returned to calculate the next round of optimization time.

[0104] It can be understood that after constructing a directed acyclic graph based on tasks, the embodiment of the present application calculates the optimizable duration through the target key link of the directed acyclic graph, and then can efficiently and accurately adjust the set time of unreasonable tasks in the task link, thereby achieving the optimal task scheduling time.

[0105] For the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the order of the actions described, because according to the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0106] The above are some specific implementations of the directed acyclic graph-based task scheduling method provided in the embodiment of the present application. Based on this, the present application also provides a corresponding device. The following will introduce the directed acyclic graph-based task scheduling device provided in the embodiment of the present application from the perspective of functional modularization.

[0107] See also Figure 3 , is a structural schematic diagram of a task scheduling device based on a directed acyclic graph provided in an embodiment of the present application, the device comprising:

[0108] A construction module 301 is used to construct a directed acyclic graph based on tasks, wherein the nodes of the directed acyclic graph are tasks, and the edges of the directed acyclic graph are tasks with dependencies;

[0109] The assigning module 302 is used to assign a corresponding waiting parameter to each node according to the waiting time of each task, and assign a corresponding weight parameter to each node according to the execution time of each task;

[0110] A determination module 303 is used to determine a target critical link of the directed acyclic graph, wherein the target critical link is a link in the task link with the longest sum of weight parameters to the terminal task, and the terminal task is an end node of the directed acyclic graph;

[0111] A calculation module 304 is used to calculate the optimizable duration according to the sum of the weight parameters and the task completion time of the terminal task;

[0112] The recursive module 305 is used to recursively upward from the terminal task, calculate the optimizable time of the current node according to the optimizable time and the waiting parameter of the current node, until the last node of the upper layer of the directed acyclic graph, to obtain the optimizable time of each node.

[0113] Optionally, the device further comprises:

[0114] The adjustment module is used for not adjusting the task scheduling time of the current node if the waiting parameter of the current node is less than the waiting boundary value.

[0115] Optionally, after the optimizable time length of the current node is calculated according to the optimizable time length and the waiting parameter of the current node;

[0116] The calculation module is further configured to calculate a first difference between the optimizable duration and the waiting parameter of the current node if the waiting parameter of the current node is greater than the waiting boundary value;

[0117] The adjustment module is further configured to use the first difference as the optimizable duration of the current node if the first difference is greater than a preset threshold;

[0118] The adjustment module is further configured to: if the first difference is less than a preset threshold, the task scheduling time of the current node is not adjusted.

[0119] Optionally, the adjustment module is further configured to use a second difference between the optimizable duration and the first difference as a remaining optimizable duration of a next node of the current node.

[0120] Optionally, the determination module is further configured to determine the problem node of the target critical link according to the target critical link and the critical link of the previous day when the terminal task output is delayed.

[0121] It can be seen from the above technical scheme that the embodiment of the present application first constructs a directed acyclic graph based on tasks, wherein the nodes of the directed acyclic graph are tasks, and the edges of the directed acyclic graph are tasks with dependencies; then, a corresponding waiting parameter is assigned to each node according to the waiting time of each task, and a corresponding weight parameter is assigned to each node according to the execution time of each task; then, the target critical link of the directed acyclic graph is determined, and the target critical link is the link with the longest sum of weight parameters to the terminal task in the task link, and the terminal task is the end node of the directed acyclic graph; then, the optimizable duration is calculated based on the sum of the weight parameters and the task completion time of the terminal task; finally, recursively upward from the terminal task, the optimizable duration of the current node is calculated based on the optimizable duration and the waiting parameter of the current node, until the last node of the upper layer of the directed acyclic graph, the optimizable duration of each node is obtained. Through the above method, after constructing a directed acyclic graph based on tasks, the optimizable duration is calculated through the target key link of the directed acyclic graph, and then the setting time of unreasonable tasks in the task link can be adjusted efficiently and accurately, so as to achieve the optimal task scheduling time.

[0122] An embodiment of the present application further provides an electronic device, comprising: a memory for storing one or more programs;

[0123] Processor; when the one or more programs are executed by the processor, the task scheduling method based on the directed acyclic graph described in the above embodiment is implemented.

[0124] An embodiment of the present application further provides a computer storage medium, in which a program is stored. When the program is executed by a processor, the task scheduling method based on a directed acyclic graph described in the above embodiment is implemented.

[0125] The "first" and "second" in the names such as "first" and "second" (if any) mentioned in the embodiments of the present application are only used as name identifiers and do not represent the first or second in order.

[0126] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0127] Those skilled in the art can understand that the flowchart shown in the figure is only an example in which the embodiments of the present application can be implemented, and the scope of application of the embodiments of the present application is not limited by any aspect of the flowchart.

[0128] In the several embodiments provided in the present application, it should be understood that the disclosed methods, devices and equipment can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of the device or unit can be electrical, mechanical or other forms.

[0129] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, the functional units in the various embodiments of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0130] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.

[0131] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A task scheduling method based on directed acyclic graph, characterized in that: The method comprises: Constructing a directed acyclic graph based on the tasks, wherein the nodes of the directed acyclic graph are tasks, and the edges of the directed acyclic graph are tasks with dependencies; Assign a corresponding waiting parameter to each node according to the waiting time of each task, and assign a corresponding weight parameter to each node according to the execution time of each task; Determine a target critical link of the directed acyclic graph, wherein the target critical link is a link in the task link with the longest sum of weight parameters to the terminal task, and the terminal task is an end node of the directed acyclic graph; Calculate the optimizable duration according to the sum of the weight parameters and the task completion time of the terminal task; Recursively upward from the terminal task, the optimizable duration of the current node is calculated according to the optimizable duration and the waiting parameter of the current node, until the last node of the upper layer of the directed acyclic graph, to obtain the optimizable duration of each node.

2. The method according to claim 1, characterized in that The method further comprises: If the waiting parameter of the current node is less than the waiting boundary value, the task scheduling time of the current node is not adjusted.

3. The method according to claim 2, characterized in that After calculating the optimizable time length of the current node according to the optimizable time length and the waiting parameter of the current node, the method further includes: If the waiting parameter of the current node is greater than the waiting boundary value, calculating a first difference between the optimizable time length and the waiting parameter of the current node; If the first difference is greater than a preset threshold, the first difference is used as the optimizable duration of the current node.

4. The method according to claim 3, characterized in that The method further comprises: If the first difference is smaller than a preset threshold, the task scheduling time of the current node is not adjusted.

5. The method according to claim 3, characterized in that: The method further comprises: A second difference between the optimizable duration and the first difference is used as a remaining optimizable duration of a node next to the current node.

6. The method according to claim 1, characterized in that The method further comprises: When the terminal task output is delayed, a problem node of the target key link is determined according to the target key link.

7. The method according to claim 6, characterized in that Determining a problem node of the target key link according to the target key link includes: According to the target key link and the key links of the historical directed acyclic graph, the problem node of the target key link is determined.

8. A task scheduling device based on a directed acyclic graph, characterized in that: The device comprises: A construction module, used to construct a directed acyclic graph based on tasks, wherein the nodes of the directed acyclic graph are tasks, and the edges of the directed acyclic graph are tasks with dependencies; The assignment module is used to assign corresponding waiting parameters to each node according to the waiting time of each task, and to assign corresponding weight parameters to each node according to the execution time of each task; A determination module, used to determine a target critical link of the directed acyclic graph, wherein the target critical link is a link in the task link with the longest sum of weight parameters to the terminal task, and the terminal task is an end node of the directed acyclic graph; A calculation module, used for calculating the optimizable duration according to the sum of the weight parameters and the task completion time of the terminal task; The recursive module is used to recursively upward from the terminal task, calculate the optimizable time of the current node according to the optimizable time and the waiting parameter of the current node, until the last node of the upper layer of the directed acyclic graph, and obtain the optimizable time of each node.

9. The device according to claim 8, characterized in that The device also includes: The adjustment module is used for not adjusting the task scheduling time of the current node if the waiting parameter of the current node is less than the waiting boundary value.

10. The device according to claim 9, characterized in that After the optimizable time length of the current node is calculated according to the optimizable time length and the waiting parameter of the current node; The calculation module is further configured to calculate a first difference between the optimizable duration and the waiting parameter of the current node if the waiting parameter of the current node is greater than the waiting boundary value; The adjustment module is further configured to use the first difference as the optimizable duration of the current node if the first difference is greater than a preset threshold.

Citation Information

Cited By

  • Campus security risk identification method and system based on multi-algorithm nested cooperation, and medium

    CN121504187A

  • Campus safety risk identification method and system based on multi-algorithm nested cooperation, and medium

    CN121504187B