A task scheduling method, device, computer equipment and storage medium

By adjusting task scheduling based on task running logs, the problem of low resource utilization of the task scheduling platform is solved and more efficient resource utilization is achieved.

CN112486660BActive Publication Date: 2024-10-22CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011511859.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-18
Publication Date
2024-10-22
Estimated Expiration
2040-12-18

AI Technical Summary

Technical Problem

In the existing technology, the task scheduling platform has a particularly large number of tasks during certain time periods, which leads to the problem of low system resource utilization.

Method used

Determine the target task to be adjusted based on the task running log, add it to the target task queue, and reasonably adjust the running period of the task based on the dependencies between tasks and the degree of resource competition to form a new task scheduling queue to optimize Task scheduling.

Benefits of technology

It improves the resource utilization of the system, avoids the problem of excessive or insufficient resource contention during task scheduling, and improves the overall efficiency of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112486660B_ABST
    Figure CN112486660B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a task scheduling method, device, computer equipment and storage medium. The method can be used in the field of cloud computing technology. The method includes: determining the target task to be adjusted to be added to the target task queue according to the task operation log, and determining the operation period to which the target task is to be updated, the target task queue is the first task queue or the second task queue; according to the operation period to which each task in the target task queue is to be updated, remove the tasks that do not meet the first task adjustment condition in the target task queue; merge the first task queue after removal and the second task queue after removal to obtain a third task queue, and schedule the tasks not removed from the third task queue according to the operation period to which the tasks not removed from the third task queue are to be updated. By adopting this application, the task scheduling time can be reasonably arranged and the system resource utilization rate can be improved. The present application relates to blockchain technology, such as reading the task operation log from the blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of cloud computing technology, and in particular, to a task scheduling method, device, computer device, and storage medium. Background Art

[0002] Some services have a lot of DAG (Directed Acyclic Graph) scheduling tasks every day. For example, in a scheduling platform such as the Linkdo platform, the number of daily task scheduling reaches the ten-thousand level. Therefore, optimizing the scheduling algorithm to save computing resources and improve application timeliness is of great significance.

[0003] The scheduling rule of the scheduling platform is that a task can start execution only when the set scheduling time is reached and all upstream tasks on which it depends are completed. For a task A, assuming its completion time is Ae, and the start times of all its downstream tasks are B1, B2, B3... Bn respectively, then the start time of the earliest-executed downstream task B is Bs = MIN(B1, B2, B3... Bn). When Ae < Bs, there will be idle time during the period from Bs - Ae. This situation where there are a large number of tasks running in one period and a small number of tasks running in another period reduces the resource utilization rate of the system. Summary of the Invention

[0004] Embodiments of this application provide a task scheduling method, device, computer device, and storage medium, which can reasonably arrange task scheduling time and improve the resource utilization rate of the system.

[0005] In a first aspect, embodiments of this application provide a task scheduling method, including:

[0006] Determine a target task to be adjusted according to the task running log, add the target task to a target task queue, and determine the running period to which the target task is to be updated. The target task queue is the first task queue or the second task queue. The first task queue includes tasks to be run in advance, and the second task queue includes tasks to be run later;

[0007] According to the running periods to which the tasks in the target task queue are to be updated, determine the tasks that do not meet the first task adjustment condition from the target task queue, and remove the tasks that do not meet the first task adjustment condition from the target task queue to obtain a target task queue after the removal process;

[0008] Perform a merging process on the first task queue after the removal process and the second task queue after the removal process to obtain a third task queue, and schedule the tasks that are not removed from the third task queue according to the running periods to which the tasks that are not removed from the third task queue are to be updated.

[0009] Optionally, determining the target task to be adjusted according to the task running log to add it to the target task queue includes:

[0010] Determine the running time period of the first task and the running time period of the second task associated with the first task according to the task running log, wherein the task running log includes running information of each task in the plurality of tasks, and the running information includes the running time period of the task;

[0011] Determining whether the first task satisfies a second task adjustment condition according to the running time period of the first task and the running time period of the second task;

[0012] When the first task meets the second task adjustment condition, the first task is determined as a target task to be adjusted to be added to a target task queue.

[0013] Optionally, judging whether the first task satisfies the second task adjustment condition according to the running time period of the first task and the running time period of the second task includes:

[0014] When the second task is an upstream task and there are multiple second tasks, determining the second task that runs the latest from the multiple second tasks according to the running time period of each of the multiple second tasks;

[0015] Calculating a first difference between the task start time of the first task and the task end time of the second task that is run the latest;

[0016] When the first difference is greater than or equal to a first preset value, it is determined that the first task meets a second task adjustment condition; wherein the target task queue is the first task queue.

[0017] Optionally, judging whether the first task satisfies the second task adjustment condition according to the running time period of the first task and the running time period of the second task includes:

[0018] When the second task is a downstream task and there are multiple second tasks, determining the earliest running second task from the multiple second tasks according to the running time period of each of the multiple second tasks;

[0019] Calculate a second difference between the task start time of the earliest running second task and the task end time of the first task;

[0020] When the second difference is greater than or equal to a second preset value, it is determined that the first task meets a second task adjustment condition; wherein the target task queue is the second task queue.

[0021] Optionally, determining the tasks that do not meet the first task adjustment condition from the target task queue according to the running time period to which each task in the target task queue is to be updated includes:

[0022] Determine the historical resource contention level value of the running time period of each task in the target task queue;

[0023] Determine the historical resource contention degree value of the running time period to which each task in the target task queue is to be updated;

[0024] According to the historical resource contention degree values ​​of the running time periods of each task in the target task queue and the historical resource contention degree values ​​of the running time periods to which each task in the target task queue is to be updated, tasks that do not meet the first task adjustment condition are determined from the target task queue.

[0025] Optionally, the method further includes:

[0026] Determine a designated task from the first task queue, and determine an associated task of the designated task from the second task queue, wherein the designated task refers to any task that has an associated task in the second task queue;

[0027] When the running time period to which the designated task is to be updated conflicts with the running time period to which the associated task is to be updated, a first decrease ratio of a first resource contention degree of the running time period to which the designated task is to be updated compared to a second resource contention degree of the running time period in which the designated task is located, and a second decrease ratio of a third resource contention degree of the running time period to which the associated task is to be updated compared to a fourth resource contention degree of the running time period in which the associated task is located are calculated;

[0028] When the first decrease ratio is less than the second decrease ratio, removing the designated task from the first task queue;

[0029] When the first decrease ratio is greater than or equal to the second decrease ratio, the associated task is removed from the second task queue.

[0030] Optionally, the method further includes:

[0031] Determine a resource contention level value of a running time period to which a third task in the third task queue is to be updated, the third task being any task included in the third task queue;

[0032] When the resource contention level value of the running time period to which the third task is to be updated is greater than or equal to the resource contention level value of the running time period in which the third task is located, the third task is removed from the third task queue and scheduled according to the running time period in which the third task is located.

[0033] In a second aspect, an embodiment of the present application provides a task scheduling device, including:

[0034] An adding processing module is used to determine the target task to be adjusted according to the task running log, add the target task to the target task queue, and determine the running period to which the target task is to be updated, the target task queue is the first task queue or the second task queue, the first task queue includes the tasks to be run in advance, and the second task queue includes the tasks to be run in delay;

[0035] a removal processing module, used for determining tasks that do not meet the first task adjustment condition from the target task queue according to the running time period to which each task in the target task queue is to be updated, and removing the tasks that do not meet the first task adjustment condition from the target task queue to obtain a target task queue after removal processing;

[0036] The scheduling module is used to merge the first task queue after the removal processing and the second task queue after the removal processing to obtain a third task queue, and for the tasks that have not been removed from the third task queue, schedule the tasks that have not been removed from the third task queue according to the running time period to which the tasks that have not been removed from the third task queue are intended to be updated.

[0037] In a third aspect, an embodiment of the present application provides a computer device, comprising a processor and a memory, wherein the processor and the memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method described in the first aspect.

[0038] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method described in the first aspect.

[0039] To summarize, the computer device can determine the target task to be adjusted according to the task running log, add the target task to the target task queue, and determine the running time period to which the target task is to be updated, and the target task queue is the first task queue or the second task queue; the computer device determines the tasks that do not meet the first task adjustment condition from the target task queue according to the running time period to which each task in the target task queue is to be updated, and removes the tasks that do not meet the first task adjustment condition from the target task queue to obtain the target task queue after the removal processing; the computer device merges the first task queue after the removal processing and the second task queue after the removal processing to obtain the third task queue, and for the tasks that have not been removed from the third task queue, schedules the tasks that have not been removed from the third task queue according to the running time period to which the tasks that have not been removed from the third task queue are to be updated. Compared with the situation in the prior art where there are a lot of tasks running within a period of time and a few tasks running within a period of time, the embodiment of the present application can reasonably arrange the task scheduling time and improve the resource utilization of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] 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 some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1 This is a schematic diagram of a task scheduling process provided by an embodiment of the present application;

[0042] Figure 2 This is another task scheduling process schematic diagram provided by an embodiment of the present application;

[0043] Figure 3 It is a flowchart of a task scheduling method provided in an embodiment of the present application;

[0044] Figure 4 It is a flowchart of another task scheduling method provided in an embodiment of the present application;

[0045] Figure 5 It is a structural diagram of a task scheduling device provided in an embodiment of the present application;

[0046] Figure 6 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0048] In the embodiment of the present application, "less than" in time means earlier than, and "greater than" in the embodiment of the present application means later than.

[0049] The resource contention degree value referred to in the embodiment of the present application can be used to measure the task parallelism of the corresponding operating period, that is, the task parallelism, which can also be said to be the number of running tasks per unit time.

[0050] Combine the following Figure 1 and Figure 2 A brief description of how to determine the degree of resource contention is given.

[0051] Figure 1 The tasks shown are A1, A2, A3...Am, and B1, B2, B3...Bn. B1 depends on A1 and A. The scheduling time of B1 is t4.2. B2 depends on A2 and A. The scheduling time of B2 is t4.5. B3 depends on A2, A and A3. The scheduling time of B3 is t4.3. Bn depends on Am and A. The scheduling time of Bn is t4.6. The scheduling time is the task start time referred to in the embodiment of the present application. The operating range of A1 is [t1.5, t2.8). The operating range of A2 is [t2.4, t3.5). The operating range of A3 is [t1.1, t2.4). The operating range of Am is [t2.4, t3.6). The operating range of A is [t2, t3.3). The operating range is the operating period referred to in the embodiment of the present application.

[0052] Depend on Figure 1 It can be seen that among all downstream tasks (B, B1, B2, B3…Bn) that depend on A, task B is the first to be scheduled. B's schedule time is t4, and since B has not reached the scheduled time, it has not started to execute. B2, on the other hand, cannot start to execute even if B2's schedule time arrives, because A2, which it depends on, has not been completed when A is completed, and will remain in a waiting state. For more information, see Figure 2 Taking A as an example, even if [t2, t3.3) is very busy and [t3.3, t4) is idle, A will still be scheduled at t2, which means that the running time of A will fall at the peak of concurrency.

[0053] For example, for task x, the calculation formula for the resource contention degree value in its running period is as follows:

[0054]

[0055] Where c represents the resource contention degree value, and Tm represents the duration of the overlap or conflict between the running time periods of task x and task m. Tm can be obtained by the following formula:

[0056]

[0057] Among them, E represents the task end time of task m, and S represents the task start time of task m.

[0058] For example, when task x is A, for task A, the duration of the running period of A can be calculated as T = t3.3-t2 = 3.3-2.0 = 1.3 (time units). Among them, t represents the time point in the universal reference system, such as the difference between time t2 and time t3.3 is 1.3 time units.

[0059] When task 1 is A1...task m is Am, T1-Tm can be calculated for A1-Am, and the process is as follows. Similarly, T1=0.8, T2=0.9, T3=0.4...Tm=0.9 are all time units, which can be years, months, days or hours, minutes and seconds.

[0060] T1 = Min (t3.3, t2.8) - Max (t2, t1.5) = 2.8 - 2.0 = 0.8 (time unit);

[0061] T2 = Min (t3.3, t3.5) - Max (t2, t2.4) = 3.3 - 2.4 = 0.9 (time unit);

[0062] T3 = Min (t3.3, t2.4) - Max (t2, t1.1) = 2.4 - 2.0 = 0.4 (time unit);

[0063] Tm = Min (t3.3, t3.6) - Max (t2, t2.4) = 3.3 - 2.4 = 0.9 (time unit).

[0064] It should be noted that the embodiment of the present application can also calculate that the duration of the overlap between each downstream task and Task A is 0. Therefore, the embodiment of the present application substitutes T and T1-Tm into the above formula, and can calculate c=(T1+T2+T3+…Tm) / T=(0.8+0.9+0.4+…0.9) / 1.3≈2.31, that is, on average, 2.31 tasks compete with Task A for resources.

[0065] Assume Xs=8:42, Xe=10:00. If A1 runs at [8:12,9:30), then the time range that falls within the Ax running time [8:42,10:00] is [8:42,9:30], with a total of 0.8h; if A2 runs at [9:06,10:12), then the time range that falls within the Ax running time is [9:06,10:00), with a total of 0.9h; if A3 runs at [7:48,9:06), then the time range that falls within the Ax running time is [8:42,9:06), with a total of 0.4h; if Am runs at [9:06,10:18), then the time range that falls within the Ax running time is [9:06,10:00), with a total of 0.9h. The embodiment of the present application can calculate T1+T2+T3+…Tm=0.8+0.9+0.4…+0.9=3, where 3 is the total time that all tasks run in parallel with Ax, which can be understood as an average of 3 / 1.3≈2.31 tasks competing for resources with Ax per hour during the running period of Ax [8:42,9:30].

[0066] See also Figure 3 , is a flow chart of a task scheduling method provided in an embodiment of the present application. Specifically, the method can be applied to computer devices such as servers. The method can include the following steps:

[0067] S301. Determine the target task to be adjusted according to the task running log, add the target task to the target task queue, and determine the running time period to which the target task is to be updated. The target task queue is the first task queue or the second task queue. The first task queue includes tasks to be run in advance, and the second task queue includes tasks to be run later.

[0068] Among them, the target task to be adjusted can be a target task to be advanced or a target task to be postponed. The target task can be any task among multiple tasks. The target task queue can be a first task queue (such as an advance postpone queue) or a second task queue (such as an ahead queue). The task operation log records the operation information of each task in multiple tasks, such as the operation period of each task. The operation period mentioned in the embodiment of the present application includes the task start time and the task end time.

[0069] In one embodiment, the process of a computer device determining a target task to be adjusted to be added to a target task queue according to a task running log is specifically as follows: the computer device determines the running time period of the first task and the running time period of the second task associated with the first task according to the task running log, the task running log includes the running information of each task in a plurality of tasks, and the running information includes the running time period of the task; the computer device determines whether the first task meets the second task adjustment condition according to the running time period of the first task and the running time period of the second task, and when the first task meets the second task adjustment condition, the first task is determined as the target task to be adjusted to be added to the target task queue. Wherein, the first task is any task among the plurality of tasks, and the second task is an upstream task or a downstream task. For example, the running time period of the first task can be the preset running time period of the first task (the running time period corresponding to the first task). The running time period of the second task can be the preset running time period of the second task (the running time period corresponding to the second task). Or, the running time period of the first task can be the running time period of the first task in each historical operation, such as the running time period of the first task in each of the last 7 operations. The running time period of the second task may refer to the running time period of each historical running of the second task, such as the running time period of each of the last seven running of the second task. The preset running time period may be different from the actual running time period.

[0070] In one embodiment, the computer device determines whether the first task meets the second task adjustment condition according to the running time period in which the first task is located and the running time period in which the second task is located. The method can be: when the second task is an upstream task and there are multiple second tasks, the computer device determines the second task that runs the latest from the multiple second tasks according to the running time period in which each second task in the multiple second tasks is located; the computer device calculates the first difference between the task start time of the first task and the task end time of the second task that runs the latest, and when the first difference is greater than or equal to the first preset value, determines that the first task meets the second task adjustment condition; wherein the target task queue is the first task queue. In one embodiment, the computer device can determine the first task as the target task to be adjusted after determining that the first task meets the second task adjustment condition, which is the target task to be advanced here. In one embodiment, the computer device can advance the task start time of the first task to a task end time greater than the task end time of the second task that runs the latest (which can be the preset task end time of the second task that runs the latest, the task end time of the most recent run, or (the latest task end time during the historical run).

[0071] In one embodiment, when the running time period of the first task is the running time period of each historical running of the first task, and the running time period of the second task is the running time period of each historical running of the second task, the process of the computer device calculating the difference between the task start time of the first task and the task end time of the second task that was run the latest can be: the computer device calculates the first difference between each task start time of the first task and each task end time of the second task that was run the latest, based on the running time period of each historical running of the first task and the running time period of each historical running of the second task that was run the latest. For example, the computer device calculates the first difference between each task start time of the first task and each task end time of the second task that was run the latest, based on the running time period of each of the last 7 running of the first task and the running time period of each of the last 7 running of the second task, so that 7 first differences can be obtained, and when it is determined that each first difference is greater than the first preset value, the first task is determined to be the target task to be advanced.

[0072] In one embodiment, the computer device determines whether the first task meets the second task adjustment condition according to the running time period in which the first task is located and the running time period in which the second task is located as follows: when the second task is a downstream task and there are multiple second tasks, the computer device determines the earliest running second task from the multiple second tasks according to the running time period in which each second task in the multiple second tasks is located; the computer device calculates the second difference between the task start time of the earliest running second task and the task end time of the first task, and when the second difference is greater than or equal to the second preset value, determines that the first task meets the second task adjustment condition; wherein the target task queue is the second task queue. In one embodiment, the computer device can determine the first task as the target task to be adjusted after determining that the first task meets the second task adjustment condition, which is the target task to be postponed here. In one embodiment, the computer device can postpone the task end time of the first task to a task start time that is less than or equal to the task start time of the earliest running second task (which can be the preset task start time of the earliest running second task, the task start time of the most recent running, or the earliest task start time in the historical running).

[0073] In one embodiment, when the running time period of the first task is the running time period of each historical running of the first task, and the running time period of the second task is the running time period of each historical running of the second task, the process of the computer device calculating the second difference between the task start time of the earliest running second task and the task end time of the first task can be: the computer device calculates the second difference between each task start time of the earliest running second task and each task end time of the first task based on the running time period of the first task in each historical running and the running time period of the earliest running second task in each historical running. For example, the computer device calculates the second difference between each task start time of the earliest running second task and each task end time of the first task based on the running time period of the first task in each of the last 7 running times and the running time period of the earliest running second task in each of the last 7 running times, so that 7 second differences can be obtained, and when it is determined that each second difference is greater than the second preset value, the first task is determined to be the target task to be postponed.

[0074] In one embodiment, in order to avoid affecting the task start time of the downstream task due to the postponement of the upstream task, it must be ensured that after the upstream task is postponed, its task end time must be earlier than the original task start time of the downstream task. Therefore, for safety reasons, the task end time after the upstream task is postponed cannot be later than the earliest task start time of the downstream task in the recent few times. For example, the earliest executed downstream task associated with task A is task B. The task start times of task B in the last 7 times are 7:30, 7:10, 7:15, 7:35, 7:42, 7:20, and 7:05. The task end time after the postponement of task A must be less than or equal to Min (7:30, 7:10, 7:15, 7:35, 7:42: 7:20: 7:05), that is, less than or equal to 7:05, so as not to reduce the timeliness of task B.

[0075] In an application scenario, suppose the task start time of task A is 8:42 and the task end time is 10:00. The earliest executed downstream task associated with task A is task B. The latest executed upstream task associated with task B is task A. The task start time of task B is 11:00 and the task end time is 12:00. The computer device can calculate the difference between the task start time of task B and the task end time of task A, where the second difference calculated here is the period from 10:00 to 11:00. When it is determined that this difference is greater than the second preset value, it can be determined that task A meets the second task adjustment condition, and then task A is determined to be the target task to be postponed. Similarly, when it is determined that this difference is greater than the first preset value, it can be determined that task B meets the second task adjustment condition, and then task B is determined to be the target task to be advanced. In the embodiment of the present application, task A can be placed in the second task queue for subsequent analysis of the decrease in parallelism before and after the postponed execution, or task B can be placed in the first task queue for subsequent analysis of the decrease in parallelism before and after the early execution. After obtaining the difference, the task end time of task A can be postponed to 11:00 at most, and the task start time of task B can be advanced to 10:00 at most.

[0076] S302. According to the running time period to which each task in the target task queue is to be updated, tasks that do not meet the first task adjustment condition are determined from the target task queue, and the tasks that do not meet the first task adjustment condition are removed from the target task queue to obtain a target task queue after removal processing.

[0077] In an embodiment of the present application, the computer device determines the tasks that do not meet the first task adjustment condition from the target task queue according to the running time period to which each task in the target task queue is to be updated as follows: the computer device determines the resource contention degree value of the running time period in which each task in the target task queue is located, and the resource contention degree value of the running time period to which each task in the target task queue is to be updated; the computer device determines the tasks that do not meet the first task adjustment condition from the target task queue according to the resource contention degree value of the running time period in which each task in the target task queue is located, and the resource contention degree value of the running time period to which each task in the target task queue is to be updated. The computer device may determine the task as a task that does not meet the first task adjustment condition when it is determined that the resource contention degree value of the running time period in which a task in the target task queue is located is less than or equal to the resource contention degree value of the running time period to which the task is to be updated.

[0078] S303, merge the first task queue after the removal processing and the second task queue after the removal processing to obtain a third task queue, and for the tasks that have not been removed from the third task queue, schedule the tasks that have not been removed from the third task queue according to the running time period to which the tasks that have not been removed from the third task queue are intended to be updated.

[0079] In an embodiment of the present application, the computer device can determine the resource contention level value of the running time period to which the third task in the third task queue is intended to be updated, and the third task is any task included in the third task queue; when the resource contention level value of the running time period to which the third task is intended to be updated is greater than or equal to the resource contention level value of the running time period in which the third task is located, the computer device removes the third task from the third task queue and schedules the third task according to the running time period in which the third task is located.

[0080] For example, if task T in the third task queue Q originally runs in the [8:30,9:30] time period and is to be adjusted to [8:45,9:45], other tasks may also be adjusted to [8:45,9:45] time period. Therefore, when resource competition becomes more intense after task T is adjusted to [8:45,9:45] time period, task T should be removed from Q. At this time, task T does not adjust the scheduling time and is still executed in the original [8:30,9:30] time period. After the entire solution process is completed, the tasks that can still remain in the third task queue, that is, the tasks that have not been removed from the third task queue, are the tasks whose scheduling time should be updated in the end.

[0081] In addition, in the embodiment of the present application, for a task removed from the target task queue, the removed task is also scheduled according to the running time period before the update of the removed task.

[0082] visible, Figure 3In the illustrated embodiment, the computer device can determine the target task to be adjusted according to the task running log, add the target task to the target task queue, and determine the running time period to which the target task is to be updated, the target task queue is the first task queue or the second task queue, the first task queue includes tasks to be run in advance, and the second task queue includes tasks to be run later; the computer device determines the tasks that do not meet the first task adjustment condition from the target task queue according to the running time period to which each task in the target task queue is to be updated, and removes the tasks that do not meet the first task adjustment condition from the target task queue to obtain the target task queue after removal processing; the computer device merges the first task queue after removal processing and the second task queue after removal processing to obtain a third task queue, and for the tasks that have not been removed from the third task queue, schedules the tasks that have not been removed from the third task queue according to the running time period to which the tasks that have not been removed from the third task queue are to be updated, and the use of this process can reasonably adjust the scheduling time of the tasks, thereby solving the problem of low system resource utilization caused by the prior art that there are many task features in a period of time and very few tasks executed in a period of time.

[0083] The present application can be used in the field of cloud computing technology, such as the field of load balancing technology. The present application relates to the field of blockchain technology, such as writing a task running log into a blockchain and obtaining the task running log from the blockchain when needed.

[0084] See also Figure 4 , is a flow chart of another task scheduling method provided in an embodiment of the present application. The method can be applied to the aforementioned server. Specifically, the method can include the following steps:

[0085] S401. Determine the target task to be adjusted according to the task running log, add the target task to the target task queue, and determine the running time period to which the target task is to be updated. The target task queue is the first task queue or the second task queue. The first task queue includes tasks to be run in advance, and the second task queue includes tasks to be run later.

[0086] Among them, step S401 can be found in Figure 3 Step S301 in the embodiment is not described in detail in the embodiment of the present application.

[0087] S402: Determine the historical resource contention level value of the running time period of each task in the target task queue.

[0088] S403: Determine the historical resource contention level value of the running time period to which each task in the target task queue is to be updated.

[0089] The running time period of each task in the target task queue may refer to a preset running time period of each task in the target task queue (a running time period set corresponding to each task).

[0090] The historical resource contention level value refers to the resource contention level value of the running time period of each task in the target task queue. The historical resource contention level value may include the resource contention level of each time in a preset time range, such as the resource contention level value of each day in the last 7 days. Or, the historical resource contention level value may include the resource contention level value of each time within a preset number of times, such as the resource contention level value of each time in the last 7 times.

[0091] S404. According to the historical resource contention degree values ​​of the running time periods of the tasks in the target task queue and the historical resource contention degree values ​​of the running time periods to which the tasks in the target task queue are to be updated, determine the tasks that do not meet the first task adjustment condition from the target task queue.

[0092] S405: remove the tasks that do not meet the first task adjustment condition from the target task queue to obtain a target task queue after removal processing.

[0093] In an embodiment of the present application, the computer device may compare each resource degree value in the historical resource contention degree value of the running time period to which each task in the target task queue is intended to be updated with each resource degree value in the historical resource contention degree value of the running time period in which each task in the target task queue is located, to obtain a comparison result, and based on the comparison result, determine the tasks that do not meet the first task adjustment condition from the target task queue, and remove the tasks that do not meet the first task adjustment condition from the target task queue, to obtain the target task queue after the removal processing.

[0094] For example, the target task queue includes task a and task b. The historical resource contention level value of the running period of task a includes the resource contention level value of each day in the past 7 days. The historical resource contention level value of the running period of task b includes the resource contention level value of each day in the past 7 days. The computer device may compare the resource contention level value of date 1 of the running period of task a in the last 7 days with the resource contention level value of date 1 of the running period of task b in the last 7 days; the computer device compares the resource contention level value of date 2 of the running period of task a in the last 7 days with the resource contention level value of date 2 of the running period of task b in the last 7 days… The computer device compares the resource contention level value of date 7 of the running period of task a in the last 7 days with the resource contention level value of date 7 of the running period of task b in the last 7 days to obtain a comparison result. If the comparison result indicates that the resource contention level value of the running period of task a on half or more of the days in the last 7 days is greater than the resource contention level value of the running period of task b on these half or more of the days, then task a is determined to be a task that does not meet the first task condition.

[0095] S406. Merge the first task queue after the removal process and the second task queue after the removal process to obtain a third task queue, and schedule the tasks that have not been removed from the third task queue according to the running time period to which the tasks that have not been removed from the third task queue are intended to be updated.

[0096] Among them, step S405 can be found in Figure 3 Step S303 in the embodiment is not described in detail in the embodiment of the present application.

[0097] In one embodiment, the computer device can also determine a specified task from the first task queue, and determine an associated task of the specified task from the second task queue, the specified task refers to any task with an associated task in the second task queue; when the running period to which the specified task is to be updated conflicts with the running period to which the associated task is to be updated, the computer device can calculate the first decrease ratio of the first resource contention degree of the running period to which the specified task is to be updated compared to the second resource contention degree of the running period in which the specified task is located, and the second decrease ratio of the third resource contention degree of the running period to which the associated task is to be updated compared to the fourth resource contention degree of the running period in which the associated task is located; when the first decrease ratio is less than the second decrease ratio, remove the specified task from the first task queue; when the first decrease ratio is greater than or equal to the second decrease ratio, remove the associated task from the second task queue; at this point, the computer device can obtain the target task queue after removal processing. In one embodiment, this step can be performed after the task that does not meet the first task adjustment condition is removed from the target task queue.

[0098] For example, combined with Figure 2 For example, the designated task included in the first task queue is task A', and the associated task of the designated task in the second task queue is task B3'. The computer device can postpone the execution of task A to the running interval of task A', that is, the running period to which A is to be updated is the running period of A'. Figure 2 It can be seen that the task end time Te' of A' is earlier than the task start time t4 of task B3. In order not to affect the execution of downstream tasks, the task start time Ts' of A' can be earlier than t4-T=4-1.3=t2.7.

[0099] The computer device can use the following formula to calculate the resource contention level value c' in the running time period where A' is located:

[0100] T1'=Min(t4,t2.8)-Max(t2.7,t1.5)=2.8-2.7=0.1;

[0101] T2'=Min(t4,t3.5)-Max(t2.7,t2.4)=3.5-2.7=0.8;

[0102] T3'=0 (the task end time of A3 is less than the task start time of A', and the two will not be executed in parallel);

[0103] Tm'=Min(t4,t3.6)-Max(t2.7,t2.4)=3.6-2.7=0.9;

[0104]

[0105] The computer device can determine that the resource contention level value of the operation period of A' is lower than the resource contention level value of the operation period of A based on the resource contention level value of the operation period of A'. This percentage is the first decrease ratio. In addition, the computer device can also calculate that the resource contention level value of the running time period of B3 is about 3.5, and the resource contention level value of B3' is about 1.33. Based on the resource contention level value of the running time period of B3' and the resource contention level value of the running time period of B3, the computer device can determine that the resource contention level value of the running time period of B3' is lower than the resource contention level value of the running time period of B3. This percentage is the second decrease ratio. The computer device determines that 61.9% is greater than 47.06%, removes A from the first task queue, and obtains the first task queue after removal processing.

[0106] visible, Figure 3In the illustrated embodiment, the computer device can determine the historical resource contention level values ​​of the running time periods in which each task in the target task queue is located, as well as the historical resource contention level values ​​of the running time periods to which each task in the target task queue is intended to be updated; the computer device determines the tasks that do not meet the first task adjustment condition from the target task queue based on the historical resource contention level values ​​of the running time periods in which each task in the target task queue is located, as well as the historical resource contention level values ​​of the running time periods to which each task in the target task queue is intended to be updated, to remove them from the target task queue. The embodiment of the present application adopts the above process to avoid the situation where the resource contention level of the task increases after adjusting the running time period of the task.

[0107] See also Figure 3 , is a structural diagram of a task scheduling device provided in an embodiment of the present application. The task scheduling device can be applied to a server. Specifically, the task scheduling device may include:

[0108] Add processing module 301, used to determine the target task to be adjusted according to the task running log, add the target task to the target task queue, and determine the running time period to which the target task is to be updated. The target task queue is the first task queue or the second task queue. The first task queue includes tasks to be run in advance, and the second task queue includes tasks to be delayed.

[0109] The removal processing module 302 is used to determine the tasks that do not meet the first task adjustment condition from the target task queue according to the running period to which each task in the target task queue is intended to be updated, and remove the tasks that do not meet the first task adjustment condition from the target task queue to obtain the target task queue after removal processing.

[0110] The scheduling module 303 is used to merge the first task queue after the removal processing and the second task queue after the removal processing to obtain a third task queue, and for the tasks that have not been removed from the third task queue, schedule the tasks that have not been removed from the third task queue according to the running time period to which the tasks that have not been removed from the third task queue are intended to be updated.

[0111] In an optional embodiment, the adding processing module 301 module determines the target task to be adjusted according to the task running log to add it to the target task queue, specifically determining the running time period of the first task and the running time period of the second task associated with the first task according to the task running log, the task running log including the running information of each task in the multiple tasks, the running information including the running time period of the task; judging whether the first task meets the second task adjustment condition according to the running time period of the first task and the running time period of the second task; when the first task meets the second task adjustment condition, determining the first task as the target task to be adjusted to add it to the target task queue.

[0112] In an optional embodiment, an add processing module 301 determines whether the first task meets the second task adjustment condition based on the running time period of the first task and the running time period of the second task. Specifically, when the second task is an upstream task and there are multiple second tasks, the latest running second task is determined from the multiple second tasks based on the running time period of each second task in the multiple second tasks; the first difference between the task start time of the first task and the task end time of the latest running second task is calculated; when the first difference is greater than or equal to a first preset value, it is determined that the first task meets the second task adjustment condition; wherein, the target task queue is the first task queue.

[0113] In an optional embodiment, the adding processing module 301 determines whether the first task satisfies the second task adjustment condition according to the running time period of the first task and the running time period of the second task. Specifically, when the second task is a downstream task and there are multiple second tasks, the earliest running second task is determined from the multiple second tasks according to the running time period of each second task in the multiple second tasks; the second difference between the task start time of the earliest running second task and the task end time of the first task is calculated; when the second difference is greater than or equal to a second preset value, it is determined that the first task satisfies the second task adjustment condition; wherein, the target task queue is the second task queue.

[0114] In an optional implementation, the adding processing module 301 determines the tasks that do not meet the first task adjustment condition from the target task queue according to the running time period to which each task in the target task queue is intended to be updated, specifically determining the historical resource contention degree value of the running time period in which each task in the target task queue is located; determining the historical resource contention degree value of the running time period to which each task in the target task queue is intended to be updated; and determining the tasks that do not meet the first task adjustment condition from the target task queue according to the historical resource contention degree value of the running time period in which each task in the target task queue is located and the historical resource contention degree value of the running time period to which each task in the target task queue is intended to be updated.

[0115] In an optional embodiment, the removal processing module 302 is also used to determine a designated task from the first task queue and an associated task of the designated task from the second task queue, wherein the designated task refers to any task that has an associated task in the second task queue; when the running time period to which the designated task is to be updated conflicts with the running time period to which the associated task is to be updated, calculate a first decrease ratio of the first resource contention level of the running time period to which the designated task is to be updated compared to the second resource contention level of the running time period in which the designated task is located, and a second decrease ratio of the third resource contention level of the running time period to which the associated task is to be updated compared to the fourth resource contention level of the running time period in which the associated task is located; when the first decrease ratio is less than the second decrease ratio, remove the designated task from the first task queue; when the first decrease ratio is greater than or equal to the second decrease ratio, remove the associated task from the second task queue.

[0116] In an optional embodiment, the removal processing module 302 is also used to determine the resource contention level value of the running time period to which the third task in the third task queue is intended to be updated, and the third task is any task included in the third task queue; when the resource contention level value of the running time period to which the third task is intended to be updated is greater than or equal to the resource contention level value of the running time period in which the third task is located, the third task is removed from the third task queue, and the third task is scheduled according to the running time period in which the third task is located through the scheduling module 303.

[0117] visible, Figure 3In the illustrated embodiment, the document processing device can determine the target task to be adjusted according to the task running log, add the target task to the target task queue, and determine the running time period to which the target task is to be updated, and the target task queue is the first task queue or the second task queue; the document processing device determines the tasks that do not meet the first task adjustment condition from the target task queue according to the running time period to which each task in the target task queue is to be updated, and removes the tasks that do not meet the first task adjustment condition from the target task queue to obtain the target task queue after removal processing; the document processing device merges the first task queue after removal processing and the second task queue after removal processing to obtain a third task queue, and for the tasks that have not been removed from the third task queue, schedules the tasks that have not been removed from the third task queue according to the running time period to which the tasks that have not been removed from the third task queue are to be updated. Compared with the prior art where there are particularly many tasks running within a period of time and particularly few tasks running within a period of time, the embodiment of the present application can reasonably arrange the task scheduling time and improve the resource utilization of the system.

[0118] See also Figure 4 , is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. The computer device described in this embodiment may include: one or more processors 1000 and a memory 2000. The processor 1000 and the memory 2000 may be connected via a bus or the like.

[0119] The processor 1000 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0120] The memory 2000 may be a high-speed RAM memory or a non-volatile memory, such as a disk memory. The memory 2000 is used to store a set of program codes, and the processor 1000 may call the program codes stored in the memory 2000. Specifically:

[0121] Processor 1000 is used to determine a target task to be adjusted according to a task running log, add the target task to a target task queue, and determine the running time period to which the target task is to be updated, wherein the target task queue is a first task queue or a second task queue, wherein the first task queue includes tasks to be run in advance, and the second task queue includes tasks to be run later; according to the running time period to which each task in the target task queue is to be updated, tasks that do not satisfy a first task adjustment condition are determined from the target task queue, and the tasks that do not satisfy the first task adjustment condition are removed from the target task queue to obtain a target task queue after removal processing; the first task queue after removal processing and the second task queue after removal processing are merged to obtain a third task queue, and for tasks that have not been removed from the third task queue, the tasks that have not been removed from the third task queue are scheduled according to the running time period to which the tasks that have not been removed from the third task queue are to be updated.

[0122] In one embodiment, the processor 1000 determines a target task to be adjusted based on a task running log to add it to a target task queue, specifically determining a running time period of a first task and a running time period of a second task associated with the first task based on the task running log, the task running log including running information of each task in a plurality of tasks, the running information including the running time period of the task; judging whether the first task meets a second task adjustment condition based on the running time period of the first task and the running time period of the second task; and determining the first task as a target task to be adjusted to add it to a target task queue when the first task meets the second task adjustment condition.

[0123] In one embodiment, the processor 1000 determines whether the first task satisfies the second task adjustment condition based on the running time period in which the first task is located and the running time period in which the second task is located. Specifically, when the second task is an upstream task and there are multiple second tasks, the latest running second task is determined from the multiple second tasks based on the running time period in which each second task is located; the first difference between the task start time of the first task and the task end time of the latest running second task is calculated; when the first difference is greater than or equal to a first preset value, it is determined that the first task satisfies the second task adjustment condition; wherein the target task queue is the first task queue.

[0124] In one embodiment, the processor 1000 determines whether the first task satisfies the second task adjustment condition based on the running time period in which the first task is located and the running time period in which the second task is located. Specifically, when the second task is a downstream task and there are multiple second tasks, the earliest running second task is determined from multiple second tasks based on the running time period in which each second task is located; the second difference between the task start time of the earliest running second task and the task end time of the first task is calculated; when the second difference is greater than or equal to a second preset value, it is determined that the first task satisfies the second task adjustment condition; wherein the target task queue is the second task queue.

[0125] In one embodiment, the processor 1000 determines the tasks that do not meet the first task adjustment condition from the target task queue according to the running time period to which each task in the target task queue is intended to be updated, specifically determining the historical resource contention degree value of the running time period in which each task in the target task queue is located; determining the historical resource contention degree value of the running time period to which each task in the target task queue is intended to be updated; and determining the tasks that do not meet the first task adjustment condition from the target task queue according to the historical resource contention degree value of the running time period in which each task in the target task queue is located and the historical resource contention degree value of the running time period to which each task in the target task queue is intended to be updated.

[0126] In one embodiment, the processor 1000 is also used to determine a specified task from the first task queue and an associated task of the specified task from the second task queue, wherein the specified task refers to any task with an associated task in the second task queue; when the running time period to which the specified task is to be updated conflicts with the running time period to which the associated task is to be updated, calculate a first decrease ratio of a first resource contention level of the running time period to which the specified task is to be updated compared to a second resource contention level of the running time period in which the specified task is located, and a second decrease ratio of a third resource contention level of the running time period to which the associated task is to be updated compared to a fourth resource contention level of the running time period in which the associated task is located; when the first decrease ratio is less than the second decrease ratio, remove the specified task from the first task queue; when the first decrease ratio is greater than or equal to the second decrease ratio, remove the associated task from the second task queue.

[0127] In one embodiment, the processor 1000 is also used to determine the resource contention level value of the running time period to which the third task in the third task queue is intended to be updated, and the third task is any task included in the third task queue; when the resource contention level value of the running time period to which the third task is intended to be updated is greater than or equal to the resource contention level value of the running time period in which the third task is located, the third task is removed from the third task queue and scheduled according to the running time period in which the third task is located.

[0128] In a specific implementation, the processor 1000 described in the embodiment of the present application may execute Figure 1 Example Figure 2 The implementation method described in the embodiment can also execute the implementation method described in the embodiment of the present application, which will not be repeated here.

[0129] Each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of sampling hardware or sampling software functional modules.

[0130] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the computer-readable storage medium can be volatile or non-volatile. For example, the computer storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM). The computer-readable storage medium can mainly include a storage program area and a storage data area, wherein the storage program area can store an operating system, at least one application required for a function, etc.; the storage data area can store data created according to the use of the blockchain node, etc.

[0131] Among them, the blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0132] What is disclosed above is only a preferred embodiment of the present application, and it certainly cannot be used to limit the scope of rights of the present application. Ordinary technicians in this field can understand that all or part of the processes of implementing the above embodiment and equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A task scheduling method, characterized in that: include: Determine the running time period of the first task and the running time period of the second task associated with the first task according to the task running log, wherein the task running log includes running information of each task in the plurality of tasks, and the running information includes the running time period of the task; Determining whether the first task satisfies a second task adjustment condition according to the running time period of the first task and the running time period of the second task; If the first task meets the second task adjustment condition, the first task is determined as a target task to be adjusted, the target task is added to a target task queue, and the running time period to which the target task is to be updated is determined, the target task queue is a first task queue or a second task queue, the first task queue includes tasks to be run in advance, and the second task queue includes tasks to be run in a delayed manner; Determine the historical resource contention level value of the running time period of each task in the target task queue; Determine the historical resource contention level value of the running time period to which each task in the target task queue is to be updated; According to the historical resource contention degree values ​​of the running time periods of the tasks in the target task queue and the historical resource contention degree values ​​of the running time periods to which the tasks in the target task queue are to be updated, determining the tasks that do not meet the first task adjustment condition from the target task queue; The tasks that do not meet the first task adjustment condition are removed from the target task queue to obtain a target task queue after removal processing; The first task queue after the removal processing and the second task queue after the removal processing are merged to obtain a third task queue, and for tasks that have not been removed from the third task queue, the tasks that have not been removed from the third task queue are scheduled according to the running time period to which the tasks that have not been removed from the third task queue are intended to be updated.

2. The method according to claim 1, characterized in that The determining, according to the running time period of the first task and the running time period of the second task, whether the first task satisfies the second task adjustment condition includes: When the second task is an upstream task and there are multiple second tasks, determining the second task that runs the latest from the multiple second tasks according to the running time period of each of the multiple second tasks; Calculating a first difference between the task start time of the first task and the task end time of the second task that is run the latest; When the first difference is greater than or equal to a first preset value, it is determined that the first task meets a second task adjustment condition; wherein the target task queue is the first task queue.

3. The method according to claim 1, characterized in that The determining, according to the running time period of the first task and the running time period of the second task, whether the first task satisfies the second task adjustment condition includes: When the second task is a downstream task and there are multiple second tasks, determining the earliest running second task from the multiple second tasks according to the running time period of each of the multiple second tasks; Calculate a second difference between the task start time of the earliest running second task and the task end time of the first task; When the second difference is greater than or equal to a second preset value, it is determined that the first task meets a second task adjustment condition; wherein the target task queue is the second task queue.

4. The method according to claim 1, characterized in that: The method further comprises: Determine a designated task from the first task queue, and determine an associated task of the designated task from the second task queue, wherein the designated task refers to any task that has an associated task in the second task queue; When the running time period to which the designated task is to be updated conflicts with the running time period to which the associated task is to be updated, a first decrease ratio of a first resource contention degree of the running time period to which the designated task is to be updated compared to a second resource contention degree of the running time period in which the designated task is located, and a second decrease ratio of a third resource contention degree of the running time period to which the associated task is to be updated compared to a fourth resource contention degree of the running time period in which the associated task is located are calculated; When the first decrease ratio is less than the second decrease ratio, removing the designated task from the first task queue; When the first decrease ratio is greater than or equal to the second decrease ratio, the associated task is removed from the second task queue.

5. The method according to claim 1, characterized in that The method further comprises: Determine a resource contention level value of a running time period to which a third task in the third task queue is to be updated, the third task being any task included in the third task queue; When the resource contention level value of the running time period to which the third task is to be updated is greater than or equal to the resource contention level value of the running time period in which the third task is located, the third task is removed from the third task queue and scheduled according to the running time period in which the third task is located.

6. A task scheduling device, characterized in that: include: Add a processing module, used to determine the running time period of the first task and the running time period of the second task associated with the first task according to the task running log, the task running log includes the running information of each task in multiple tasks, and the running information includes the running time period of the task; according to the running time period of the first task and the running time period of the second task, judge whether the first task meets the second task adjustment condition; if the first task meets the second task adjustment condition, determine the first task as the target task to be adjusted, add the target task to the target task queue, and determine the running time period to which the target task is to be updated, the target task queue is the first task queue or the second task queue, the first task queue includes tasks to be run in advance, and the second task queue includes tasks to be delayed; A removal processing module is used to determine the historical resource contention degree value of the running time period where each task in the target task queue is located; determine the historical resource contention degree value of the running time period to which each task in the target task queue is to be updated; according to the historical resource contention degree value of the running time period where each task in the target task queue is located and the historical resource contention degree value of the running time period to which each task in the target task queue is to be updated, determine the tasks that do not meet the first task adjustment condition from the target task queue, and remove the tasks that do not meet the first task adjustment condition from the target task queue, so as to obtain the target task queue after removal processing; The scheduling module is used to merge the first task queue after the removal processing and the second task queue after the removal processing to obtain a third task queue, and for the tasks that have not been removed from the third task queue, schedule the tasks that have not been removed from the third task queue according to the running time period to which the tasks that have not been removed from the third task queue are intended to be updated.

7. A computer device, characterized in that: The method comprises a processor and a memory, wherein the processor and the memory are connected to each other, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 5.