Batch task processing method and device

By adjusting the execution time of financial industry tasks based on the historical data allocation and sorting of batch tasks, the problem of uneven task distribution and unreasonable initial running time is solved, and balanced execution and efficient operation of tasks are achieved.

CN113326114BActive Publication Date: 2024-10-11WEBANK (CHINA)
View PDF 14 Cites 0 Cited by

Patent Information

Application Number
CN202110651629.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-11
Publication Date
2024-10-11
Estimated Expiration
2041-06-11

AI Technical Summary

Technical Problem

In the existing technology, when the financial industry adjusts the execution time of batch tasks, due to the different experience of operation and maintenance personnel, the task distribution is uneven, resulting in the preset queue running the task may be too idle or too busy, and the initial running time of the task The settings are unreasonable and affect the normal execution of tasks.

Method used

By assigning tasks to each preset queue based on the first historical average running time of batch tasks and the number of preset queues, and determining the target starting running time of the task based on the historical average starting running time and running time of the task, To reasonably adjust the order and time of task execution.

Benefits of technology

It achieves balanced distribution of tasks and reasonable execution time, avoids excessive idleness or busyness of the preset queue, and ensures normal operation and efficient execution of tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113326114B_ABST
    Figure CN113326114B_ABST
Patent Text Reader

Abstract

An embodiment of the present application provides a batch task processing method and device, which includes: based on the first historical average running time of each task in the batch task within a first time period and the number of preset queues, allocating the tasks to each preset queue so that each preset queue will not be too idle or too busy when running tasks; for any preset queue, according to the historical average starting running time of each task in the preset queue within the first time period and the first historical average running time, determining the target starting running time of each task in the preset queue, and based on the target starting running time, running the tasks in the preset queue in a more reasonable sequence, thereby reasonably adjusting the execution time of each task in the batch task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of financial technology (Fintech), and in particular, to a batch task processing method and device. Background Art

[0002] With the development of computer technology, more and more technologies are applied in the financial field. Traditional finance is gradually transforming into financial technology. However, due to the security and real-time requirements of the financial industry, higher requirements are also placed on technology. In the financial field, when adding batch tasks, it is necessary to configure the execution time of each task, and execute the corresponding task according to the configured execution time (that is, the starting running time of the task).

[0003] In the related art, during the task execution process, a new execution time is set based on the experience of the operation and maintenance personnel, and the new execution time is uploaded, thereby adjusting the task execution time. However, due to the different experiences of different operation and maintenance personnel, this processing method may lead to unreasonable new execution times. For example: the task distribution in each preset queue is uneven, resulting in some preset queues being too idle when running tasks, and some preset queues being too busy when running tasks; or the starting running time of each task in the preset queue is set unreasonably, some tasks need to be executed first but are queued behind the preset queue, and some tasks do not need to be executed first but are queued in front of the preset queue.

[0004] In summary, there is an urgent need for a batch task processing method to reasonably adjust the execution time of batch tasks. Summary of the invention

[0005] The embodiments of the present application provide a batch task processing method and device for reasonably adjusting the execution time of batch tasks.

[0006] In a first aspect, an embodiment of the present application provides a batch task processing method, the method comprising:

[0007] Allocate the tasks to the preset queues based on a first historical average running time of each task in the batch task within a first time period and the number of preset queues;

[0008] For any preset queue, the target starting running time of each task in the preset queue is determined according to the historical average starting running time of each task in the preset queue in the first time period and the first historical average running time, and the corresponding task is run based on the target starting running time.

[0009] In the above technical scheme, since the first historical average running time of the task represents the length of the running time of the task in the first time period, and reflects to a certain extent the time required for the subsequent running of the task, the tasks are allocated to each preset queue according to the first historical average running time and the number of preset queues, so that each preset queue will not be too idle or too busy when running the task; since the historical average starting running time of the task represents the order of the start running of the task in the first time period, and reflects to a certain extent the order of the subsequent start running of the task, the target starting running time of each task in the preset queue is determined according to the historical average starting running time of each task in the preset queue and the first historical average running time, and then the tasks in the preset queue are run in a more reasonable sequence, and the execution time of each task in the batch task is reasonably adjusted.

[0010] Optionally, based on a first historical average running time of each task in the batch task in the first time period and the number of preset queues, allocating the task to each preset queue includes:

[0011] sorting the tasks in the batch tasks from shortest to longest according to the first historical average running time;

[0012] Based on the sorting result, multiple batches of tasks of a preset number of queues are selected from the batch tasks, and the tasks are allocated to each of the preset queues;

[0013] If the ratio of the sum of the first historical average running time of all tasks in any preset queue to the target running time exceeds the preset ratio, the task will no longer be allocated to the preset queue; the target running time is determined based on the sum of the first historical average running time of all tasks in the batch tasks and the number of the preset queues.

[0014] In the above technical solution, by selecting tasks of a preset number of queues from batch tasks in multiple batches, the tasks can be evenly distributed to each preset queue according to the number; since when the sum of the first historical average running time of all tasks in the preset queue is large, the task will no longer be allocated to the preset queue, thereby ensuring the balance of the sum of the first historical average running time of all tasks in each preset queue, so that the sum of the first historical average running time of all tasks in each preset queue will not be too much or too little, further ensuring that each preset queue will not be too idle or too busy when running tasks.

[0015] Optionally, for any batch, selecting tasks of a preset number of queues from the batch tasks and allocating them to each of the preset queues includes:

[0016] Select tasks corresponding to the first historical average running time of the number of preset queues that are before the median value and adjacent to the median value, and allocate them to each of the preset queues in sequence; wherein the median value is the median value of the first historical average running time of the batch tasks;

[0017] Tasks corresponding to the first historical average running time of the number of preset queues that are after the median value and adjacent to the median value are selected, and are allocated to each of the preset queues in sequence.

[0018] In the above technical solution, by selecting tasks corresponding to the first historical average running time that is before the median value and adjacent to the median value, the selected tasks are allocated to each of the preset queues in order from long to short according to the first historical average running time; by selecting tasks corresponding to the first historical average running time of a number of preset queues that are after the median value and adjacent to the median value, the selected tasks are allocated to each of the preset queues in order from short to long according to the first historical average running time, so that each batch can distribute the tasks to each preset queue more evenly according to the first historical average running time.

[0019] Optionally, determining the target start running time of each task in the preset queue according to the historical average start running time of each task in the preset queue in the first time period and the first historical average running time includes:

[0020] If there is a target task in the preset queue, sort the target tasks in the preset queue from most to least according to the number of dependencies, wherein any target task is a task that is dependent on the execution of other tasks; sort the tasks in the preset queue except the target task after the target task, and sort the tasks except the target task from front to back according to the historical average start running time; or

[0021] If there is no target task in the preset queue, sort the tasks in the preset queue from front to back according to the historical average start running time;

[0022] The target starting running time of the next task is determined based on the target starting running time of the previous task in the preset queue and the first historical average running time, wherein the target starting running time of the first task in the preset queue is the corresponding historical average starting running time, or the preset starting running time.

[0023] In the above technical scheme, if there is a target task in the preset queue, the number of times the target task is relied upon represents how many other tasks are dependent on the target task. By placing the target tasks with more dependencies in front, the target tasks with more dependencies can be run first in the future, thereby ensuring the normal operation of more other tasks. Since tasks other than the target task do not affect the normal operation of other tasks, these tasks are placed after the target task. In addition, the historical average start running time of these tasks reflects the order of the subsequent start running of these tasks to a certain extent. Therefore, these tasks are sorted from front to back according to the historical average start running time. If there is no target task in the preset queue, the historical average start running time of each task represents the order of the start running of the task in the first period, and reflects the order of the subsequent start running of the task to a certain extent. Therefore, each task is sorted from front to back according to the historical average start running time. After the tasks in the preset queue are sorted, the order of running the tasks is determined. Since the first historical average running time of each task reflects the time required for the subsequent running of the task to a certain extent, the target starting running time of the next task is determined more reasonably based on the target starting running time of the previous task in the preset queue and the first historical average running time. By using the historical average starting running time of the first task in the preset queue, or the preset starting running time, as its target starting running time, it can be applied to the needs of different scenarios.

[0024] Optionally, before executing the corresponding task based on the target start running time, the method further includes:

[0025] Compare a first historical average running time of a task executed by a single thread with a second historical average running time in a second time period, where the second time period is a time period before the first time period;

[0026] If the increase of the first historical average running time compared to the second historical running time is greater than a preset increase, the task executed by the single thread is switched to multi-thread execution.

[0027] In the above technical solution, the second time period is the time period before the first time period. If the first historical average running time of the task executed by a single thread increases more than the second historical running time of the task executed by the single thread in the second time period than the preset increase, it means that the running time of the task executed by the single thread has increased significantly. By switching the task executed by a single thread to multi-threaded execution, the time required for subsequent execution of the task can be reduced.

[0028] Optionally, the method further comprises:

[0029] In response to the re-run instruction, based on the information of the preset representation mechanism corresponding to the re-run instruction, the task corresponding to the re-run instruction is executed.

[0030] In the above technical solution, when a rerun instruction is received, the information of the corresponding preset representation mechanism and the corresponding task can be determined, so that the corresponding task is executed based on the information of the corresponding preset representation mechanism, without the need to write a rerun code every time a task is rerun.

[0031] Optionally, running a corresponding task based on the target start running time includes:

[0032] For any task, if the task corresponds to dependency information, then after the target start running time of the task is reached, the target dependency rule corresponding to the task is determined based on a preset corresponding relationship; wherein the corresponding relationship includes an association between the preset dependency information and the dependency rule;

[0033] For any information of a preset representation mechanism, determine, according to the target dependency rule, whether to execute and complete a corresponding target task based on the information of the preset representation mechanism, wherein the corresponding target task is a task on which the execution of the task depends;

[0034] After determining that the corresponding target task is completed based on the information of the preset representation mechanism, the to-be-processed data corresponding to the information of the preset representation mechanism is processed according to the calculation information of the task.

[0035] In the above technical solution, by presetting the dependency rules in advance and presetting the corresponding relationship between the dependency information and the dependency rules, the corresponding dependency rules can be directly determined according to the dependency information of the task. In this way, when writing the calculation information of the task, there is no need to write the dependency rules corresponding to the task, which facilitates the management of the dependency rules.

[0036] In a second aspect, the embodiment of the present application further provides a batch task processing device, including:

[0037] A task allocation unit, configured to allocate the tasks to each of the preset queues based on a first historical average running time of each task in the batch task within a first time period and the number of preset queues;

[0038] The operation processing unit is used to determine the target starting running time of each task in any preset queue according to the historical average starting running time of each task in the preset queue within the first time period and the first historical average running time, and run the corresponding task based on the target starting running time.

[0039] In a third aspect, an embodiment of the present application provides a computing device, comprising at least one processor and at least one memory, wherein the memory stores a computer program, and when the program is executed by the processor, the processor executes any batch task processing method described in the first aspect.

[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program executable by a computing device, wherein when the program runs on the computing device, the computing device executes any batch task processing method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments 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.

[0042] Figure 1 A flowchart of a first batch task processing method provided in an embodiment of the present application;

[0043] Figure 2 A flowchart of a second batch task processing method provided in an embodiment of the present application;

[0044] Figure 3 A flowchart of a third batch task processing method provided in an embodiment of the present application;

[0045] Figure 4 A flowchart of a fourth batch task processing method provided in an embodiment of the present application;

[0046] Figure 5 A flowchart of a fifth batch task processing method provided in an embodiment of the present application;

[0047] Figure 6 A schematic diagram of the structure of a batch task processing device provided in an embodiment of the present application;

[0048] Figure 7 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than 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 the present application.

[0050] In the embodiments of the present application, the term "and / or" describes the association relationship of the associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0051] The terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "plurality" means two or more.

[0052] In the description of this application, unless otherwise clearly specified and limited, the term "connection" should be understood in a broad sense, for example, it can be directly connected, or indirectly connected through an intermediate medium, or it can be the internal connection of two devices. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to specific circumstances.

[0053] The term "execution time" refers to the start running time of a task. In some embodiments, "start running time" is directly used to refer to "execution time".

[0054] When adding batch tasks, you need to configure the execution time of each task, and execute the corresponding task according to the configured execution time. In the related technology, during the task execution process, a new execution time is set based on the experience of the operation and maintenance personnel, and the new execution time is uploaded to adjust the task execution time.

[0055] However, due to the different experiences of different operation and maintenance personnel, this processing method may lead to new problems of unreasonable execution time. For example, the task distribution in each preset queue is unbalanced, resulting in some preset queues being too idle when running tasks, and some preset queues being too busy when running tasks; or the starting running time of each task in the preset queue is set unreasonably, some tasks need to be executed first but are queued behind the preset queue, and some tasks do not need to be executed first but are queued in front of the preset queue.

[0056] In view of this, an embodiment of the present application proposes a batch task processing method and device, the method comprising: allocating the tasks to each preset queue based on the first historical average running time of each task in the batch task within the first time period and the number of preset queues; for any preset queue, determining the target starting running time of each task in the preset queue according to the historical average starting running time of each task in the preset queue within the first time period and the first historical average running time, and running the corresponding task based on the target starting running time.

[0057] Since the first historical average running time of the task represents the running time of the task in the first period, and reflects to a certain extent the time required for the subsequent running of the task, the task is allocated to each preset queue according to the first historical average running time and the number of preset queues, so that each preset queue will not be too idle or too busy when running the task; since the historical average starting running time of the task represents the order of the start running of the task in the first period, and reflects to a certain extent the order of the subsequent start running of the task, the target starting running time of each task in the preset queue is determined according to the historical average starting running time of each task in the preset queue and the first historical average running time, and then the tasks in the preset queue are run in a more reasonable sequence, and the execution time of each task in the batch task is reasonably adjusted.

[0058] The following will be combined with the accompanying drawings and specific embodiments to describe in detail the technical solution of the present application and how the technical solution of the present application solves the above technical problems. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.

[0059] The present application embodiment provides a first batch task processing method, such as Figure 1 As shown, the following steps are included:

[0060] Step S101: based on a first historical average running time of each task in a batch of tasks in a first time period and the number of preset queues, the tasks are allocated to each of the preset queues.

[0061] Since the first historical average running time of the task represents the running time of the task in the first period, it reflects to a certain extent the time required for the subsequent running of the task. Therefore, the tasks in each preset queue are determined according to the first historical average running time and the number of preset queues, so that each preset queue will not be too idle or too busy when running tasks.

[0062] The first period can be set according to the actual application scenario, such as a week before the current time. Correspondingly, the first historical average running time of any task is the average running time of the task every day in this week, such as: the first historical average running time of task 1 A 11 is the running time of Task 1 on the first day of this week, A 12 is the running time of Task 1 on the second day of the week, A 13 is the running time of Task 1 on the third day of this week, A 14 is the running time of Task 1 on the fourth day of this week, A 15 is the running time of Task 1 on the fifth day of this week, A 16 is the running time of Task 1 on the sixth day of this week, A 17 This is the running time of Task 1 on the seventh day of this week.

[0063] This embodiment does not limit the specific implementation method of determining the tasks in each preset queue. In some optional implementations, the tasks in the preset queue meet at least one of the following conditions:

[0064] 1) The ratio of the sum of the first historical average running time of all tasks in any preset queue to the target running time is less than the preset ratio; wherein the target running time is determined according to the sum of the first historical average running time of all tasks in the batch task and the number of the preset queues. For example, a batch task includes 100 tasks, there are 4 preset queues (respectively denoted as preset queue a, preset queue b, preset queue c and preset queue d), and the preset ratio is 1.25:

[0065] The sum of the first historical average running time of these 100 tasks is recorded as Target runtime The sum of the first historical average running time of all tasks in the preset queue a is recorded as A a , the sum of the first historical average running time of all tasks in the preset queue b is recorded as A b , the sum of the first historical average running time of all tasks in the preset queue c is recorded as A c , the sum of the first historical average running time of all tasks in the preset queue d is recorded as A d Among them, A a / A0<1.25,A b / A0<1.25,A c / A0<1.25,A d / A0<1.25.

[0066] Since the ratio of the sum of the first historical average running time of all tasks in each preset queue to the target running time is less than the above preset ratio, the sum of the first historical average running time of all tasks in each preset queue will not be too much or too little (such as the above A a , A b , A c and A d This further ensures that each preset queue will not be too idle or too busy when running tasks.

[0067] 2) The difference between the number of tasks in any two preset queues does not exceed the preset number difference. Taking the above four preset queues as an example, the preset number difference is 10:

[0068] The number of tasks in the preset queue a is recorded as B a , the number of tasks in the preset queue b is recorded as B b , the number of tasks in the preset queue c is recorded as B c , the number of tasks in the preset queue d is recorded as B d ; Among them, |B a -B b |<10,|B a -B c |<10,|B a -B d |<10,|B b -B c |<10,|B b -B d |<10,|B c -B d |<10.

[0069] Since the difference between the number of tasks in any two preset queues does not exceed the preset number difference, the number of tasks in each preset queue will not be too much or too little (such as B above). a , B b , B c and B d There will not be too big a difference between them), which ensures the balance of tasks in each preset queue.

[0070] It can be understood that the number of tasks in the above-mentioned batch tasks, the number of preset queues, the preset ratio and the preset number difference are only exemplary descriptions, and the specific values ​​of these parameters can be set according to the actual application scenario, and the present application is not limited thereto.

[0071] In order to make the tasks in the preset queues meet the above conditions, still taking the above batch task including 100 tasks and 4 preset queues as an example, the present application exemplarily provides the following two ways of determining the tasks in each preset queue:

[0072] Method 1:

[0073] The 100 tasks are sorted from short to long according to the first historical average running time, and are recorded as task 1, task 2, task 3, ..., task 99, and task 100 respectively; among which, the first historical average running time of task 1 is The first historical average running time of task 2 is The first historical average running time of task 3 is The first historical average running time of task 99 is The first historical average running time of task 100 is

[0074] Determine the median of the 100 first historical average run times From the 100 tasks, select the tasks corresponding to the four first historical average running times that are before the median value and adjacent to the median value (i.e., the above-mentioned tasks 50, 49, 48, and 47) as the tasks in the preset queue a, preset queue b, preset queue c, and preset queue d, respectively; and select the tasks corresponding to the four first historical average running times that are after the median value and adjacent to the median value (i.e., the above-mentioned tasks 51, 52, 53, and 54) as the tasks in the preset queue a, preset queue b, preset queue c, and preset queue d, respectively;

[0075] From the 92 tasks remaining after the above selection, select the tasks corresponding to the four first historical average running times before the median value and adjacent to the median value (i.e., the above-mentioned tasks 46, 45, 44, and 43), and use them as the tasks in the preset queue a, preset queue b, preset queue c, and preset queue d, respectively; and select the tasks corresponding to the four first historical average running times after the median value and adjacent to the median value (i.e., the above-mentioned tasks 55, 56, 57, and 58), and use them as the tasks in the preset queue a, preset queue b, preset queue c, and preset queue d, respectively;

[0076] After multiple selections, if the ratio of the sum of the first historical running time of tasks in a preset queue to the target running time reaches the preset ratio, the tasks in the preset queue will no longer be selected; if the ratio of the sum of the first historical running time of tasks in the above-mentioned preset queue b to the target running time reaches the preset ratio, from the remaining tasks, select the tasks corresponding to the three first historical average running times before the median value and adjacent to the median value, and use them as the tasks in the preset queue a, preset queue c, and preset queue d respectively; and select the tasks corresponding to the three first historical average running times after the median value and adjacent to the median value, and use them as the tasks in the preset queue a, preset queue c, and preset queue d respectively, until the preset queues for the 100 tasks are determined.

[0077] Method 2:

[0078] The 100 tasks are sorted from short to long according to the first historical average running time, and are recorded as task 1, task 2, task 3, ..., task 99, and task 100 respectively; among which, the first historical average running time of task 1 is The first historical average running time of task 2 is The first historical average running time of task 3 is The first historical average running time of task 99 is The first historical average running time of task 100 is

[0079] According to the sorting results, four tasks (i.e., the above-mentioned task 1, task 2, task 3, and task 4) are selected in turn as tasks in preset queue a, preset queue b, preset queue c, and preset queue d, respectively;

[0080] From the remaining 96 tasks after the first selection, four tasks (i.e., the above-mentioned tasks 5, 6, 7, and 8) are selected in sequence as tasks in preset queue d, preset queue c, preset queue b, and preset queue a, respectively;

[0081] From the remaining 92 tasks after the second selection, four tasks (i.e., the above-mentioned tasks 9, 10, 11, and 12) are selected in sequence as tasks in the preset queue a, preset queue b, preset queue c, and preset queue d, respectively;

[0082] After multiple selections, if the ratio of the sum of the first historical running time of tasks in a preset queue to the target running time reaches the preset ratio, the tasks in the preset queue will no longer be selected; if the ratio of the sum of the first historical running time of tasks in the above-mentioned preset queue a to the target running time reaches the preset ratio, 3 tasks will be selected from the remaining tasks in turn, as the tasks in preset queue b, preset queue c and preset queue d, until the preset queues for the 100 tasks are determined.

[0083] The above-mentioned method 1 and method 2 both sort the batch tasks from short to long according to the first historical average running time. In some embodiments, the batch tasks can also be sorted from long to short according to the first historical average running time. The method for determining the tasks in each preset queue can refer to the above-mentioned method 1 and method 2, which will not be repeated here.

[0084] In addition, this embodiment does not limit the method of triggering the execution of S101, which can be triggered based on user instructions; or triggered at fixed intervals, that is, the batch task processing method is executed once every cycle, such as executing the batch task processing method once in the early morning every day to determine the target starting running time of each task in that day.

[0085] Step S102: For any preset queue, determine the target start running time of each task in the preset queue according to the historical average start running time of each task in the preset queue in the first time period and the first historical average running time, and run the corresponding task based on the target start running time.

[0086] Since the historical average start running time of the task represents the order in which the task started running in the first period, it reflects to a certain extent the order in which the task will start running subsequently. Therefore, the target start running time of each task in the preset queue is determined based on the historical average start running time of each task in the preset queue and the first historical average running time, and the tasks in the preset queue are run in a more reasonable order.

[0087] As mentioned above, the first period can be set according to the actual application scenario. Taking the week before the current time as an example, the historical average start running time of any task is the average of the start running time of the task every day in this week. For example, the historical average start running time of task 1 is C 11 The time when Task 1 starts running on the first day of this week, C 12 The time when Task 1 starts running on the second day of the week, C 13 The time when Task 1 starts running on the third day of this week, C 14 The time when Task 1 starts running on the fourth day of this week, C15 The time when Task 1 starts running on the fifth day of this week, C 16 is the time when Task 1 starts running on the sixth day of this week. 17 The time to start running Task 1 on the seventh day of this week.

[0088] Exemplarily, the device executing the above method will load batch tasks one by one into Quartz (an open source job scheduling framework) at startup, and manage them through Spring (an open source container framework). After determining the target start running time of each task in the above preset queue, update it to the task configuration table; by configuring a monitoring task separately to read the unloaded effective task configuration information (target start running time) in the task configuration table at regular intervals, after reading the corresponding task configuration information, first check whether the task has been executed (the task has been executed according to the historical start running time) or is being executed (the task is being executed according to the historical start running time). If it has been executed or is being executed, there is no need to execute the task again according to the target start running time; if it has not been executed, update the trigger of the task according to the target start running time and reload it into the device, so as to adjust the execution time of the batch task in a timely and dynamic manner.

[0089] In the above technical scheme, since the first historical average running time of the task represents the length of the running time of the task in the first time period, and reflects to a certain extent the time required for the subsequent running of the task, the tasks in each preset queue are determined according to the first historical average running time and the number of preset queues, so that each preset queue will not be too idle or too busy when running the task; since the historical average starting running time of the task represents the order of the start running of the task in the first time period, and reflects to a certain extent the order of the subsequent start running of the task, the target starting running time of each task in the preset queue is determined according to the historical average starting running time of each task in the preset queue and the first historical average running time, and the tasks in the preset queue are run in a more reasonable sequence, so as to reasonably adjust the execution time (i.e., the starting running time) of each task in the batch task.

[0090] For the case where there is a target task in the preset queue (the target task is a task that other tasks need to depend on to execute), the embodiment of the present application provides a second batch task processing method, such as Figure 2 As shown, the following steps are included:

[0091] Step S201: based on a first historical average running time of each task in a batch of tasks in a first time period and the number of preset queues, the tasks are allocated to each of the preset queues.

[0092] The specific implementation method of step S201 can refer to the above step S101, which will not be repeated here.

[0093] Step S202: for any preset queue, if there is a target task in the preset queue, sort the target tasks in the preset queue from most to least according to the number of dependencies.

[0094] In this embodiment, if there is a target task in the preset queue, the number of times the target task is dependent represents how many other tasks depend on the target task. By arranging the target tasks with a large number of dependencies to the front, the target tasks with a large number of dependencies can be run first subsequently, thereby ensuring the normal operation of more other tasks.

[0095] Exemplarily, there are 5 target tasks in the preset queue a (respectively recorded as target task 1, target task 2, target task 3, target task 4 and target task 5), among which target task 1 is dependent on 5 times, target task 2 is dependent on 3 times, target task 3 is dependent on 1 times, target task 4 is dependent on 6 times, and target task 5 is dependent on 2 times. The sorting results of these 5 target tasks are: target task 4, target task 1, target task 2, target task 5, target task 3.

[0096] The target tasks in the above-mentioned preset queue a and the number of times each target task is dependent are only exemplary descriptions, and the present application is not limited thereto.

[0097] In some specific embodiments, some target tasks in the preset queue are dependent on the same number of times. In this case, the target tasks with the same number of dependencies can be randomly sorted; or the target tasks with the same number of dependencies can be sorted from front to back according to the historical average starting running time.

[0098] Step S203: arranging the tasks in the preset queue except the target task after the target task, and sorting the tasks except the target task from front to back according to the historical average start running time.

[0099] Since tasks other than the target task do not affect the normal operation of other tasks, these tasks are placed after the target task. In addition, the historical average start running time of these tasks reflects, to a certain extent, the order of subsequent start running of these tasks. Therefore, these tasks can be sorted from front to back according to the historical average start running time.

[0100] Let's take the above preset queue a as an example:

[0101] In addition to the above five target tasks, there are seven other tasks in the preset queue a (respectively recorded as ordinary task 1, ordinary task 2, ordinary task 3, ordinary task 4, ordinary task 5, ordinary task 6 and ordinary task 7). Among them, these seven tasks are, from front to back according to the historical average starting running time: ordinary task 2, ordinary task 7, ordinary task 6, ordinary task 1, ordinary task 4, ordinary task 5, ordinary task 3.

[0102] The sorting results of all tasks in the preset queue a are: target task 4, target task 1, target task 2, target task 5, target task 3, ordinary task 2, ordinary task 7, ordinary task 6, ordinary task 1, ordinary task 4, ordinary task 5, ordinary task 3.

[0103] The tasks in the above-mentioned preset queue a, the number of times the target task is dependent, and the historical average start running time are only exemplary descriptions, and the present application is not limited thereto.

[0104] Step S204: Determine the target starting running time of the next task based on the target starting running time of the previous task in the preset queue and the first historical average running time, wherein the target starting running time of the first task in the preset queue is the corresponding historical average starting running time, or the preset starting running time.

[0105] After the tasks in the preset queue are sorted, the order of running the tasks is determined. Since the first historical average running time of each task reflects to a certain extent the time required for subsequent running of the task, the target starting running time of the next task can be determined more reasonably based on the target starting running time of the previous task in the preset queue and the first historical average running time.

[0106] This embodiment does not limit the specific implementation method of determining the target starting running time of the next task based on the target starting running time of the previous task in the preset queue and the first historical average running time. For example, the time corresponding to the first historical average running time after the target starting running time of the previous task can be used as the target starting running time for determining the next task.

[0107] Step S205: running the corresponding task based on the target start running time.

[0108] In the above technical scheme, if there is a target task in the preset queue, the number of times the target task is relied on represents how many other tasks are dependent on the target task. By arranging the target tasks with more reliance on the target tasks to the front, the target tasks with more reliance on the target tasks can be run first in the future, thereby ensuring the normal operation of more other tasks; since the tasks other than the target task do not affect the normal operation of other tasks, these tasks are arranged after the target task. In addition, the historical average start running time of these tasks reflects the order of the subsequent start running of these tasks to a certain extent. Therefore, these tasks are sorted from front to back according to the historical average start running time. After the tasks in the preset queue are sorted, the order of running each task is determined. Since the first historical average running time of the task reflects the required time for the subsequent running of the task to a certain extent, the target start running time of the next task is determined more reasonably according to the target start running time of the previous task in the preset queue and the first historical average running time. By taking the historical average start running time of the first task in the preset queue, or the preset start running time, as its target start running time, it is suitable for the needs of different scenarios.

[0109] In view of the situation that there is no target task in the preset queue, the embodiment of the present application provides a third batch task processing method, such as Figure 3 As shown, the following steps are included:

[0110] Step S301: based on a first historical average running time of each task in the batch task within a first time period and the number of preset queues, the tasks are allocated to each of the preset queues.

[0111] Step S302: If there is no target task in the preset queue, the tasks in the preset queue are sorted from front to back according to the historical average start running time.

[0112] Step S303: Determine the target starting running time of the next task based on the target starting running time of the previous task in the preset queue and the first historical average running time, wherein the target starting running time of the first task in the preset queue is the corresponding historical average starting running time, or the preset starting running time.

[0113] Step S304: running the corresponding task based on the target start running time.

[0114] The specific implementation of steps S301 - 304 may refer to the above embodiments and will not be described again here.

[0115] In the above technical solution, if there is no target task in the preset queue, the historical average start running time of the task represents the order of the start running of the task in the first period, and reflects the order of the subsequent start running of the task to a certain extent. Therefore, each task is sorted from front to back according to the historical average start running time. After the tasks in the preset queue are sorted, the order of running each task is determined. Since the first historical average running time of each task reflects the time required for the subsequent running of the task to a certain extent, the target start running time of the next task is determined more reasonably based on the target start running time of the previous task in the preset queue and the first historical average running time. By using the historical average start running time of the first task in the preset queue, or the preset start running time, as its target start running time, it can be adapted to the needs of different scenarios.

[0116] The present application embodiment provides a fourth batch task processing method, such as Figure 4 As shown, the following steps are included:

[0117] Step S401: based on a first historical average running time of each task in the batch task within a first time period and the number of preset queues, the tasks are allocated to each of the preset queues.

[0118] The specific implementation of step S401 can refer to the above embodiment and will not be described again here.

[0119] Step S402: Compare a first historical average running time of a task executed by a single thread with a second historical average running time in a second time period, where the second time period is a time period before the first time period.

[0120] In implementation, the second time period is the time period before the first time period, the second time period may be the same as or different from the first time period, and the second time period may be one or more. If there are multiple second time periods, the first historical average running time of the task executed by a single thread needs to be compared with the second historical average running time of the task executed by the single thread in each second time period.

[0121] Still taking the first period as a week before the current time as an example, the second period may include at least one of the following:

[0122] 1) The week before the current time, e.g., if the current time is the early morning of the third Wednesday in May, the first period is from the early morning of the second Wednesday in May to the early morning of the third Wednesday in May; the second period is from the early morning of the first Wednesday in May to the early morning of the second Wednesday in May.

[0123] 2) One week starting from one month before the current time. For example, if the current time is the early morning of the third Wednesday in May, the first period is from the early morning of the second Wednesday in May to the early morning of the third Wednesday in May; the second period is from the early morning of the second Wednesday in April to the early morning of the third Wednesday in April.

[0124] The above second time periods are only exemplary, and the number of second time periods and specific second time periods can be set according to actual application scenarios.

[0125] Step S403: If the increase of the first historical average running time compared to the second historical running time is greater than a preset increase, the task executed in a single thread is switched to executed in multiple threads.

[0126] As described above, if there are multiple second time periods, the first historical average running time of the task executed by a single thread needs to be compared with the second historical average running time of the task executed by the single thread in each second time period. In implementation, if the first historical average running time is satisfied, and the increase in the second historical running time in part or all of the second time periods is greater than the preset increase, the corresponding single-threaded task is switched to multi-threaded execution.

[0127] The first historical average running time of the task executed by a single thread, compared to the increase in the second historical running time of the task executed by the single thread in the second time period, reflects how much the running time of the task executed by the single thread has increased. If the increase in the first historical average running time of the task executed by a single thread, compared to the second historical running time of the task executed by the single thread in the second time period, is greater than a preset increase, it indicates that the running time of the task executed by the single thread has increased significantly.

[0128] If the above-mentioned single-threaded task can be executed by multiple threads, in order to avoid the time required for subsequent execution of the task continuing to be too long, the single-threaded task can be switched to multi-threaded execution to reduce the time required for subsequent execution of the task.

[0129] Step S404: For any preset queue, determine the target start running time of each task in the preset queue according to the historical average start running time of each task in the preset queue in the first time period and the first historical average running time, and run the corresponding task based on the target start running time.

[0130] In the above technical solution, the second time period is the time period before the first time period. If the first historical average running time of the task executed by a single thread increases more than the second historical running time of the task executed by the single thread in the second time period than the preset increase, it means that the running time of the task executed by the single thread has increased significantly. By switching the task executed by a single thread to multi-threaded execution, the time required for subsequent execution of the task can be reduced.

[0131] The present application embodiment provides a fifth batch task processing method, such as Figure 5 As shown, the following steps are included:

[0132] Step S501: based on a first historical average running time of each task in a batch of tasks in a first time period and the number of preset queues, the tasks are allocated to each of the preset queues.

[0133] Step S502: for any preset queue, determine the target start running time of each task in the preset queue according to the historical average start running time of each task in the preset queue in the first time period and the first historical average running time.

[0134] The specific implementation of steps S501 - 502 may refer to the above embodiments and will not be described again here.

[0135] Step S503: for any task, after the target start running time of the task is reached, the task is executed in sequence based on the information of each preset representation mechanism.

[0136] In order to share development and maintenance costs, multi-tenant architecture is widely used in the financial field. Multi-tenant architecture is to share the same system or program components in a multi-tenant (institution) environment, and can ensure the isolation of data between institutions. In some embodiments, when adding a batch task, it is necessary to configure the institution information corresponding to the task, determine the institution corresponding to the task when executing the task, and execute the task based on the corresponding institution. However, developers may forget to configure the institution information corresponding to some tasks in the batch task, so that data isolation between different institutions cannot be guaranteed.

[0137] Based on this, this embodiment presets the relevant information representing the mechanism in advance in the device executing the above method, so that when developers write the calculation information of the task, they do not need to write the mechanism information corresponding to the task, and there will be no problem of missing the mechanism information corresponding to some tasks.

[0138] Exemplarily, a task base class F is implemented in the device for executing the batch task processing method, and an abstract method M is provided for scheduling tasks of specific mechanisms, and all tasks inherit the task base class F. When executing any task, it is scheduled to the unified entrance of the above-mentioned task base class F; after entering this entrance, first traverse the relevant information of all preset representation mechanisms, and then call the N method of the interface I in the M method based on the information of each preset representation mechanism in turn, so as to execute the corresponding task (the data to be processed corresponding to the information of the preset representation mechanism is calculated through the calculation information of the task to obtain the calculation data).

[0139] As mentioned above, the execution of some tasks depends on the target task. For any information of the preset representation mechanism, the task can be executed in the following ways:

[0140] For any task, if the task corresponds to dependency information, then after the target start running time of the task is reached, the target dependency rule corresponding to the task is determined based on a preset corresponding relationship; wherein the corresponding relationship includes an association between the preset dependency information and the dependency rule;

[0141] For any information of a preset representation mechanism, determine, according to the target dependency rule, whether to execute and complete a corresponding target task based on the information of the preset representation mechanism, wherein the corresponding target task is a task on which the execution of the task depends;

[0142] After determining that the corresponding target task is completed based on the information of the preset representation mechanism, the to-be-processed data corresponding to the information of the preset representation mechanism is processed according to the calculation information of the task.

[0143] Exemplarily, the variable attributes of interface I are defined in the task (i.e., the calculation information of the task, taking task 1 as an example). When processing a single organization (taking organization A as an example), it will be dispatched to the base class S (i.e., based on the information of each preset representation organization in turn, the N method of interface I is called in the M method). Through the base class S, it is first determined whether there is dependency information corresponding to task 1. If there is dependency information, the target dependency rule corresponding to task 1 is determined according to the preset corresponding relationship (the association between the preset dependency information and the dependency rule) (in implementation, multiple dependency rules can be preset, such as the dependency of batch tasks of the same type, the dependency of file transfer tasks between organizations, the dependency of internal data synchronization tasks, etc.); the starting running time of the target task is obtained according to the target dependency rule, and then it is determined whether the corresponding target task is completed based on the above-mentioned organization A. If the corresponding target task is completed based on the above-mentioned organization A, the corresponding data to be processed corresponding to organization A (the data to be processed includes the calculation result obtained based on the completion of the above-mentioned target task by organization A) is processed according to the calculation information of task 1 to obtain the calculation result obtained based on the execution of task 1 by organization A.

[0144] By presetting dependency rules in advance and presetting the corresponding relationship between dependency information and dependency rules, the corresponding dependency rules can be directly determined according to the dependency information of the task. In this way, when developers write the calculation information of the task, they do not need to write the dependency rules corresponding to the task, which facilitates the management of dependency rules.

[0145] In the above technical solution, the multi-tenant architecture needs to isolate the data of different organizations. By presetting the relevant information representing the organization in advance, developers do not need to write the organization information corresponding to the task when writing the calculation information of the task. After the target start running time of the task is reached, the task is executed in turn based on the information of each preset organization, thus realizing the data isolation of different organizations. This avoids the inability to execute the task based on the organization dimension due to the developer's omission of the organization information corresponding to the task, which affects the data isolation of different organizations.

[0146] In addition, when performing a task based on the information of a preset characterization mechanism, an error may occur, and at this time, it is necessary to perform the task again based on the information of the preset characterization mechanism (i.e., task rerun). In some embodiments, it is necessary for developers to write a rerun code each time a task is rerun, so that the device for executing the above method performs the task again based on the information of the preset characterization mechanism according to the rerun code. However, it is relatively cumbersome to write a rerun code each time a task is rerun, and it is easy to write an erroneous rerun code.

[0147] Based on this, in some optional implementation manners, the above method further includes:

[0148] In response to the re-run instruction, based on the information of the preset representation mechanism corresponding to the re-run instruction, the task corresponding to the re-run instruction is executed.

[0149] The specific implementation method of executing the task corresponding to the re-run instruction is similar to the above step S503. The only difference is that for the re-run instruction, the corresponding task does not need to be executed based on the target starting running time, nor does it need to be executed based on the information of each preset characterization mechanism in turn. Instead, the task corresponding to the re-run instruction is executed based on the information of the preset characterization mechanism corresponding to the re-run instruction, which will not be repeated here.

[0150] In the above technical solution, when a rerun instruction is received, the information of the corresponding preset representation mechanism and the corresponding task can be determined, so that the corresponding task is executed based on the information of the corresponding preset representation mechanism, without the need to write a rerun code every time a task is rerun.

[0151] Based on the same inventive concept, the present application embodiment provides a batch task processing device, see Figure 6 As shown, the batch task processing device 600 includes:

[0152] The task allocation unit 601 is used to allocate the tasks to each of the preset queues based on the first historical average running time of each task in the batch task within the first time period and the number of preset queues;

[0153] The operation processing unit 602 is used to determine the target start running time of each task in any preset queue according to the historical average start running time of each task in the preset queue within the first time period and the first historical average running time, and run the corresponding task based on the target start running time.

[0154] Optionally, the task allocating unit 601 is specifically configured to:

[0155] sorting the tasks in the batch tasks from shortest to longest according to the first historical average running time;

[0156] Based on the sorting result, multiple batches of tasks of a preset number of queues are selected from the batch tasks, and the tasks are allocated to each of the preset queues;

[0157] If the ratio of the sum of the first historical average running time of all tasks in any preset queue to the target running time exceeds the preset ratio, the task will no longer be allocated to the preset queue; the target running time is determined based on the sum of the first historical average running time of all tasks in the batch tasks and the number of the preset queues.

[0158] Optionally, the task allocating unit 601 is specifically configured to:

[0159] Select tasks corresponding to the first historical average running time of the number of preset queues that are before the median value and adjacent to the median value, and allocate them to each of the preset queues in sequence; wherein the median value is the median value of the first historical average running time of the batch tasks;

[0160] Tasks corresponding to the first historical average running time of the number of preset queues that are after the median value and adjacent to the median value are selected, and are allocated to each of the preset queues in sequence.

[0161] Optionally, the operation processing unit 602 is specifically configured to:

[0162] If there is a target task in the preset queue, sort the target tasks in the preset queue from most to least according to the number of dependencies, wherein any target task is a task that is dependent on the execution of other tasks; sort the tasks in the preset queue except the target task after the target task, and sort the tasks except the target task from front to back according to the historical average start running time; or

[0163] If there is no target task in the preset queue, sort the tasks in the preset queue from front to back according to the historical average start running time;

[0164] The target starting running time of the next task is determined based on the target starting running time of the previous task in the preset queue and the first historical average running time, wherein the target starting running time of the first task in the preset queue is the corresponding historical average starting running time, or the preset starting running time.

[0165] Optionally, before running the corresponding task based on the target start running time, the running processing unit 602 is further configured to:

[0166] Compare a first historical average running time of a task executed by a single thread with a second historical average running time in a second time period, where the second time period is a time period before the first time period;

[0167] If the increase of the first historical average running time compared to the second historical running time is greater than a preset increase, the task executed by the single thread is switched to multi-thread execution.

[0168] Optionally, the operation processing unit 602 is further configured to:

[0169] In response to the re-run instruction, based on the information of the preset representation mechanism corresponding to the re-run instruction, the task corresponding to the re-run instruction is executed.

[0170] Optionally, the operation processing unit 602 is specifically configured to:

[0171] For any task, if the task corresponds to dependency information, then after the target start running time of the task is reached, the target dependency rule corresponding to the task is determined based on a preset corresponding relationship; wherein the corresponding relationship includes an association between the preset dependency information and the dependency rule;

[0172] For any information of a preset representation mechanism, determine, according to the target dependency rule, whether to execute and complete a corresponding target task based on the information of the preset representation mechanism, wherein the corresponding target task is a task on which the execution of the task depends;

[0173] After determining that the corresponding target task is completed based on the information of the preset representation mechanism, the to-be-processed data corresponding to the information of the preset representation mechanism is processed according to the calculation information of the task.

[0174] Since the device is the device in the method in the embodiment of the present application, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0175] Based on the same technical concept, the present application embodiment also provides a computing device 700, such as Figure 7 As shown, it includes at least one processor 701 and a memory 702 connected to the at least one processor. The specific connection medium between the processor 701 and the memory 702 is not limited in the embodiment of the present application. Figure 7 For example, the processor 701 and the memory 702 are connected via a bus 703. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0176] Among them, the processor 701 is the control center of the computing device, and can use various interfaces and lines to connect various parts of the computing device, and realize data processing by running or executing instructions stored in the memory 702 and calling data stored in the memory 702. Optionally, the processor 701 may include one or more processing units, and the processor 701 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes the issuance of instructions. It is understandable that the above-mentioned modem processor may not be integrated into the processor 701. In some embodiments, the processor 701 and the memory 702 may be implemented on the same chip, and in some embodiments, they may also be implemented separately on independent chips.

[0177] Processor 701 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit (ASIC), a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the method disclosed in the batch task processing method embodiment can be directly embodied as a hardware processor execution, or a combination of hardware and software modules in the processor.

[0178] The memory 702 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 702 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 702 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 702 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, for storing program instructions and / or data.

[0179] In the embodiment of the present application, the memory 702 stores a computer program. When the program is executed by the processor 701, the processor 701 executes:

[0180] Allocate the tasks to the preset queues based on a first historical average running time of each task in the batch task within a first time period and the number of preset queues;

[0181] For any preset queue, the target starting running time of each task in the preset queue is determined according to the historical average starting running time of each task in the preset queue in the first time period and the first historical average running time, and the corresponding task is run based on the target starting running time.

[0182] Optionally, the processor 701 specifically performs:

[0183] sorting the tasks in the batch tasks from shortest to longest according to the first historical average running time;

[0184] Based on the sorting result, multiple batches of tasks of a preset number of queues are selected from the batch tasks, and the tasks are allocated to each of the preset queues;

[0185] If the ratio of the sum of the first historical average running time of all tasks in any preset queue to the target running time exceeds the preset ratio, the task will no longer be allocated to the preset queue; the target running time is determined based on the sum of the first historical average running time of all tasks in the batch tasks and the number of the preset queues.

[0186] Optionally, the processor 701 specifically performs:

[0187] Select tasks corresponding to the first historical average running time of the number of preset queues that are before the median value and adjacent to the median value, and allocate them to each of the preset queues in sequence; wherein the median value is the median value of the first historical average running time of the batch tasks;

[0188] Tasks corresponding to the first historical average running time of the number of preset queues that are after the median value and adjacent to the median value are selected, and are allocated to each of the preset queues in sequence.

[0189] Optionally, the processor 701 specifically performs:

[0190] If there is a target task in the preset queue, sort the target tasks in the preset queue from most to least according to the number of dependencies, wherein any target task is a task that is dependent on the execution of other tasks; sort the tasks in the preset queue except the target task after the target task, and sort the tasks except the target task from front to back according to the historical average start running time; or

[0191] If there is no target task in the preset queue, sort the tasks in the preset queue from front to back according to the historical average start running time;

[0192] The target starting running time of the next task is determined based on the target starting running time of the previous task in the preset queue and the first historical average running time, wherein the target starting running time of the first task in the preset queue is the corresponding historical average starting running time, or the preset starting running time.

[0193] Optionally, before running the corresponding task based on the target start running time, the processor 701 further executes:

[0194] Compare a first historical average running time of a task executed by a single thread with a second historical average running time in a second time period, where the second time period is a time period before the first time period;

[0195] If the increase of the first historical average running time compared to the second historical running time is greater than a preset increase, the task executed by the single thread is switched to multi-thread execution.

[0196] Optionally, the processor 701 further executes:

[0197] In response to the re-run instruction, based on the information of the preset representation mechanism corresponding to the re-run instruction, the task corresponding to the re-run instruction is executed.

[0198] Optionally, the processor 701 specifically performs:

[0199] For any task, if the task corresponds to dependency information, then after the target start running time of the task is reached, the target dependency rule corresponding to the task is determined based on a preset corresponding relationship; wherein the corresponding relationship includes an association between the preset dependency information and the dependency rule;

[0200] For any information of a preset representation mechanism, determine, according to the target dependency rule, whether to execute and complete a corresponding target task based on the information of the preset representation mechanism, wherein the corresponding target task is a task on which the execution of the task depends;

[0201] After determining that the corresponding target task is completed based on the information of the preset representation mechanism, the to-be-processed data corresponding to the information of the preset representation mechanism is processed according to the calculation information of the task.

[0202] Since the computing device is the computing device in the method in the embodiment of the present application, and the principle of solving the problem by the computing device is similar to that of the method, the implementation of the computing device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0203] Based on the same technical concept, an embodiment of the present application also provides a computer-readable storage medium, which stores a computer program that can be executed by a computing device. When the program runs on the computing device, the computing device executes the steps of the above-mentioned batch task processing method.

[0204] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0205] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0206] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0207] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0208] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0209] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A batch task processing method, characterized in that: The method includes: Based on the first historical average running time of each task in the batch task in the first time period and the number of preset queues, the tasks are allocated to each of the preset queues: the tasks in the batch task are sorted from short to long according to the first historical average running time; based on the sorting result, multiple batches of tasks of the preset number of queues are selected from the batch task and allocated to each of the preset queues; if the ratio of the sum of the first historical average running time of all tasks in any preset queue to the target running time exceeds the preset ratio, the task will no longer be allocated to the preset queue; the target running time is determined according to the ratio of the sum of the first historical average running time of all tasks in the batch task and the number of the preset queues; For any preset queue, the target starting running time of each task in the preset queue is determined according to the historical average starting running time of each task in the preset queue in the first time period and the first historical average running time, and the corresponding task is run based on the target starting running time.

2. The method according to claim 1, characterized in that For any batch, tasks of a preset number of queues are selected from the batch tasks and allocated to each of the preset queues, including: Select tasks corresponding to the first historical average running time of the number of preset queues that are before the median value and adjacent to the median value, and allocate them to each of the preset queues in sequence; wherein the median value is the median value of the first historical average running time of the batch tasks; Tasks corresponding to the first historical average running time of the number of preset queues that are after the median value and adjacent to the median value are selected, and are allocated to each of the preset queues in sequence.

3. The method according to claim 1, characterized in that Determining a target starting running time of each task in the preset queue according to the historical average starting running time of each task in the preset queue in the first time period and the first historical average running time includes: If there is a target task in the preset queue, sort the target tasks in the preset queue from most to least according to the number of dependencies, wherein any target task is a task that is dependent on the execution of other tasks; sort the tasks in the preset queue except the target task after the target task, and sort the tasks except the target task from front to back according to the historical average start running time; or If there is no target task in the preset queue, sort the tasks in the preset queue from front to back according to the historical average start running time; The target starting running time of the next task is determined based on the target starting running time of the previous task in the preset queue and the first historical average running time, wherein the target starting running time of the first task in the preset queue is the corresponding historical average starting running time, or the preset starting running time.

4. The method according to claim 1, characterized in that Before running the corresponding task based on the target start running time, the method further includes: Compare a first historical average running time of a task executed by a single thread with a second historical average running time in a second time period, where the second time period is a time period before the first time period; If the increase of the first historical average running time compared to the second historical average running time is greater than a preset increase, the task executed by the single thread is switched to multi-thread execution.

5. The method according to claim 1, characterized in that The method further comprises: In response to the re-run instruction, based on the information of the preset representation mechanism corresponding to the re-run instruction, the task corresponding to the re-run instruction is executed.

6. The method according to claim 1, characterized in that Based on the target start running time, running a corresponding task includes: For any task, if the task corresponds to dependency information, then after the target start running time of the task is reached, the target dependency rule corresponding to the task is determined based on a preset corresponding relationship; wherein the corresponding relationship includes an association between the preset dependency information and the dependency rule; For any information of a preset representation mechanism, determine, according to the target dependency rule, whether to execute and complete a corresponding target task based on the information of the preset representation mechanism, wherein the corresponding target task is a task on which the execution of the task depends; After determining that the corresponding target task is completed based on the information of the preset representation mechanism, the to-be-processed data corresponding to the information of the preset representation mechanism is processed according to the calculation information of the task.

7. A batch task processing device, characterized in that: include: A task allocation unit, configured to allocate the tasks to each of the preset queues based on a first historical average running time of each task in the batch task within a first time period and the number of preset queues; The task allocation unit is specifically used to: sort the tasks in the batch tasks from short to long according to the first historical average running time; based on the sorting result, select tasks of a preset number of queues from the batch tasks in multiple batches and allocate them to each of the preset queues; If the ratio of the sum of the first historical average running time of all tasks in any preset queue to the target running time exceeds a preset ratio, the task will no longer be allocated to the preset queue; the target running time is determined according to the ratio of the sum of the first historical average running time of all tasks in the batch task and the number of the preset queues; The operation processing unit is used to determine the target starting running time of each task in any preset queue according to the historical average starting running time of each task in the preset queue within the first time period and the first historical average running time, and run the corresponding task based on the target starting running time.

8. A computing device, characterized in that The method comprises at least one processor and at least one memory, wherein the memory stores a computer program, and when the program is executed by the processor, the processor executes the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: It stores a computer program executable by a computing device, and when the program is run on the computing device, the computing device executes the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Task allocation method, task allocation device and electronic equipment

    CN106339802A

  • Method and device for automatically configuring data warehouse parallel task queues

    CN107315627A

  • Request allocation method and device

    CN107704322A

  • Intelligent task scheduling method and device, equipment and storage medium

    CN110096345A

  • Big data task scheduling management method, device and apparatus and storage medium

    CN111125444A