WO2022095358A1 - Task scheduling method and apparatus, electronic device, and readable storage medium - Google Patents
Task scheduling method and apparatus, electronic device, and readable storage medium Download PDFInfo
- Publication number
- WO2022095358A1 WO2022095358A1 PCT/CN2021/090716 CN2021090716W WO2022095358A1 WO 2022095358 A1 WO2022095358 A1 WO 2022095358A1 CN 2021090716 W CN2021090716 W CN 2021090716W WO 2022095358 A1 WO2022095358 A1 WO 2022095358A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- task
- scheduling
- scheduled
- standard
- tasks
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 42
- 238000003860 storage Methods 0.000 title claims abstract description 21
- 238000003780 insertion Methods 0.000 claims abstract description 39
- 230000037431 insertion Effects 0.000 claims abstract description 39
- 238000012216 screening Methods 0.000 claims abstract description 14
- 230000006870 function Effects 0.000 claims description 61
- 238000005457 optimization Methods 0.000 claims description 52
- 238000004590 computer program Methods 0.000 claims description 15
- 238000012545 processing Methods 0.000 claims description 9
- 238000000605 extraction Methods 0.000 claims 8
- 238000004220 aggregation Methods 0.000 claims 3
- 230000002776 aggregation Effects 0.000 claims 3
- 230000008569 process Effects 0.000 abstract description 5
- 238000005516 engineering process Methods 0.000 abstract description 4
- 238000007726 management method Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 239000000284 extract Substances 0.000 description 4
- 238000004422 calculation algorithm Methods 0.000 description 3
- GNFTZDOKVXKIBK-UHFFFAOYSA-N 3-(2-methoxyethoxy)benzohydrazide Chemical compound COCCOC1=CC=CC(C(=O)NN)=C1 GNFTZDOKVXKIBK-UHFFFAOYSA-N 0.000 description 2
- FGUUSXIOTUKUDN-IBGZPJMESA-N C1(=CC=CC=C1)N1C2=C(NC([C@H](C1)NC=1OC(=NN=1)C1=CC=CC=C1)=O)C=CC=C2 Chemical compound C1(=CC=CC=C1)N1C2=C(NC([C@H](C1)NC=1OC(=NN=1)C1=CC=CC=C1)=O)C=CC=C2 FGUUSXIOTUKUDN-IBGZPJMESA-N 0.000 description 2
- 238000004364 calculation method Methods 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 230000003111 delayed effect Effects 0.000 description 2
- 239000004973 liquid crystal related substance Substances 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
Definitions
- the present application relates to the field of Internet technologies, and in particular, to a task scheduling method, apparatus, electronic device, and readable storage medium.
- the first-come, first-served scheduling scheme based on task priority is used in many fields, such as thread scheduling in the operating system, scheduling of workshop workpieces on the production line, etc.
- the inventor realizes that although this strategy is simple and effective, in some business scenarios, due to the relatively rich attributes of tasks to be scheduled, better resource usage and even user experience cannot be guaranteed, such as financial settlement related to e-commerce in the banking system.
- the efficiency of business task scheduling directly affects the user's shopping experience, so a better task scheduling method is needed to improve the efficiency of multi-task scheduling.
- a task scheduling method provided by this application includes:
- Task scheduling is performed according to the task scheduling table.
- the present application also provides a task scheduling device, the device comprising:
- the scheduling table generation module is used to obtain the task set to be scheduled, sort the task set to be scheduled, and obtain a standard task set to be scheduled; schedule and assign tasks in the standard task set to be scheduled in order to obtain an initial task scheduling table and unscheduled task set; perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table, and obtain a standard scheduled task table; randomly shuffle the order of the tasks in the standard to-be-scheduled task set for many times, Obtain a plurality of random task sets to be scheduled; schedule and assign tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set; All tasks in the scheduling task set are inserted and scheduled to obtain a random standard scheduling task table, and all the random standard scheduling task tables are aggregated to obtain a random standard scheduling task table set; according to the standard scheduling task table, the random standard scheduling task Filter the table set to obtain one or more scheduling tables to be selected;
- the scheduling table screening module is used to select one of the scheduling tables to be selected as the task scheduling table according to a preset rule from the plurality of scheduling tables to be selected;
- the scheduling table scheduling module is configured to perform task scheduling according to the task scheduling table.
- the present application also provides an electronic device, the electronic device comprising:
- the processor executes the computer program stored in the memory to realize the following steps:
- Task scheduling is performed according to the task scheduling table.
- the present application also provides a computer-readable storage medium, where at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is executed by a processor in an electronic device to implement the following steps:
- Task scheduling is performed according to the task scheduling table.
- FIG. 1 is a schematic flowchart of a task scheduling method provided by an embodiment of the present application
- FIG. 2 is a schematic flowchart of obtaining one or more scheduling tables to be selected in a task scheduling method provided by an embodiment of the present application;
- FIG. 3 is a schematic block diagram of a task scheduling apparatus provided by an embodiment of the present application.
- FIG. 4 is a schematic diagram of the internal structure of an electronic device for implementing a task scheduling method provided by an embodiment of the present application
- the embodiment of the present application provides a task scheduling method.
- the execution subject of the task scheduling method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server and a terminal.
- the task scheduling method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform.
- the server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
- the task scheduling method includes:
- the set of tasks to be scheduled is a set of multiple tasks to be scheduled, such as multiple programs to be executed, threads to be executed, and the like.
- the tasks to be scheduled have corresponding task information marks, wherein the task information includes: task name, task plan start time, task latest deadline, task expected execution time, task priority, task executable list of objects, etc.
- the task executable object list is a list of numbers or names of the task executable objects, indicating which execution objects the task can be executed on. For example: task a can be executed on execution objects B, C, and D, then The executable object list of task a includes: execution objects B, C and D.
- the execution object is a carrier for task execution, such as a computer, a computer cluster, and the like.
- All tasks to be scheduled in the set of tasks to be scheduled are sorted according to the priority of the task and the scheduled start time of the task to obtain the standard set of tasks to be scheduled.
- sorting all tasks to be scheduled in the set of tasks to be scheduled according to the task priority corresponding to each task to be scheduled in the set of tasks to be scheduled and the planned start time of the task including: The to-be-scheduled tasks in the to-be-scheduled task set are sorted according to the task priorities to obtain an initial to-be-scheduled task set; The standard set of tasks to be scheduled.
- the embodiment of the present application extracts the execution objects in the executable object list corresponding to each to-be-scheduled task in the standard to-be-scheduled task set, and performs a summary and deduplication process on the extracted execution objects to obtain Execute the object set.
- task O and task Q there are two tasks to be scheduled in the standard task set to be scheduled, task O and task Q, the executable object list of task O includes execution objects B and C, and the executable object list of task Q includes execution objects C and D.
- deduplication processing by summarizing execution objects B and C and execution objects C and D to obtain execution object sets B, C, and D.
- the execution object scheduling of each execution object in the execution object set is obtained.
- a task set wherein the execution object scheduling task set is a set of tasks that have been scheduled in the execution object, and each task in the execution object scheduling task set contains corresponding task scheduling information, including: task scheduling start time, task scheduling Estimated execution time, latest task deadline, and task scheduling execution object.
- one execution object can only execute one task at the same time.
- the embodiment of the present application schedules and allocates tasks in the standard task set to be scheduled according to the execution object set and the execution object scheduling task set in sequence, so as to obtain an initial task scheduling table and an unscheduled task set.
- the tasks in the standard to-be-scheduled task set are scheduled and allocated in order to obtain an initial task schedule and an unscheduled task set, including:
- Step A extracting a task to be scheduled Task i from the standard task set to be scheduled by traversing operation
- Step B sorting the extracted execution objects in the executable object list of the to-be-scheduled task Task i according to the execution object scheduling task set to obtain a first standard execution object list;
- the executable object list of the task to be scheduled Task i includes: execution objects B, C, D, the number of tasks in the execution object scheduling task set corresponding to execution object B is 2, and the execution object corresponding to execution object C in the execution object scheduling task set is 2 tasks.
- the number of tasks is 5, and the number of tasks in the execution object scheduling task set corresponding to execution object D is 3.
- the list of executable objects of the to-be-scheduled task Task i is compared.
- the execution objects are sorted according to the order of execution objects to obtain the first standard execution object list of the task Task i to be scheduled.
- the execution objects in the first standard execution object list are execution object C, execution object D, and execution object B in sequence.
- Step C extract a standard execution object Machine j from the first standard execution object list by traversing operation
- Step D extract the scheduling time of each task in the execution scheduling task set of the standard execution object, and judge whether the extracted scheduling time has a time conflict with the planning scheduling time included in the task Task i to be scheduled; If there is no time conflict in the extracted planned scheduling time of the to-be-scheduled task Task i , then directly schedule the to-be-scheduled task Task i , and add the directly-scheduled to-be-scheduled task Task i to the execution scheduling task set , and return to step A, until the task traversal in the standard to-be-scheduled task set is completed; if there is a time conflict between all the scheduling times and the planned scheduling time corresponding to the to-be-scheduled task Task i , the to-be-scheduled task Task i i is determined to be an unscheduled task, and returns to step C until the task traversal in the standard to-be-scheduled task set is completed;
- the embodiment of the present application extracts the task scheduling time of each task according to the task scheduling information contained in each task in the execution object scheduling task set, for example: the task start time in the task scheduling information of task A is 8:00 and the task's estimated execution time is 30 minutes, then the scheduling time of task A is 8:00 to 8:30.
- the time conflict in the embodiments of the present application refers to the overlapping part of the time interval, for example, the scheduling time o is from 8:00 to 8:30, and the planned scheduling time p is from 8:15 to 8:45.
- the time intervals overlap, so the scheduling time o and the planned scheduling time p have a time conflict.
- the direct scheduling of the to-be-scheduled task Task i in the embodiment of the present application includes: determining the corresponding planned scheduling time of the to-be-scheduled task Task i as the scheduling time, and determining the scheduling execution object.
- Step E Summarize all execution object scheduling task sets to obtain an initial scheduled task table, and sort and summarize all the unscheduled tasks to obtain an unscheduled task set.
- the embodiment of the present application summarizes the execution object scheduling task set of all execution objects according to the execution object set, obtains an initial scheduling task table, and assigns all the unscheduled tasks according to the corresponding order of the standard to-be-scheduled task set. Sort and summarize in order to get the set of unscheduled tasks.
- the initial scheduled task table is determined as a standard scheduled task table.
- insert scheduling is performed on all tasks in the unscheduled task set according to the initial scheduled task table to obtain a standard scheduled task table.
- the insertion scheduling is performed on all tasks in the unscheduled task set according to the initial scheduled task table.
- the standard schedule task table including:
- Step a sequentially extracting an unscheduled task Task q from the unscheduled task set through a traversal operation
- Step b sorting the execution objects in the executable object list of the unscheduled task Task q according to the execution object scheduling task set to obtain a second standard execution object list;
- Step c Take out a standard execution object in turn from the first standard execution object list through a traversal operation, select all tasks in the execution scheduling task set corresponding to the standard execution object that meet the preset insertion conditions, and obtain an insertion task set, wherein , the insertion condition is that the task scheduling start time is greater than or equal to the task planning start time of the unscheduled task Task q , the first task Task s in the task set is inserted, and the last task is Task send .
- Step d attempt to insert described unscheduled task Task q into the gap between the second task Task s-1 and the first task Task s in the described insertion task set, and adjust the insertion of task Task s and the execution object thereafter All scheduled tasks in the task set are until there is no conflict; if the adjustment result causes the last task Task send to be inserted into the task set to be abandoned, then continue to try to insert the unscheduled task Task q into the next gap; if the adjustment result satisfies the condition, then jump Go to step e below.
- the scheduling time of task A is 10:00 to 10:30
- the scheduling time of task B is 10:45 to 11:30
- the scheduling time of task C is not scheduled.
- the scheduled scheduling time is from 9:00 to 9:30.
- the scheduling time of unscheduled task C is from 10:30 to 11:00.
- the scheduling time of task B is adjusted and delayed to 11:00 to 11:45.
- the scheduling end time of a task is greater than the latest task deadline of the task, the task is discarded.
- Step e Count the delay time of the execution object after the unscheduled task Task q is inserted into the gap. If the delay time is less than the delay time calculated before, update the minimum delay time of the execution object and record the gap.
- the delay time calculation formula in the embodiment of the present application is as follows:
- n is the total number of scheduled tasks of the execution object
- q is the scheduled tasks in the execution object
- RealStartTime q is the task scheduling start time
- ExecutionTime q is the expected execution time of the task
- EndTime q is the latest deadline for the task.
- Step f mark whether the execution object can be scheduled, and update the information of the minimum delay time, and jump to the above step c, until all the execution objects in the standard execution object list of the unscheduled task Task q are traversed.
- Step g choose the execution object with the minimum schedulable minimum delay time in the standard execution object list corresponding to the unscheduled task Task q , insert the unscheduled task Task q into the gap recorded in step e, and return to step a , until all the unscheduled task sets in the unscheduled task set are traversed, and the standard scheduled task table is obtained by counting the task information of each task in the standard unscheduled task set at this time.
- the standard scheduling task table may be locally optimal scheduling.
- the embodiment of the present application randomly shuffles the tasks in the standard to-be-scheduled task set multiple times to obtain multiple random to-be-scheduled task sets.
- randomly shuffling the order of tasks in the standard to-be-scheduled task set for multiple times to obtain multiple random to-be-scheduled task sets includes: arranging the tasks in the standard to-be-scheduled task set according to the predetermined order.
- the set sorting rule set is sorted multiple times to obtain a plurality of the random task sets to be scheduled, wherein the sorting rules in the sorting rule set include: task estimated execution time sorting, task priority sorting and/or task planning start time sorting .
- the method for sequentially scheduling and assigning tasks in the random task set to be scheduled is the same as the above S2, and details are not described herein again.
- the random initial task scheduling table is determined as a random standard task scheduling table; if If the number of tasks in the random unscheduled task set is not zero, shuffle the tasks in the random initial unscheduled task set according to a preset sorting rule to obtain a random unscheduled task set, and according to the random initial task scheduling table Perform insertion scheduling on all tasks in the random unscheduled task set to obtain a random standard task scheduling table.
- the method for performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table described in the embodiment of the present application is the same as the above-mentioned S3, and details are not repeated here.
- the random standard scheduling task table set is screened according to the standard scheduling task table to obtain one or more to-be-selected scheduling tables, including:
- the embodiment of the present application uses the following objective optimization function to calculate the optimization function value F of each random standard scheduling task table set in the random standard scheduling task table set:
- f 1 is the task delay time optimization function
- f 2 is the number of tasks discarded
- f 3 is the optimization function of the minimum number of executors
- StartTime i is the task plan start time of task i
- ExecutionTime i is the estimated execution time of task i
- EndTime i is the latest deadline of the task
- Machine j is the jth execution object in the execution object set
- t is the execution time of the task i
- M is the execution object set.
- the random standard scheduling task table set includes a first random standard task scheduling table with an optimization function value of 10, a second random standard task scheduling table with an optimization function value of 15, and a third random standard task with an optimization function value of 17.
- the second random standard task schedule table of 15 is the schedule table to be selected.
- the embodiment of the present application calculates the scores of the one or more to-be-selected schedules, and determines the to-be-selected schedule with the lowest score as the task schedule.
- the following scoring algorithm is used to calculate the score Grade i of the scheduling table to be selected:
- Grade i the delay time of the task with the highest priority ⁇ ⁇ + the delay time of the task with the non-highest priority ⁇ ⁇
- ⁇ , ⁇ , ⁇ , ⁇ are preset weight coefficients.
- the task scheduling table is selected as the task scheduling table with the lowest score.
- the score of the first scheduling table to be selected among the multiple scheduling tables to be selected is 33, and the score of the second scheduling table to be selected is 66. Then, the first scheduling table to be selected is selected as the task scheduling table.
- the task schedule may be stored in a blockchain node.
- the task is scheduled to the execution objects in the execution object set for execution according to the task scheduling table.
- FIG. 3 it is a functional block diagram of the task scheduling apparatus of the present application.
- the task scheduling apparatus 100 described in this application may be installed in an electronic device. According to the realized functions, the task scheduling apparatus may include a schedule generation module 101, a schedule screening module 102, and a schedule scheduling module 103.
- the modules in the present invention may also be referred to as units, which refer to a device that can be used by electronic equipment. A series of computer program segments executed by a processor and capable of performing fixed functions and stored in the memory of an electronic device.
- each module/unit is as follows:
- the scheduling table generating module 101 is configured to obtain a task set to be scheduled, sort the task set to be scheduled, and obtain a standard task set to be scheduled; schedule and assign tasks in the standard task set to be scheduled in order to obtain an initial task Scheduling table and unscheduled task set; perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table to obtain a standard scheduled task table; randomly scramble the tasks in the standard to-be-scheduled task set for many times sequence to obtain a plurality of random task sets to be scheduled; assign tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set; All tasks in the random unscheduled task set are inserted and scheduled to obtain a random standard scheduling task table, and all the random standard scheduling task tables are aggregated to obtain a random standard scheduling task table set; according to the standard scheduling task table, the random standard The scheduling task table set is filtered to obtain one or more scheduling tables to be selected.
- the set of tasks to be scheduled is a set of multiple tasks to be scheduled, such as multiple programs to be executed, threads to be executed, and the like.
- the tasks to be scheduled have corresponding task information marks, wherein the task information includes: task name, task plan start time, task latest deadline, task expected execution time, task priority, task executable list of objects, etc.
- the task executable object list is a list of numbers or names of the task executable objects, indicating which execution objects the task can be executed on. For example: task a can be executed on execution objects B, C, and D, then The executable object list of task a includes: execution objects B, C and D.
- the execution object is a carrier for task execution, such as a computer, a computer cluster, and the like.
- All tasks to be scheduled in the set of tasks to be scheduled are sorted by the task priority corresponding to each task to be scheduled and the scheduled start time of the task to obtain the standard set of tasks to be scheduled.
- the scheduling table generating module 101 in the embodiment of the present application performs all tasks to be scheduled in the set of tasks to be scheduled according to the task priority and planned start time of each task to be scheduled in the set of tasks to be scheduled.
- Sorting includes: sorting tasks to be scheduled in the set of tasks to be scheduled according to task priorities to obtain an initial set of tasks to be scheduled; Sorting is performed to obtain the standard task set to be scheduled.
- the scheduling table generation module 101 described in this embodiment of the present application extracts the execution objects in the executable object list corresponding to each to-be-scheduled task in the standard to-be-scheduled task set, and performs an analysis on the extracted execution objects. Perform summary and deduplication processing to obtain the execution object set.
- task O and task Q there are two tasks to be scheduled in the standard task set to be scheduled, task O and task Q, the executable object list of task O includes execution objects B and C, and the executable object list of task Q includes execution objects C and D.
- deduplication processing by summarizing execution objects B and C and execution objects C and D to obtain execution object sets B, C, and D.
- An execution object scheduling task set of an execution object wherein the execution object scheduling task set is the task set that has been scheduled in the execution object, and each task in the execution object scheduling task set contains corresponding task scheduling information, including : Task scheduling start time, task expected execution time, task latest deadline, task scheduling execution object.
- task scheduling information including : Task scheduling start time, task expected execution time, task latest deadline, task scheduling execution object.
- one execution object can only execute one task at the same time.
- the scheduling table generating module 101 schedules and allocates tasks in the standard task set to be scheduled in order, and obtains the initial task scheduling table and the unscheduled tasks. Schedule a set of tasks.
- the scheduling table generating module 101 described in the embodiment of the present application obtains the initial task scheduling table and the unscheduled task set by using the following means, including:
- Step A extracting a task to be scheduled Task i from the standard task set to be scheduled by traversing operation
- Step B sorting the extracted execution objects in the executable object list of the to-be-scheduled task Task i according to the execution object scheduling task set to obtain a first standard execution object list;
- the executable object list of the task to be scheduled Task i includes: execution objects B, C, D, the number of tasks in the execution object scheduling task set corresponding to execution object B is 2, and the execution object corresponding to execution object C in the execution object scheduling task set is 2 tasks.
- the number of tasks is 5, and the number of tasks in the execution object scheduling task set corresponding to execution object D is 3.
- the list of executable objects of the to-be-scheduled task Task i is compared.
- the execution objects are sorted according to the order of execution objects to obtain the first standard execution object list of the task Task i to be scheduled.
- the execution objects in the first standard execution object list are execution object C, execution object D, and execution object B in sequence.
- Step C extract a standard execution object Machine j from the first standard execution object list by traversing operation
- Step D extract the scheduling time of each task in the execution scheduling task set of the standard execution object, and judge whether the extracted scheduling time has a time conflict with the planning scheduling time included in the task Task i to be scheduled; If there is no time conflict in the extracted planned scheduling time of the to-be-scheduled task Task i , then directly schedule the to-be-scheduled task Task i , and add the directly-scheduled to-be-scheduled task Task i to the execution scheduling task set , and return to step A, until the task traversal in the standard to-be-scheduled task set is completed; if there is a time conflict between all the scheduling times and the planned scheduling time corresponding to the to-be-scheduled task Task i , the to-be-scheduled task Task i i is determined to be an unscheduled task, and returns to step C until the task traversal in the standard to-be-scheduled task set is completed;
- the embodiment of the present application extracts the task scheduling time of each task according to the task scheduling information contained in each task in the execution object scheduling task set, for example: the task start time in the task scheduling information of task A is 8:00 and the task's estimated execution time is 30 minutes, then the scheduling time of task A is 8:00 to 8:30.
- the time conflict in the embodiments of the present application refers to the overlapping part of the time interval, for example, the scheduling time o is from 8:00 to 8:30, and the planned scheduling time p is from 8:15 to 8:45.
- the time intervals overlap, so the scheduling time o and the planned scheduling time p have a time conflict.
- the direct scheduling of the to-be-scheduled task Task i in the embodiment of the present application includes: determining the corresponding planned scheduling time of the to-be-scheduled task Task i as the scheduling time, and determining the scheduling execution object.
- Step E Summarize all execution object scheduling task sets to obtain an initial scheduled task table, and sort and summarize all the unscheduled tasks to obtain an unscheduled task set.
- the embodiment of the present application summarizes the execution object scheduling task set of all execution objects according to the execution object set, obtains an initial scheduling task table, and assigns all the unscheduled tasks according to the corresponding order of the standard to-be-scheduled task set. Sort and summarize in order to get the set of unscheduled tasks.
- the scheduling table generating module 101 determines the initial scheduling task table as Standard schedule task table.
- the scheduling table generation module 101 performs insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table, Get a list of standard scheduled tasks.
- the schedule generation module 101 uses the following means to insert all tasks in the unscheduled task set: Scheduling, get the standard scheduling task table, including:
- Step a sequentially extracting an unscheduled task Task q from the unscheduled task set through a traversal operation
- Step b sorting the execution objects in the executable object list of the unscheduled task Task q according to the execution object scheduling task set to obtain a second standard execution object list;
- Step c Take out a standard execution object in turn from the first standard execution object list through a traversal operation, select all tasks in the execution scheduling task set corresponding to the standard execution object that meet the preset insertion conditions, and obtain an insertion task set, wherein , the insertion condition is that the task scheduling start time is greater than or equal to the task planning start time of the unscheduled task Task q , the first task Task s in the task set is inserted, and the last task is Task send .
- Step d attempt to insert described unscheduled task Task q into the gap between the second task Task s-1 and the first task Task s in the described insertion task set, and adjust the insertion of task Task s and the execution object thereafter All scheduled tasks in the task set are until there is no conflict; if the adjustment result causes the last task Task send to be inserted into the task set to be abandoned, then continue to try to insert the unscheduled task Task q into the next gap; if the adjustment result satisfies the condition, then jump Go to step e below.
- the scheduling time of task A is 10:00 to 10:30
- the scheduling time of task B is 10:45 to 11:30
- the scheduling time of task C is not scheduled.
- the scheduled scheduling time is from 9:00 to 9:30.
- the scheduling time of unscheduled task C is from 10:30 to 11:00.
- the scheduling time of task B is adjusted and delayed to 11:00 to 11:45.
- the scheduling end time of a task is greater than the latest task deadline of the task, the task is discarded.
- Step e Count the delay time of the execution object after the unscheduled task Task q is inserted into the gap. If the delay time is less than the delay time calculated before, update the minimum delay time of the execution object and record the gap.
- the delay time calculation formula in the embodiment of the present application is as follows:
- n is the total amount of scheduled tasks of the execution object
- q is the scheduled tasks in the execution object
- RealStartTime q is the task scheduling start time
- ExecutionTime q is the expected execution time of the task
- EndTime q is the latest deadline for the task.
- Step f mark whether the execution object can be scheduled, and update the information of the minimum delay time, and jump to the above step c, until all the execution objects in the standard execution object list of the unscheduled task Task q are traversed.
- Step g choose the execution object with the minimum schedulable minimum delay time in the standard execution object list corresponding to the unscheduled task Task q , insert the unscheduled task Task q into the gap recorded in step e, and return to step a , until all the unscheduled task sets in the unscheduled task set have been traversed, and at this time, the task information of each task in the standard to-be-scheduled task set is counted to obtain a standard scheduled task table.
- the standard scheduling task table may be locally optimal scheduling.
- the scheduling table generating module 101 in the embodiment of the present application randomly shuffles the tasks in the standard task set to be scheduled for many times to obtain multiple tasks. A random set of tasks to be scheduled.
- the scheduling table generating module 101 in the embodiment of the present application randomly shuffles the tasks in the standard task set to be scheduled multiple times to obtain multiple random task sets to be scheduled, including: The centralized tasks are sorted multiple times according to a preset sorting rule set to obtain a plurality of the random task sets to be scheduled, wherein the sorting rules in the sorting rule set include: sorting by expected execution time of tasks, sorting by priority of tasks, and/or Task schedule start time sorting.
- the method for sequentially scheduling and assigning tasks in the random to-be-scheduled task set is the same as the above-mentioned method for sequentially scheduling and assigning tasks in the standard to-be-scheduled task set, and details are not repeated here.
- the schedule generation module 101 determines the random initial task schedule as: Random standard task scheduling table; if the number of tasks in the random unscheduled task set is not zero, the scheduling table generating module 101 shuffles the tasks in the random initial unscheduled task set according to the preset sorting rules to obtain random unscheduled tasks A task set, performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial task scheduling table to obtain a random standard task scheduling table.
- the method of performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table in the embodiment of the present application is the same as the above-mentioned method for performing insertion scheduling on all tasks in the unscheduled task set. The method is the same, and will not be repeated here.
- the scheduling table generation module 101 uses the following means to filter the random standard scheduling task table set to obtain one or more scheduling tables to be selected, including:
- the embodiment of the present application uses the following objective optimization function to calculate the optimization function value F of each random standard scheduling task table set in the random standard scheduling task table set:
- f 1 is the task delay time optimization function
- f 2 is the number of tasks discarded
- f 3 is the optimization function of the minimum number of executors
- StartTime i is the task plan start time of task i
- ExecutionTime i is the estimated execution time of task i
- EndTime i is the latest deadline of the task
- Machine j is the jth execution object in the execution object set
- t is the execution time of the task i
- M is the execution object set.
- the random standard scheduling task table set includes a first random standard task scheduling table with an optimization function value of 10, a second random standard task scheduling table with an optimization function value of 15, and a third random standard task with an optimization function value of 17.
- the second random standard task schedule table of 15 is the schedule table to be selected.
- the scheduling table screening module 102 is configured to select one of the scheduling tables to be selected as the task scheduling table according to a preset rule from among the scheduling tables to be selected.
- the schedule screening module 102 described in this embodiment of the present application calculates the score of the one or more schedules to be selected, and determines that the schedule to be selected with the lowest score is the task schedule.
- the scheduling table screening module 102 uses the following scoring algorithm to calculate the score Grade i of the scheduling table to be selected:
- Grade i the delay time of the task with the highest priority ⁇ ⁇ + the delay time of the task with the non-highest priority ⁇ ⁇
- ⁇ , ⁇ , ⁇ , ⁇ are preset weight coefficients.
- the task scheduling table is selected as the task scheduling table with the lowest score.
- the score of the first scheduling table to be selected among the multiple scheduling tables to be selected is 33, and the score of the second scheduling table to be selected is 66. Then, the first scheduling table to be selected is selected as the task scheduling table.
- the task schedule may be stored in a blockchain node.
- the scheduling table scheduling module 103 is configured to perform task scheduling according to the task scheduling table.
- tasks are scheduled to execution objects in the execution object set for execution according to the task scheduling table.
- FIG. 4 it is a schematic structural diagram of an electronic device implementing the task scheduling method of the present application.
- the electronic device 1 may include a processor 10, a memory 11 and a bus, and may also include a computer program, such as a task scheduler 12, stored in the memory 11 and executable on the processor 10.
- a computer program such as a task scheduler 12 stored in the memory 11 and executable on the processor 10.
- the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, magnetic disk, CD etc.
- the memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a mobile hard disk of the electronic device 1 .
- the memory 11 may also be an external storage device of the electronic device 1, such as a pluggable mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital) equipped on the electronic device 1. , SD) card, flash memory card (Flash Card), etc.
- the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device.
- the memory 11 can not only be used to store application software installed in the electronic device 1 and various types of data, such as the code of a task scheduler, etc., but also can be used to temporarily store data that has been output or will be output.
- the processor 10 may be composed of integrated circuits, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits packaged with the same function or different functions, including one or more integrated circuits.
- Central Processing Unit CPU
- microprocessor digital processing chip
- graphics processor and combination of various control chips, etc.
- the processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect the various components of the entire electronic device, by running or executing programs or modules (such as tasks) stored in the memory 11. Scheduler, etc.), and call data stored in the memory 11 to execute various functions of the electronic device 1 and process data.
- the bus may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (Extended industry standard architecture, EISA for short) bus or the like.
- PCI peripheral component interconnect
- EISA Extended industry standard architecture
- the bus can be divided into address bus, data bus, control bus and so on.
- the bus is configured to implement connection communication between the memory 11 and at least one processor 10 and the like.
- FIG. 4 only shows an electronic device with components. Those skilled in the art can understand that the structure shown in FIG. 4 does not constitute a limitation on the electronic device 1, and may include fewer or more components than those shown in the drawings. components, or a combination of certain components, or a different arrangement of components.
- the electronic device 1 may also include a power supply (such as a battery) for powering the various components, preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that the power management
- the device implements functions such as charge management, discharge management, and power consumption management.
- the power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components.
- the electronic device 1 may further include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
- the electronic device 1 may also include a network interface, optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
- a network interface optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
- the electronic device 1 may further include a user interface, and the user interface may be a display (Display), an input unit (eg, a keyboard (Keyboard)), optionally, the user interface may also be a standard wired interface or a wireless interface.
- the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, and the like.
- the display may also be appropriately called a display screen or a display unit, which is used for displaying information processed in the electronic device 1 and for displaying a visualized user interface.
- the task scheduler 12 stored in the memory 11 in the electronic device 1 is a combination of multiple computer programs, and when running in the processor 10, it can realize:
- Task scheduling is performed according to the task scheduling table.
- the modules/units integrated in the electronic device 1 may be stored in a computer-readable storage medium.
- the computer-readable storage medium may be non-volatile or volatile.
- the computer-readable storage medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory) ).
- a computer program is stored in the computer-readable storage medium, and when the computer program is executed by the processor, the following steps are implemented:
- Task scheduling is performed according to the task scheduling table.
- modules described as separate components may or may not be physically separated, and components shown as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
- each functional module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
- the above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
- the blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
- Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block.
- the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
A task scheduling method and apparatus, an electronic device, and a computer-readable storage medium, which relate to Internet technology. The method comprises: sorting all tasks in a set of tasks to be scheduled, so as to obtain a standard set of tasks to be scheduled, and performing a scheduling process, which includes sequential allocation and insertion scheduling, on tasks in the standard set of tasks to be scheduled, so as to obtain a standard scheduled task table; randomly disrupting, multiple times, the order of the tasks in the standard set of tasks to be scheduled, so as to obtain a plurality of random sets of tasks to be scheduled; performing the same scheduling process on the random sets of tasks to be scheduled as that on the standard set of tasks to be scheduled, so as to obtain random standard scheduled task table sets; performing screening on the random standard scheduled task table sets according to the standard scheduled task table, so as to obtain a task scheduling table; and performing task scheduling according to the task scheduling table. The task scheduling table can be stored in a blockchain. By means of the method, the efficiency of multi-task scheduling can be improved.
Description
本申请要求于2020年11月06日提交中国专利局、申请号为CN202011229916.6、名称为“任务调度方法、装置、电子设备及可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number CN202011229916.6 and the title of "Task Scheduling Method, Device, Electronic Device and Readable Storage Medium", which was filed with the Chinese Patent Office on November 06, 2020, the entire contents of which are Incorporated herein by reference.
本申请涉及互联网技术领域,尤其涉及一种任务调度方法、装置、电子设备及可读存储介质。The present application relates to the field of Internet technologies, and in particular, to a task scheduling method, apparatus, electronic device, and readable storage medium.
随着计算机技术的发展,在计算机运行的过程中存在着调度多任务执行的情形,合理的安排多任务的执行顺序,有利于缩减总体任务执行的时间,提高执行任务的效率。With the development of computer technology, there is a situation of scheduling multi-task execution in the process of computer operation. Reasonably arranging the execution sequence of multi-tasks is beneficial to shorten the overall task execution time and improve the efficiency of task execution.
当前,基于任务优先级的先来先调度方案在很多领域都有使用,比如操作系统内的线程调度,车间工件在生产线的调度等。发明人意识到这种策略虽然简单有效,但是在某些业务场景下,由于待调度的任务属性比较丰富,无法保证更优的资源使用甚至用户体验,例如:银行系统的电子商务相关的金融结算业务的任务调度的效率直接影响用户的购物体验,因此需要一种更好地任务调度方法来提高多任务调度的效率。Currently, the first-come, first-served scheduling scheme based on task priority is used in many fields, such as thread scheduling in the operating system, scheduling of workshop workpieces on the production line, etc. The inventor realizes that although this strategy is simple and effective, in some business scenarios, due to the relatively rich attributes of tasks to be scheduled, better resource usage and even user experience cannot be guaranteed, such as financial settlement related to e-commerce in the banking system. The efficiency of business task scheduling directly affects the user's shopping experience, so a better task scheduling method is needed to improve the efficiency of multi-task scheduling.
发明内容SUMMARY OF THE INVENTION
本申请提供的一种任务调度方法,包括:A task scheduling method provided by this application includes:
获取待调度任务集,对所述待调度任务集进行排序,得到标准待调度任务集;Obtaining a task set to be scheduled, sorting the task set to be scheduled, and obtaining a standard task set to be scheduled;
将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集;Scheduling and assigning tasks in the standard to-be-scheduled task set in order to obtain an initial task schedule and an unscheduled task set;
根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表;Perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table to obtain a standard scheduled task table;
将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集;Randomly shuffle the tasks in the standard task set to be scheduled for multiple times to obtain multiple random task sets to be scheduled;
将所述随机待调度任务集中的任务按顺序调度分配,得到随机初始任务调度表及随机未调度任务集;Scheduling and assigning tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set;
根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准调度任务表,汇总所有的所述随机标准调度任务表,得到随机标准调度任务表集;Performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table, obtaining a random standard scheduling task table, summarizing all the random standard scheduling task tables, and obtaining a random standard scheduling task table set;
根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表;Screening the random standard scheduling task table set according to the standard scheduling task table to obtain one or more to-be-selected scheduling tables;
从多张待选取调度表中,按照预设的规则选择其中一个待选取调度表作为任务调度表;From the multiple schedule tables to be selected, select one of the schedule tables to be selected as the task schedule table according to a preset rule;
按照所述任务调度表进行任务调度。Task scheduling is performed according to the task scheduling table.
本申请还提供一种任务调度装置,所述装置包括:The present application also provides a task scheduling device, the device comprising:
调度表生成模块,用于获取待调度任务集,对所述待调度任务集进行排序,得到标准待调度任务集;将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集;根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表;将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集;将所述随机待调度任务集中的任务按顺序调度分配,得到随机初始任务调度表及随机未调度任务集;根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准调度任务表,汇总所有的所述随机标准调度任务表,得到随机标准调度任务表集;根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表;The scheduling table generation module is used to obtain the task set to be scheduled, sort the task set to be scheduled, and obtain a standard task set to be scheduled; schedule and assign tasks in the standard task set to be scheduled in order to obtain an initial task scheduling table and unscheduled task set; perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table, and obtain a standard scheduled task table; randomly shuffle the order of the tasks in the standard to-be-scheduled task set for many times, Obtain a plurality of random task sets to be scheduled; schedule and assign tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set; All tasks in the scheduling task set are inserted and scheduled to obtain a random standard scheduling task table, and all the random standard scheduling task tables are aggregated to obtain a random standard scheduling task table set; according to the standard scheduling task table, the random standard scheduling task Filter the table set to obtain one or more scheduling tables to be selected;
调度表筛选模块,用于从多张待选取调度表中,按照预设的规则选择其中一个待选取调度表作为任务调度表;The scheduling table screening module is used to select one of the scheduling tables to be selected as the task scheduling table according to a preset rule from the plurality of scheduling tables to be selected;
调度表调度模块,用于按照所述任务调度表进行任务调度。The scheduling table scheduling module is configured to perform task scheduling according to the task scheduling table.
本申请还提供一种电子设备,所述电子设备包括:The present application also provides an electronic device, the electronic device comprising:
存储器,存储至少一个计算机程序;及a memory that stores at least one computer program; and
处理器,执行所述存储器中存储的计算机程序以实现如下步骤:The processor executes the computer program stored in the memory to realize the following steps:
获取待调度任务集,对所述待调度任务集进行排序,得到标准待调度任务集;Obtaining a task set to be scheduled, sorting the task set to be scheduled, and obtaining a standard task set to be scheduled;
将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集;Scheduling and assigning tasks in the standard to-be-scheduled task set in order to obtain an initial task schedule and an unscheduled task set;
根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表;Perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table to obtain a standard scheduled task table;
将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集;Randomly shuffle the tasks in the standard task set to be scheduled for multiple times to obtain multiple random task sets to be scheduled;
将所述随机待调度任务集中的任务按顺序调度分配,得到随机初始任务调度表及随机未调度任务集;Scheduling and assigning tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set;
根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准调度任务表,汇总所有的所述随机标准调度任务表,得到随机标准调度任务表集;Performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table, obtaining a random standard scheduling task table, summarizing all the random standard scheduling task tables, and obtaining a random standard scheduling task table set;
根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表;Screening the random standard scheduling task table set according to the standard scheduling task table to obtain one or more to-be-selected scheduling tables;
从多张待选取调度表中,按照预设的规则选择其中一个待选取调度表作为任务调度表;From the multiple schedule tables to be selected, select one of the schedule tables to be selected as the task schedule table according to a preset rule;
按照所述任务调度表进行任务调度。Task scheduling is performed according to the task scheduling table.
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质中存储有至少一个计算机程序,所述至少一个计算机程序被电子设备中的处理器执行以实现如下步骤:The present application also provides a computer-readable storage medium, where at least one computer program is stored in the computer-readable storage medium, and the at least one computer program is executed by a processor in an electronic device to implement the following steps:
获取待调度任务集,对所述待调度任务集进行排序,得到标准待调度任务集;Obtaining a task set to be scheduled, sorting the task set to be scheduled, and obtaining a standard task set to be scheduled;
将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集;Scheduling and assigning tasks in the standard to-be-scheduled task set in order to obtain an initial task schedule and an unscheduled task set;
根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表;Perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table to obtain a standard scheduled task table;
将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集;Randomly shuffle the tasks in the standard task set to be scheduled for multiple times to obtain multiple random task sets to be scheduled;
将所述随机待调度任务集中的任务按顺序调度分配,得到随机初始任务调度表及随机未调度任务集;Scheduling and assigning tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set;
根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准调度任务表,汇总所有的所述随机标准调度任务表,得到随机标准调度任务表集;Performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table, obtaining a random standard scheduling task table, summarizing all the random standard scheduling task tables, and obtaining a random standard scheduling task table set;
根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表;Screening the random standard scheduling task table set according to the standard scheduling task table to obtain one or more to-be-selected scheduling tables;
从多张待选取调度表中,按照预设的规则选择其中一个待选取调度表作为任务调度表;From the multiple schedule tables to be selected, select one of the schedule tables to be selected as the task schedule table according to a preset rule;
按照所述任务调度表进行任务调度。Task scheduling is performed according to the task scheduling table.
图1为本申请一实施例提供的任务调度方法的流程示意图;FIG. 1 is a schematic flowchart of a task scheduling method provided by an embodiment of the present application;
图2为本申请一实施例提供的任务调度方法中得到一个或者多个待选取调度表的流程示意图;2 is a schematic flowchart of obtaining one or more scheduling tables to be selected in a task scheduling method provided by an embodiment of the present application;
图3为本申请一实施例提供的任务调度装置的模块示意图;FIG. 3 is a schematic block diagram of a task scheduling apparatus provided by an embodiment of the present application;
图4为本申请一实施例提供的实现任务调度方法的电子设备的内部结构示意图;4 is a schematic diagram of the internal structure of an electronic device for implementing a task scheduling method provided by an embodiment of the present application;
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。The realization, functional characteristics and advantages of the purpose of the present application will be further described with reference to the accompanying drawings in conjunction with the embodiments.
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.
本申请实施例提供一种任务调度方法。所述任务调度方法的执行主体包括但不限于服务端、终端等能够被配置为执行本申请实施例提供的该方法的电子设备中的至少一种。换言之,所述任务调度方法可以由安装在终端设备或服务端设备的软件或硬件来执行,所述软件可以是区块链平台。所述服务端包括但不限于:单台服务器、服务器集群、云端服务器或云端服务器集群等。The embodiment of the present application provides a task scheduling method. The execution subject of the task scheduling method includes, but is not limited to, at least one of electronic devices that can be configured to execute the method provided by the embodiments of the present application, such as a server and a terminal. In other words, the task scheduling method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, and the like.
参照图1所示的本申请一实施例提供的任务调度方法的流程示意图,在本申请实施例中,所述任务调度方法包括:Referring to the schematic flowchart of the task scheduling method provided by an embodiment of the present application shown in FIG. 1 , in the embodiment of the present application, the task scheduling method includes:
S1、获取待调度任务集,对所述待调度任务集进行排序,得到标准待调度任务集;S1. Obtain a task set to be scheduled, and sort the task set to be scheduled to obtain a standard task set to be scheduled;
本申请实施例中,所述待调度任务集为多个待调度任务的集合,例如多个待执行程序、待执行线程等。进一步地,所述待调度任务都有对应的任务信息标记,其中,所述任务信息包括:任务名称、任务计划开始时间、任务最晚截止时间、任务预计执行时间、任务优先级、任务可执行对象列表等。其中,所述任务可执行对象列表为该任务可执行对象的编号或名称的列表,指示该任务可在哪些执行对象上执行,例如:任务a可以在执行对象B、C、D上执行,那么任务a的可执行对象列表包括:执行对象B、C及D。所述执行对象为任务运行的载体,例如计算机、计算机集群等。In this embodiment of the present application, the set of tasks to be scheduled is a set of multiple tasks to be scheduled, such as multiple programs to be executed, threads to be executed, and the like. Further, the tasks to be scheduled have corresponding task information marks, wherein the task information includes: task name, task plan start time, task latest deadline, task expected execution time, task priority, task executable list of objects, etc. Wherein, the task executable object list is a list of numbers or names of the task executable objects, indicating which execution objects the task can be executed on. For example: task a can be executed on execution objects B, C, and D, then The executable object list of task a includes: execution objects B, C and D. The execution object is a carrier for task execution, such as a computer, a computer cluster, and the like.
进一步地,本申请实施例为了节省调度分配时间,需要先对所述待调度任务集中包含的所有待调度任务进行排序,因此,本申请实施例根据所述待调度任务集中每个待调度任务对应的任务优先级及任务计划开始时间对所述待调度任务集中的所有待调度任务进行排序,得到所述标准待调度任务集。Further, in order to save the scheduling allocation time in the embodiment of the present application, it is necessary to sort all the tasks to be scheduled included in the task set to be scheduled first. All tasks to be scheduled in the set of tasks to be scheduled are sorted according to the priority of the task and the scheduled start time of the task to obtain the standard set of tasks to be scheduled.
详细地,本申请实施例中所述根据所述待调度任务集中每个待调度任务对应的任务优先级及任务计划开始时间对所述待调度任务集中的所有待调度任务进行排序,包括:对所述待调度任务集中的待调度任务按照任务优先级进行排序,得到初始待调度任务集;将所述初始待调度任务集中任务优先级相同的待调度任务按照任务计划开始时间进行排序,得到所述标准待调度任务集。In detail, in the embodiment of the present application, sorting all tasks to be scheduled in the set of tasks to be scheduled according to the task priority corresponding to each task to be scheduled in the set of tasks to be scheduled and the planned start time of the task, including: The to-be-scheduled tasks in the to-be-scheduled task set are sorted according to the task priorities to obtain an initial to-be-scheduled task set; The standard set of tasks to be scheduled.
S2、将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集;S2, scheduling and assigning tasks in the standard to-be-scheduled task set in order to obtain an initial task scheduling table and an unscheduled task set;
为了更好地对任务进行调度,本申请实施例提取所述标准待调度任务集中每个待调度任务对应的可执行对象列表中的执行对象,并对提取的执行对象进行汇总去重处理,得到执行对象集。In order to better schedule tasks, the embodiment of the present application extracts the execution objects in the executable object list corresponding to each to-be-scheduled task in the standard to-be-scheduled task set, and performs a summary and deduplication process on the extracted execution objects to obtain Execute the object set.
例如:所述标准待调度任务集中共有两个待调度任务为任务O和任务Q,任务O的可执行对象列表中包含执行对象B、C,任务Q的可执行对象列表包含执行对象C、D,汇总执行对象B、C及执行对象C、D进行去重处理,得到执行对象集B、C、D。For example: there are two tasks to be scheduled in the standard task set to be scheduled, task O and task Q, the executable object list of task O includes execution objects B and C, and the executable object list of task Q includes execution objects C and D. , and perform deduplication processing by summarizing execution objects B and C and execution objects C and D to obtain execution object sets B, C, and D.
进一步地,为了对所述执行对象集中的执行对象进行更好的利用,需要了解每个执行对象的任务调度情况,因此,本申请实施例获取所述执行对象集中每个执行对象的执行对象调度任务集,其中,所述执行对象调度任务集为该执行对象中已经调度完成的任务集合,所述执行对象调度任务集中每个任务包含有对应的任务调度信息,包括:任务调度开始时间、任务预计执行时间、任务最晚截止时间、任务调度执行对象。本申请实施例中一个执行对象同一时间只能执行一个任务。进一步地,本申请实施例根据所述执行对象集及所述执行对象调度任务集对所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集。Further, in order to make better use of the execution objects in the execution object set, it is necessary to know the task scheduling situation of each execution object. Therefore, in this embodiment of the present application, the execution object scheduling of each execution object in the execution object set is obtained. A task set, wherein the execution object scheduling task set is a set of tasks that have been scheduled in the execution object, and each task in the execution object scheduling task set contains corresponding task scheduling information, including: task scheduling start time, task scheduling Estimated execution time, latest task deadline, and task scheduling execution object. In this embodiment of the present application, one execution object can only execute one task at the same time. Further, the embodiment of the present application schedules and allocates tasks in the standard task set to be scheduled according to the execution object set and the execution object scheduling task set in sequence, so as to obtain an initial task scheduling table and an unscheduled task set.
详细地,本申请实施例中所述将所述标准待调度任务集中的任务按顺序调度分配得到 初始任务调度表及未调度任务集,包括:In detail, according to the embodiment of the present application, the tasks in the standard to-be-scheduled task set are scheduled and allocated in order to obtain an initial task schedule and an unscheduled task set, including:
步骤A、通过遍历操作从所述标准待调度任务集中提取一个待调度任务Task
i;
Step A, extracting a task to be scheduled Task i from the standard task set to be scheduled by traversing operation;
步骤B、根据所述执行对象调度任务集将提取的所述待调度任务Task
i的可执行对象列表中的执行对象排序,得到第一标准执行对象列表;
Step B, sorting the extracted execution objects in the executable object list of the to-be-scheduled task Task i according to the execution object scheduling task set to obtain a first standard execution object list;
例如:待调度任务Task
i的可执行对象列表包括:执行对象B、C、D,执行对象B对应的执行对象调度任务集中的任务数量为2个,执行对象C对应的执行对象调度任务集中的任务数量为5个,执行对象D对应的执行对象调度任务集中的任务数量为3个,根据执行对象对应的执行对象调度任务集中的任务数量对所述待调度任务Task
i的可执行对象列表中的执行对象排序,得到待调度任务Task
i的第一标准执行对象列表,所述第一标准执行对象列表中的执行对象依次为执行对象C、执行对象D、执行对象B。
For example, the executable object list of the task to be scheduled Task i includes: execution objects B, C, D, the number of tasks in the execution object scheduling task set corresponding to execution object B is 2, and the execution object corresponding to execution object C in the execution object scheduling task set is 2 tasks. The number of tasks is 5, and the number of tasks in the execution object scheduling task set corresponding to execution object D is 3. According to the number of tasks in the execution object scheduling task set corresponding to the execution object, the list of executable objects of the to-be-scheduled task Task i is compared. The execution objects are sorted according to the order of execution objects to obtain the first standard execution object list of the task Task i to be scheduled. The execution objects in the first standard execution object list are execution object C, execution object D, and execution object B in sequence.
步骤C、通过遍历操作从所述第一标准执行对象列表中提取一个标准执行对象Machine
j;
Step C, extract a standard execution object Machine j from the first standard execution object list by traversing operation;
步骤D、提取所述标准执行对象的执行调度任务集中每个任务的调度时间,判断提取的调度时间是否与待调度任务Task
i包含的计划调度时间存在时间冲突;若所有的所述调度时间与提取的所述待调度任务Task
i的计划调度时间不存在时间冲突,则对所述待调度任务Task
i进行直接调度,将直接调度后的所述待调度任务Task
i加入所述执行调度任务集,并返回步骤A,直至所述标准待调度任务集中的任务遍历完成;若所有的所述调度时间与所述待调度任务Task
i对应的计划调度时间存在时间冲突,将所述待调度任务Task
i确定为未调度任务,返回步骤C,直至所述标准待调度任务集中的任务遍历完成;
Step D, extract the scheduling time of each task in the execution scheduling task set of the standard execution object, and judge whether the extracted scheduling time has a time conflict with the planning scheduling time included in the task Task i to be scheduled; If there is no time conflict in the extracted planned scheduling time of the to-be-scheduled task Task i , then directly schedule the to-be-scheduled task Task i , and add the directly-scheduled to-be-scheduled task Task i to the execution scheduling task set , and return to step A, until the task traversal in the standard to-be-scheduled task set is completed; if there is a time conflict between all the scheduling times and the planned scheduling time corresponding to the to-be-scheduled task Task i , the to-be-scheduled task Task i i is determined to be an unscheduled task, and returns to step C until the task traversal in the standard to-be-scheduled task set is completed;
本申请实施例根据所述执行对象调度任务集中每个任务包含的任务调度信息提取该任务的任务调度时间,例如:任务A的任务调度信息中的任务开始时间为8:00及任务预计执行时间为30分钟,那么任务A的调度时间为8:00至8:30。The embodiment of the present application extracts the task scheduling time of each task according to the task scheduling information contained in each task in the execution object scheduling task set, for example: the task start time in the task scheduling information of task A is 8:00 and the task's estimated execution time is 30 minutes, then the scheduling time of task A is 8:00 to 8:30.
详细地,本申请实施例中所述时间冲突为时间区间有重叠的部分,例如:调度时间o为8:00至8:30,计划调度时间p为8:15至8:45,两者的时间区间有重合,则所以调度时间o与计划调度时间p有时间冲突。In detail, the time conflict in the embodiments of the present application refers to the overlapping part of the time interval, for example, the scheduling time o is from 8:00 to 8:30, and the planned scheduling time p is from 8:15 to 8:45. The time intervals overlap, so the scheduling time o and the planned scheduling time p have a time conflict.
进一步地,本申请实施例中所述对所述待调度任务Task
i进行直接调度,包括:将所述待调度任务Task
i的对应的计划调度时间确定为调度时间,并确定调度执行对象。
Further, the direct scheduling of the to-be-scheduled task Task i in the embodiment of the present application includes: determining the corresponding planned scheduling time of the to-be-scheduled task Task i as the scheduling time, and determining the scheduling execution object.
步骤E、将所有执行对象调度任务集汇总,得到初始调度任务表,及将所有的所述未调度任务进行排序汇总得到未调度任务集。Step E: Summarize all execution object scheduling task sets to obtain an initial scheduled task table, and sort and summarize all the unscheduled tasks to obtain an unscheduled task set.
详细地,本申请实施例根据所述执行对象集汇总所有执行对象的执行对象调度任务集,得到初始调度任务表,并将所有的所述未调度任务按照所述标准待调度任务集中对应的先后顺序进行排序汇总得到未调度任务集。In detail, the embodiment of the present application summarizes the execution object scheduling task set of all execution objects according to the execution object set, obtains an initial scheduling task table, and assigns all the unscheduled tasks according to the corresponding order of the standard to-be-scheduled task set. Sort and summarize in order to get the set of unscheduled tasks.
S3、根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表;S3, performing insertion scheduling on all tasks in the unscheduled task set according to the initial scheduling task table to obtain a standard scheduling task table;
本申请其中一个实施例中,若所述未调度任务集中的任务数量为零,则表示待调度任务集中的所有任务已经调度完成,将所述初始调度任务表确定为标准调度任务表。In one of the embodiments of the present application, if the number of tasks in the unscheduled task set is zero, it means that all tasks in the to-be-scheduled task set have been scheduled, and the initial scheduled task table is determined as a standard scheduled task table.
本申请另一实施例中,若所述未调度任务集中的任务数量不为零,根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表。In another embodiment of the present application, if the number of tasks in the unscheduled task set is not zero, insert scheduling is performed on all tasks in the unscheduled task set according to the initial scheduled task table to obtain a standard scheduled task table.
详细地,为了使所述未调度任务集中的任务调度的执行对象的延迟时间最小,本申请实施例中,所述根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表,包括:In detail, in order to minimize the delay time of the execution object of the task scheduling in the unscheduled task set, in this embodiment of the present application, the insertion scheduling is performed on all tasks in the unscheduled task set according to the initial scheduled task table. , get the standard schedule task table, including:
步骤a、通过遍历操作依次从所述未调度任务集中提取一个未调度任务Task
q;
Step a, sequentially extracting an unscheduled task Task q from the unscheduled task set through a traversal operation;
步骤b、根据所述执行对象调度任务集将所述未调度任务Task
q的可执行对象列表中的执行对象排序,得到第二标准执行对象列表;
Step b, sorting the execution objects in the executable object list of the unscheduled task Task q according to the execution object scheduling task set to obtain a second standard execution object list;
步骤c、通过遍历操作从所述第一标准执行对象列表中依次取出一个标准执行对象, 选取所述标准执行对象对应的执行调度任务集中符合预设插入条件的所有任务,得到插入任务集,其中,所述插入条件为任务调度开始时间大于或等于所述未调度任务Task
q的任务计划开始时间,插入任务集中第一个任务Task
s,最后一个任务为Task
send。
Step c. Take out a standard execution object in turn from the first standard execution object list through a traversal operation, select all tasks in the execution scheduling task set corresponding to the standard execution object that meet the preset insertion conditions, and obtain an insertion task set, wherein , the insertion condition is that the task scheduling start time is greater than or equal to the task planning start time of the unscheduled task Task q , the first task Task s in the task set is inserted, and the last task is Task send .
步骤d、尝试将所述未调度任务Task
q插入所述插入任务集中的第二个任务Task
s-1与第一个任务Task
s的空隙,并调整任务Task
s及之后的该执行对象的插入任务集中所有调度任务直到没有冲突为止;若调整结果导致插入任务集中最后一个任务Task
send被抛弃,则继续尝试将所述未调度任务Task
q插入下一个空隙;如果调整结果满足条件,则跳转至下述步骤e。
Step d, attempt to insert described unscheduled task Task q into the gap between the second task Task s-1 and the first task Task s in the described insertion task set, and adjust the insertion of task Task s and the execution object thereafter All scheduled tasks in the task set are until there is no conflict; if the adjustment result causes the last task Task send to be inserted into the task set to be abandoned, then continue to try to insert the unscheduled task Task q into the next gap; if the adjustment result satisfies the condition, then jump Go to step e below.
例如:所述插入任务集中共有两个任务分别为A、B,任务A的调度时间为10:00至10:30,任务B的调度时间为10:45至11:30,未调度任务C的计划调度时间为9:00至9:30,将未调度任务C插入任务A和任务B的空隙中进行插入调度,则未调度任务C的调度时间为10:30至11:00,为避免冲突任务B的调度时间调整后延变为11:00至11:45。本申请实施例中,若某任务的调度结束时间大于该任务的任务最晚截止时间,则该任务被抛弃。For example, there are two tasks in the inserted task set, A and B respectively, the scheduling time of task A is 10:00 to 10:30, the scheduling time of task B is 10:45 to 11:30, and the scheduling time of task C is not scheduled. The scheduled scheduling time is from 9:00 to 9:30. Insert unscheduled task C into the gap between task A and task B for insertion scheduling. Then the scheduling time of unscheduled task C is from 10:30 to 11:00. To avoid conflicts The scheduling time of task B is adjusted and delayed to 11:00 to 11:45. In this embodiment of the present application, if the scheduling end time of a task is greater than the latest task deadline of the task, the task is discarded.
步骤e、统计将未调度任务Task
q插入这个空隙后该执行对象的延迟时间,如果延迟时间小于之前统计到的延迟时间,则更新该执行对象最小延迟时间,并记录这个空隙。
Step e. Count the delay time of the execution object after the unscheduled task Task q is inserted into the gap. If the delay time is less than the delay time calculated before, update the minimum delay time of the execution object and record the gap.
详细地,本申请实施例中延迟时间计算公式如下:In detail, the delay time calculation formula in the embodiment of the present application is as follows:
其中,n为该执行对象的调度任务总量,q为该执行对象中的调度任务,RealStartTime
q为任务调开始度时间,ExecutionTime
q为任务预计执行时间,EndTime
q为任务最晚截止时间。
Among them, n is the total number of scheduled tasks of the execution object, q is the scheduled tasks in the execution object, RealStartTime q is the task scheduling start time, ExecutionTime q is the expected execution time of the task, and EndTime q is the latest deadline for the task.
步骤f、标记这个执行对象是否可以调度,并且更新最小延迟时间的信息,跳转至上述的步骤c,直到所述未调度任务Task
q的标准执行对象列表中执行对象全部遍历。
Step f, mark whether the execution object can be scheduled, and update the information of the minimum delay time, and jump to the above step c, until all the execution objects in the standard execution object list of the unscheduled task Task q are traversed.
步骤g、选取所述未调度任务Task
q对应的标准执行对象列表中可调度的最小延迟时间最小的执行对象,将所述未调度任务Task
q插入到步骤e记录的空隙中,并返回步骤a,直到所述未调度任务集中的未调度任务集全部遍历完,统计此时标准待调度任务集中每个任务的任务信息得到得到标准调度任务表。
Step g, choose the execution object with the minimum schedulable minimum delay time in the standard execution object list corresponding to the unscheduled task Task q , insert the unscheduled task Task q into the gap recorded in step e, and return to step a , until all the unscheduled task sets in the unscheduled task set are traversed, and the standard scheduled task table is obtained by counting the task information of each task in the standard unscheduled task set at this time.
S4、将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集;S4, randomly shuffling the tasks in the standard task set to be scheduled multiple times to obtain multiple random task sets to be scheduled;
所述标准调度任务表可能为局部最优调度,为了得到全局最优调度,本申请实施例将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集。The standard scheduling task table may be locally optimal scheduling. In order to obtain the global optimal scheduling, the embodiment of the present application randomly shuffles the tasks in the standard to-be-scheduled task set multiple times to obtain multiple random to-be-scheduled task sets.
详细地,本申请实施例中所述将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集,包括:将所述标准待调度任务集中的任务按照预设的排序规则集进行多次排序,得到多个所述随机待调度任务集,其中,所述排序规则集中排序规则包括:任务预计执行时间排序、任务优先级排序及、或任务计划开始时间排序。In detail, in the embodiment of the present application, randomly shuffling the order of tasks in the standard to-be-scheduled task set for multiple times to obtain multiple random to-be-scheduled task sets includes: arranging the tasks in the standard to-be-scheduled task set according to the predetermined order. The set sorting rule set is sorted multiple times to obtain a plurality of the random task sets to be scheduled, wherein the sorting rules in the sorting rule set include: task estimated execution time sorting, task priority sorting and/or task planning start time sorting .
S5、将所述随机待调度任务集中的任务按顺序调度分配得到随机初始任务调度表及随机未调度任务集;S5, scheduling and assigning tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set;
本申请实施例中,将所述随机待调度任务集中的任务按顺序调度分配的方法与上述S2一致,在此不再赘述。In this embodiment of the present application, the method for sequentially scheduling and assigning tasks in the random task set to be scheduled is the same as the above S2, and details are not described herein again.
进一步地,若所述随机未调度任务集中的任务数量为零,则表示所述随机待调度任务集中的所有任务已经调度完成,将所述随机初始任务调度表确定为随机标准任务调度表;若所述若所述随机未调度任务集中的任务数量不为零,将随机初始未调度任务集中的任务按照预设的排序规则打乱顺序得到随机未调度任务集,根据所述随机初始任务调度表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准任务调度表。Further, if the number of tasks in the random unscheduled task set is zero, it means that all tasks in the random to-be-scheduled task set have been scheduled, and the random initial task scheduling table is determined as a random standard task scheduling table; if If the number of tasks in the random unscheduled task set is not zero, shuffle the tasks in the random initial unscheduled task set according to a preset sorting rule to obtain a random unscheduled task set, and according to the random initial task scheduling table Perform insertion scheduling on all tasks in the random unscheduled task set to obtain a random standard task scheduling table.
S6、根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准调度任务表,汇总所有的所述随机标准调度任务表得到随机标准调度任务表集;S6, performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table, to obtain a random standard scheduling task table, and summarizing all the random standard scheduling task tables to obtain a random standard scheduling task table set;
详细地,本申请实施例中所述根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度的方法与上述的S3一致,在此不再赘述。In detail, the method for performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table described in the embodiment of the present application is the same as the above-mentioned S3, and details are not repeated here.
S7、根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或者多个待选取调度表;S7. Screen the random standard scheduling task table set according to the standard scheduling task table to obtain one or more scheduling tables to be selected;
本申请实施例中,参阅图2所示,所述根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或者多个待选取调度表,包括:In the embodiment of the present application, referring to FIG. 2 , the random standard scheduling task table set is screened according to the standard scheduling task table to obtain one or more to-be-selected scheduling tables, including:
S71、利用目标优化函数计算所述随机标准调度任务表集中每张随机标准调度任务表集的优化函数值;S71, using the target optimization function to calculate the optimization function value of each random standard scheduling task table set in the random standard scheduling task table set;
详细地,本申请实施例利用如下目标优化函数计算所述随机标准调度任务表集中每个随机标准调度任务表集的优化函数值F:In detail, the embodiment of the present application uses the following objective optimization function to calculate the optimization function value F of each random standard scheduling task table set in the random standard scheduling task table set:
F=f
1+f
2+f
3
F=f 1 +f 2 +f 3
f
1=Σ(StartTime
i+ExecutionTime
i-EndTime
i)
f 1 =Σ(StartTime i +ExecutionTime i -EndTime i )
其中,f
1为任务延迟时间优化函数,f
2为被抛弃的任务数,f
3为最小执行器数目优化函数,StartTime
i为任务i的任务计划开始时间,ExecutionTime
i为任务i的预计执行时间,EndTime
i为任务最晚截止时间,Machine
j为所述执行对象集中的第j个执行对象,t为任务i的执行时刻,M为所述执行对象集。
Among them, f 1 is the task delay time optimization function, f 2 is the number of tasks discarded, f 3 is the optimization function of the minimum number of executors, StartTime i is the task plan start time of task i, and ExecutionTime i is the estimated execution time of task i , EndTime i is the latest deadline of the task, Machine j is the jth execution object in the execution object set, t is the execution time of the task i, and M is the execution object set.
S72、利用所述目标优化函数计算所述标准调度任务表的优化函数值;S72, using the target optimization function to calculate the optimization function value of the standard scheduling task table;
S73、选取所述随机标准调度任务表集中优化函数值小于或等于所述标准调度任务表的优化函数值的随机标准调度任务表,得到一个或多个待选取调度表;S73, selecting a random standard scheduling task table whose optimization function value in the random standard scheduling task table is less than or equal to the optimization function value of the standard scheduling task table, to obtain one or more scheduling tables to be selected;
例如,所述随机标准调度任务表集中包括优化函数值为10的第一随机标准任务调度表、优化函数值为15的第二随机标准任务调度表、优化函数值为17的第三随机标准任务调度表和优化函数值为19的第四随机标准任务调度表;当所述标准调度任务表的优化函数值为16时,选取优化函数值为10的第一随机标准任务调度表和优化函数值为15的第二随机标准任务调度表为待选取调度表。For example, the random standard scheduling task table set includes a first random standard task scheduling table with an optimization function value of 10, a second random standard task scheduling table with an optimization function value of 15, and a third random standard task with an optimization function value of 17. The scheduling table and the fourth random standard task scheduling table with the optimization function value of 19; when the optimization function value of the standard scheduling task table is 16, select the first random standard task scheduling table and the optimization function value with the optimization function value of 10 The second random standard task schedule table of 15 is the schedule table to be selected.
S8、从多张待选取调度表中,按照预设的规则选择其中一个待选取调度表作为任务调度表。S8. From the multiple schedule tables to be selected, select one of the schedule tables to be selected as the task schedule table according to a preset rule.
详细地,本申请实施例计算所述一个或多个待选取调度表的得分,确定得分最低的待选取调度表为任务调度表。In detail, the embodiment of the present application calculates the scores of the one or more to-be-selected schedules, and determines the to-be-selected schedule with the lowest score as the task schedule.
本申请实施例中,利用如下得分算法计算所述待选取调度表的得分Grade
i:
In the embodiment of the present application, the following scoring algorithm is used to calculate the score Grade i of the scheduling table to be selected:
Grade
i=优先级最高的任务的延迟时间×α+优先级非最高的任务的延迟时间×β
Grade i = the delay time of the task with the highest priority × α + the delay time of the task with the non-highest priority × β
+优先级最高的任务的预计执行时间×γ+ estimated execution time of the highest priority task × γ
+优先级非最高的任务的预计执行时间×δ+ estimated execution time of tasks with non-highest priority × δ
其中,α,β,γ,δ为预设权重系数。Among them, α, β, γ, δ are preset weight coefficients.
本申请实施例选取得分最低的待选取调取表为任务调度表,例如,多张待选取调度表中第一待选取调度表的得分为33,第二待选取调度表的得分为66,则选取第一待选取调度表为任务调度表。In the embodiment of the present application, the task scheduling table is selected as the task scheduling table with the lowest score. For example, the score of the first scheduling table to be selected among the multiple scheduling tables to be selected is 33, and the score of the second scheduling table to be selected is 66. Then, the first scheduling table to be selected is selected as the task scheduling table.
本申请实施例中,为了保证数据的隐私性,所述任务调度表可以存储在区块链节点中。In this embodiment of the present application, in order to ensure the privacy of data, the task schedule may be stored in a blockchain node.
S9、按照所述任务调度表进行任务调度。S9. Perform task scheduling according to the task scheduling table.
本申请实施例中,按照任务调度表将任务调度给执行对象集中的执行对象进行执行。In the embodiment of the present application, the task is scheduled to the execution objects in the execution object set for execution according to the task scheduling table.
如图3所示,是本申请任务调度装置的功能模块图。As shown in FIG. 3 , it is a functional block diagram of the task scheduling apparatus of the present application.
本申请所述任务调度装置100可以安装于电子设备中。根据实现的功能,所述任务调度装置可以包括调度表生成模块101、调度表筛选模块102、调度表调度模块103,本发所述模块也可以称之为单元,是指一种能够被电子设备处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在电子设备的存储器中。The task scheduling apparatus 100 described in this application may be installed in an electronic device. According to the realized functions, the task scheduling apparatus may include a schedule generation module 101, a schedule screening module 102, and a schedule scheduling module 103. The modules in the present invention may also be referred to as units, which refer to a device that can be used by electronic equipment. A series of computer program segments executed by a processor and capable of performing fixed functions and stored in the memory of an electronic device.
在本实施例中,关于各模块/单元的功能如下:In this embodiment, the functions of each module/unit are as follows:
所述调度表生成模块101用于获取待调度任务集,对所述待调度任务集进行排序,得到标准待调度任务集;将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集;根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表;将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集;将所述随机待调度任务集中的任务按顺序调度分配,得到随机初始任务调度表及随机未调度任务集;根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准调度任务表,汇总所有的所述随机标准调度任务表,得到随机标准调度任务表集;根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表。The scheduling table generating module 101 is configured to obtain a task set to be scheduled, sort the task set to be scheduled, and obtain a standard task set to be scheduled; schedule and assign tasks in the standard task set to be scheduled in order to obtain an initial task Scheduling table and unscheduled task set; perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table to obtain a standard scheduled task table; randomly scramble the tasks in the standard to-be-scheduled task set for many times sequence to obtain a plurality of random task sets to be scheduled; assign tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set; All tasks in the random unscheduled task set are inserted and scheduled to obtain a random standard scheduling task table, and all the random standard scheduling task tables are aggregated to obtain a random standard scheduling task table set; according to the standard scheduling task table, the random standard The scheduling task table set is filtered to obtain one or more scheduling tables to be selected.
本申请实施例中,所述待调度任务集为多个待调度任务的集合,例如多个待执行程序、待执行线程等。进一步地,所述待调度任务都有对应的任务信息标记,其中,所述任务信息包括:任务名称、任务计划开始时间、任务最晚截止时间、任务预计执行时间、任务优先级、任务可执行对象列表等。其中,所述任务可执行对象列表为该任务可执行对象的编号或名称的列表,指示该任务可在哪些执行对象上执行,例如:任务a可以在执行对象B、C、D上执行,那么任务a的可执行对象列表包括:执行对象B、C及D。所述执行对象为任务运行的载体,例如计算机、计算机集群等。In this embodiment of the present application, the set of tasks to be scheduled is a set of multiple tasks to be scheduled, such as multiple programs to be executed, threads to be executed, and the like. Further, the tasks to be scheduled have corresponding task information marks, wherein the task information includes: task name, task plan start time, task latest deadline, task expected execution time, task priority, task executable list of objects, etc. Wherein, the task executable object list is a list of numbers or names of the task executable objects, indicating which execution objects the task can be executed on. For example: task a can be executed on execution objects B, C, and D, then The executable object list of task a includes: execution objects B, C and D. The execution object is a carrier for task execution, such as a computer, a computer cluster, and the like.
进一步地,本申请实施例为了节省调度分配时间,需要先对所述待调度任务集中包含的所有待调度任务进行排序,因此,本申请实施例所述调度表生成模块101根据所述待调度任务集中每个待调度任务对应的任务优先级及任务计划开始时间对所述待调度任务集中的所有待调度任务进行排序,得到所述标准待调度任务集。Further, in order to save the scheduling and allocation time in the embodiment of the present application, it is necessary to sort all the tasks to be scheduled included in the task set to be scheduled first. All tasks to be scheduled in the set of tasks to be scheduled are sorted by the task priority corresponding to each task to be scheduled and the scheduled start time of the task to obtain the standard set of tasks to be scheduled.
详细地,本申请实施例中所述调度表生成模块101根据所述待调度任务集中每个待调度任务对应的任务优先级及任务计划开始时间对所述待调度任务集中的所有待调度任务进行排序,包括:对所述待调度任务集中的待调度任务按照任务优先级进行排序,得到初始待调度任务集;将所述初始待调度任务集中任务优先级相同的待调度任务按照任务计划开始时间进行排序,得到所述标准待调度任务集。In detail, the scheduling table generating module 101 in the embodiment of the present application performs all tasks to be scheduled in the set of tasks to be scheduled according to the task priority and planned start time of each task to be scheduled in the set of tasks to be scheduled. Sorting includes: sorting tasks to be scheduled in the set of tasks to be scheduled according to task priorities to obtain an initial set of tasks to be scheduled; Sorting is performed to obtain the standard task set to be scheduled.
为了更好地对任务进行调度,本申请实施例所述调度表生成模块101提取所述标准待调度任务集中每个待调度任务对应的可执行对象列表中的执行对象,并对提取的执行对象进行汇总去重处理,得到执行对象集。In order to better schedule tasks, the scheduling table generation module 101 described in this embodiment of the present application extracts the execution objects in the executable object list corresponding to each to-be-scheduled task in the standard to-be-scheduled task set, and performs an analysis on the extracted execution objects. Perform summary and deduplication processing to obtain the execution object set.
例如:所述标准待调度任务集中共有两个待调度任务为任务O和任务Q,任务O的可执行对象列表中包含执行对象B、C,任务Q的可执行对象列表包含执行对象C、D,汇总执行对象B、C及执行对象C、D进行去重处理,得到执行对象集B、C、D。For example: there are two tasks to be scheduled in the standard task set to be scheduled, task O and task Q, the executable object list of task O includes execution objects B and C, and the executable object list of task Q includes execution objects C and D. , and perform deduplication processing by summarizing execution objects B and C and execution objects C and D to obtain execution object sets B, C, and D.
进一步地,为了对所述执行对象集中的执行对象进行更好的利用,需要了解每个执行对象的任务调度情况,因此,本申请实施例所述调度表生成模块101获取所述执行对象集中每个执行对象的执行对象调度任务集,其中,所述执行对象调度任务集为该执行对象中已经调度完成的任务集合,所述执行对象调度任务集中每个任务包含有对应的任务调度信息,包括:任务调度开始时间、任务预计执行时间、任务最晚截止时间、任务调度执行对象。本申请实施例中一个执行对象同一时间只能执行一个任务。进一步地,本申请实施例 所述调度表生成模块101根据所述执行对象集及所述执行对象调度任务集对所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集。Further, in order to make better use of the execution objects in the execution object set, it is necessary to know the task scheduling situation of each execution object. An execution object scheduling task set of an execution object, wherein the execution object scheduling task set is the task set that has been scheduled in the execution object, and each task in the execution object scheduling task set contains corresponding task scheduling information, including : Task scheduling start time, task expected execution time, task latest deadline, task scheduling execution object. In this embodiment of the present application, one execution object can only execute one task at the same time. Further, according to the execution object set and the execution object scheduling task set, the scheduling table generating module 101 according to the embodiment of the present application schedules and allocates tasks in the standard task set to be scheduled in order, and obtains the initial task scheduling table and the unscheduled tasks. Schedule a set of tasks.
详细地,本申请实施例中所述调度表生成模块101利用如下手段得到初始任务调度表及未调度任务集,包括:In detail, the scheduling table generating module 101 described in the embodiment of the present application obtains the initial task scheduling table and the unscheduled task set by using the following means, including:
步骤A、通过遍历操作从所述标准待调度任务集中提取一个待调度任务Task
i;
Step A, extracting a task to be scheduled Task i from the standard task set to be scheduled by traversing operation;
步骤B、根据所述执行对象调度任务集将提取的所述待调度任务Task
i的可执行对象列表中的执行对象排序,得到第一标准执行对象列表;
Step B, sorting the extracted execution objects in the executable object list of the to-be-scheduled task Task i according to the execution object scheduling task set to obtain a first standard execution object list;
例如:待调度任务Task
i的可执行对象列表包括:执行对象B、C、D,执行对象B对应的执行对象调度任务集中的任务数量为2个,执行对象C对应的执行对象调度任务集中的任务数量为5个,执行对象D对应的执行对象调度任务集中的任务数量为3个,根据执行对象对应的执行对象调度任务集中的任务数量对所述待调度任务Task
i的可执行对象列表中的执行对象排序,得到待调度任务Task
i的第一标准执行对象列表,所述第一标准执行对象列表中的执行对象依次为执行对象C、执行对象D、执行对象B。
For example, the executable object list of the task to be scheduled Task i includes: execution objects B, C, D, the number of tasks in the execution object scheduling task set corresponding to execution object B is 2, and the execution object corresponding to execution object C in the execution object scheduling task set is 2 tasks. The number of tasks is 5, and the number of tasks in the execution object scheduling task set corresponding to execution object D is 3. According to the number of tasks in the execution object scheduling task set corresponding to the execution object, the list of executable objects of the to-be-scheduled task Task i is compared. The execution objects are sorted according to the order of execution objects to obtain the first standard execution object list of the task Task i to be scheduled. The execution objects in the first standard execution object list are execution object C, execution object D, and execution object B in sequence.
步骤C、通过遍历操作从所述第一标准执行对象列表中提取一个标准执行对象Machine
j;
Step C, extract a standard execution object Machine j from the first standard execution object list by traversing operation;
步骤D、提取所述标准执行对象的执行调度任务集中每个任务的调度时间,判断提取的调度时间是否与待调度任务Task
i包含的计划调度时间存在时间冲突;若所有的所述调度时间与提取的所述待调度任务Task
i的计划调度时间不存在时间冲突,则对所述待调度任务Task
i进行直接调度,将直接调度后的所述待调度任务Task
i加入所述执行调度任务集,并返回步骤A,直至所述标准待调度任务集中的任务遍历完成;若所有的所述调度时间与所述待调度任务Task
i对应的计划调度时间存在时间冲突,将所述待调度任务Task
i确定为未调度任务,返回步骤C,直至所述标准待调度任务集中的任务遍历完成;
Step D, extract the scheduling time of each task in the execution scheduling task set of the standard execution object, and judge whether the extracted scheduling time has a time conflict with the planning scheduling time included in the task Task i to be scheduled; If there is no time conflict in the extracted planned scheduling time of the to-be-scheduled task Task i , then directly schedule the to-be-scheduled task Task i , and add the directly-scheduled to-be-scheduled task Task i to the execution scheduling task set , and return to step A, until the task traversal in the standard to-be-scheduled task set is completed; if there is a time conflict between all the scheduling times and the planned scheduling time corresponding to the to-be-scheduled task Task i , the to-be-scheduled task Task i i is determined to be an unscheduled task, and returns to step C until the task traversal in the standard to-be-scheduled task set is completed;
本申请实施例根据所述执行对象调度任务集中每个任务包含的任务调度信息提取该任务的任务调度时间,例如:任务A的任务调度信息中的任务开始时间为8:00及任务预计执行时间为30分钟,那么任务A的调度时间为8:00至8:30。The embodiment of the present application extracts the task scheduling time of each task according to the task scheduling information contained in each task in the execution object scheduling task set, for example: the task start time in the task scheduling information of task A is 8:00 and the task's estimated execution time is 30 minutes, then the scheduling time of task A is 8:00 to 8:30.
详细地,本申请实施例中所述时间冲突为时间区间有重叠的部分,例如:调度时间o为8:00至8:30,计划调度时间p为8:15至8:45,两者的时间区间有重合,则所以调度时间o与计划调度时间p有时间冲突。In detail, the time conflict in the embodiments of the present application refers to the overlapping part of the time interval, for example, the scheduling time o is from 8:00 to 8:30, and the planned scheduling time p is from 8:15 to 8:45. The time intervals overlap, so the scheduling time o and the planned scheduling time p have a time conflict.
进一步地,本申请实施例中所述对所述待调度任务Task
i进行直接调度,包括:将所述待调度任务Task
i的对应的计划调度时间确定为调度时间,并确定调度执行对象。
Further, the direct scheduling of the to-be-scheduled task Task i in the embodiment of the present application includes: determining the corresponding planned scheduling time of the to-be-scheduled task Task i as the scheduling time, and determining the scheduling execution object.
步骤E、将所有执行对象调度任务集汇总,得到初始调度任务表,及将所有的所述未调度任务进行排序汇总得到未调度任务集。Step E: Summarize all execution object scheduling task sets to obtain an initial scheduled task table, and sort and summarize all the unscheduled tasks to obtain an unscheduled task set.
详细地,本申请实施例根据所述执行对象集汇总所有执行对象的执行对象调度任务集,得到初始调度任务表,并将所有的所述未调度任务按照所述标准待调度任务集中对应的先后顺序进行排序汇总得到未调度任务集。In detail, the embodiment of the present application summarizes the execution object scheduling task set of all execution objects according to the execution object set, obtains an initial scheduling task table, and assigns all the unscheduled tasks according to the corresponding order of the standard to-be-scheduled task set. Sort and summarize in order to get the set of unscheduled tasks.
本申请其中一个实施例中,若所述未调度任务集中的任务数量为零,则表示待调度任务集中的所有任务已经调度完成,所述调度表生成模块101将所述初始调度任务表确定为标准调度任务表。In one of the embodiments of the present application, if the number of tasks in the unscheduled task set is zero, it means that all tasks in the to-be-scheduled task set have been scheduled, and the scheduling table generating module 101 determines the initial scheduling task table as Standard schedule task table.
本申请另一实施例中,若所述未调度任务集中的任务数量不为零,所述调度表生成模块101根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表。In another embodiment of the present application, if the number of tasks in the unscheduled task set is not zero, the scheduling table generation module 101 performs insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table, Get a list of standard scheduled tasks.
详细地,为了使所述未调度任务集中的任务调度的执行对象的延迟时间最小,本申请实施例中,所述调度表生成模块101利用如下手段对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表,包括:In detail, in order to minimize the delay time of the execution object of the task scheduling in the unscheduled task set, in this embodiment of the present application, the schedule generation module 101 uses the following means to insert all tasks in the unscheduled task set: Scheduling, get the standard scheduling task table, including:
步骤a、通过遍历操作依次从所述未调度任务集中提取一个未调度任务Task
q;
Step a, sequentially extracting an unscheduled task Task q from the unscheduled task set through a traversal operation;
步骤b、根据所述执行对象调度任务集将所述未调度任务Task
q的可执行对象列表中的执行对象排序,得到第二标准执行对象列表;
Step b, sorting the execution objects in the executable object list of the unscheduled task Task q according to the execution object scheduling task set to obtain a second standard execution object list;
步骤c、通过遍历操作从所述第一标准执行对象列表中依次取出一个标准执行对象,选取所述标准执行对象对应的执行调度任务集中符合预设插入条件的所有任务,得到插入任务集,其中,所述插入条件为任务调度开始时间大于或等于所述未调度任务Task
q的任务计划开始时间,插入任务集中第一个任务Task
s,最后一个任务为Task
send。
Step c. Take out a standard execution object in turn from the first standard execution object list through a traversal operation, select all tasks in the execution scheduling task set corresponding to the standard execution object that meet the preset insertion conditions, and obtain an insertion task set, wherein , the insertion condition is that the task scheduling start time is greater than or equal to the task planning start time of the unscheduled task Task q , the first task Task s in the task set is inserted, and the last task is Task send .
步骤d、尝试将所述未调度任务Task
q插入所述插入任务集中的第二个任务Task
s-1与第一个任务Task
s的空隙,并调整任务Task
s及之后的该执行对象的插入任务集中所有调度任务直到没有冲突为止;若调整结果导致插入任务集中最后一个任务Task
send被抛弃,则继续尝试将所述未调度任务Task
q插入下一个空隙;如果调整结果满足条件,则跳转至下述步骤e。
Step d, attempt to insert described unscheduled task Task q into the gap between the second task Task s-1 and the first task Task s in the described insertion task set, and adjust the insertion of task Task s and the execution object thereafter All scheduled tasks in the task set are until there is no conflict; if the adjustment result causes the last task Task send to be inserted into the task set to be abandoned, then continue to try to insert the unscheduled task Task q into the next gap; if the adjustment result satisfies the condition, then jump Go to step e below.
例如:所述插入任务集中共有两个任务分别为A、B,任务A的调度时间为10:00至10:30,任务B的调度时间为10:45至11:30,未调度任务C的计划调度时间为9:00至9:30,将未调度任务C插入任务A和任务B的空隙中进行插入调度,则未调度任务C的调度时间为10:30至11:00,为避免冲突任务B的调度时间调整后延变为11:00至11:45。本申请实施例中,若某任务的调度结束时间大于该任务的任务最晚截止时间,则该任务被抛弃。For example, there are two tasks in the inserted task set, A and B respectively, the scheduling time of task A is 10:00 to 10:30, the scheduling time of task B is 10:45 to 11:30, and the scheduling time of task C is not scheduled. The scheduled scheduling time is from 9:00 to 9:30. Insert unscheduled task C into the gap between task A and task B for insertion scheduling. Then the scheduling time of unscheduled task C is from 10:30 to 11:00. To avoid conflicts The scheduling time of task B is adjusted and delayed to 11:00 to 11:45. In this embodiment of the present application, if the scheduling end time of a task is greater than the latest task deadline of the task, the task is discarded.
步骤e、统计将未调度任务Task
q插入这个空隙后该执行对象的延迟时间,如果延迟时间小于之前统计到的延迟时间,则更新该执行对象最小延迟时间,并记录这个空隙。
Step e. Count the delay time of the execution object after the unscheduled task Task q is inserted into the gap. If the delay time is less than the delay time calculated before, update the minimum delay time of the execution object and record the gap.
详细地,本申请实施例中延迟时间计算公式如下:In detail, the delay time calculation formula in the embodiment of the present application is as follows:
其中,n为该执行对象的调度任务总量,q为该执行对象中的调度任务,RealStartTime
q为任务调开始度时间,ExecutionTime
q为任务预计执行时间,EndTime
q为任务最晚截止时间。
Among them, n is the total amount of scheduled tasks of the execution object, q is the scheduled tasks in the execution object, RealStartTime q is the task scheduling start time, ExecutionTime q is the expected execution time of the task, and EndTime q is the latest deadline for the task.
步骤f、标记这个执行对象是否可以调度,并且更新最小延迟时间的信息,跳转至上述的步骤c,直到所述未调度任务Task
q的标准执行对象列表中执行对象全部遍历。
Step f, mark whether the execution object can be scheduled, and update the information of the minimum delay time, and jump to the above step c, until all the execution objects in the standard execution object list of the unscheduled task Task q are traversed.
步骤g、选取所述未调度任务Task
q对应的标准执行对象列表中可调度的最小延迟时间最小的执行对象,将所述未调度任务Task
q插入到步骤e记录的空隙中,并返回步骤a,直到所述未调度任务集中的未调度任务集全部遍历完,统计此时标准待调度任务集中每个任务的任务信息得到标准调度任务表。
Step g, choose the execution object with the minimum schedulable minimum delay time in the standard execution object list corresponding to the unscheduled task Task q , insert the unscheduled task Task q into the gap recorded in step e, and return to step a , until all the unscheduled task sets in the unscheduled task set have been traversed, and at this time, the task information of each task in the standard to-be-scheduled task set is counted to obtain a standard scheduled task table.
所述标准调度任务表可能为局部最优调度,为了得到全局最优调度,本申请实施例所述调度表生成模块101将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集。The standard scheduling task table may be locally optimal scheduling. In order to obtain the global optimal scheduling, the scheduling table generating module 101 in the embodiment of the present application randomly shuffles the tasks in the standard task set to be scheduled for many times to obtain multiple tasks. A random set of tasks to be scheduled.
详细地,本申请实施例中所述调度表生成模块101将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集,包括:将所述标准待调度任务集中的任务按照预设的排序规则集进行多次排序,得到多个所述随机待调度任务集,其中,所述排序规则集中排序规则包括:任务预计执行时间排序、任务优先级排序及、或任务计划开始时间排序。In detail, the scheduling table generating module 101 in the embodiment of the present application randomly shuffles the tasks in the standard task set to be scheduled multiple times to obtain multiple random task sets to be scheduled, including: The centralized tasks are sorted multiple times according to a preset sorting rule set to obtain a plurality of the random task sets to be scheduled, wherein the sorting rules in the sorting rule set include: sorting by expected execution time of tasks, sorting by priority of tasks, and/or Task schedule start time sorting.
本申请实施例中,将所述随机待调度任务集中的任务按顺序调度分配的方法与上述的将所述标准待调度任务集中的任务按顺序调度分配的方法一致,在此不再赘述。In this embodiment of the present application, the method for sequentially scheduling and assigning tasks in the random to-be-scheduled task set is the same as the above-mentioned method for sequentially scheduling and assigning tasks in the standard to-be-scheduled task set, and details are not repeated here.
进一步地,若所述随机未调度任务集中的任务数量为零,则表示所述随机待调度任务集中的所有任务已经调度完成,所述调度表生成模块101将所述随机初始任务调度表确定为随机标准任务调度表;若所述随机未调度任务集中的任务数量不为零,所述调度表生成模块101将随机初始未调度任务集中的任务按照预设的排序规则打乱顺序得到随机未调度 任务集,根据所述随机初始任务调度表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准任务调度表。Further, if the number of tasks in the random unscheduled task set is zero, it means that all tasks in the random to-be-scheduled task set have been scheduled, and the schedule generation module 101 determines the random initial task schedule as: Random standard task scheduling table; if the number of tasks in the random unscheduled task set is not zero, the scheduling table generating module 101 shuffles the tasks in the random initial unscheduled task set according to the preset sorting rules to obtain random unscheduled tasks A task set, performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial task scheduling table to obtain a random standard task scheduling table.
进一步地,本申请实施例中所述根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度的方法与上述的对所述未调度任务集中的所有任务进行插入调度的方法一致,在此不再赘述。Further, the method of performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table in the embodiment of the present application is the same as the above-mentioned method for performing insertion scheduling on all tasks in the unscheduled task set. The method is the same, and will not be repeated here.
此外,本申请实施例中,所述调度表生成模块101利用如下手段对所述随机标准调度任务表集进行筛选,得到一个或者多个待选取调度表,包括:In addition, in the embodiment of the present application, the scheduling table generation module 101 uses the following means to filter the random standard scheduling task table set to obtain one or more scheduling tables to be selected, including:
利用目标优化函数计算所述随机标准调度任务表集中每张随机标准调度任务表集的优化函数值;Use the objective optimization function to calculate the optimization function value of each random standard scheduling task table set in the random standard scheduling task table set;
利用所述目标优化函数计算所述标准调度任务表的优化函数值;及using the objective optimization function to calculate an optimization function value of the standard scheduled task table; and
选取所述随机标准调度任务表集中优化函数值小于或等于所述标准调度任务表的优化函数值的随机标准调度任务表,得到一个或多个待选取调度表。Selecting a random standard scheduling task table whose optimization function value in the random standard scheduling task table is less than or equal to the optimization function value of the standard scheduling task table, to obtain one or more to-be-selected scheduling tables.
详细地,本申请实施例利用如下目标优化函数计算所述随机标准调度任务表集中每个随机标准调度任务表集的优化函数值F:In detail, the embodiment of the present application uses the following objective optimization function to calculate the optimization function value F of each random standard scheduling task table set in the random standard scheduling task table set:
F=f
1+f
2+f
3
F=f 1 +f 2 +f 3
f
1=Σ(StartTime
i+ExecutionTime
i-EndTime
i)
f 1 =Σ(StartTime i +ExecutionTime i -EndTime i )
其中,f
1为任务延迟时间优化函数,f
2为被抛弃的任务数,f
3为最小执行器数目优化函数,StartTime
i为任务i的任务计划开始时间,ExecutionTime
i为任务i的预计执行时间,EndTime
i为任务最晚截止时间,Machine
j为所述执行对象集中的第j个执行对象,t为任务i的执行时刻,M为所述执行对象集。
Among them, f 1 is the task delay time optimization function, f 2 is the number of tasks discarded, f 3 is the optimization function of the minimum number of executors, StartTime i is the task plan start time of task i, and ExecutionTime i is the estimated execution time of task i , EndTime i is the latest deadline of the task, Machine j is the jth execution object in the execution object set, t is the execution time of the task i, and M is the execution object set.
例如,所述随机标准调度任务表集中包括优化函数值为10的第一随机标准任务调度表、优化函数值为15的第二随机标准任务调度表、优化函数值为17的第三随机标准任务调度表和优化函数值为19的第四随机标准任务调度表;当所述标准调度任务表的优化函数值为16时,选取优化函数值为10的第一随机标准任务调度表和优化函数值为15的第二随机标准任务调度表为待选取调度表。For example, the random standard scheduling task table set includes a first random standard task scheduling table with an optimization function value of 10, a second random standard task scheduling table with an optimization function value of 15, and a third random standard task with an optimization function value of 17. The scheduling table and the fourth random standard task scheduling table with the optimization function value of 19; when the optimization function value of the standard scheduling task table is 16, select the first random standard task scheduling table and the optimization function value with the optimization function value of 10 The second random standard task schedule table of 15 is the schedule table to be selected.
所述调度表筛选模块102用于从多张待选取调度表中,按照预设的规则选择其中一个待选取调度表作为任务调度表。The scheduling table screening module 102 is configured to select one of the scheduling tables to be selected as the task scheduling table according to a preset rule from among the scheduling tables to be selected.
详细地,本申请实施例所述调度表筛选模块102计算所述一个或多个待选取调度表的得分,确定得分最低的待选取调度表为任务调度表。In detail, the schedule screening module 102 described in this embodiment of the present application calculates the score of the one or more schedules to be selected, and determines that the schedule to be selected with the lowest score is the task schedule.
本申请实施例中,所述调度表筛选模块102利用如下得分算法计算所述待选取调度表的得分Grade
i:
In the embodiment of the present application, the scheduling table screening module 102 uses the following scoring algorithm to calculate the score Grade i of the scheduling table to be selected:
Grade
i=优先级最高的任务的延迟时间×α+优先级非最高的任务的延迟时间×β
Grade i = the delay time of the task with the highest priority × α + the delay time of the task with the non-highest priority × β
+优先级最高的任务的预计执行时间×γ+ estimated execution time of the highest priority task × γ
+优先级非最高的任务的预计执行时间×δ+ estimated execution time of tasks with non-highest priority × δ
其中,α,β,γ,δ为预设权重系数。Among them, α, β, γ, δ are preset weight coefficients.
本申请实施例选取得分最低的待选取调取表为任务调度表,例如,多张待选取调度表中第一待选取调度表的得分为33,第二待选取调度表的得分为66,则选取第一待选取调度表为任务调度表。In the embodiment of the present application, the task scheduling table is selected as the task scheduling table with the lowest score. For example, the score of the first scheduling table to be selected among the multiple scheduling tables to be selected is 33, and the score of the second scheduling table to be selected is 66. Then, the first scheduling table to be selected is selected as the task scheduling table.
本申请实施例中,为了保证数据的隐私性,所述任务调度表可以存储在区块链节点中。In this embodiment of the present application, in order to ensure the privacy of data, the task schedule may be stored in a blockchain node.
所述调度表调度模块103用于按照所述任务调度表进行任务调度。The scheduling table scheduling module 103 is configured to perform task scheduling according to the task scheduling table.
本申请实施例中,按照任务调度表将任务调度给执行对象集中的执行对象进行执行。In this embodiment of the present application, tasks are scheduled to execution objects in the execution object set for execution according to the task scheduling table.
如图4所示,是本申请实现任务调度方法的电子设备的结构示意图。As shown in FIG. 4 , it is a schematic structural diagram of an electronic device implementing the task scheduling method of the present application.
所述电子设备1可以包括处理器10、存储器11和总线,还可以包括存储在所述存储器11中并可在所述处理器10上运行的计算机程序,如任务调度程序12。The electronic device 1 may include a processor 10, a memory 11 and a bus, and may also include a computer program, such as a task scheduler 12, stored in the memory 11 and executable on the processor 10.
其中,所述存储器11至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、移动硬盘、多媒体卡、卡型存储器(例如:SD或DX存储器等)、磁性存储器、磁盘、光盘等。所述存储器11在一些实施例中可以是电子设备1的内部存储单元,例如该电子设备1的移动硬盘。所述存储器11在另一些实施例中也可以是电子设备1的外部存储设备,例如电子设备1上配备的插接式移动硬盘、智能存储卡(Smart Media Card,SMC)、安全数字(Secure Digital,SD)卡、闪存卡(Flash Card)等。进一步地,所述存储器11还可以既包括电子设备1的内部存储单元也包括外部存储设备。所述存储器11不仅可以用于存储安装于电子设备1的应用软件及各类数据,例如任务调度程序的代码等,还可以用于暂时地存储已经输出或者将要输出的数据。Wherein, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, magnetic disk, CD etc. The memory 11 may be an internal storage unit of the electronic device 1 in some embodiments, such as a mobile hard disk of the electronic device 1 . In other embodiments, the memory 11 may also be an external storage device of the electronic device 1, such as a pluggable mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital) equipped on the electronic device 1. , SD) card, flash memory card (Flash Card), etc. Further, the memory 11 may also include both an internal storage unit of the electronic device 1 and an external storage device. The memory 11 can not only be used to store application software installed in the electronic device 1 and various types of data, such as the code of a task scheduler, etc., but also can be used to temporarily store data that has been output or will be output.
所述处理器10在一些实施例中可以由集成电路组成,例如可以由单个封装的集成电路所组成,也可以是由多个相同功能或不同功能封装的集成电路所组成,包括一个或者多个中央处理器(Central Processing unit,CPU)、微处理器、数字处理芯片、图形处理器及各种控制芯片的组合等。所述处理器10是所述电子设备的控制核心(Control Unit),利用各种接口和线路连接整个电子设备的各个部件,通过运行或执行存储在所述存储器11内的程序或者模块(例如任务调度程序等),以及调用存储在所述存储器11内的数据,以执行电子设备1的各种功能和处理数据。In some embodiments, the processor 10 may be composed of integrated circuits, for example, may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits packaged with the same function or different functions, including one or more integrated circuits. Central Processing Unit (CPU), microprocessor, digital processing chip, graphics processor and combination of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect the various components of the entire electronic device, by running or executing programs or modules (such as tasks) stored in the memory 11. Scheduler, etc.), and call data stored in the memory 11 to execute various functions of the electronic device 1 and process data.
所述总线可以是外设部件互连标准(peripheral component interconnect,简称PCI)总线或扩展工业标准结构(extended industry standard architecture,简称EISA)总线等。该总线可以分为地址总线、数据总线、控制总线等。所述总线被设置为实现所述存储器11以及至少一个处理器10等之间的连接通信。The bus may be a peripheral component interconnect (PCI for short) bus or an extended industry standard architecture (Extended industry standard architecture, EISA for short) bus or the like. The bus can be divided into address bus, data bus, control bus and so on. The bus is configured to implement connection communication between the memory 11 and at least one processor 10 and the like.
图4仅示出了具有部件的电子设备,本领域技术人员可以理解的是,图4示出的结构并不构成对所述电子设备1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。FIG. 4 only shows an electronic device with components. Those skilled in the art can understand that the structure shown in FIG. 4 does not constitute a limitation on the electronic device 1, and may include fewer or more components than those shown in the drawings. components, or a combination of certain components, or a different arrangement of components.
例如,尽管未示出,所述电子设备1还可以包括给各个部件供电的电源(比如电池),优选地,电源可以通过电源管理装置与所述至少一个处理器10逻辑相连,从而通过电源管理装置实现充电管理、放电管理、以及功耗管理等功能。电源还可以包括一个或一个以上的直流或交流电源、再充电装置、电源故障检测电路、电源转换器或者逆变器、电源状态指示器等任意组件。所述电子设备1还可以包括多种传感器、蓝牙模块、Wi-Fi模块等,在此不再赘述。For example, although not shown, the electronic device 1 may also include a power supply (such as a battery) for powering the various components, preferably, the power supply may be logically connected to the at least one processor 10 through a power management device, so that the power management The device implements functions such as charge management, discharge management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and any other components. The electronic device 1 may further include various sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
进一步地,所述电子设备1还可以包括网络接口,可选地,所述网络接口可以包括有线接口和/或无线接口(如WI-FI接口、蓝牙接口等),通常用于在该电子设备1与其他电子设备之间建立通信连接。Further, the electronic device 1 may also include a network interface, optionally, the network interface may include a wired interface and/or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is usually used in the electronic device 1 Establish a communication connection with other electronic devices.
可选地,该电子设备1还可以包括用户接口,用户接口可以是显示器(Display)、输入单元(比如键盘(Keyboard)),可选地,用户接口还可以是标准的有线接口、无线接口。可选地,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在电子设备1中处理的信息以及用于显示可视化的用户界面。Optionally, the electronic device 1 may further include a user interface, and the user interface may be a display (Display), an input unit (eg, a keyboard (Keyboard)), optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, and the like. The display may also be appropriately called a display screen or a display unit, which is used for displaying information processed in the electronic device 1 and for displaying a visualized user interface.
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。It should be understood that the embodiments are only used for illustration, and are not limited by this structure in the scope of the patent application.
所述电子设备1中的所述存储器11存储的任务调度程序12是多个计算机程序的组合,在所述处理器10中运行时,可以实现:The task scheduler 12 stored in the memory 11 in the electronic device 1 is a combination of multiple computer programs, and when running in the processor 10, it can realize:
获取待调度任务集,对所述待调度任务集进行排序,得到标准待调度任务集;Obtaining a task set to be scheduled, sorting the task set to be scheduled, and obtaining a standard task set to be scheduled;
将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集;Scheduling and assigning tasks in the standard to-be-scheduled task set in order to obtain an initial task schedule and an unscheduled task set;
根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表;Perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table to obtain a standard scheduled task table;
将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集;Randomly shuffle the tasks in the standard task set to be scheduled for multiple times to obtain multiple random task sets to be scheduled;
将所述随机待调度任务集中的任务按顺序调度分配,得到随机初始任务调度表及随机未调度任务集;Scheduling and assigning tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set;
根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准调度任务表,汇总所有的所述随机标准调度任务表,得到随机标准调度任务表集;Performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table, obtaining a random standard scheduling task table, summarizing all the random standard scheduling task tables, and obtaining a random standard scheduling task table set;
根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表;Screening the random standard scheduling task table set according to the standard scheduling task table to obtain one or more to-be-selected scheduling tables;
从多张待选取调度表中,按照预设的规则选择其中一个待选取调度表作为任务调度表;From the multiple schedule tables to be selected, select one of the schedule tables to be selected as the task schedule table according to a preset rule;
按照所述任务调度表进行任务调度。Task scheduling is performed according to the task scheduling table.
具体地,所述处理器10对上述计算机程序的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。Specifically, for the specific implementation method of the above-mentioned computer program by the processor 10, reference may be made to the description of the relevant steps in the corresponding embodiment of FIG. 1, and details are not described herein.
进一步地,所述电子设备1集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。所述计算机可读存储介质可以是非易失性的,也可以是易失性的。所述计算机可读存储介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。Further, if the modules/units integrated in the electronic device 1 are implemented in the form of software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium. The computer-readable storage medium may be non-volatile or volatile. The computer-readable storage medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer memory, a read-only memory (ROM, Read-Only Memory) ).
进一步地,所述计算机可读存储介质中存储有计算机程序,所述计算机程序被处理器执行时实现如下步骤:Further, a computer program is stored in the computer-readable storage medium, and when the computer program is executed by the processor, the following steps are implemented:
获取待调度任务集,对所述待调度任务集进行排序,得到标准待调度任务集;Obtaining a task set to be scheduled, sorting the task set to be scheduled, and obtaining a standard task set to be scheduled;
将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集;Scheduling and assigning tasks in the standard to-be-scheduled task set in order to obtain an initial task schedule and an unscheduled task set;
根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表;Perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table to obtain a standard scheduled task table;
将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集;Randomly shuffle the tasks in the standard task set to be scheduled for multiple times to obtain multiple random task sets to be scheduled;
将所述随机待调度任务集中的任务按顺序调度分配,得到随机初始任务调度表及随机未调度任务集;Scheduling and assigning tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set;
根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准调度任务表,汇总所有的所述随机标准调度任务表,得到随机标准调度任务表集;Performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table, obtaining a random standard scheduling task table, summarizing all the random standard scheduling task tables, and obtaining a random standard scheduling task table set;
根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表;Screening the random standard scheduling task table set according to the standard scheduling task table to obtain one or more to-be-selected scheduling tables;
从多张待选取调度表中,按照预设的规则选择其中一个待选取调度表作为任务调度表;From the multiple schedule tables to be selected, select one of the schedule tables to be selected as the task schedule table according to a preset rule;
按照所述任务调度表进行任务调度。Task scheduling is performed according to the task scheduling table.
在本申请所提供的几个实施例中,应该理解到,所揭露的设备,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。In the several embodiments provided in this application, it should be understood that the disclosed apparatus, apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative. For example, the division of the modules is only a logical function division, and there may be other division manners in actual implementation.
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separated, and components shown as modules may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。In addition, each functional module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware, or can be implemented in the form of hardware plus software function modules.
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。It will be apparent to those skilled in the art that the present application is not limited to the details of the above-described exemplary embodiments, but that the present application can be implemented in other specific forms without departing from the spirit or essential characteristics of the present application.
因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。Accordingly, the embodiments are to be regarded in all respects as illustrative and not restrictive, and the scope of the application is to be defined by the appended claims rather than the foregoing description, which is therefore intended to fall within the scope of the claims. All changes within the meaning and scope of the equivalents of , are included in this application. Any reference signs in the claims shall not be construed as limiting the involved claim.
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。The blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。系统权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第二等词语用来表示名称,而并不表示任何特定的顺序。Furthermore, it is clear that the word "comprising" does not exclude other units or steps and the singular does not exclude the plural. Several units or means recited in the system claims can also be realized by one unit or means by means of software or hardware. Second-class terms are used to denote names and do not denote any particular order.
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application rather than limitations. Although the present application has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present application can be Modifications or equivalent substitutions can be made without departing from the spirit and scope of the technical solutions of the present application.
Claims (20)
- 一种任务调度方法,其中,所述方法包括:A task scheduling method, wherein the method comprises:获取待调度任务集,对所述待调度任务集进行排序,得到标准待调度任务集;Obtaining a task set to be scheduled, sorting the task set to be scheduled, and obtaining a standard task set to be scheduled;将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集;Scheduling and assigning tasks in the standard to-be-scheduled task set in order to obtain an initial task schedule and an unscheduled task set;根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表;Perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table to obtain a standard scheduled task table;将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集;Randomly shuffle the tasks in the standard task set to be scheduled for multiple times to obtain multiple random task sets to be scheduled;将所述随机待调度任务集中的任务按顺序调度分配,得到随机初始任务调度表及随机未调度任务集;Scheduling and assigning tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set;根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准调度任务表,汇总所有的所述随机标准调度任务表,得到随机标准调度任务表集;Performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table, obtaining a random standard scheduling task table, summarizing all the random standard scheduling task tables, and obtaining a random standard scheduling task table set;根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表;Screening the random standard scheduling task table set according to the standard scheduling task table to obtain one or more to-be-selected scheduling tables;从多张待选取调度表中,按照预设的规则选择其中一个待选取调度表作为任务调度表;From the multiple schedule tables to be selected, select one of the schedule tables to be selected as the task schedule table according to a preset rule;按照所述任务调度表进行任务调度。Task scheduling is performed according to the task scheduling table.
- 如权利要求1所述的任务调度方法,其中,所述对所述待调度任务集进行排序,得到标准待调度任务集,包括:The task scheduling method according to claim 1, wherein the sorting of the to-be-scheduled task set to obtain a standard to-be-scheduled task set comprises:根据所述待调度任务集中每个待调度任务的任务优先级及任务计划开始时间对所述待调度任务集中的所有待调度任务进行排序,得到所述标准待调度任务集。All tasks to be scheduled in the set of tasks to be scheduled are sorted according to the task priority of each task to be scheduled in the set of tasks to be scheduled and the planned start time of the task to obtain the set of standard tasks to be scheduled.
- 如权利要求2所述的任务调度方法,其中,所述根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表,包括:The task scheduling method according to claim 2, wherein the random standard scheduling task table set is screened according to the standard scheduling task table to obtain one or more to-be-selected scheduling tables, comprising:利用目标优化函数计算所述随机标准调度任务表集中每个随机标准调度任务表的优化函数值;Use the objective optimization function to calculate the optimization function value of each random standard scheduling task table in the random standard scheduling task table set;利用所述目标优化函数计算所述标准调度任务表的优化函数值;Calculate the optimization function value of the standard scheduling task table by using the objective optimization function;选取所述随机标准调度任务表集中优化函数值小于或等于所述标准调度任务表的优化函数值的随机标准调度任务表,得到一个或多个待选取调度表。Selecting a random standard scheduling task table whose optimization function value in the random standard scheduling task table is less than or equal to the optimization function value of the standard scheduling task table, to obtain one or more to-be-selected scheduling tables.
- 如权利要求2所述的任务调度方法,其中,所述将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集,包括:The task scheduling method according to claim 2, wherein the scheduling and assigning tasks in the standard task set to be scheduled in order to obtain an initial task scheduling table and an unscheduled task set, comprising:提取所述标准待调度任务集中每个待调度任务对应的可执行对象列表中的执行对象,并对提取的执行对象进行汇总去重处理,得到执行对象集;Extracting execution objects in the executable object list corresponding to each task to be scheduled in the standard task set to be scheduled, and performing aggregation and deduplication processing on the extracted execution objects to obtain an execution object set;获取所述执行对象集中每个执行对象的执行对象调度任务集;obtaining the execution object scheduling task set of each execution object in the execution object set;根据所述执行对象集及所述执行对象调度任务集对所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集。According to the execution object set and the execution object scheduling task set, the tasks in the standard to-be-scheduled task set are scheduled and allocated in sequence, and an initial task scheduling table and an unscheduled task set are obtained.
- 如权利要求4所述的任务调度方法,其中,所述根据所述执行对象集及所述执行对象调度任务集对所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集,包括:The task scheduling method according to claim 4, wherein the tasks in the standard to-be-scheduled task set are sequentially scheduled and allocated according to the execution object set and the execution object scheduling task set to obtain an initial task scheduling table and a Set of unscheduled tasks, including:任务提取步骤:通过遍历操作从所述标准待调度任务集中提取一个待调度任务;Task extracting step: extracting a task to be scheduled from the standard task set to be scheduled through a traversal operation;执行对象排序步骤:根据所述执行对象调度任务集将提取的所述待调度任务的可执行对象列表中的执行对象排序,得到第一标准执行对象列表;The step of sorting execution objects: sorting the execution objects in the extracted executable object list of the to-be-scheduled task according to the execution object scheduling task set to obtain a first standard execution object list;执行对象提取步骤:通过遍历操作从所述第一标准执行对象列表中提取一个标准执行对象;The step of extracting execution objects: extracting a standard execution object from the first standard execution object list through a traversal operation;任务调度步骤:提取所述标准执行对象的执行调度任务集中每个任务的调度时间,判 断提取的调度时间是否与提取的所述待调度任务的计划调度时间存在时间冲突;若所有的所述调度时间与提取的所述待调度任务的计划调度时间不存在时间冲突,则对所述待调度任务进行直接调度,将直接调度后的所述待调度任务加入所述执行调度任务集,并返回所述任务提取步骤,直至所述标准待调度任务集中的任务遍历完成;若所有的所述调度时间与所述待调度任务对应的计划调度时间存在时间冲突,将所述待调度任务确定为未调度任务,返回所述执行对象提取步骤,直至所述标准待调度任务集中的任务遍历完成;The task scheduling step: extracting the scheduling time of each task in the execution scheduling task set of the standard execution object, and judging whether the extracted scheduling time has a time conflict with the extracted planning scheduling time of the to-be-scheduled task; If there is no time conflict between the time and the extracted planned scheduling time of the to-be-scheduled task, the to-be-scheduled task is directly scheduled, the directly-scheduled to-be-scheduled task is added to the execution scheduling task set, and returned The task extraction step is performed until the task traversal in the standard to-be-scheduled task set is completed; if there is a time conflict between all the scheduling times and the planned scheduling time corresponding to the to-be-scheduled task, the to-be-scheduled task is determined to be unscheduled task, return to the execution object extraction step, until the task traversal in the standard task set to be scheduled is completed;调度统计步骤:将所有执行对象调度任务集汇总,得到初始调度任务表,及将所有的所述未调度任务进行排序汇总得到未调度任务集。Scheduling statistics step: summarizing all execution object scheduling task sets to obtain an initial scheduled task table, and sorting and summarizing all the unscheduled tasks to obtain an unscheduled task set.
- 如权利要求5所述的任务调度方法,其中,所述对所述待调度任务进行直接调度,包括:The task scheduling method according to claim 5, wherein the direct scheduling of the to-be-scheduled task comprises:将所述待调度任务对应的计划调度时间确定为调度时间,并确定调度执行对象。The planned scheduling time corresponding to the task to be scheduled is determined as the scheduling time, and the scheduling execution object is determined.
- 如权利要求1至6中任意一项所述的任务调度方法,其中,所述将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集,包括:The task scheduling method according to any one of claims 1 to 6, wherein the random order of tasks in the standard to-be-scheduled task set is randomly shuffled multiple times to obtain a plurality of random to-be-scheduled task sets, including:将所述标准待调度任务集中的任务按照预设的排序规则集进行多次排序,得到多个所述随机待调度任务集。The tasks in the standard to-be-scheduled task set are sorted for multiple times according to a preset sorting rule set to obtain a plurality of the random to-be-scheduled task sets.
- 一种任务调度装置,其中,包括:A task scheduling device, comprising:调度表生成模块,用于获取待调度任务集,对所述待调度任务集进行排序,得到标准待调度任务集;将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集;根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表;将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集;将所述随机待调度任务集中的任务按顺序调度分配,得到随机初始任务调度表及随机未调度任务集;根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准调度任务表,汇总所有的所述随机标准调度任务表,得到随机标准调度任务表集;根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表;The scheduling table generation module is used to obtain the task set to be scheduled, sort the task set to be scheduled, and obtain a standard task set to be scheduled; schedule and assign tasks in the standard task set to be scheduled in order to obtain an initial task scheduling table and unscheduled task set; perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table, and obtain a standard scheduled task table; randomly shuffle the order of the tasks in the standard to-be-scheduled task set for many times, Obtain a plurality of random task sets to be scheduled; schedule and assign tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set; All tasks in the scheduling task set are inserted and scheduled to obtain a random standard scheduling task table, and all the random standard scheduling task tables are aggregated to obtain a random standard scheduling task table set; the random standard scheduling task table is based on the standard scheduling task table. Filter the table set to obtain one or more scheduling tables to be selected;调度表筛选模块,用于从多张待选取调度表中,按照预设的规则选择其中一个待选取调度表作为任务调度表;The scheduling table screening module is used to select one of the scheduling tables to be selected as the task scheduling table according to a preset rule from the plurality of scheduling tables to be selected;调度表调度模块,用于按照所述任务调度表进行任务调度。The scheduling table scheduling module is configured to perform task scheduling according to the task scheduling table.
- 一种电子设备,其中,所述电子设备包括:An electronic device, wherein the electronic device comprises:至少一个处理器;以及,at least one processor; and,与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,所述存储器存储有可被所述至少一个处理器执行的计算机程序指令,所述计算机程序指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下步骤:The memory stores computer program instructions executable by the at least one processor, the computer program instructions being executed by the at least one processor to enable the at least one processor to perform the steps of:获取待调度任务集,对所述待调度任务集进行排序,得到标准待调度任务集;Obtaining a task set to be scheduled, sorting the task set to be scheduled, and obtaining a standard task set to be scheduled;将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集;Scheduling and assigning tasks in the standard to-be-scheduled task set in order to obtain an initial task schedule and an unscheduled task set;根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表;Perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table to obtain a standard scheduled task table;将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集;Randomly shuffle the tasks in the standard task set to be scheduled for multiple times to obtain multiple random task sets to be scheduled;将所述随机待调度任务集中的任务按顺序调度分配,得到随机初始任务调度表及随机未调度任务集;Scheduling and assigning tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set;根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准调度任务表,汇总所有的所述随机标准调度任务表,得到随机标准调度任务表集;Performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table, obtaining a random standard scheduling task table, summarizing all the random standard scheduling task tables, and obtaining a random standard scheduling task table set;根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待 选取调度表;Screen the random standard scheduling task table set according to the standard scheduling task table to obtain one or more scheduling tables to be selected;从多张待选取调度表中,按照预设的规则选择其中一个待选取调度表作为任务调度表;From the multiple schedule tables to be selected, select one of the schedule tables to be selected as the task schedule table according to a preset rule;按照所述任务调度表进行任务调度。Task scheduling is performed according to the task scheduling table.
- 如权利要求9所述的电子设备,其中,所述对所述待调度任务集进行排序,得到标准待调度任务集,包括:The electronic device according to claim 9, wherein the sorting of the to-be-scheduled task set to obtain a standard to-be-scheduled task set comprises:根据所述待调度任务集中每个待调度任务的任务优先级及任务计划开始时间对所述待调度任务集中的所有待调度任务进行排序,得到所述标准待调度任务集。All tasks to be scheduled in the set of tasks to be scheduled are sorted according to the task priority of each task to be scheduled in the set of tasks to be scheduled and the planned start time of the task to obtain the set of standard tasks to be scheduled.
- 如权利要求10所述的电子设备,其中,所述根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表,包括:The electronic device according to claim 10, wherein the random standard scheduling task table set is filtered according to the standard scheduling task table to obtain one or more to-be-selected scheduling tables, comprising:利用目标优化函数计算所述随机标准调度任务表集中每个随机标准调度任务表的优化函数值;Use the objective optimization function to calculate the optimization function value of each random standard scheduling task table in the random standard scheduling task table set;利用所述目标优化函数计算所述标准调度任务表的优化函数值;Calculate the optimization function value of the standard scheduling task table by using the objective optimization function;选取所述随机标准调度任务表集中优化函数值小于或等于所述标准调度任务表的优化函数值的随机标准调度任务表,得到一个或多个待选取调度表。Selecting a random standard scheduling task table whose optimization function value in the random standard scheduling task table is less than or equal to the optimization function value of the standard scheduling task table, to obtain one or more to-be-selected scheduling tables.
- 如权利要求10所述的电子设备,其中,所述将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集,包括:The electronic device according to claim 10, wherein the scheduling and assigning tasks in the standard task set to be scheduled in order to obtain an initial task scheduling table and an unscheduled task set, comprising:提取所述标准待调度任务集中每个待调度任务对应的可执行对象列表中的执行对象,并对提取的执行对象进行汇总去重处理,得到执行对象集;Extracting execution objects in the executable object list corresponding to each task to be scheduled in the standard task set to be scheduled, and performing aggregation and deduplication processing on the extracted execution objects to obtain an execution object set;获取所述执行对象集中每个执行对象的执行对象调度任务集;obtaining the execution object scheduling task set of each execution object in the execution object set;根据所述执行对象集及所述执行对象调度任务集对所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集。According to the execution object set and the execution object scheduling task set, the tasks in the standard to-be-scheduled task set are scheduled and allocated in sequence, and an initial task scheduling table and an unscheduled task set are obtained.
- 如权利要求12所述的电子设备,其中,所述根据所述执行对象集及所述执行对象调度任务集对所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集,包括:The electronic device according to claim 12, wherein the tasks in the standard to-be-scheduled task set are scheduled and allocated in sequence according to the execution object set and the execution object scheduling task set, to obtain an initial task schedule table and future tasks A set of scheduled tasks, including:任务提取步骤:通过遍历操作从所述标准待调度任务集中提取一个待调度任务;Task extracting step: extracting a task to be scheduled from the standard task set to be scheduled through a traversal operation;执行对象排序步骤:根据所述执行对象调度任务集将提取的所述待调度任务的可执行对象列表中的执行对象排序,得到第一标准执行对象列表;The step of sorting execution objects: sorting the execution objects in the extracted executable object list of the to-be-scheduled task according to the execution object scheduling task set to obtain a first standard execution object list;执行对象提取步骤:通过遍历操作从所述第一标准执行对象列表中提取一个标准执行对象;The step of extracting execution objects: extracting a standard execution object from the first standard execution object list through a traversal operation;任务调度步骤:提取所述标准执行对象的执行调度任务集中每个任务的调度时间,判断提取的调度时间是否与提取的所述待调度任务的计划调度时间存在时间冲突;若所有的所述调度时间与提取的所述待调度任务的计划调度时间不存在时间冲突,则对所述待调度任务进行直接调度,将直接调度后的所述待调度任务加入所述执行调度任务集,并返回所述任务提取步骤,直至所述标准待调度任务集中的任务遍历完成;若所有的所述调度时间与所述待调度任务对应的计划调度时间存在时间冲突,将所述待调度任务确定为未调度任务,返回所述执行对象提取步骤,直至所述标准待调度任务集中的任务遍历完成;The task scheduling step: extracting the scheduling time of each task in the execution scheduling task set of the standard execution object, and judging whether the extracted scheduling time has a time conflict with the extracted planning scheduling time of the to-be-scheduled task; If there is no time conflict between the time and the extracted planned scheduling time of the to-be-scheduled task, the to-be-scheduled task is directly scheduled, the directly-scheduled to-be-scheduled task is added to the execution scheduling task set, and returned The task extraction step is performed until the task traversal in the standard to-be-scheduled task set is completed; if there is a time conflict between all the scheduling times and the planned scheduling time corresponding to the to-be-scheduled task, the to-be-scheduled task is determined to be unscheduled task, return to the execution object extraction step, until the task traversal in the standard task set to be scheduled is completed;调度统计步骤:将所有执行对象调度任务集汇总,得到初始调度任务表,及将所有的所述未调度任务进行排序汇总得到未调度任务集。Scheduling statistics step: summarizing all execution object scheduling task sets to obtain an initial scheduled task table, and sorting and summarizing all the unscheduled tasks to obtain an unscheduled task set.
- 如权利要求13所述的电子设备,其中,所述对所述待调度任务进行直接调度,包括:The electronic device according to claim 13, wherein the direct scheduling of the to-be-scheduled task comprises:将所述待调度任务对应的计划调度时间确定为调度时间,并确定调度执行对象。The planned scheduling time corresponding to the task to be scheduled is determined as the scheduling time, and the scheduling execution object is determined.
- 如权利要求9至14中任意一项所述的电子设备,其中,所述将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集,包括:The electronic device according to any one of claims 9 to 14, wherein the tasks in the standard task set to be scheduled are randomly shuffled multiple times to obtain a plurality of random task sets to be scheduled, including:将所述标准待调度任务集中的任务按照预设的排序规则集进行多次排序,得到多个所述随机待调度任务集。The tasks in the standard to-be-scheduled task set are sorted for multiple times according to a preset sorting rule set to obtain a plurality of the random to-be-scheduled task sets.
- 一种计算机可读存储介质,存储有计算机程序,其中,所述计算机程序被处理器执行时实现如下步骤:A computer-readable storage medium storing a computer program, wherein the computer program implements the following steps when executed by a processor:获取待调度任务集,对所述待调度任务集进行排序,得到标准待调度任务集;Obtaining a task set to be scheduled, sorting the task set to be scheduled, and obtaining a standard task set to be scheduled;将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集;Scheduling and assigning tasks in the standard to-be-scheduled task set in order to obtain an initial task schedule and an unscheduled task set;根据所述初始调度任务表对所述未调度任务集中的所有任务进行插入调度,得到标准调度任务表;Perform insertion scheduling on all tasks in the unscheduled task set according to the initial scheduled task table to obtain a standard scheduled task table;将所述标准待调度任务集中的任务多次随机打乱顺序,得到多个随机待调度任务集;Randomly shuffle the tasks in the standard task set to be scheduled for multiple times to obtain multiple random task sets to be scheduled;将所述随机待调度任务集中的任务按顺序调度分配,得到随机初始任务调度表及随机未调度任务集;Scheduling and assigning tasks in the random task set to be scheduled in order to obtain a random initial task schedule and a random unscheduled task set;根据所述随机初始调度任务表对所述随机未调度任务集中的所有任务进行插入调度,得到随机标准调度任务表,汇总所有的所述随机标准调度任务表,得到随机标准调度任务表集;Performing insertion scheduling on all tasks in the random unscheduled task set according to the random initial scheduling task table, obtaining a random standard scheduling task table, summarizing all the random standard scheduling task tables, and obtaining a random standard scheduling task table set;根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表;Screening the random standard scheduling task table set according to the standard scheduling task table to obtain one or more to-be-selected scheduling tables;从多张待选取调度表中,按照预设的规则选择其中一个待选取调度表作为任务调度表;From the multiple schedule tables to be selected, select one of the schedule tables to be selected as the task schedule table according to a preset rule;按照所述任务调度表进行任务调度。Task scheduling is performed according to the task scheduling table.
- 如权利要求16所述的计算机可读存储介质,其中,所述对所述待调度任务集进行排序,得到标准待调度任务集,包括:The computer-readable storage medium according to claim 16, wherein the sorting of the task set to be scheduled to obtain a standard task set to be scheduled comprises:根据所述待调度任务集中每个待调度任务的任务优先级及任务计划开始时间对所述待调度任务集中的所有待调度任务进行排序,得到所述标准待调度任务集。All tasks to be scheduled in the set of tasks to be scheduled are sorted according to the task priority of each task to be scheduled in the set of tasks to be scheduled and the planned start time of the task to obtain the set of standard tasks to be scheduled.
- 如权利要求17所述的计算机可读存储介质,其中,所述根据所述标准调度任务表对所述随机标准调度任务表集进行筛选,得到一个或多个待选取调度表,包括:The computer-readable storage medium according to claim 17, wherein the random standard scheduling task table set is filtered according to the standard scheduling task table to obtain one or more scheduling tables to be selected, comprising:利用目标优化函数计算所述随机标准调度任务表集中每个随机标准调度任务表的优化函数值;Use the objective optimization function to calculate the optimization function value of each random standard scheduling task table in the random standard scheduling task table set;利用所述目标优化函数计算所述标准调度任务表的优化函数值;Using the objective optimization function to calculate the optimization function value of the standard scheduling task table;选取所述随机标准调度任务表集中优化函数值小于或等于所述标准调度任务表的优化函数值的随机标准调度任务表,得到一个或多个待选取调度表。Selecting a random standard scheduling task table whose optimization function value in the random standard scheduling task table is less than or equal to the optimization function value of the standard scheduling task table, to obtain one or more to-be-selected scheduling tables.
- 如权利要求17所述的计算机可读存储介质,其中,所述将所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集,包括:The computer-readable storage medium according to claim 17, wherein the scheduling and assigning tasks in the standard task set to be scheduled in order to obtain an initial task scheduling table and an unscheduled task set, comprising:提取所述标准待调度任务集中每个待调度任务对应的可执行对象列表中的执行对象,并对提取的执行对象进行汇总去重处理,得到执行对象集;Extracting the execution objects in the executable object list corresponding to each to-be-scheduled task in the standard to-be-scheduled task set, and performing aggregation and deduplication processing on the extracted execution objects to obtain an execution object set;获取所述执行对象集中每个执行对象的执行对象调度任务集;Obtain the execution object scheduling task set of each execution object in the execution object set;根据所述执行对象集及所述执行对象调度任务集对所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集。According to the execution object set and the execution object scheduling task set, the tasks in the standard to-be-scheduled task set are scheduled and allocated in sequence, and an initial task scheduling table and an unscheduled task set are obtained.
- 如权利要求19所述的计算机可读存储介质,其中,所述根据所述执行对象集及所述执行对象调度任务集对所述标准待调度任务集中的任务按顺序调度分配,得到初始任务调度表及未调度任务集,包括:The computer-readable storage medium according to claim 19, wherein the tasks in the standard to-be-scheduled task set are sequentially scheduled and allocated according to the execution object set and the execution object scheduling task set to obtain an initial task schedule Table and set of unscheduled tasks, including:任务提取步骤:通过遍历操作从所述标准待调度任务集中提取一个待调度任务;The task extraction step: extracting a task to be scheduled from the standard task set to be scheduled through a traversal operation;执行对象排序步骤:根据所述执行对象调度任务集将提取的所述待调度任务的可执行对象列表中的执行对象排序,得到第一标准执行对象列表;The step of sorting execution objects: sorting the execution objects in the extracted executable object list of the to-be-scheduled task according to the execution object scheduling task set to obtain a first standard execution object list;执行对象提取步骤:通过遍历操作从所述第一标准执行对象列表中提取一个标准执行对象;The execution object extraction step: extracting a standard execution object from the first standard execution object list through a traversal operation;任务调度步骤:提取所述标准执行对象的执行调度任务集中每个任务的调度时间,判断提取的调度时间是否与提取的所述待调度任务的计划调度时间存在时间冲突;若所有的 所述调度时间与提取的所述待调度任务的计划调度时间不存在时间冲突,则对所述待调度任务进行直接调度,将直接调度后的所述待调度任务加入所述执行调度任务集,并返回所述任务提取步骤,直至所述标准待调度任务集中的任务遍历完成;若所有的所述调度时间与所述待调度任务对应的计划调度时间存在时间冲突,将所述待调度任务确定为未调度任务,返回所述执行对象提取步骤,直至所述标准待调度任务集中的任务遍历完成;The task scheduling step: extracting the scheduling time of each task in the execution scheduling task set of the standard execution object, and judging whether the extracted scheduling time has a time conflict with the extracted planned scheduling time of the to-be-scheduled task; If there is no time conflict between the time and the extracted planned scheduling time of the to-be-scheduled task, the to-be-scheduled task is directly scheduled, the directly-scheduled to-be-scheduled task is added to the execution scheduling task set, and returned The task extraction step is performed until the task traversal in the standard to-be-scheduled task set is completed; if there is a time conflict between all the scheduling times and the planned scheduling time corresponding to the to-be-scheduled task, the to-be-scheduled task is determined to be unscheduled task, returning to the execution object extraction step, until the task traversal in the standard task set to be scheduled is completed;调度统计步骤:将所有执行对象调度任务集汇总,得到初始调度任务表,及将所有的所述未调度任务进行排序汇总得到未调度任务集。Scheduling statistics step: summarizing all execution object scheduling task sets to obtain an initial scheduled task table, and sorting and summarizing all the unscheduled tasks to obtain an unscheduled task set.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011229916.6 | 2020-11-06 | ||
CN202011229916.6A CN112306661B (en) | 2020-11-06 | 2020-11-06 | Task scheduling method and device, electronic equipment and readable storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022095358A1 true WO2022095358A1 (en) | 2022-05-12 |
Family
ID=74325148
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/090716 WO2022095358A1 (en) | 2020-11-06 | 2021-04-28 | Task scheduling method and apparatus, electronic device, and readable storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112306661B (en) |
WO (1) | WO2022095358A1 (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115658271A (en) * | 2022-11-01 | 2023-01-31 | 中科雨辰科技有限公司 | Method for acquiring target task object based on target task list |
CN116542413A (en) * | 2023-04-28 | 2023-08-04 | 北京大数据先进技术研究院 | Task processing method, device, equipment and storage medium based on time coordinates |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112306661B (en) * | 2020-11-06 | 2023-09-15 | 平安科技(深圳)有限公司 | Task scheduling method and device, electronic equipment and readable storage medium |
CN115292021A (en) * | 2022-09-28 | 2022-11-04 | 江西萤火虫微电子科技有限公司 | Task scheduling method, system, electronic device and readable storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060190943A1 (en) * | 2005-02-22 | 2006-08-24 | Northrop Grumman Corporation | System and a method for scheduling tasks |
US7895071B2 (en) * | 2006-08-14 | 2011-02-22 | Hrl Laboratories, Llc | System and method for multi-mission prioritization using cost-based mission scheduling |
CN107291548A (en) * | 2016-03-31 | 2017-10-24 | 阿里巴巴集团控股有限公司 | The resource regulating method and device of task |
CN108268319A (en) * | 2016-12-31 | 2018-07-10 | 中国移动通信集团河北有限公司 | Method for scheduling task, apparatus and system |
CN110096345A (en) * | 2019-03-16 | 2019-08-06 | 平安科技(深圳)有限公司 | Intelligent task dispatching method, device, equipment and storage medium |
CN112306661A (en) * | 2020-11-06 | 2021-02-02 | 平安科技(深圳)有限公司 | Task scheduling method and device, electronic equipment and readable storage medium |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP5262593B2 (en) * | 2008-11-10 | 2013-08-14 | 富士通株式会社 | Data transfer system and data transfer method |
US20190050786A1 (en) * | 2017-08-10 | 2019-02-14 | Dassault Systemes Americas Corp. | Task Assisted Resources Assignment Based On Schedule Impact |
CN107748696B (en) * | 2017-09-20 | 2020-05-01 | 深圳壹账通智能科技有限公司 | Task scheduling method and terminal equipment |
CN111881025B (en) * | 2020-07-20 | 2023-08-04 | 中国工商银行股份有限公司 | Automatic test task scheduling method, device and system |
-
2020
- 2020-11-06 CN CN202011229916.6A patent/CN112306661B/en active Active
-
2021
- 2021-04-28 WO PCT/CN2021/090716 patent/WO2022095358A1/en active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20060190943A1 (en) * | 2005-02-22 | 2006-08-24 | Northrop Grumman Corporation | System and a method for scheduling tasks |
US7895071B2 (en) * | 2006-08-14 | 2011-02-22 | Hrl Laboratories, Llc | System and method for multi-mission prioritization using cost-based mission scheduling |
CN107291548A (en) * | 2016-03-31 | 2017-10-24 | 阿里巴巴集团控股有限公司 | The resource regulating method and device of task |
CN108268319A (en) * | 2016-12-31 | 2018-07-10 | 中国移动通信集团河北有限公司 | Method for scheduling task, apparatus and system |
CN110096345A (en) * | 2019-03-16 | 2019-08-06 | 平安科技(深圳)有限公司 | Intelligent task dispatching method, device, equipment and storage medium |
CN112306661A (en) * | 2020-11-06 | 2021-02-02 | 平安科技(深圳)有限公司 | Task scheduling method and device, electronic equipment and readable storage medium |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115658271A (en) * | 2022-11-01 | 2023-01-31 | 中科雨辰科技有限公司 | Method for acquiring target task object based on target task list |
CN116542413A (en) * | 2023-04-28 | 2023-08-04 | 北京大数据先进技术研究院 | Task processing method, device, equipment and storage medium based on time coordinates |
CN116542413B (en) * | 2023-04-28 | 2024-04-16 | 北京大数据先进技术研究院 | Task processing method, device, equipment and storage medium based on time coordinates |
Also Published As
Publication number | Publication date |
---|---|
CN112306661B (en) | 2023-09-15 |
CN112306661A (en) | 2021-02-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2022095358A1 (en) | Task scheduling method and apparatus, electronic device, and readable storage medium | |
Liu et al. | A new improved NEH heuristic for permutation flowshop scheduling problems | |
CN110727512B (en) | Cluster resource scheduling method, device, equipment and storage medium | |
CN110837410B (en) | Task scheduling method and device, electronic equipment and computer readable storage medium | |
CN108090225B (en) | Database instance running method, device and system and computer readable storage medium | |
CN107291545B (en) | Task scheduling method and device for multiple users in computing cluster | |
WO2016197716A1 (en) | Task scheduling method and device | |
CN111984426B (en) | Task scheduling method and device, electronic equipment and storage medium | |
CN111506404A (en) | Kubernetes-based shared GPU (graphics processing Unit) scheduling method | |
CN108683692A (en) | A kind of service request processing method and device | |
US9424212B2 (en) | Operating system-managed interrupt steering in multiprocessor systems | |
WO2015043528A1 (en) | Parallel multi-thread message processing method and device | |
WO2022048362A1 (en) | Data storage method and apparatus, electronic device, and storage medium | |
US20170228319A1 (en) | Memory-Constrained Aggregation Using Intra-Operator Pipelining | |
CN108255607A (en) | Task processing method, device, electric terminal and readable storage medium storing program for executing | |
US20150040144A1 (en) | Program, information processing apparatus, and event processing method | |
CN108241531A (en) | A kind of method and apparatus for distributing resource for virtual machine in the cluster | |
WO2014046885A2 (en) | Concurrency identification for processing of multistage workflows | |
CN114968566A (en) | Container scheduling method and device under shared GPU cluster | |
CN111694843A (en) | Missing number detection method and device, electronic equipment and storage medium | |
CN114844844A (en) | Delay message processing method, device, equipment and storage medium | |
CN108829790A (en) | A kind of data batch processing method, apparatus and system | |
CN114817408A (en) | Scheduling resource identification method and device, electronic equipment and storage medium | |
CN109086132A (en) | A kind of recognition of face task balance call method, device and terminal device | |
US20220300887A1 (en) | Dynamic scheduling system with performance-based access |
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: 21888062 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: 21888062 Country of ref document: EP Kind code of ref document: A1 |