Task scheduling method, device, storage medium and electronic device
By evaluating the task operation environment and determining task priorities, combining dynamic planning algorithms and task pressure prediction results, task scheduling is optimized, and task scheduling is solved in the existing technology, and efficient task scheduling and on-time completion rate are achieved.
Patent Information
- Application Number
- CN202411978459.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-04-08
AI Technical Summary
The existing task queuing algorithm fails to effectively consider service processing capabilities and task processing redundancy, resulting in inefficient processing of burst high-priority tasks.
By evaluating the task's operating environment, determining task priority, and using dynamic planning algorithms to combine task pressure prediction results and unit time scores, task scheduling is optimized to ensure the timely processing of high-priority tasks and the timely completion of low-priority tasks.
It realizes that while maintaining task scheduling and operating efficiently, taking into account the processing efficiency of tasks at different priorities, ensuring response efficiency in emergencies, and maximizing the on-time completion rate of all tasks.
Smart Images

Figure CN119781938A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of content distribution network (CDN), and more specifically, to a task scheduling method, device, storage medium and electronic device. Background Art
[0002] The task queuing algorithm is an algorithm that describes how to queue and schedule tasks when the task processing capacity is limited.
[0003] The existing task queuing algorithms basically do not consider the processing capacity of the service, and only process as much as they can. In addition, the existing task queuing algorithms do not consider task processing redundancy. When processing sudden high-priority tasks, they either directly interrupt the current task, resulting in an increase in overall overhead, or wait for the current task to be completed, sacrificing the timeliness of the high-priority task.
[0004] Therefore, how to maintain efficient operation of task scheduling while taking into account tasks of different priorities is an urgent problem to be solved in this application. Summary of the invention
[0005] In view of this, the present application discloses a task scheduling method, device, storage medium and electronic device, which are intended to ensure high-priority tasks while taking into account low-priority tasks, so as to ensure the efficiency of responding to emergencies by maintaining minimum redundancy, and to ensure that the on-time completion rate of all tasks of different priorities is maximized, thereby maintaining efficient operation of task scheduling while taking into account tasks of different priorities.
[0006] In order to achieve the above purpose, the disclosed technical solution is as follows:
[0007] The first aspect of the present application discloses a task scheduling method, the method comprising:
[0008] When multiple tasks to be scheduled are received, the operating environments of the multiple tasks to be processed are evaluated to obtain evaluation results;
[0009] Determine the task priorities corresponding to multiple tasks to be scheduled;
[0010] Calculate the task duration according to the evaluation result and the task priorities corresponding to the multiple tasks to be scheduled, and obtain the latest completion time of each task;
[0011] Obtaining scores for each unit of time according to a preset basic score and the latest completion time of each task;
[0012] Generate task stress prediction results through a pre-trained stress prediction model;
[0013] Obtaining a dynamic programming result of task scheduling according to a dynamic programming algorithm, the task pressure prediction result and each unit time score;
[0014] Task scheduling is performed according to the dynamic programming result.
[0015] Preferably, the evaluation result includes at least the task processing speed and the number of concurrent tasks. When receiving multiple tasks to be scheduled, the operating environment of the multiple tasks to be scheduled is evaluated to obtain the evaluation result, including:
[0016] When receiving a plurality of tasks to be scheduled in the pending task pool, determining the processing task type of each of the plurality of tasks to be scheduled;
[0017] The software and hardware environment is evaluated according to each processing task type to obtain the task processing speed and the concurrency number under the software and hardware environment.
[0018] Preferably, the step of calculating the task duration according to the evaluation result and the task priorities corresponding to the plurality of tasks to be scheduled to obtain the latest completion time of each task includes:
[0019] Get the historical task completion speed of each historical task type;
[0020] The evaluation result, the types of each processing task, the historical task completion speed, the number of concurrencies and the task priorities corresponding to each of the multiple tasks to be scheduled are input into the task duration model to calculate the task duration and obtain the latest completion time of each task.
[0021] Preferably, determining the task priorities corresponding to the plurality of tasks to be scheduled includes:
[0022] Get the required completion time of each task to be scheduled;
[0023] According to each required completion time and the preset priority time, the task priority corresponding to each of the multiple tasks to be scheduled is determined.
[0024] Preferably, the step of obtaining each unit time score according to the preset basic score and the latest completion time of each task includes:
[0025] Perform timeout monitoring on multiple tasks to be scheduled;
[0026] If it is detected that there is a task timeout among multiple tasks to be scheduled, the timeout duration of the task is obtained;
[0027] Obtaining a unit time score of the overtime scheduled task according to the basic score, the overtime duration and the task priority of the overtime scheduled task;
[0028] If it is monitored that multiple tasks to be scheduled have not timed out, the preset basic score is divided by the latest completion time of each task to obtain the unit time scores of the multiple tasks to be processed.
[0029] Preferably, the task pressure prediction result at least includes the predicted number of tasks and the predicted processing time, and the dynamic programming result of task scheduling is obtained according to the dynamic programming algorithm, the task pressure prediction result and the unit time scores, including:
[0030] Perform state transfer calculation according to the state transfer equation, the number of predicted tasks, the predicted processing time, and the scores of each unit time to obtain an overall task score;
[0031] According to the overall task score, a dynamic planning result of task scheduling is obtained; wherein the dynamic planning result at least includes the tasks to be scheduled and the scheduling path.
[0032] The second aspect of the present application discloses a task scheduling device, the device comprising:
[0033] An evaluation unit, for evaluating the operating environments of the plurality of tasks to be processed when receiving the plurality of tasks to be scheduled, and obtaining evaluation results;
[0034] A determination unit, used to determine the task priorities corresponding to each of the multiple tasks to be scheduled;
[0035] A calculation unit, used to calculate the task time consumption according to the evaluation result and the task priorities corresponding to the plurality of tasks to be scheduled, so as to obtain the latest completion time of each task;
[0036] A first acquisition unit, configured to obtain each unit time score according to a preset basic score and the latest completion time of each task;
[0037] A generating unit, used for generating a task pressure prediction result by using a pre-trained pressure prediction model;
[0038] A second acquisition unit is used to obtain a dynamic programming result of task scheduling according to a dynamic programming algorithm, the task pressure prediction result and each unit time score;
[0039] A scheduling unit is used to schedule tasks according to the dynamic planning result.
[0040] Preferably, the evaluation result at least includes the task processing speed and the number of concurrent tasks, and the evaluation unit includes:
[0041] A first determination module is used to determine the processing task type of each of the multiple tasks to be scheduled when receiving multiple tasks to be scheduled in the task pool to be processed;
[0042] The first acquisition module is used to evaluate the software and hardware environment according to the types of the processing tasks, and obtain the task processing speed and the concurrency number under the software and hardware environment.
[0043] A third aspect of the present application discloses a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the task scheduling method as described in any one of the first aspects.
[0044] The fourth aspect of the present application discloses an electronic device, comprising a memory and one or more instructions, wherein the one or more instructions are stored in the memory and are configured to be executed by one or more processors to perform a task scheduling method as described in any one of the first aspects.
[0045] It can be known from the above technical scheme that the present application discloses a task scheduling method, device, storage medium and electronic device. When multiple tasks to be scheduled are received, the operating environment of the multiple tasks to be processed is evaluated to obtain evaluation results, and the task priorities corresponding to the multiple tasks to be scheduled are determined. The task time consumption is calculated according to the evaluation results and the task priorities corresponding to the multiple tasks to be scheduled to obtain the latest completion time of each task. According to the preset basic score and the latest completion time of each task, each unit time score is obtained, and the task pressure prediction result is generated by a pre-trained pressure prediction model. According to the dynamic programming algorithm, the task pressure prediction result and each unit time score, the dynamic programming result of the task scheduling is obtained, and the task scheduling is performed according to the dynamic programming result.
[0046] Through the above scheme, a unified scoring standard is established for scheduling tasks of different priorities, different task completion time requirements are proposed for tasks of different priorities, and scores are given according to the completion status, and the overall performance is judged by the score. The redundancy of the system task capacity is determined based on the historical task status and the time scores of each unit in the task pressure prediction results, and the tasks are converted into basic processing units according to different priority tasks and the latest completion time is estimated. The dynamic planning results of task scheduling are obtained according to the current service pressure situation and the combination of the current service pressure and the predicted recent pressure, task priority, task timing requirements, etc. The dynamic planning results are used for comprehensive scheduling to ensure that all tasks are completed on time and the rate is maximized, giving high priority tasks less deadlines, reserving processing channels for high priority tasks, and making full use of the task processing bandwidth in the process of task scheduling according to the dynamic planning results. While ensuring high priority tasks, low priority tasks are taken into account, so as to ensure the efficiency of emergency response by maintaining minimum redundancy, and to ensure that all tasks of different priorities are completed on time and the rate is maximized, so as to maintain the efficient operation of task scheduling while taking into account tasks of different priorities. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0048] Figure 1 A flowchart of a task scheduling method disclosed in an embodiment of the present application;
[0049] Figure 2 A schematic diagram of task queuing disclosed in an embodiment of the present application;
[0050] Figure 3 A schematic diagram of the state transition of the score change disclosed in the embodiment of the present application;
[0051] Figure 4 A flowchart of another task scheduling method disclosed in an embodiment of the present application;
[0052] Figure 5 A schematic diagram of the structure of a task scheduling device disclosed in an embodiment of the present application;
[0053] Figure 6 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0055] In this application, the terms "comprises", "comprising" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element.
[0056] As can be seen from the background technology, the existing task queuing algorithms basically do not consider the processing capacity of the service, and only process as much as they can. In addition, the existing task queuing algorithms do not consider task processing redundancy. For the processing of sudden high-priority tasks, either the current task is directly interrupted, resulting in an increase in overall overhead, or the current task is waited for to be completed, sacrificing the timeliness of the high-priority task. Therefore, how to maintain the efficient operation of task scheduling while taking into account tasks of different priorities is a problem that needs to be solved urgently in this application.
[0057] In order to solve the above problems, the present application discloses a task scheduling method, device, storage medium and electronic device, which use a unified scoring standard for scheduling tasks of different priorities, propose different task completion time requirements for tasks of different priorities, and score according to the completion status, and judge the overall performance by the score. The redundancy of the system task capacity is determined according to the historical task status and each unit time score in the task pressure prediction result, and the task is converted into a basic processing unit according to the task of different priorities and the latest completion time is estimated. According to the current service pressure situation and the current service pressure and the predicted recent pressure, task priority, task timing requirements, etc., the dynamic planning result of task scheduling is obtained, and the dynamic planning result is comprehensively scheduled to ensure that all tasks are completed on time and the rate is maximized, and a high priority is given less deadline, and a processing channel is reserved for high priority tasks. In the process of scheduling tasks according to the dynamic planning results, the task processing bandwidth is fully utilized, and low priority tasks are taken into account while ensuring high priority tasks, so as to ensure the efficiency of responding to emergencies by maintaining minimum redundancy, and to ensure that all tasks of different priorities are completed on time and the rate is maximized, so as to maintain the efficient operation of task scheduling while taking into account tasks of different priorities. The specific implementation method is specifically described by the following embodiments.
[0058] refer to Figure 1 FIG. 1 is a flow chart of a task scheduling method disclosed in an embodiment of the present application. The task scheduling method mainly includes the following steps:
[0059] S101: When multiple tasks to be scheduled are received, the operating environments of the multiple tasks to be processed are evaluated to obtain evaluation results.
[0060] In S101, when multiple tasks to be scheduled are received from a pool of pending tasks, the processing task types of the multiple tasks to be scheduled are determined, and the hardware and software environment is evaluated according to each processing task type to obtain the task processing speed and concurrency under the hardware and software environment.
[0061] Among them, each processing task type includes a task type of a download task, a task type of an upload task, and the like.
[0062] Multiple tasks to be scheduled in the pending task pool are queued so that the queued tasks can be sent to each processing unit later, and each task to be scheduled is scheduled through each processing unit and task sorting scheduling algorithm. For details, please refer to Figure 2 As shown, Figure 2 A task queue diagram is shown.
[0063] The task sorting and scheduling algorithm of this scheme can be applied to computer task scheduling services. Taking CDN distribution task queuing scheduling as an example, the software and hardware environment of the running service is evaluated according to the different processing task types of the task content completed by the service, and the task processing speed and concurrency number under the software and hardware environment are judged to obtain the evaluation results.
[0064] For example, some services are specialized in processing task types for download tasks, and some services are specialized in processing upload tasks. Both of them can use this task scheduling algorithm, but the time consumption reference needs to be evaluated by the service that uses this task sorting scheduling algorithm, such as evaluating the download speed and write speed of the download task, and evaluating the read speed and upload speed of the upload task.
[0065] Since the calculation methods for different types of processing tasks are different, the task processing speed can be compared based on the CDN distribution example. In CDN distribution services, the main considerations are the (Central Processing Unit, CPU) computing power, memory, disk input / output (Input / Output, IO) and network speed. Tasks are generally used for testing, and the average distribution speed is calculated by distributing files of different sizes as the processing speed benchmark under the software and hardware environment. For example, select the average speed of multiple files such as 100MB, 1GB, 10GB, and the maximum number of concurrency that reaches this time standard. Among them, the maximum number of concurrency indicates the number of tasks processed at the same time.
[0066] It should be noted that different services have different tasks. A basic task of the service type is taken and run once in different time periods to take the average value, so as to complete the evaluation of the service of the task sorting and scheduling algorithm. For example, the distribution speed in this example can be further improved by establishing a database based on the task type, collecting experience values, and using them after statistics.
[0067] S102: Determine the task priorities corresponding to each of the multiple tasks to be scheduled.
[0068] In S102, each required completion time corresponding to the plurality of tasks to be scheduled is obtained, and the task priority corresponding to each of the plurality of tasks to be scheduled is determined according to each required completion time and a preset priority time.
[0069] The preset priority duration can be within 3 minutes, within 10 minutes, etc. The preset priority duration is set according to actual conditions and this application does not make any specific limitations.
[0070] In order to facilitate the process of determining the task priorities corresponding to multiple tasks to be scheduled, an example is given here:
[0071] For example, the preset running time of a high-level task is 10 minutes. When a task is received that is expected to take 20 minutes, 20 minutes is taken as the priority duration standard for the task, and 1 minute of score is deducted for every minute exceeding the time limit.
[0072] Among them, the priority of the task is not determined by the duration, but by its own nature. Tasks include low-level tasks with a running time of 2 minutes and high-priority tasks with a long running time. The running time standard is used to calculate the score. If the duration of the highest-level task exceeds the preset priority duration, the preset priority duration is considered to be equal to the running time.
[0073] S103: Calculate the task duration according to the evaluation result and the task priorities corresponding to the multiple tasks to be scheduled, and obtain the latest completion time of each task.
[0074] In S103, the historical task completion speed of each historical task type is obtained, and the evaluation results, each processing task type, the historical task completion speed, the number of concurrency and the task priorities corresponding to the multiple tasks to be scheduled are input into the task duration model to calculate the task duration and obtain the latest completion time of each task.
[0075] The task priorities corresponding to the multiple tasks to be scheduled represent the processing speed benchmark. In each task scheduling process, the task information, historical task completion speed, and processing speed benchmark are input into the task time consumption model to calculate the task time consumption. Different scheduled tasks may have different task information.
[0076] The task time consumption model can be trained using historical data. The characteristic parameters of the training include task processing speed, current time (such as year, month, day, day of the week, specific time), current concurrent pressure, recent task processing speed, number of tasks of different priorities in the current task pool, labels, and other factors related to specific tasks. The label is the actual complete time.
[0077] The specific task time consumption model used is generally a random forest, and other models can also be used. The specific model type is not specifically limited in this application. In addition to considering the above factors when distributing CDN, it is also necessary to consider disk IO, target network bandwidth, etc.
[0078] The processing of scheduled tasks of different priorities is reflected in the different latest completion times of tasks of different priorities. For example, high-priority tasks must be completed within 10 minutes, second-priority tasks must be completed within 20 minutes, and low-priority tasks must be completed within 40 minutes.
[0079] S104: Obtain each unit time score according to the preset basic score and the latest completion time of each task.
[0080] The basic score does not distinguish between priorities, and all scheduled tasks of different priorities have the same basic score. The basic score can be calculated according to the completion time standard to calculate the unit time score.
[0081] The specific process of obtaining each unit time score according to the preset basic score and the latest completion time of each task is shown in A1-A4.
[0082] A1: Perform timeout monitoring on multiple tasks to be scheduled.
[0083] The timeout monitoring of multiple tasks to be scheduled is completed by comparing the latest completion time of each task with the preset priority duration. The preset priority durations of tasks to be scheduled with different priorities are different.
[0084] For example, when timeout monitoring is performed on a task to be scheduled, the preset priority duration of a high priority task is set to 3 minutes, and the completion time of the high priority task to be scheduled is 4 minutes, then the high priority task to be scheduled will timeout by 1 minute.
[0085] A2: If it is detected that there is a task timeout among multiple tasks to be scheduled, obtain the timeout duration of the task timeout.
[0086] A3: The unit time score of the overtime scheduled task is obtained according to the basic score, the overtime duration and the task priority of the overtime scheduled task.
[0087] In order to facilitate understanding of how to obtain the unit time score of the overtime scheduled task based on the basic score, overtime duration and task priority of the overtime scheduled task, an example is given here to illustrate:
[0088] For example, the basic score of all tasks is 1000 points. The unit time score of the high priority task to be scheduled is 1000 / 10=100 points, the second priority is 1000 / 20=50 points, and the low priority is 1000 / 40=25 points. The unit time score of the task is used for overtime deduction. For example, the score of each completed task is 1000 points, but the task is completed 1 minute overtime, then 1*100 will be deducted from the high priority to obtain a score of 1000-1*100=900 points for a high priority task completed 1 minute overtime.
[0089] A4: If it is detected that multiple tasks to be scheduled have not timed out, the preset basic score is divided by the latest completion time of each task to obtain the unit time scores of the multiple tasks to be processed.
[0090] For example, the basic score of all tasks is 1000 points. For a high-priority task to be scheduled, its latest completion time is 10 minutes, so the unit time score of the high-priority task to be scheduled is 1000 / 10=100 points. For a second-priority task to be scheduled, its latest completion time is 20 minutes, so the unit time score of the second-priority task to be scheduled is 1000 / 20=50 points. For a low-priority task to be scheduled, its latest completion time is 40 minutes, so the unit time score of the low-priority task to be scheduled is 1000 / 40=25 points.
[0091] S105: Generate task pressure prediction results through the pre-trained pressure prediction model.
[0092] The task pressure prediction result includes at least the predicted number of tasks and the predicted processing time (estimated duration).
[0093] The pressure prediction model is trained using historical data. The training feature parameters include the current time (year, month, day, day of the week, specific time), the recent task volume of each priority, the average processing time of recent tasks, etc. The tasks of each priority in the current period and the average length of the tasks are obtained through label training. Based on the pressure prediction model, the number of tasks that may be received in the current period (pre-defined length, such as the next 10 minutes) and the processing time forecast can be obtained.
[0094] It should be noted that the pressure prediction model can use machine learning algorithms (generally random forests, linear regression, neural networks, etc.), the input parameters are training feature parameters, and the labels refer to the number of tasks with different priorities. The pressure prediction model is only used as a reference when there are multiple processing units, and a single processing unit does not need to consider this prediction information.
[0095] The task information in the pending task pool is integrated, and the multi-concurrent processing module needs to consider the predicted task information. The task information includes priority, estimated duration, remaining completion time, etc.
[0096] S106: Obtain a dynamic programming result of task scheduling according to the dynamic programming algorithm, the task pressure prediction result and each unit time score.
[0097] In S106, the state transfer calculation is performed according to the state transfer equation, the predicted number of tasks, the predicted processing time and the scores of each unit time to obtain the overall task score. Based on the overall task score, the dynamic planning result of the task scheduling is obtained, wherein the dynamic planning result includes at least the tasks to be scheduled and the scheduling path.
[0098] Dynamically plan all tasks and schedule tasks in the current period based on the comprehensive scores of different task scheduling methods, and schedule based on the highest score. The specific calculation method is as follows:
[0099] Define the state: represents the maximum score that can be obtained within time t;
[0100] State transition equation: For each task to be scheduled, you need to decide whether to complete it at the current time or leave it for later. If you complete it now, you will get a score, but it will consume time; if you leave it for later, the score may decrease;
[0101] The expression of the state transfer equation is shown in formula (1):
[0102] (1)
[0103] in, represents the maximum score that can be obtained within time t; represents the score at the previous time point; Select the task execution score for this round;
[0104] Initialization state: , because the score is 0 when there is no time;
[0105] Calculation order: from t=1 to T (total time), for each time point, traverse all tasks and update ;
[0106] Return result: the maximum score that can be obtained within time T, using express.
[0107] The principle of the dynamic programming algorithm is to first fix a unified total task score, that is, the basic score (all are 1000, unless the time penalty is exceeded), and transform the calculation of the overall score from traversing the entire path to the total score deduction of other tasks after a single task is selected, before waiting for the selected task to be executed. In this way, the dynamic programming algorithm becomes a sub-path solution that selects the minimum penalty each time, which greatly saves computing power.
[0108] It should be noted that, unlike general dynamic planning, tasks are constantly updated, so it is impossible to plan all task scheduling paths at once, and planning can only be done based on currently known tasks. Each scheduling requires recalculation of the plan, and each planning requires all tasks to be iterated and completed. The following is an example of a specific algorithm.
[0109] For example, the information of each task in the current task pool to be scheduled is shown in Table 1.
[0110] Table 1
[0111] Task Name Priority Estimated duration Unit time fraction time left Time difference (negative deduction) Current score A1 high 6 100 6 0 1000 A2 high 3 100 10 7 1000 B1 Second-rate 3 50 5 2 1000 B2 Second-rate 6 50 3 -3 850
[0112] In Table 1, the current scores are obtained by the above assumptions. The basic score for completing each scheduled task is 1000 points. If a high-priority task is overdue for 1 minute, 100 points will be deducted. If a low-priority task is overdue for 1 minute, 50 points will be deducted.
[0113] From the contents in Table 1, we can draw the state transition diagram of different task selections, as follows: Figure 3 shown. Figure 3 Schematic diagram of state transition for score changes.
[0114] Figure 3 In the table, the task penalties caused by different tasks are described respectively. By comparison, it can be seen that the scheduling B1 effect is the best in the first selection. Because the overall score is high and the task benchmark score is the same, it can also be considered that the fewer the penalty points, the higher the total score. Figure 3 of options.
[0115] Figure 3 The description of the state transition of the score change is as follows:
[0116] According to the scheduling of task A1, the content of the table is updated, as shown in Table 2.
[0117] Table 2
[0118] Task Name Estimated duration Remaining time Task score Total score after scheduling A1 0 0 0 1000 A2 3 5 1000 B1 3 -4 800(-200) B2 6 -9 550(-300)
[0119] If B1 is scheduled, the content of the table is updated, as shown in Table 3.
[0120] Table 3
[0121] Task Name Estimated duration Remaining time Task score Total score after scheduling A1 6 -3 700(-300) A2 3 7 1000 B1 0 0 1000 B2 6 -6 700(-150)
[0122] Next, the state migration is performed, that is, the first step is repeated to obtain the one with the highest overall score in the second step, and then the third step is iterated to finally obtain the maximum score and scheduling path. Generally, there are multiple parallel processing modules. Since the parallel modules do not schedule tasks at the same time, each module has a sequence of processing speeds, so the algorithm is actually a separate module algorithm. In addition, only when there are multiple concurrent modules, the prediction task is considered, and the prediction task is added to the task pool list, and the processing module for sudden high-priority tasks is reserved.
[0123] S107: Perform task scheduling according to the dynamic planning result.
[0124] In S107, the emergency task channel balance maximum score is reserved and scheduled according to the dynamic programming result.
[0125] While speeding up the overall completion speed of task scheduling, fully utilizing the task processing bandwidth, ensuring high-priority tasks while taking into account low-priority tasks.
[0126] In order to facilitate the understanding of the task scheduling process, combined Figure 4 Let's take an example:
[0127] For example, evaluate the hardware and software environment and each aspect of the task to obtain the task processing benchmark capability and concurrency capability;
[0128] When receiving a task to be scheduled, calculate the task processing time based on the current hardware capabilities (using historical data to train the model to obtain the result);
[0129] Convert the task priority into the task completion time standard according to the standard, and work backwards from the latest start time of the task based on the time node and processing time;
[0130] The task unit score is calculated based on the task processing time. For tasks whose latest time meets the current time, deductions are calculated based on the completion time standard and overtime.
[0131] Based on historical predictions of the possible workload in the near future, the score is calculated based on the possible workload;
[0132] Perform concurrency control and task extraction management based on scores;
[0133] Reserve emergency task channels to balance the maximum score and schedule based on the results.
[0134] This application uses a unified scoring standard for tasks of different priorities, but proposes different task completion time requirements for tasks of different priorities, and scores are given based on the completion status. The scores are used to judge the overall performance. The redundancy of the system's task capabilities is determined based on the historical task status and each unit time score in the task pressure prediction results, and processing channels are reserved for high-priority tasks. The efficiency of responding to emergencies can be ensured by maintaining minimum redundancy, so that sudden tasks can be responded to while maintaining the overall efficient operation of the task, and the service can be continuously optimized through the scoring system.
[0135] This application converts tasks into basic processing units and estimates the time based on different tasks. It can effectively utilize hardware processing units and achieve maximum efficiency based on comprehensive scheduling such as current service pressure and predicted recent pressure, task priority, task timing requirements, etc., to ensure that all tasks are completed on time at the maximum rate.
[0136] The beneficial effects of the embodiments of the present application are as follows: a unified scoring standard is established for scheduling tasks of different priorities, different task completion time requirements are proposed for tasks of different priorities, and scores are performed based on the completion status, and the overall performance is judged by the score. The redundancy of the system task capacity is determined based on the historical task status and each unit time score in the task pressure prediction result, the task is converted into a basic processing unit based on different priority tasks and the latest completion time is estimated, the dynamic planning result of task scheduling is obtained based on the current service pressure situation and the current service pressure and the predicted recent pressure, task priority, task timing requirements, etc., the dynamic planning result is comprehensively scheduled to ensure that all tasks are completed on time and the rate is maximized, give high priority less deadlines, reserve processing channels for high priority tasks, make full use of task processing bandwidth in the process of scheduling tasks according to the dynamic planning results, take low priority tasks into account while ensuring high priority tasks, so as to ensure the efficiency of responding to emergencies by maintaining minimum redundancy, and ensure that all tasks of different priorities are completed on time and the rate is maximized, so as to maintain the efficient operation of task scheduling while taking into account tasks of different priorities.
[0137] Based on the above embodiments Figure 1 A task scheduling method is disclosed, and the embodiment of the present application also discloses a task scheduling device, such as Figure 5 As shown, the task scheduling device includes:
[0138] The evaluation unit 501 is used to evaluate the operating environment of the multiple tasks to be processed when receiving multiple tasks to be scheduled, and obtain an evaluation result;
[0139] A determination unit 502 is used to determine the task priority corresponding to each of the multiple tasks to be scheduled;
[0140] The calculation unit 503 is used to calculate the task time consumption according to the evaluation result and the task priorities corresponding to the multiple tasks to be scheduled, so as to obtain the latest completion time of each task;
[0141] A first obtaining unit 504 is used to obtain each unit time score according to a preset basic score and the latest completion time of each task;
[0142] A generating unit 505, configured to generate a task pressure prediction result by using a pre-trained pressure prediction model;
[0143] A second acquisition unit 506 is used to obtain a dynamic programming result of task scheduling according to the dynamic programming algorithm, the task pressure prediction result and each unit time score;
[0144] The scheduling unit 507 is used to schedule tasks according to the dynamic planning result.
[0145] Furthermore, the evaluation result at least includes the task processing speed and the number of concurrent tasks. The evaluation unit 501 includes:
[0146] A first determination module is used to determine the processing task type of each of the multiple tasks to be scheduled when receiving multiple tasks to be scheduled in the task pool to be processed;
[0147] The first acquisition module is used to evaluate the software and hardware environment according to each processing task type, and obtain the task processing speed and the concurrency number under the software and hardware environment.
[0148] Furthermore, the calculation unit 503 includes:
[0149] The third acquisition module is used to obtain the historical task completion speed of each historical task type;
[0150] The first calculation module is used to input the evaluation results, each processing task type, historical task completion speed, concurrency number and task priorities corresponding to multiple tasks to be scheduled into the task duration model to calculate the task duration and obtain the latest completion time of each task.
[0151] Further, the determining unit 502 includes:
[0152] A fourth acquisition module is used to obtain the required completion time corresponding to the multiple tasks to be scheduled;
[0153] The second determination module is used to determine the task priorities corresponding to each of the multiple tasks to be scheduled according to each required completion time and a preset priority time.
[0154] Furthermore, the first acquisition unit 504 includes:
[0155] A monitoring module is used to monitor the timeout of multiple tasks to be scheduled;
[0156] A fifth acquisition module is used to acquire the timeout duration of the task timeout if it is detected that there is a task timeout among multiple tasks to be scheduled;
[0157] A sixth acquisition module, used to obtain a unit time score of the overtime scheduled task according to the basic score, the overtime duration and the task priority of the overtime to be scheduled task;
[0158] The second calculation module is used to divide the preset basic score by the latest completion time of each task if it is monitored that none of the multiple tasks to be scheduled has timed out, so as to obtain the unit time scores of the multiple tasks to be processed.
[0159] Furthermore, the task pressure prediction result at least includes the predicted number of tasks and the predicted processing time. The second acquisition unit 506 includes:
[0160] The third calculation module is used to perform state transfer calculation according to the state transfer equation, the number of predicted tasks, the predicted processing time and each unit time score to obtain the overall task score;
[0161] The seventh acquisition module is used to obtain a dynamic planning result of task scheduling according to the overall task score; wherein the dynamic planning result at least includes the tasks to be scheduled and the scheduling path.
[0162] The beneficial effects of the embodiments of the present application are as follows: a unified scoring standard is established for scheduling tasks of different priorities, different task completion time requirements are proposed for tasks of different priorities, and scores are performed based on the completion status, and the overall performance is judged by the score. The redundancy of the system task capacity is determined based on the historical task status and each unit time score in the task pressure prediction result, the task is converted into a basic processing unit based on different priority tasks and the latest completion time is estimated, the dynamic planning result of task scheduling is obtained based on the current service pressure situation and the current service pressure and the predicted recent pressure, task priority, task timing requirements, etc., the dynamic planning result is comprehensively scheduled to ensure that all tasks are completed on time and the rate is maximized, give high priority less deadlines, reserve processing channels for high priority tasks, make full use of task processing bandwidth in the process of scheduling tasks according to the dynamic planning results, take low priority tasks into account while ensuring high priority tasks, so as to ensure the efficiency of responding to emergencies by maintaining minimum redundancy, and ensure that all tasks of different priorities are completed on time and the rate is maximized, so as to maintain the efficient operation of task scheduling while taking into account tasks of different priorities.
[0163] An embodiment of the present application further provides a storage medium, which includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the task scheduling method as described above.
[0164] The present application also provides an electronic device, whose structural diagram is as follows: Figure 6 As shown, it specifically includes a memory 601 and one or more instructions 602, wherein the one or more instructions 602 are stored in the memory 601 and are configured to be executed by one or more processors 603 to execute the one or more instructions 602 to perform the above-mentioned task scheduling method.
[0165] For the aforementioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the order of the actions described, because according to the present application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0166] It should be noted that each embodiment in this specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the embodiments can be referred to each other. For system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0167] The steps in the methods of the embodiments of the present application can be adjusted in order, combined, and deleted according to actual needs.
[0168] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are merely used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.
[0169] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
[0170] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A task scheduling method, characterized in that: The method comprises: When multiple tasks to be scheduled are received, the operating environments of the multiple tasks to be processed are evaluated to obtain evaluation results; Determine the task priorities corresponding to multiple tasks to be scheduled; Calculate the task duration according to the evaluation result and the task priorities corresponding to the multiple tasks to be scheduled, and obtain the latest completion time of each task; Obtaining scores for each unit of time according to a preset basic score and the latest completion time of each task; Generate task stress prediction results through a pre-trained stress prediction model; Obtaining a dynamic programming result of task scheduling according to a dynamic programming algorithm, the task pressure prediction result and each unit time score; Task scheduling is performed according to the dynamic programming result.
2. The method according to claim 1, characterized in that The evaluation result includes at least the task processing speed and the number of concurrent tasks. When receiving multiple tasks to be scheduled, the operating environment of the multiple tasks to be processed is evaluated to obtain the evaluation result, including: When receiving a plurality of tasks to be scheduled in the pending task pool, determining the processing task type of each of the plurality of tasks to be scheduled; The software and hardware environment is evaluated according to each processing task type to obtain the task processing speed and the concurrency number under the software and hardware environment.
3. The method according to claim 2, characterized in that The task time calculation is performed according to the evaluation result and the task priorities corresponding to the multiple tasks to be scheduled to obtain the latest completion time of each task, including: Get the historical task completion speed of each historical task type; The evaluation result, the types of each processing task, the historical task completion speed, the number of concurrencies and the task priorities corresponding to each of the multiple tasks to be scheduled are input into the task duration model to calculate the task duration and obtain the latest completion time of each task.
4. The method according to claim 1, characterized in that: The step of determining the task priorities corresponding to the plurality of tasks to be scheduled includes: Get the required completion time of each task to be scheduled; According to each required completion time and the preset priority time, the task priority corresponding to each of the multiple tasks to be scheduled is determined.
5. The method according to claim 1, characterized in that: The scores per unit time are obtained according to the preset basic score and the latest completion time of each task, including: Perform timeout monitoring on multiple tasks to be scheduled; If it is detected that there is a task timeout among multiple tasks to be scheduled, the timeout duration of the task is obtained; Obtaining a unit time score of the overtime scheduled task according to the basic score, the overtime duration and the task priority of the overtime scheduled task; If it is monitored that multiple tasks to be scheduled have not timed out, the preset basic score is divided by the latest completion time of each task to obtain the unit time scores of the multiple tasks to be processed.
6. The method according to claim 1, characterized in that The task pressure prediction result at least includes the predicted number of tasks and the predicted processing time. The dynamic programming result of task scheduling is obtained according to the dynamic programming algorithm, the task pressure prediction result and the unit time scores, including: Perform state transfer calculation according to the state transfer equation, the number of predicted tasks, the predicted processing time, and the scores of each unit time to obtain an overall task score; According to the overall task score, a dynamic planning result of task scheduling is obtained; wherein the dynamic planning result at least includes the tasks to be scheduled and the scheduling path.
7. A task scheduling device, characterized in that: The device comprises: An evaluation unit, for evaluating the operating environments of the plurality of tasks to be processed when receiving the plurality of tasks to be scheduled, and obtaining evaluation results; A determination unit, used to determine the task priorities corresponding to each of the multiple tasks to be scheduled; A calculation unit, used to calculate the task time consumption according to the evaluation result and the task priorities corresponding to the plurality of tasks to be scheduled, so as to obtain the latest completion time of each task; A first acquisition unit, configured to obtain each unit time score according to a preset basic score and the latest completion time of each task; A generating unit, used for generating a task pressure prediction result by using a pre-trained pressure prediction model; A second acquisition unit is used to obtain a dynamic programming result of task scheduling according to a dynamic programming algorithm, the task pressure prediction result and each unit time score; A scheduling unit is used to schedule tasks according to the dynamic planning result.
8. The device according to claim 7, characterized in that The evaluation result includes at least the task processing speed and the number of concurrent tasks. The evaluation unit includes: A first determination module is used to determine the processing task type of each of the multiple tasks to be scheduled when receiving multiple tasks to be scheduled in the task pool to be processed; The first acquisition module is used to evaluate the software and hardware environment according to the types of the processing tasks, and obtain the task processing speed and the concurrency number under the software and hardware environment.
9. A storage medium, characterized in that: The storage medium includes stored instructions, wherein when the instructions are executed, the device where the storage medium is located is controlled to execute the task scheduling method according to any one of claims 1 to 6.
10. An electronic device, characterized in that: The system comprises a memory and one or more instructions, wherein the one or more instructions are stored in the memory and configured to be executed by one or more processors to execute the task scheduling method according to any one of claims 1 to 6.