WO2022253165A1 - 调度方法、系统、服务器和计算机可读存储介质 - Google Patents

调度方法、系统、服务器和计算机可读存储介质 Download PDF

Info

Publication number
WO2022253165A1
WO2022253165A1 PCT/CN2022/095893 CN2022095893W WO2022253165A1 WO 2022253165 A1 WO2022253165 A1 WO 2022253165A1 CN 2022095893 W CN2022095893 W CN 2022095893W WO 2022253165 A1 WO2022253165 A1 WO 2022253165A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
scheduled
tasks
parent
newly added
Prior art date
Application number
PCT/CN2022/095893
Other languages
English (en)
French (fr)
Inventor
赵绍航
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2022253165A1 publication Critical patent/WO2022253165A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/283Multi-dimensional databases or data warehouses, e.g. MOLAP or ROLAP
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt

Definitions

  • the embodiments of the present application relate to the field of computer technology, and in particular to a scheduling method, system, server, and computer-readable storage medium.
  • Scheduling technology has been widely used in space environment, logistics distribution, production scheduling, business services and other fields.
  • scheduling problem of computing resources.
  • computing requirements become more and more complex and onerous.
  • computing tasks There will be a lot of computing tasks in the data warehouse.
  • scheduling is mostly performed according to a task execution state table or a previous scheduling strategy.
  • the tasks in the data warehouse are constantly updated and dynamically increased or decreased.
  • the task execution status table formed based on prior knowledge and the previous scheduling strategy may not be suitable for new task scheduling, which will lead to poor scheduling accuracy.
  • the scheduling is unstable and the scheduling efficiency is not high. For this, the performance of the hardware equipment can only be improved to support the normal progress of the task, which increases the investment cost and the later maintenance cost of the hardware equipment.
  • An embodiment of the present application provides a scheduling method.
  • the method includes: acquiring information of each task to be scheduled; wherein, the information of each task to be scheduled includes the parent-child relationship of each task to be scheduled; Obtain the multi-fork tree of each task to be scheduled based on the parent-child relationship; and schedule each task to be scheduled according to the multi-fork tree.
  • the embodiment of the present application also provides a scheduling system, the system includes a database, a scheduler and a calculator; the database is connected to the scheduler and the calculator respectively, and the scheduler is also connected to the calculator
  • the database is used to store the information of each task to be scheduled and the information of each task to be scheduled, wherein the information of each task to be scheduled includes a parent-child relationship between each task to be scheduled; Acquiring the information of the tasks to be scheduled from the database, and obtaining the multi-fork tree of the tasks to be scheduled according to the tasks to be scheduled and the parent-child relationship; the calculator is used to obtain the tasks to be scheduled from the database For tasks to be scheduled, schedule the tasks to be scheduled according to the multi-fork tree.
  • the embodiment of the present application also provides a server, including: at least one processor; and a memory connected in communication with the at least one processor; wherein, the memory stores instructions that can be executed by the at least one processor , the instruction is executed by the at least one processor, so that the at least one processor can execute the above scheduling method.
  • the embodiment of the present application also provides a computer-readable storage medium storing a computer program, and implementing the above scheduling method when the computer program is executed by a processor.
  • FIG. 1 is a flowchart one of a scheduling method according to an embodiment of the present application
  • Fig. 2 is according to one embodiment of the present application, according to each to-be-scheduled task and parent-child relationship, obtains the flowchart of the multi-fork tree of each to-be-scheduled task;
  • FIG. 3 is a first schematic diagram of a multi-fork tree of tasks to be scheduled according to an embodiment of the present application
  • FIG. 4 is a flow chart of scheduling tasks to be scheduled according to a multi-fork tree according to an embodiment of the present application
  • FIG. 5 is a second flowchart of a scheduling method according to another embodiment of the present application.
  • Fig. 6 is a second schematic diagram of a multi-fork tree of tasks to be scheduled according to another embodiment of the present application.
  • FIG. 7 is a flow chart of updating a multi-fork tree according to a newly added task to be scheduled according to another embodiment of the present application.
  • FIG. 8 is a third schematic diagram of a multi-fork tree of tasks to be scheduled according to another embodiment of the present application.
  • FIG. 9 is a flow chart of updating a multi-fork tree according to a task that modifies a parent task as needed according to another embodiment of the present application.
  • Fig. 10 is a fourth schematic diagram of a multi-fork tree of tasks to be scheduled according to another embodiment of the present application.
  • Fig. 11 is a schematic structural diagram of a scheduling system according to another embodiment of the present application.
  • Fig. 12 is a schematic structural diagram of a calculator according to another embodiment of the present application.
  • Fig. 13 is a schematic structural diagram of a server according to another embodiment of the present application.
  • the main purpose of the embodiments of the present application is to propose a scheduling method, system, server, and computer-readable storage medium, aiming to efficiently and accurately schedule tasks to be scheduled, reduce the overhead of scheduling resources, and do not need to improve the performance of hardware devices , to avoid paying high post-maintenance costs for hardware equipment.
  • An embodiment of the present application relates to a scheduling method applied to a server.
  • the implementation details of the scheduling method of this embodiment are described in detail below, and the following content is only implementation details provided for easy understanding, and is not necessary for implementing this solution.
  • the application scenarios of the embodiments of the present application may include but are not limited to: scheduling of computer computing tasks in the data warehouse; scheduling of logistics goods sorting tasks in the logistics workshop; scheduling of rider delivery tasks in the food delivery platform; Scheduling of production scheduling tasks in companies and factories; scheduling of courier delivery tasks on the express delivery platform, etc.
  • Step 101 acquiring information of each task to be scheduled.
  • the server may acquire information about each task to be scheduled.
  • the information of each to-be-scheduled task includes a parent-child relationship between each to-be-scheduled task.
  • the information of each task to be scheduled can also include but not limited to: the identity document (Identity document, referred to as: ID) of the task, the parent task ID of the task, the validity period of the task, the task execution status, the task start time and Task end time, etc.
  • the server determines that the tasks to be scheduled include task A, task B, task E, task G, and task J, wherein task A and task B can be executed without relying on the results of any tasks, and task E needs to depend on task A The result can only be executed.
  • Task G needs to rely on the result of task B before it can be executed.
  • Task J needs to rely on the result of task E before it can be executed.
  • the server determines that task A and task B have no parent task, and the parent task of task E is task A.
  • the parent task of task G is task B, and the parent task of task J is task E.
  • the tasks to be scheduled are all tasks in the data warehouse
  • the server can stratify all tasks to be scheduled according to task objectives, such as backing up data layer tasks, computing data element layer tasks, and so on.
  • the server can analyze and extract characteristic attributes of the hierarchical tasks to obtain information about each task to be scheduled.
  • a task may have multiple parent tasks
  • the task can only be executed after the tasks at the layer of the parent task are executed, and the scheduling tasks can be layered according to the task objectives, which can further improve the accuracy of scheduling.
  • the information of each to-be-scheduled task includes the validity period of each to-be-scheduled task.
  • the server can determine whether each to-be-scheduled task has an expiration date according to the validity period of each to-be-scheduled task If there are overdue tasks to be scheduled among the tasks to be scheduled, discard the overdue tasks to be scheduled. Overdue tasks are deleted and discarded in time, and no longer participate in the construction of the multi-fork tree, which can further save computing resources and reduce the amount of computation.
  • Step 102 according to each task to be scheduled and parent-child relationship, obtain the multi-fork tree of each task to be scheduled.
  • the server can obtain the multi-fork Tree.
  • the multi-dimensionality between the tasks to be scheduled can be displayed vividly and vividly, so as to quickly, clearly, scientifically and accurately clarify the dependencies between all the tasks to be scheduled and serial relationship.
  • the server may use all tasks to be scheduled without a parent task as root nodes, and then fill in the child nodes according to the parent-child relationship to obtain multiple multi-fork trees.
  • task A and task B have no parent task
  • the parent task of task E and task F is task A
  • the parent task of task G is task B
  • the parent task of task J is task E
  • the server will assign task A
  • task E, task F and task J are used as the first multi-fork tree
  • task B and task G are used as the second multi-fork tree.
  • obtaining the multi-fork tree of the tasks to be scheduled can be implemented by the sub-steps shown in Figure 2, specifically including:
  • sub-step 1021 among the tasks to be scheduled, the tasks to be scheduled without a parent task are used as first-level child nodes of the multi-tree of each task to be scheduled.
  • the server only constructs a multi-fork tree for all tasks to be scheduled, and uses Tree as the root node of the multi-fork tree by default, or sets an empty node as the root node, and then sets the The task to be scheduled is the first-level child node of the root node. Only constructing a multi-fork tree can better show the multi-dimensional relationship between the tasks to be scheduled.
  • the server uses Tree as the root node of the multi-fork tree, and the server determines that the tasks to be scheduled include task A, task B, task C, task D, task E, task F, task G, task H, task I, Task J, Task K, and Task L.
  • task A, task B, task C and task D have no parent task, and the server uses task A, task B, task C and task D as four first-level child nodes of the root node Tree.
  • a task to be scheduled that has a parent task among the tasks to be scheduled is used as a child node of the node where the parent task is located to obtain a multi-fork tree of each task to be scheduled.
  • the task to be scheduled that has a parent task among the tasks to be scheduled can be used as the child node of the node where the parent task is located according to the parent-child relationship.
  • Nodes that is, child nodes at all levels under the first-level child nodes, obtain the multi-fork tree of each task to be scheduled.
  • the multi-fork tree can be generated more quickly, so that the dependencies and serial relationships among all tasks to be scheduled can be clarified more quickly.
  • the server determines that the tasks to be scheduled include task A, task B, task C, task D, task E, task F, task G, task H, task I, task J, task K and task L, task A, task Task B, task C and task D have no parent task, task A is the parent task of task E and task F, task B is the parent task of task G, task C is the parent task of task H and task I, and task E is the parent task of task I , the parent task of task K and task L.
  • the server uses Tree as the root node of the multi-fork tree, uses task A, task B, task C and task D as the four first-level child nodes of the root node Tree, and uses task E and task F as child nodes of task A (ie, two Level child node), task G as a child node of task B (ie, a second-level child node), task H and task I as a child node of task C (ie, a second-level child node), and task J, task K, and task L As a child node of the task E (that is, a third-level child node), a multi-fork tree of each task to be scheduled is obtained, and the multi-tree of each task to be scheduled can be shown in FIG. 3 .
  • Step 103 schedule each task to be scheduled according to the multi-fork tree.
  • scheduling tasks to be scheduled according to the multi-fork tree can be implemented by sub-steps as shown in Figure 4, specifically including:
  • Sub-step 1031 determine the tasks that need to be executed in the same series among the tasks to be scheduled.
  • the server can determine the tasks that need to be executed in the same serial operation among the tasks to be scheduled according to the multi-fork tree.
  • the server may perform breadth traversal on the multi-fork tree to determine the tasks that need to be executed in the same series among the tasks to be scheduled.
  • the traversal depth required by the breadth traversal is small, the traversal resources are less spent, and the time is short, which is convenient for quickly determining the tasks that need to be performed in the same serial operation.
  • the multi-fork tree of each task to be scheduled is shown in Figure 3.
  • the server performs breadth traversal on the multi-fork tree, and the traversal order is: AB ⁇ C ⁇ D ⁇ E ⁇ F ⁇ G ⁇ H ⁇ I ⁇ J ⁇ K ⁇ L .
  • node A is a first-level child node
  • node E and node F are child nodes of node A
  • node J, node K and node L are child nodes of node E
  • the server determines node A, node E, node F, node J , node K, and node L (i.e., task A, task E, task F, task J, task K, and task L) are tasks that need to be run in the same series
  • node B is a first-level child node
  • node G is node B's Child nodes
  • the server determines that node B and node G (that is, task B and task G) are tasks that need to be run in the same series
  • node C is a first-level child node
  • node H and node I are child nodes of node C
  • node H There are no other child nodes under node I
  • the server determines that node C, node H, and node I (i.e., task C
  • sub-step 1032 put the tasks that need to be executed serially into the same thread, and push all the threads into the thread pool.
  • the server determines the tasks that need to be executed in the same series, it puts the tasks that need to be executed in the same thread into the same thread, and pushes all the threads into the thread pool. Putting the tasks that need to be run in the same series into the same thread can make the scheduling more accurate and stable.
  • the multi-fork tree of each task to be scheduled is shown in Figure 3.
  • the server confirms that task A, task E, task F, task J, task K, and task L are tasks that need to be performed in the same serial operation, and the server will Task A, task E, task F, task J, task K, and task L are put into the first thread; task B and task G are tasks that need to be run in the same serial, and the server puts task B and task G into the second thread ;Task C, task H and task I are tasks that need to be executed in the same series, and the server puts task C, task H and task I into thread No. 3; Task D is a task that requires the same serial operation, and the server puts tasks D puts thread No. 4 and pushes these four threads into the thread pool.
  • the server can first add all first-level child nodes, and then add all levels of child nodes under the first-level child node, or after adding a first-level child node, directly add each level of child nodes under the first-level child node.
  • level sub-node which is not specifically limited in this embodiment of the present application.
  • Step 1033 run the threads in the thread pool.
  • the server can instruct the calculator to run all the threads in the thread pool.
  • Multi-threads run at the same time. Since the tasks in each thread are tasks that need to be run in the same series, there will be almost no conflicts between threads, and the normal execution of all tasks will be guaranteed to the greatest extent.
  • the information of each to-be-scheduled task is obtained; wherein, the information of each to-be-scheduled task includes the parent-child relationship between each to-be-scheduled task;
  • the multi-fork tree of the tasks to be scheduled the multi-fork tree can vividly and vividly display the multi-dimensionality between the tasks to be scheduled, so as to quickly, clearly, scientifically and accurately clarify the dependencies and sequence of all tasks to be scheduled relation.
  • the multi-fork tree of the tasks to be scheduled the tasks to be scheduled are scheduled. Considering that the related scheduling technology is only scheduled on the basis of the previous scheduling strategy, it cannot be well applied to the tasks that are constantly changing today. , leading to poor scheduling accuracy, which leads to task errors.
  • each task to be scheduled can be efficiently and accurately Scheduling reduces the overhead of scheduling resources, does not need to improve the performance of hardware devices, and avoids paying high post-maintenance costs for hardware devices.
  • FIG. 5 is the The scheduling method described in the embodiment includes:
  • Step 201 acquiring information of each task to be scheduled.
  • Step 202 according to each task to be scheduled and parent-child relationship, obtain a multi-fork tree of each to-be-scheduled information.
  • Step 203 schedule each task to be scheduled according to the multi-fork tree.
  • Step 201 to Step 203 are substantially the same as Step 101 to Step 103, and will not be repeated here.
  • Step 204 determining the tasks that need to be repaired.
  • the server can determine the tasks that need to be repaired, where the tasks that need to be repaired include tasks that fail to run, and/or tasks whose running results do not meet the preset standard.
  • the server after the server schedules each task to be scheduled, that is, after running each task, it can detect whether there is a scheduling error, that is, to determine whether there is a task that fails to run, and if there is a task that fails to run, the server will run the failed task As a task that needs to be repaired.
  • the server after the server schedules the tasks to be scheduled, that is, after running each task, it can judge whether the running results of each task meet the preset standards. If there are tasks whose running results do not meet the preset standards, the server will run Tasks whose results do not meet the preset criteria are identified as tasks requiring remediation.
  • the preset standard may be set by those skilled in the art according to actual needs, which is not specifically limited in the embodiments of the present application.
  • the server may acquire repair information uploaded by those skilled in the art in real time, and the repair information includes tasks that the skilled person in the art thinks needs to be repaired.
  • Step 205 determine the sub-path including the task that needs to be repaired.
  • the server determines the task that needs to be repaired, it enters the data repair process, and can determine the subpath that includes the task that needs to be repaired in the multi-fork tree.
  • the tasks to be scheduled are tasks in a data warehouse.
  • the server determines the task that needs to be repaired, it can add an identifier for entering the data repair process in the task information table of the data warehouse, and the server can enter the data repair process according to the identifier.
  • the server may perform a deep traversal on the multi-fork tree to determine the subpath that contains the task that needs to be repaired.
  • the order of depth traversal is: M ⁇ P ⁇ Q ⁇ U ⁇ V ⁇ N ⁇ R ⁇ O ⁇ S ⁇ T ⁇ W.
  • the multi-fork tree of each task to be scheduled is shown in Figure 6.
  • the server determines that task U fails to run, and takes task U as a task that needs to be repaired.
  • the subpath where U) is located is: MQU.
  • the multi-fork tree of each task to be scheduled is shown in Figure 6.
  • the server determines that the running result of task T does not meet the preset standard, and takes task T as a task that needs to be repaired. Traverse, determine the sub-path where the task T (node T) is: O ⁇ T ⁇ W.
  • Step 206 put all the tasks in the subpath into the same thread, and push all the threads into the thread pool.
  • the server can put all the tasks in the subpath into the same thread, and push all the threads into the thread pool, so as to ensure that all tasks can be normal operation.
  • the multi-fork tree of each task to be scheduled is shown in Figure 6.
  • the server confirms that task U and task T are tasks that need to be repaired, and the server puts task M, task Q and task U into the fourth thread separately, Put task O, task T, and task W into a fifth thread, and push these five threads into the thread pool.
  • Step 207 run the threads in the thread pool.
  • the threads in the thread pool can be run, thereby realizing data restoration and new scheduling.
  • the multi-fork tree after scheduling the tasks to be scheduled according to the multi-fork tree, it further includes: determining tasks that need to be repaired; wherein the tasks that need to be repaired include tasks that fail to run, And/or, the task whose running result does not meet the preset standard; according to the multi-fork tree, determine the subpath that contains the task that needs to be repaired; put all the tasks in the subpath into the same thread, and push all threads into a thread pool; run the threads in said thread pool. Putting the tasks in the subpath into one thread can ensure that all tasks can run normally to the greatest extent.
  • Another embodiment of the present application relates to a scheduling method.
  • the implementation details of the scheduling method in this embodiment are described in detail below. The following content is only the implementation details provided for easy understanding, and is not necessary to implement this solution.
  • the task to be scheduled is scheduled, and after the scheduling is completed, the server obtains the newly added task to be scheduled, and the server can update the multi-fork tree to perform a new round of scheduling.
  • Figure 7 shows the updated task according to the newly added task to be scheduled in this embodiment.
  • the flow chart of the multi-fork tree including:
  • Step 301 acquire a newly added task to be scheduled, and obtain information about the newly added task to be scheduled.
  • the server can obtain the newly added tasks to be scheduled and obtain the information of the newly added tasks to be scheduled, wherein the information of the newly added tasks to be scheduled includes the newly added tasks to be scheduled The parent-child relationship of scheduling tasks.
  • the newly added information of the task to be scheduled may also include but not limited to: the ID number of the task, the ID of the parent task of the task, the validity period of the task, the execution status of the task, the start time of the task and the end time of the task, etc.
  • Step 302 according to the parent-child relationship of the newly added task to be scheduled, it is judged whether the newly added task to be scheduled has a parent task, if yes, execute step 304 , otherwise, execute step 303 .
  • Step 303 adding the newly added task to be scheduled as a first-level child node.
  • the server may add the newly added task to be scheduled as a first-level child node of the multi-tree.
  • the original multi-fork tree can be shown in Figure 3, the newly added task to be scheduled is task X, and the server determines that task X has no parent task according to the information of task X, then as shown in Figure 8, the server assigns task X Added as a child node of the root node Tree.
  • Step 304 judging whether the parent task of the newly added task to be scheduled is in the multi-fork tree, if yes, execute step 305, otherwise, end the process directly.
  • the server may determine that the newly added task to be scheduled is an illegal task, discard the task, and refuse to schedule the task.
  • Step 305 adding the newly added task to be scheduled as a child node of the node where the parent task of the newly added task to be scheduled is located.
  • the server can add the newly added task to be scheduled as a new task to be scheduled The child node of the node where the parent task is located.
  • the server can add it to the multi-fork tree according to the parent-child relationship of the new task, which can effectively save scheduling resources and computing resources.
  • the original multi-fork tree can be shown in Figure 3, the newly added task to be scheduled is task Y, and the server determines that the parent task of task Y is task D, as shown in Figure 8, the server adds task Y as A child node of task D.
  • Step 306 judge whether the newly added task to be scheduled has subtasks, if yes, execute step 307, otherwise, end the process directly.
  • Step 307 judge whether the subtask of the newly added task to be scheduled is in the multi-fork tree, if yes, execute step 308, otherwise, execute step 309.
  • the server can determine whether the subtask of the newly added task to be scheduled is in In the multi-fork tree, in case the multi-fork tree is confused and wrong.
  • Step 308 delete the node where the subtask of the newly added task to be scheduled is located, and add the subtask of the newly added task to be scheduled as a child node of the node where the newly added task to be scheduled is located.
  • the server can first delete the original node of the subtask from the multi-fork tree, and delete the subtask of the newly added task to be scheduled.
  • the task is added as a child node of the node where the newly added task to be scheduled resides.
  • Step 309 adding the subtasks of the newly added task to be scheduled as child nodes of the node where the newly added task to be scheduled is located.
  • the server determines that the subtask is also a newly added task to be scheduled, and the server can add the subtask of the newly added task to be scheduled as a new The child node of the node where the task to be scheduled is located.
  • the multi-fork tree after scheduling the tasks to be scheduled according to the multi-fork tree, it further includes: acquiring a newly added task to be scheduled, and acquiring information about the newly added task to be scheduled; wherein , the information of the newly added task to be scheduled includes the parent-child relationship of the newly added task to be scheduled; according to the parent-child relationship of the newly added task to be scheduled, it is judged whether the newly added task to be scheduled has a parent task; if The newly added task to be scheduled has no parent task, and the newly added task to be scheduled is added as a first-level child node; if the newly added task to be scheduled has a parent task, and the newly added task to be scheduled In the multi-fork tree, add the newly added task to be scheduled as a child node of the node where the parent task of the newly added task to be scheduled is located; determine whether the newly added task to be scheduled has Subtasks; if the newly added task to be scheduled has subtasks, and the subtask of the newly added task to be scheduled is in the
  • Another embodiment of the present application relates to a scheduling method.
  • the implementation details of the scheduling method in this embodiment are described in detail below. The following content is only the implementation details provided for easy understanding, and is not necessary to implement this solution.
  • the task to be scheduled is scheduled, and after the scheduling is completed, the server can determine the task that needs to modify the parent task, and update the multi-fork tree to perform a new round of scheduling.
  • Figure 9 shows the task of modifying the parent task according to the needs of this embodiment.
  • the flowchart of the fork tree including:
  • Step 401 determine the task that needs to modify the parent task, and obtain the information of the task that needs to modify the parent task.
  • the server can determine the task that needs to modify the parent task, and obtain the information of the task that needs to modify the parent task, wherein the information of the task that needs to modify the parent task includes the task that needs to modify the parent task The new parent task for the task.
  • the server determines that task I is a task whose parent task needs to be modified, the server may acquire information about task I, and determine that the new parent task of task I is task D according to the information about task I.
  • Step 402 if the new parent task is in the multi-fork tree, delete the node where the task whose parent task needs to be modified is located, and set the task whose parent task needs to be modified as a child node of the node where the new parent task is located.
  • the server can determine whether the new parent task is in the multi-fork tree of each task to be scheduled.
  • the server can delete the node of the task whose parent task needs to be modified in the multi-fork tree, and use the task whose parent task needs to be modified as a child node of the node of the new parent task. For tasks that need to modify the parent task, delete the original node and add a new node to ensure that the task after modifying the parent task can be scheduled and run normally.
  • the server determines that task I is a task that needs to modify the parent task.
  • the original parent task of task I is task C
  • the new parent task of task I is task D.
  • the server can delete the node where task I is located in the multi-fork tree , that is, delete node I under node C, and re-add node I under node D.
  • the server may determine that the task is an illegal task and discard the task.
  • the multi-fork tree of each task to be scheduled can be shown in Figure 3, the server determines that task J is a task that needs to modify the parent task, the original parent task of task J is task E, and the new parent task of task J is task M, the server After determining that task M is not in the original multi-fork tree, the server may delete node J under node E as shown in FIG. 10 , determine that task J is an illegal task, and discard task J.
  • the server can add the task as a first-level child of the multi-fork tree node.
  • the multi-fork tree of each task to be scheduled can be shown in Figure 3, the server determines that task L is a task that needs to modify the parent task, the original parent task of task L is task E, and the new parent task of task L is empty, the server can As shown in Figure 10, delete node L under node E, and add node L as a first-level child node of the root node Tree.
  • the tasks to be scheduled after the tasks to be scheduled are scheduled according to the multi-fork tree, it further includes: determining the tasks whose parent tasks need to be modified, and acquiring the information of the tasks whose parent tasks need to be modified; wherein , the information of the task that needs to modify the parent task includes the new parent task of the task that needs to modify the parent task; if the new parent task is in the multi-fork tree, delete the node where the task that needs to modify the parent task is located , and use the task that needs to modify the parent task as a child node of the node where the new parent task is located. For tasks that need to modify the parent task, delete the original node and add a new node to ensure that the task after modifying the parent task can be scheduled and run normally.
  • FIG. 11 is the implementation of this embodiment A schematic diagram of the scheduling system described in the example, including: a database 501 , a scheduler 502 and a calculator 503 .
  • the database 501 is connected to the scheduler 502 and the calculator 503 respectively, and the scheduler 502 is also connected to the calculator 503 .
  • the database 501 is used for storing each task to be scheduled and information of each task to be scheduled.
  • the scheduler 502 is configured to acquire information of each task to be scheduled from the database 501, wherein the information includes a parent-child relationship of each task to be scheduled, and obtain a multi-fork tree of each task to be scheduled according to each task to be scheduled and the parent-child relationship.
  • the calculator 503 is used to obtain each task to be scheduled from the database 501, and schedule each task to be scheduled according to the multi-fork tree.
  • the calculator 503 includes a storage module 5031, a coordination module 5032, a control module 5033 and an execution module 5034, and the storage module 5031 is connected to the database 501, the scheduler 502, the coordination module 5032 and the execution module respectively 5034, the coordination module 5032 is also connected to the control module 5033, and the control module 5033 is also connected to the execution module 5034 and the database 501.
  • the storage module 5031 can obtain tasks to be scheduled from the database 501. After these tasks to be scheduled enter the storage module 5031, that is, the calculator 503, they will automatically be converted into tasks to be executed. When the tasks to be executed are required to be executed, the storage module 5031 will Send it to the coordination module 5032.
  • the storage module 5031 can also scan the multi-fork tree scheduling strategy built by the scheduler 502, determine the status of the task to be executed and the status of other tasks that have been executed, and notify the coordination module 5032.
  • the coordinating module 5032 submits idle tasks to be executed to the control module 5033 when the number of connections and task requests is lower than the preset threshold.
  • the control module 5033 may send the idle tasks to be executed to the execution module 5034, and control the execution module 5034 to execute the idle tasks to be executed.
  • the control module 5033 can also invoke a preset feedback algorithm after the idle task to be executed is completed, and return the task result and task completion status to the database 501 for record keeping.
  • this embodiment is a system embodiment corresponding to the above method embodiment, and this embodiment can be implemented in cooperation with the above method embodiment.
  • the relevant technical details and technical effects mentioned in the above embodiments are still valid in this embodiment, and will not be repeated here to reduce repetition.
  • the relevant technical details mentioned in this embodiment can also be applied in the above embodiments.
  • modules involved in this embodiment are logical modules.
  • a logical unit can be a physical unit, or a part of a physical unit, or multiple physical units. Combination of units.
  • units that are not closely related to solving the technical problem proposed in the present application are not introduced in this embodiment, but this does not mean that there are no other units in this embodiment.
  • FIG. 13 Another embodiment of the present application relates to a server, as shown in FIG. 13 , including: at least one processor 601; and a memory 602 communicatively connected to the at least one processor 601; An instruction executed by the at least one processor 601, the instruction is executed by the at least one processor 601, so that the at least one processor 601 can execute the scheduling methods in the foregoing embodiments.
  • the memory and the processor are connected by a bus
  • the bus may include any number of interconnected buses and bridges, and the bus connects one or more processors and various circuits of the memory together.
  • the bus may also connect together various other circuits such as peripherals, voltage regulators, and power management circuits, all of which are well known in the art and therefore will not be further described herein.
  • the bus interface provides an interface between the bus and the transceivers.
  • a transceiver may be a single element or multiple elements, such as multiple receivers and transmitters, providing means for communicating with various other devices over a transmission medium.
  • the data processed by the processor is transmitted on the wireless medium through the antenna, further, the antenna also receives the data and transmits the data to the processor.
  • the processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interface, voltage regulation, power management, and other control functions. Instead, memory can be used to store data that the processor uses when performing operations.
  • Another embodiment of the present application relates to a computer-readable storage medium storing a computer program.
  • the above method embodiments are implemented when the computer program is executed by the processor.
  • the program is stored in a storage medium, and includes several instructions to make a device ( It may be a single-chip microcomputer, a chip, etc.) or a processor (processor) to execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc., which can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

本申请实施例涉及计算机技术领域,特别涉及一种调度方法、系统、服务器和计算机可读存储介质,该方法包括:获取各待调度任务的信息;其中,所述各待调度任务的信息包括各待调度任务的父子关系;根据所述各待调度任务和所述父子关系,获取所述各待调度任务的多叉树;根据所述多叉树,对所述各待调度任务进行调度。

Description

调度方法、系统、服务器和计算机可读存储介质
相关申请的交叉引用
本申请基于申请号为“202110624609.6”、申请日为2021年06月04日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此以引入方式并入本申请。
技术领域
本申请实施例涉及计算机技术领域,特别涉及一种调度方法、系统、服务器和计算机可读存储介质。
背景技术
调度技术一直被广泛的应用于空间环境、物流配送、生产排班、商业服务等领域。在计算机技术领域中,同样存在着计算资源的调度问题。随着大数据技术的飞速发展,计算需求变得越来越复杂和繁重。在数据仓库中会有非常多的计算任务。相关技术中,大多依据任务执行状态表或以往的调度策略进行调度。
然而,数据仓库中的任务是不断更新、动态增减的,依据先验知识形成的任务执行状态表,以及以往的调度策略,很可能不适用于新的任务调度,这都会导致调度准确性差,调度不稳定,调度效率不高,对此只能提升硬件的设备性能来支持任务正常进行,增加了投入成本和硬件设备的后期维护成本。
发明内容
本申请实施例提供了一种调度方法,所述方法包括:获取各待调度任务的信息;其中,所述各待调度任务的信息包括各待调度任务的父子关系;根据所述各待调度任务和所述父子关系,获取所述各待调度任务的多叉树;根据所述多叉树,对所述各待调度任务进行调度。
本申请实施例还提供一种调度系统,所述系统包括数据库、调度器和计算器;所述数据库分别与所述调度器和所述计算器连接,所述调度器还与所述计算器连接;所述数据库用于存储各待调度任务和所述各待调度任务的信息,其中,所述各待调度任务的信息包括各待调度任务之间的父子关系;所述调度器用于从所述数据库中获取所述各待调度任务的信息,根据所述各待调度任务和所述父子关系,获取所述各待调度任务的多叉树;所述计算器用于从所述数据库获取所述各待调度任务,根据所述多叉树,对所述各待调度任务进行调度。
本申请实施例还提供了一种服务器,包括:至少一个处理器;以及,与所述至少一个处理器通信连接的存储器;其中,所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行上述的调度方法。
本申请实施例还提供了一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现上述的调度方法。
附图说明
图1是根据本申请一个实施例的调度方法的流程图一;
图2是根据本申请一个实施例中,根据各待调度任务和父子关系,获取各待调度任务的多叉树的流程图;
图3是根据本申请一个实施例中提供的一种各待调度任务的多叉树的示意图一;
图4是根据本申请一个实施例中,根据多叉树,对各待调度任务进行调度的流程图;
图5是根据本申请另一个实施例的调度方法的流程图二;
图6是根据本申请另一个实施例中提供的一种各待调度任务的多叉树示意图二;
图7是根据本申请另一个实施例中提供的一种根据新增的待调度任务,更新多叉树的流程图;
图8是根据本申请另一个实施例中提供的一种各待调度任务的多叉树示意图三;
图9是根据本申请另一个实施例中提供的一种根据需要修改父任务的任务,更新多叉树的流程图;
图10是根据本申请另一个实施例中提供的一种各待调度任务的多叉树示意图四;
图11是根据本申请另一个实施例的调度系统的结构示意图;
图12是根据本申请另一个实施例中,计算器的具体结构示意图;
图13是根据本申请另一个实施例的服务器的结构示意图。
具体实施方式
本申请实施例的主要目的在于提出一种调度方法、系统、服务器和计算机可读存储介质,旨在高效地、准确地对各待调度任务进行调度,降低调度资源的开销,无需提升硬件设备性能,避免支付高昂的硬件设备的后期维护成本。
为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合附图对本申请的各实施例进行详细的阐述。然而,本领域的普通技术人员可以理解,在本申请各实施例中,为了使读者更好地理解本申请而提出了许多技术细节。但是,即使没有这些技术细节和基于以下各实施例的种种变化和修改,也可以实现本申请所要求保护的技术方案。以下各个实施例的划分是为了描述方便,不应对本申请的具体实现方式构成任何限定,各个实施例在不矛盾的前提下可以相互结合相互引用。
本申请的一个实施例涉及一种调度方法,应用于服务器。下面对本实施例的调度方法的实现细节进行具体的说明,以下内容仅为方便理解提供的实现细节,并非实施本方案的必须。
本申请的实施例的应用场景可以包括但不限于:在数据仓库中进行计算机计算任务的调度;在物流车间进行物流货物分拣任务的调度;在外卖平台中进行骑手送餐任务的调度;在公司、工厂中进行生产排班任务的调度;在快递平台中进行快递员送快递任务的调度等。
本实施例的调度方法的具体流程可以如图1所示,包括:
步骤101,获取各待调度任务的信息。
具体而言,服务器在进行调度之前,可以先获取各待调度任务的信息。其中,各待调度任务的信息包括各待调度任务之间的父子关系。
在具体实现中,各待调度任务的信息还可以包括但不限于:任务的身份标识号(Identity document,简称:ID),任务的父任务ID,任务的有效期,任务执行状态,任务开始时间和任务结束时间等。
在一个例子中,服务器确定待调度任务包括任务A、任务B、任务E、任务G和任务J,其中,任务A和任务B不需要依赖任何任务的结果即可执行,任务E需要依赖任务A的结果才可以执行,任务G需要依赖任务B的结果才可以执行,任务J需要依赖任务E的结果才可以执行,服务器确定任务A、任务B没有父任务,任务E的父任务为任务A,任务G的父任务为任务B,任务J的父任务为任务E。
在一个例子中,待调度任务为数据仓库中的所有任务,服务器可以对所有待调度任务,按照任务目标进行分层,比如备份数据层任务,计算数据元层任务等。服务器可以对分层后的任务进行分析和特征属性提取,获取各待调度任务的信息。考虑到一个任务可能存在多个父任务,只有父任务所在层的任务都执行完成后,才能执行该任务,对待调度任务按照任务目标进行分层,可以进一步提升调度的准确性。
在另一个例子中,各待调度任务的信息包括各待调度任务的有效期,服务器在获取到各待调度任务的有效期后,可以根据各待调度任务的有效期,判断各待调度任务中是否有超期的待调度任务,若各待调度任务中有超期的待调度任务,丢弃超期的待调度任务。超期任务及时删除丢弃,不再参与多叉树的构建,可以进一步节约计算资源,减少计算量。
步骤102,根据各待调度任务和父子关系,获取各待调度任的多叉树。
在具体实现中,服务器在获取到各待调度任务的信息后,可以根据根据各待调度任务,和各待调度任务的信息中的各待调度任务的父子关系,获取各待调度任务的多叉树。本申请的实施例,通过构建多叉树的方式,可以将各待调度任务之间的多维生动、形象地展现出来,从而快速、清晰、科学、准确地理清所有待调度任务之间的依赖关系和串行关系。
在一个例子中,服务器可以将所有没有父任务的待调度任务都作为根节点,再根据父子关系填入子节点,获取多个多叉树。比如:任务A、任务B没有父任务,任务E和任务F的父任务为任务A,任务G的父任务为任务B,任务J的父任务为任务E,服务器将任务A、任务E、任务F和任务J作为第一个多叉树,将任务B和任务G作为第二个多叉树。
在另一个例子中,根据各待调度任务和父子关系,获取各待调度任务的多叉树,可以由如图2所示的各子步骤实现,具体包括:
子步骤1021,将各待调度任务中没有父任务的待调度任务,作为各待调度任务的多叉树的一级子节点。
在具体实现中,服务器对所有待调度任务只构建一个多叉树,默认将Tree作为多叉树的根节点,或设置一个空的节点作为根节点,再将各待调度任务中没有父任务的待调度任务,作为该根节点的一级子节点。只构建一个多叉树,可以更好地展现各待调度任务之间的多维关系。
在一个例子中,服务器将将Tree作为多叉树的根节点,服务器确定待调度任务包括任务A、任务B、任务C、任务D、任务E、任务F、任务G、任务H、任务I、任务J、任务K和任务L。其中,任务A、任务B、任务C和任务D没有父任务,服务器将任务A、任务B、任务C和任务D作为根节点Tree的四个一级子节点。
子步骤1022,将各待调度任务中有父任务的待调度任务,作为父任务所在节点的子节点,得到各待调度任务的多叉树。
具体而言,服务器在获取完各待调度任务的多叉树的各一级子节点后,可以将各待调度任务中有父任务的待调度任务,根据父子关系,作为父任务所在节点的子节点,即一级子节 点下的各级子节点,得到各待调度任务的多叉树。本申请的实施例,可以更加快速地生成多叉树,从而更快速地理清所有待调度任务之间的依赖关系和串行关系。
在一个例子中,服务器确定待调度任务包括任务A、任务B、任务C、任务D、任务E、任务F、任务G、任务H、任务I、任务J、任务K和任务L,任务A、任务B、任务C和任务D没有父任务,任务A为任务E和任务F的父任务,任务B为任务G的父任务,任务C为任务H和任务I的父任务,任务E为任务I、任务K和任务L的父任务。服务器将Tree作为多叉树的根节点,将任务A、任务B、任务C和任务D作为根节点Tree的四个一级子节点,将任务E和任务F作为任务A的子节点(即二级子节点),将任务G作为任务B的子节点(即二级子节点),任务H和任务I作为任务C的子节点(即二级子节点),将任务J、任务K和任务L作为任务E的子节点(即三级子节点),得到各待调度任务的多叉树,各待调度任务的多叉树可以如图3所示。
步骤103,根据多叉树,对各待调度任务进行调度。
在一个例子中,根据多叉树,对各待调度任务进行调度,可以由如图4所示的各子步骤实现,具体包括:
子步骤1031,根据多叉树,确定各待调度任务中需要进行同一串行运行的任务。
具体而言,服务器在获取各待调度任务的多叉树后,可以根据多叉树,确定各待调度任务中需要进行同一串行运行的任务。
在一个例子中,服务器在获取各待调度任务的多叉树后,可以对多叉树进行广度遍历,确定各待调度任务中需要进行同一串行运行的任务。广度遍历所需的遍历深度较小,花费的遍历资源少,时间短,便于快速确定出需要进行同一串行运行的任务。
比如,各待调度任务的多叉树如图3所示,服务器对多叉树进行广度遍历,遍历顺序为:AB→C→D→E→F→G→H→I→J→K→L。其中,节点A为一级子节点,节点E和节点F未节点A的子节点,节点J、节点K和节点L为节点E的子节点,服务器确定节点A、节点E、节点F、节点J、节点K和节点L(即任务A、任务E、任务F、任务J、任务K和任务L)为需要进行同一串行运行的任务;节点B为一级子节点,节点G为节点B的子节点,服务器确定节点B和节点G(即任务B和任务G)为需要进行同一串行运行的任务;节点C为一级子节点,节点H和节点I为节点C的子节点,节点H和节点I下面没有其他子节点,服务器确定节点C、节点H和节点I(即任务C、任务H和任务I)为需要进行同一串行运行的任务;节点D为一级子节点,节点D没有子节点,服务器确认节点D(即任务D)为需要进行同一串行运行的任务。
子步骤1032,将需要进行同一串行运行的任务放入同一个线程中,并将所有线程压入线程池。
具体而言,服务器确定完需要进行同一串行运行的任务后,将需要进行同一串行运行的任务放入同一个线程中,并将所有线程压入线程池。将需要进行同一串行运行的任务放入同一个线程中,可以使得调度更加准确、稳定。
在一个例子中,各待调度任务的多叉树如图3所示,服务器确认任务A、任务E、任务F、任务J、任务K和任务L为需要进行同一串行运行的任务,服务器将任务A、任务E、任务F、任务J、任务K和任务L放入一号线程;任务B和任务G为需要进行同一串行运行的任务,服务器将任务B和任务G放入二号线程;任务C、任务H和任务I为需要进行同一串行运行 的任务,服务器将任务C、任务H和任务I放入三号线程;任务D为需要进行同一串行运行的任务,服务器将任务D放入四号线程,并将这四个线程压入线程池中。
在具体实现中,服务器可以先添加完所有一级子节点,再添加一级子节点下的各级子节点,也可以添加完一个一级子节点后,直接添加该一级子节点下的各级子节点,本申请的实施例对此不做具体限定。
步骤1033,运行线程池中的线程。
具体而言,服务器将所有线程压入线程池后,可以指示计算器运行线程池中的所有线程,进行。多线程同时运行,由于每个线程中的任务都是需要进行同一串行运行的任务,各线程之间几乎不会发生冲突,最大限度地保证所有任务能够正常执行。
本实施例,获取各待调度任务的信息;其中,所述各待调度任务的信息包括各待调度任务之间的父子关系;根据所述各待调度任务和所述父子关系,获取所述各待调度任务的多叉树,多叉树可以将各待调度任务之间的多维生动、形象地展现出来,从而快速、清晰、科学、准确地理清所有待调度任务之间的依赖关系和串行关系。根据所述各待调度任务的多叉树,对所述各待调度任务进行调度,考虑到相关的调度技术只是在以往的调度策略基础上进行调度,不能很好地适用如今不断发生变化的任务,导致调度准确性很差,从而导致任务出错,本申请的实施例,通过获取各待调度任务的多叉树并根据多叉树进行调度的方式,可以高效地、准确地对各待调度任务进行调度,降低了调度资源的开销,无需提升硬件设备性能,避免支付高昂的硬件设备的后期维护成本。
本申请的另一个实施例涉及一种调度方法,下面对本实施例的调度方法的实现细节进行具体的说明,以下内容仅为方便理解提供的实现细节,并非实施本方案的必须,图5是本实施例所述的调度方法,包括:
步骤201,获取各待调度任务的信息。
步骤202,根据各待调度任务和父子关系,获取各待调度信息的多叉树。
步骤203,根据多叉树,对各待调度任务进行调度。
其中,步骤201至步骤203与步骤101至步骤103大致相同,此处不再赘述。
步骤204,确定需要进行修复的任务。
具体而言,服务器在对各待调度任务进行调度后,可以确定需要进行修复的任务,其中,需要进行修复的任务包括运行失败的任务,和/或,运行结果不符合预设标准的任务。
在一个例子中,服务器在对各待调度任务进行调度,即运行各任务后,可以检测是否有调度错误,即判断是否有运行失败的任务,若有运行失败的任务,服务器将运行失败的任务作为需要进行修复的任务。
在另一个例子中,服务器在对各待调度任务进行调度,即运行各任务后,可以判断各任务的运行结果是否符合预设标准,若有运行结果不符合预设标准的任务,服务器将运行结果不符合预设标准的任务作为需要进行修复的任务。其中,预设标准可以由本领域的技术人员根据实际需求进行设定,本申请的实施例对此不做具体限定。
在一个例子中,服务器可以实时获取本领域的技术人员上传的修复信息,修复信息中包括本领域的技术人员认为需要进行修复的任务。
步骤205,根据多叉树,确定包含需要进行修复的任务的子路径。
具体而言,服务器在确定需要进行修复的任务后,进入数据修复流程,可以在多叉树中确定包含需要进行修复的任务的子路径。
在一个例子中,待调度任务是数据仓库中的任务。服务器在确定需要进行修复的任务后,可以在数据仓库的任务信息表中增添一个用于表征进入数据修复流程的标识,服务器可以根据该标识进入数据修复流程。
在一个例子中,服务器在确定需要进行修复的任务后,可以对多叉树进行深度遍历,确定包含需要进行修复的任务的子路径。如图6所示,深度遍历的顺序为:M→P→Q→U→V→N→R→O→S→T→W。使用深度遍历的方法,可以更加准确地找到包含需要进行修复的任务的子路径。
在一个例子中,各待调度任务的多叉树如图6所示,服务器确定任务U运行失败,将任务U作为需要进行修复的任务,服务器对多叉树进行深度遍历,确定任务U(节点U)所在的子路径为:MQU。
在另一个例子中,各待调度任务的多叉树如图6所示,服务器确定任务T的运行结果不符合预设标准,将任务T作为需要进行修复的任务,服务器对多叉树进行深度遍历,确定任务T(节点T)所在的子路径为:O→T→W。
步骤206,将子路径中的所有任务放入同一个线程中,并将所有线程压入线程池。
具体而言,服务器包含需要进行修复的任务的子路径后,可以将该子路径中的所有任务放入同一个线程中,并将所有线程压入线程池,从而最大限度地保证所有任务都能够正常运行。
在一个例子中,各待调度任务的多叉树如图6所示,在修复之前线程池中有任务M、任务P、任务Q、任务U和任务V线程,任务N和任务R线程,任务O、任务S、任务T和任务W线程,共三个线程,服务器确认任务U和任务T为需要进行修复的任务,服务器将任务M、任务Q和任务U单独放入第四个线程中,将任务O、任务T和任务W放入第五个线程中,并将这五个线程压入线程池中。
步骤207,运行线程池中的线程。
具体而言,服务器将子路径中的所有任务放入同一个线程中,并将所有线程压入线程池后,可以运行线程池中的线程,从而实现数据修复,实现新的调度。
本实施例,在所述根据所述多叉树,对所述各待调度任务进行调度之后,还包括:确定需要进行修复的任务;其中,所述需要进行修复的任务包括运行失败的任务,和/或,运行结果不符合预设标准的任务;根据所述多叉树,确定包含所述需要进行修复的任务的子路径;将所述子路径中的所有任务放入同一个线程中,并将所有线程压入线程池;运行所述线程池中的线程。将子路径中的任务放入一个线程中,可以最大限度地保证所有任务都能够正常运行。
本申请的另一个实施例涉及一种调度方法,下面对本实施例的调度方法的实现细节进行具体的说明,以下内容仅为方便理解提供的实现细节,并非实施本方案的必须,在服务器对各待调度任务进行调度,并完成调度后,服务器获取到新增的待调度任务,服务器可以更新多叉树,进行新一轮的调度,图7是本实施例根据新增的待调度任务,更新多叉树的流程图,包括:
步骤301,获取新增的待调度任务,并获取新增的待调度任务的信息。
具体而言,服务器在对待调度任务完成本轮调度后,可以获取新增的待调度任务,并获取新增的待调度任务的信息,其中,新增的待调度任务的信息包括新增的待调度任务的父子关系。
在具体实现中,新增的待调度任务的信息还可以包括但不限于:任务的身份标识号,任务的父任务ID,任务的有效期,任务执行状态,任务开始时间和任务结束时间等。
步骤302,根据新增的待调度任务的父子关系,判断新增的待调度任务是否有父任务,如果是,执行步骤304,否则,执行步骤303。
步骤303,将新增的待调度任务添加为一级子节点。
具体而言,若服务器判断新增的待调度任务没有父任务,服务器可以将新增的待调度任务添加为多叉树的一级子节点。
在一个例子中,原多叉树可以如图3所示,新增的待调度任务为任务X,服务器根据任务X的信息确定任务X没有父任务,则如图8所示,服务器将任务X添加为根节点Tree的子节点。
步骤304,判断新增的待调度任务的父任务是否在多叉树中,如果是,执行步骤305,否则,直接结束流程。
在一个例子中,若新增的待调度任务的父任务不在多叉树中,服务器可以判定该新增的待调度任务为非法任务,丢弃该任务,拒绝对该任务进行调度。
步骤305,将新增的待调度任务添加为新增的待调度任务的父任务所在节点的子节点。
具体而言,若服务器判断新增的待调度任务有父任务,且新增的待调度任务的父任务在多叉树中,服务器可以将新增的待调度任务添加为新增的待调度任务的父任务所在节点的子节点。当有新增的调度任务时,无需重新扫描所有任务,只需根据新任务的父子关系将其添加到多叉树中,可以有效节约调度资源和计算资源。
在一个例子中,原多叉树可以如图3所示,新增的待调度任务为任务Y,服务器确定任务Y的父任务为任务D,则如图8所示,服务器将任务Y添加为任务D的子节点。
步骤306,判断新增的待调度任务是否有子任务,如果是,执行步骤307,否则,直接结束流程。
步骤307,判断新增的待调度任务的子任务是否在多叉树中,如果是,执行步骤308,否则,执行步骤309.
具体而言,考虑到新增的待调度任务可能是原待调度任务的父任务,服务器在多叉树中添加新增的待调度任务后,可以判断新增的待调度任务的子任务是否在多叉树中,以防多叉树混乱出错。
步骤308,删除新增的待调度任务的子任务所在节点,并将新增的待调度任务的子任务添加为新增的待调度任务所在节点的子节点。
具体而言,若新增的待调度任务的子任务在多叉树中,服务器可以先将该子任务原来的所在的节点从多叉树中删去,并将新增的待调度任务的子任务添加为新增的待调度任务所在节点的子节点。
步骤309,将新增的待调度任务的子任务添加为新增的待调度任务所在节点的子节点。
具体而言,若新增的待调度任务的子任务不在多叉树中,则服务器判定该子任务也是新 增的待调度任务,服务器可以将新增的待调度任务的子任务添加为新增的待调度任务所在节点的子节点。
本实施例,在所述根据所述多叉树,对所述各待调度任务进行调度之后,还包括:获取新增的待调度任务,并获取所述新增的待调度任务的信息;其中,所述新增的待调度任务的信息包括新增的待调度任务的父子关系;根据所述新增的待调度任务的父子关系,判断所述新增的待调度任务是否有父任务;若所述新增的待调度任务没有父任务,将所述新增的待调度任务添加为一级子节点;若所述新增的待调度任务有父任务,且所述新增的待调度任务的父任务在所述多叉树中,将所述新增的待调度任务添加为所述新增的待调度任务的父任务所在节点的子节点;判断所述新增的待调度任务是否有子任务;若所述新增的待调度任务有子任务,且所述新增的待调度任务的子任务在所述多叉树中,则删除所述新增的待调度任务的子任务所在节点,并将所述新增的待调度任务的子任务添加为所述新增的待调度任务所在节点的子节点。当有新增的调度任务时,无需重新扫描所有任务,只需根据新任务的父子关系将其添加到多叉树中,可以有效节约调度资源和计算资源。
本申请的另一个实施例涉及一种调度方法,下面对本实施例的调度方法的实现细节进行具体的说明,以下内容仅为方便理解提供的实现细节,并非实施本方案的必须,在服务器对各待调度任务进行调度,并完成调度后,服务器可以确定需要修改父任务的任务,并更新多叉树,进行新一轮的调度,图9是本实施例根据需要修改父任务的任务,更新多叉树的流程图,包括:
步骤401,确定需要修改父任务的任务,并获取需要修改父任务的任务的信息。
具体而言,服务器在对待调度任务完成本轮调度后,可以确定需要修改父任务的任务,并获取需要修改父任务的任务的信息,其中,需要修改父任务的任务的信息包括需要修改父任务的任务的新父任务。
在一个例子中,服务器确定任务I为需要修改父任务的任务,服务器可以获取任务I的信息,根据任务I的信息确定任务I的新父任务为任务D。
步骤402,若新父任务在多叉树中,删除需要修改父任务的任务所在节点,并将需要修改父任务的任务作为新父任务所在节点的子节点。
具体而言,服务器在确定需要修改父任务的任务,并获取需要修改父任务的任务的信息后,可以判断新父任务是否在各待调度任务的多叉树中,若新父任务在各待调度任务的多叉树中,服务器可以在多叉树中,删除需要修改父任务的任务所在节点,并将需要修改父任务的任务作为新父任务所在节点的子节点。对于需要修改父任务的任务,删除原节点,并添加新节点,可以保证修改父任务后的任务能够正常调度、正常运行。
在一个例子中,服务器确定任务I为需要修改父任务的任务,任务I的原父任务为任务C,任务I的新父任务为任务D,服务器可以在多叉树中,删除任务I所在节点,即删除节点C下的节点I,并在节点D下重新添加节点I。
在另一个例子中,若服务器确定需要修改父任务的任务的新父任务不在各待调度任务的多叉树中,服务器可以判定该任务为非法任务,丢弃该任务。
比如:各待调度任务的多叉树可以如图3所示,服务器确定任务J为需要修改父任务的任务,任务J的原父任务为任务E,任务J的新父任务为任务M,服务器确定任务M不在原 多叉树中,服务器可以如图10所示,删除节点E下的节点J,并判定任务J为非法任务,丢弃任务J。
在另一个例子中,若服务器确定需要修改父任务的任务的新父任务为空,即该任务不再依赖其他任务的运行结果而运行,服务器可以将该任务添加为多叉树的一级子节点。
比如:各待调度任务的多叉树可以如图3所示,服务器确定任务L为需要修改父任务的任务,任务L的原父任务为任务E,任务L的新父任务为空,服务器可以如图10所示,删除节点E下的节点L,并将节点L添加为根节点Tree的一级子节点。
本实施例,在所述根据所述多叉树,对所述各待调度任务进行调度之后,还包括:确定需要修改父任务的任务,并获取所述需要修改父任务的任务的信息;其中,所述需要修改父任务的任务的信息包括所述需要修改父任务的任务的新父任务;若所述新父任务在所述多叉树中,删除所述需要修改父任务的任务所在节点,并将所述需要修改父任务的任务作为所述新父任务所在节点的子节点。对于需要修改父任务的任务,删除原节点,并添加新节点,可以保证修改父任务后的任务能够正常调度、正常运行。
本申请的另一个实施例涉及一种调度系统,下面对本实施例的调度系统的细节进行具体的说明,以下内容仅为方便理解提供的实现细节,并非实施本例的必须,图11是本实施例所述的调度系统的示意图,包括:数据库501、调度器502和计算器503。
数据库501分别与调度器502和计算器503连接,调度器502还与计算器503连接。
数据库501用于存储各待调度任务和各待调度任务的信息。
调度器502用于从数据库501中获取各待调度任务的信息,其中,信息包括各待调度任务的父子关系,根据各待调度任务和父子关系,获取各待调度任务的多叉树。
计算器503用于从数据库501获取各待调度任务,根据多叉树,对各待调度任务进行调度。
在一个例子中,如图12所示,计算器503包括存储模块5031,协调模块5032,控制模块5033和执行模块5034,存储模块5031分别于与数据库501、调度器502、协调模块5032和执行模块5034连接,协调模块5032还与控制模块5033连接,控制模块5033还与执行模块5034和数据库501连接。存储模块5031可以从数据库501中获取待调度任务,这些待调度任务进入存储模块5031即计算器503后,自动转变为待执行任务,当待执行任务被要求执行时,存储模块5031将待执行任务发送给协调模块5032,同时,存储模块5031还可以扫描调度器502已构建好的多叉树调度策略,确定待执行任务的状态和其他已完成执行的任务的状态,并告知协调模块5032。协调模块5032在当连接数和任务请求数低于预设阈值时,将空闲的待执行任务提交给控制模块5033。控制模块5033收到空闲的待执行任务后,可以将空闲的待执行任务发送给执行模块5034,并控制执行模块5034执行空闲的待执行任务。控制模块5033还可以在空闲的待执行任务执行完成后,调用预设的反馈算法,将任务结果和任务完成状态返回给数据库501记录保存。
不难发现,本实施例为与上述方法实施例对应的系统实施例,本实施例可以与上述方法实施例互相配合实施。上述实施例中提到的相关技术细节和技术效果在本实施例中依然有效,为了减少重复,这里不再赘述。相应地,本实施例中提到的相关技术细节也可应用在上述实施例中。
值得一提的是,本实施例中所涉及到的各模块均为逻辑模块,在实际应用中,一个逻辑单元可以是一个物理单元,也可以是一个物理单元的一部分,还可以以多个物理单元的组合实现。此外,为了突出本申请的创新部分,本实施例中并没有将与解决本申请所提出的技术问题关系不太密切的单元引入,但这并不表明本实施例中不存在其它的单元。
本申请另一个实施例涉及一种服务器,如图13所示,包括:至少一个处理器601;以及,与所述至少一个处理器601通信连接的存储器602;其中,所述存储器602存储有可被所述至少一个处理器601执行的指令,所述指令被所述至少一个处理器601执行,以使所述至少一个处理器601能够执行上述各实施例中的调度方法。
其中,存储器和处理器采用总线方式连接,总线可以包括任意数量的互联的总线和桥,总线将一个或多个处理器和存储器的各种电路连接在一起。总线还可以将诸如外围设备、稳压器和功率管理电路等之类的各种其他电路连接在一起,这些都是本领域所公知的,因此,本文不再对其进行进一步描述。总线接口在总线和收发机之间提供接口。收发机可以是一个元件,也可以是多个元件,比如多个接收器和发送器,提供用于在传输介质上与各种其他装置通信的单元。经处理器处理的数据通过天线在无线介质上进行传输,进一步,天线还接收数据并将数据传送给处理器。
处理器负责管理总线和通常的处理,还可以提供各种功能,包括定时,外围接口,电压调节、电源管理以及其他控制功能。而存储器可以被用于存储处理器在执行操作时所使用的数据。
本申请另一个实施例涉及一种计算机可读存储介质,存储有计算机程序。计算机程序被处理器执行时实现上述方法实施例。
即,本领域技术人员可以理解,实现上述实施例方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序存储在一个存储介质中,包括若干指令用以使得一个设备(可以是单片机,芯片等)或处理器(processor)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
本领域的普通技术人员可以理解,上述各实施例是实现本申请的具体实施例,而在实际应用中,可以在形式上和细节上对其作各种改变,而不偏离本申请的精神和范围。

Claims (12)

  1. 一种调度方法,应用于服务器,包括:
    获取各待调度任务的信息;其中,所述各待调度任务的信息包括各待调度任务的父子关系;
    根据所述各待调度任务和所述父子关系,获取所述各待调度任务的多叉树;
    根据所述多叉树,对所述各待调度任务进行调度。
  2. 根据权利要求1所述的调度方法,其中,所述根据所述多叉树,对所述各待调度任务进行调度,包括:
    根据所述多叉树,确定所述各待调度任务中需要进行同一串行运行的任务;
    将所述需要进行同一串行运行的任务放入同一个线程中,并将所有线程压入线程池;
    运行所述线程池中的线程。
  3. 根据权利要求2所述的调度方法,其中,所述根据所述多叉树,确定所述各待调度任务中需要进行同一串行运行的任务,包括:
    对所述多叉树进行广度遍历,确定所述各待调度任务中需要进行同一串行运行的任务。
  4. 根据权利要求1至3中任一项所述的调度方法,其中,在所述根据所述多叉树,对所述各待调度任务进行调度之后,还包括:
    确定需要进行修复的任务;其中,所述需要进行修复的任务包括运行失败的任务,和/或,运行结果不符合预设标准的任务;
    根据所述多叉树,确定包含所述需要进行修复的任务的子路径;
    将所述子路径中的所有任务放入同一个线程中,并将所有线程压入线程池;
    运行所述线程池中的线程。
  5. 根据权利要求4所述的调度方法,其中,所述根据所述多叉树,确定包含所述需要进行修复的任务的子路径,包括:
    对所述多叉树进行深度遍历,确定包含所述需要进行修复的任务的子路径。
  6. 根据权利要求1至5中任一项所述的调度方法,其中,根据所述各待调度任务和所述父子关系,获取所述各待调度任务的多叉树,包括:
    将各待调度任务中没有父任务的待调度任务,作为各待调度任务的多叉树的一级子节点;
    将各待调度任务中有父任务的待调度任务,作为所述父任务所在节点的子节点,得到所述各待调度任务的多叉树。
  7. 根据权利要求6所述的调度方法,其中,在所述根据所述多叉树,对所述各待调度任务进行调度之后,还包括:
    获取新增的待调度任务,并获取所述新增的待调度任务的信息;其中,所述新增的待调度任务的信息包括新增的待调度任务的父子关系;
    根据所述新增的待调度任务的父子关系,判断所述新增的待调度任务是否有父任务;
    若所述新增的待调度任务没有父任务,将所述新增的待调度任务添加为一级子节点;
    若所述新增的待调度任务有父任务,且所述新增的待调度任务的父任务在所述多叉树中,将所述新增的待调度任务添加为所述新增的待调度任务的父任务所在节点的子节点;
    判断所述新增的待调度任务是否有子任务;
    若所述新增的待调度任务有子任务,且所述新增的待调度任务的子任务在所述多叉树中,则删除所述新增的待调度任务的子任务所在节点,并将所述新增的待调度任务的子任务添加为所述新增的待调度任务所在节点的子节点。
  8. 根据权利要求6所述的调度方法,其中,在所述根据所述多叉树,对所述各待调度任务进行调度之后,还包括:
    确定需要修改父任务的任务,并获取所述需要修改父任务的任务的信息;其中,所述需要修改父任务的任务的信息包括所述需要修改父任务的任务的新父任务;
    若所述新父任务在所述多叉树中,删除所述需要修改父任务的任务所在节点,并将所述需要修改父任务的任务作为所述新父任务所在节点的子节点。
  9. 根据权利要求1至8中任一项所述的调度方法,其中,所述信息还包括各待调度任务的有效期;
    在所述获取各待调度任务的信息之后,且在所述根据所述各待调度任务和所述父子关系,获取所述各待调度任务的多叉树之前,所述方法还包括:
    根据所述各待调度任务的有效期,判断所述各待调度任务中是否有超期的待调度任务;
    若所述各待调度任务中有超期的待调度任务,丢弃所述超期的待调度任务。
  10. 一种调度系统,包括:数据库、调度器和计算器;
    所述数据库分别与所述调度器和所述计算器连接,所述调度器还与所述计算器连接;
    所述数据库用于存储各待调度任务和所述各待调度任务的信息,其中,所述各待调度任务的信息包括各待调度任务的父子关系;
    所述调度器用于从所述数据库中获取所述各待调度任务的信息,根据所述各待调度任务和所述父子关系,获取所述各待调度任务的多叉树;
    所述计算器用于从所述数据库获取所述各待调度任务,根据所述多叉树,对所述各待调度任务进行调度。
  11. 一种服务器,包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如权利要求1至9中任一项所述的调度方法。
  12. 一种计算机可读存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1至9中任一项所述的调度方法。
PCT/CN2022/095893 2021-06-04 2022-05-30 调度方法、系统、服务器和计算机可读存储介质 WO2022253165A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110624609.6A CN115437757A (zh) 2021-06-04 2021-06-04 调度方法、系统、服务器和计算机可读存储介质
CN202110624609.6 2021-06-04

Publications (1)

Publication Number Publication Date
WO2022253165A1 true WO2022253165A1 (zh) 2022-12-08

Family

ID=84240532

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/095893 WO2022253165A1 (zh) 2021-06-04 2022-05-30 调度方法、系统、服务器和计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN115437757A (zh)
WO (1) WO2022253165A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116149829B (zh) * 2023-04-20 2023-07-21 中邮消费金融有限公司 任务管理方法、装置、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8209701B1 (en) * 2007-09-27 2012-06-26 Emc Corporation Task management using multiple processing threads
US20150301854A1 (en) * 2014-04-21 2015-10-22 Samsung Electronics Co., Ltd. Apparatus and method for hardware-based task scheduling
CN112579273A (zh) * 2020-12-15 2021-03-30 京东数字科技控股股份有限公司 任务调度方法及装置、计算机可读存储介质
CN112749034A (zh) * 2019-10-31 2021-05-04 北京沃东天骏信息技术有限公司 一种数据异常处理方法、装置、存储介质及电子设备
CN112748993A (zh) * 2019-10-31 2021-05-04 北京国双科技有限公司 任务执行方法、装置、存储介质及电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8209701B1 (en) * 2007-09-27 2012-06-26 Emc Corporation Task management using multiple processing threads
US20150301854A1 (en) * 2014-04-21 2015-10-22 Samsung Electronics Co., Ltd. Apparatus and method for hardware-based task scheduling
CN112749034A (zh) * 2019-10-31 2021-05-04 北京沃东天骏信息技术有限公司 一种数据异常处理方法、装置、存储介质及电子设备
CN112748993A (zh) * 2019-10-31 2021-05-04 北京国双科技有限公司 任务执行方法、装置、存储介质及电子设备
CN112579273A (zh) * 2020-12-15 2021-03-30 京东数字科技控股股份有限公司 任务调度方法及装置、计算机可读存储介质

Also Published As

Publication number Publication date
CN115437757A (zh) 2022-12-06

Similar Documents

Publication Publication Date Title
CN111427681B (zh) 边缘计算中基于资源监控的实时任务匹配调度系统和方法
CN104572122B (zh) 一种软件应用数据的生成装置及方法
CN105719126B (zh) 一种基于生命周期模型的互联网大数据任务调度的系统及方法
US20140250103A1 (en) Obtaining partial results from a database query
CN111930489B (zh) 一种任务调度方法、装置、设备及存储介质
CN105808323A (zh) 一种虚拟机创建方法及系统
CN105446799A (zh) 一种计算机系统中进行规则管理的方法及系统
CN102542382A (zh) 业务规则的管理方法和装置
US20120005682A1 (en) Holistic task scheduling for distributed computing
CN108509339A (zh) 基于浏览器和思维导图的测试用例生成方法、装置及设备
CN107870949B (zh) 数据分析作业依赖关系生成方法和系统
US20120215583A1 (en) System and method for managing real-time batch workflows
CN110297820B (zh) 一种数据处理方法、装置、设备和存储介质
CN110399089B (zh) 数据存储方法、装置、设备和介质
WO2022253165A1 (zh) 调度方法、系统、服务器和计算机可读存储介质
US8561011B2 (en) Task management for changes to shared artifacts
CN114661752A (zh) 分布式数据库的计划调度方法、装置和系统
US10503823B2 (en) Method and apparatus providing contextual suggestion in planning spreadsheet
CN112395339B (zh) 系统间数据准入校验方法、装置、计算机设备和存储介质
CN114996319B (zh) 基于规则引擎的数据处理方法、装置、设备及存储介质
CN114416669B (zh) 群组过程文件管理方法、装置、网盘及存储介质
US12072886B2 (en) Method and device for accelerating database operation
CN113139022B (zh) 一种基于混合规则的企业物流数据按需融合方法
CN114969111A (zh) 分布式数据库的逻辑子计划执行方法、装置及系统
CN113722141A (zh) 数据任务的延迟原因确定方法、装置、电子设备及介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22815211

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22815211

Country of ref document: EP

Kind code of ref document: A1