Task execution method and device

By dividing tasks into subtasks and only executing unfinished subtasks during recovery, the problem of wasted computing resources when the Quartz framework handles interrupted tasks is solved and the efficiency of task processing is improved.

CN118779071APending Publication Date: 2024-10-15BEIJING GRIDSUM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310376980.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-04-10
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

When the Quartz framework processes tasks, tasks interrupted after system upgrades or hardware maintenance need to be re-executed, resulting in a waste of computing resources because already processed data needs to be recalculated.

Method used

Divide pending tasks into multiple subtasks with processing order, pause unfinished subtasks, and only execute unprocessed completed subtasks when resuming to avoid recalculating completed tasks.

Benefits of technology

This effectively avoids the waste of computing resources and improves task processing efficiency and resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118779071A_ABST
    Figure CN118779071A_ABST
Patent Text Reader

Abstract

The invention provides a task execution method and device, and relates to the technical field of computers. The task execution method comprises the steps of dividing a to-be-processed task by utilizing a preset rule to obtain a plurality of first tasks with a processing sequence, processing the plurality of first tasks according to the processing sequence, storing a processing result of the processed first tasks into a cache, and pausing the first tasks according to a received pause request. And determining the first task which does not store the processing result in the cache as a second task, pausing to process the second task, and executing the paused second task according to the received recovery request and the processing sequence. According to the technical scheme, the to-be-processed task is divided before task processing, one to-be-processed task is divided into the multiple sub-tasks, when the sub-tasks divided under the suspended to-be-processed task are executed again, all the sub-tasks under the suspended to-be-processed task are not executed, the suspended to-be-processed task does not need to be recalculated, and the task processing efficiency is improved. And waste of computing resources is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a task execution method and device. Background Art

[0002] In daily life and work, we will be involved in the processing of tasks. In order to process tasks quickly, we will choose to use computers to process tasks. For computer processing tasks, the Quartz framework is usually used to implement it. In the process of processing tasks through the Quartz framework, you may encounter situations where the system for processing tasks is upgraded, computer hardware is maintained and replaced, or urgent tasks need to be processed in advance. In the above cases, the tasks being processed will be interrupted. After the system for processing tasks is upgraded, the computer hardware is maintained and replaced, or the urgent tasks are processed, the interrupted tasks will be executed to ensure the smooth processing of the tasks.

[0003] The current method of executing interrupted tasks is: for tasks processed by the Quartz framework, when a task is interrupted, the interrupted task is marked, and when it needs to be executed again, the interrupted task with the mark is re-executed. However, among the interrupted tasks, there are tasks with more than half of the execution progress. These tasks need to be re-executed during the recovery process, which means that the previously processed data needs to be re-calculated, which will lead to a waste of computing resources. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a method and device for executing a task to solve the problem of wasting computing resources.

[0005] In order to solve the above technical problems, the embodiments of the present application provide the following technical solutions:

[0006] The first aspect of the present application provides a method for executing a task, the method comprising:

[0007] Dividing the tasks to be processed by using a preset rule to obtain a plurality of first tasks with a processing order;

[0008] Processing the plurality of first tasks in the processing order, and storing the processing results of the first tasks that have been processed into a cache;

[0009] According to the received suspension request, determining the first task whose processing result is not stored in the cache as the second task, and suspending the processing of the second task;

[0010] According to the received resumption request, the suspended second task is executed according to the processing order.

[0011] A second aspect of the present application provides a task execution device, the device comprising:

[0012] A division module, used for dividing the tasks to be processed by using a preset rule to obtain a plurality of first tasks with a processing order;

[0013] A storage module, configured to process the plurality of first tasks in the processing order, and store the processing results of the first tasks that have been processed into a cache;

[0014] a pause module, configured to determine, according to the received pause request, a first task whose processing result is not stored in the cache as a second task, and to pause processing of the second task;

[0015] An execution module is used to execute the suspended second task according to the processing order according to the received resumption request.

[0016] The third aspect of the present application provides an electronic device, which includes: at least one processor; and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the task execution method of the above-mentioned first aspect or any optional embodiment of the first aspect.

[0017] A fourth aspect of the present application provides a computer-readable storage medium, the storage medium including a stored program, wherein when the program is running, a method for executing a task of the first aspect or any optional embodiment of the first aspect is controlled to control the device where the storage medium is located.

[0018] Compared with the prior art, the task execution method and device provided in the present application can divide the task to be processed according to preset rules before task processing, and divide a task to be processed into multiple sub-tasks with a processing order. When the executing sub-task is suspended, the sub-task whose processing result is not stored in the cache, that is, the unprocessed sub-task is determined as the sub-task that needs to be suspended. When the suspended task is executed again, only the suspended unprocessed sub-task is executed in sequence according to the processing order, and there is no need to execute the processed sub-task again. That is to say, when the sub-task divided from the suspended task to be processed is executed again, it is not necessary to execute all the sub-tasks divided from the suspended task to be processed, that is, there is no need to recalculate the suspended task to be processed, thereby avoiding waste of computing resources.

[0019] The task execution device provided in the second aspect of the present application has the same beneficial effects as the task execution method provided in the first aspect of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] By reading the detailed description below with reference to the accompanying drawings, the above and other purposes, features and advantages of the exemplary embodiments of the present application will become easy to understand. In the accompanying drawings, several embodiments of the present application are shown in an exemplary and non-limiting manner, and the same or corresponding reference numerals represent the same or corresponding parts, wherein:

[0021] Figure 1 A flowchart schematically shows a method for executing a task;

[0022] Figure 2 A flowchart for dividing the tasks to be processed is schematically shown;

[0023] Figure 3 Schematically shows the structure of the task execution device Figure 1 ;

[0024] Figure 4 Schematically shows the structure of the task execution device Figure 2 ;

[0025] Figure 5 The structure diagram of an electronic device is schematically shown. DETAILED DESCRIPTION

[0026] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0027] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.

[0028] Regarding the execution of tasks, the prior art is to mark the interrupted tasks, and when it is necessary to execute the interrupted tasks again, the interrupted tasks with the marks are re-executed. Since the prior art needs to re-execute the tasks that have more than half of the execution progress in the interrupted tasks, it is necessary to re-execute, that is, the data that has been processed before must be recalculated, which will lead to a waste of computing resources. Therefore, the present invention takes into account that when executing the tasks, it is necessary to re-calculate the data that has been processed before, resulting in a waste of computing resources, and a method is needed to not re-calculate the data that has been processed before, replacing the method of re-calculating the data that has been processed before in the prior art. For this reason, the present invention chooses a method of not re-calculating the data that has been processed before, and divides the task into multiple subtasks before executing the suspended task. When the suspended task is executed again, only the unprocessed subtasks under this task are calculated, and it is not necessary to calculate the processed subtasks under this task, that is, the data that has been processed before is not recalculated, avoiding waste of resources. The main idea of ​​the present invention is to divide the task into multiple subtasks before executing the paused task. The task is equivalent to executing multiple subtasks. When the executing task is paused, it is equivalent to pausing multiple subtasks under the task. There are subtasks that have been processed and subtasks that have not been processed in the subtasks. It is only necessary to pause the unprocessed subtasks. When resuming the paused task, it is only necessary to execute the unprocessed subtasks, and it is not necessary to execute all the subtasks under the task, that is, there is no need to re-execute the task.

[0029] The method in the embodiment of the present invention is described in detail below.

[0030] Figure 1 A flowchart schematically shows a method for executing a task in an embodiment of the present invention, see Figure 1 As shown, the method may include:

[0031] S101. Divide the tasks to be processed by using a preset rule to obtain a plurality of first tasks with a processing order.

[0032] The execution subject of this application is the Quartz framework, the task to be processed can be an asynchronous task, and the first task is a subtask under the task to be processed.

[0033] Before processing a task, the task to be processed is divided into multiple subtasks using preset rules. The multiple subtasks divided have a processing order. When the task is subsequently processed, the multiple subtasks are processed in sequence according to this processing order.

[0034] Exemplarily, the task to be processed is task, and there are four first tasks after division, namely subTask1, subTask2, subTask3 and subTask4, and the processing order is to process subTask1 first, then subTask2, then subTask3, and finally subTask4.

[0035] S102: Process a plurality of first tasks in a processing order, and store processing results of the first tasks that have been processed into a cache.

[0036] Specifically, multiple first tasks are processed according to the processing order obtained by the division in step S101, and the processing results of the first tasks that have been processed are stored in the cache, while the processing results of the first tasks that have not been processed are not stored in the cache.

[0037] In order to facilitate the search for the first task that has been processed, the processing results of the first task that has been processed in the processing order need to be stored in the cache, and the first task that has been processed and the corresponding processing results can be stored in the cache according to the corresponding relationship. The first task that has been processed can be determined by searching the cache, and the first task that has not been processed can also be determined by searching the cache, and the first task that has not been stored in the cache is determined as the first task that has not been processed.

[0038] Continuing with the example of step S101, subTask1 is processed first, then subTask2, then subTask3, and finally subTask4 in the processing order. The first tasks that have been processed are subTask1 and subTask2, and the first tasks that have not been processed are subTask3 and subTask4. SubTask1 and subTask2 are stored in the cache.

[0039] S103 . According to the received pause request, determine the first task whose processing result is not stored in the cache as the second task, and pause the processing of the second task.

[0040] When using the Quartz framework to suspend tasks, you can only suspend pending tasks, that is, suspend all unfinished tasks under the pending tasks, that is, suspend all running tasks and queued tasks, but cannot suspend specific running tasks and queued tasks.

[0041] Specifically, the second task is a task that needs to be paused. When a pause request is received, the first task whose processing result is not stored in the cache, that is, the first task that has not been completed, needs to be determined as the task that needs to be paused. The uncompleted tasks include tasks being processed and tasks in the queue. In other words, the tasks being processed and tasks in the queue are determined as tasks that need to be paused, and the processing of the tasks being processed and tasks in the queue is suspended.

[0042] Continuing with the example of step S102, the first tasks whose processing results are not stored in the cache are subTask3 and subTask4, which are tasks that need to be suspended. When the suspension request a is received, subTask3 and subTask4 are suspended.

[0043] S104: Execute the suspended second task in a processing order according to the received resumption request.

[0044] Specifically, according to the received resumption request, the second task suspended in step S101 is executed according to the processing sequence obtained by division in step S101.

[0045] Continuing with the example of step S103 , the suspended tasks are subTask3 and subTask4 . When the resume request b is received, subTask3 and subTask4 are executed in sequence in the order of processing subTask3 first and processing subTask4 last.

[0046] Based on the above Figure 1 It can be seen from the implementation method that the embodiment of the present invention determines multiple subtasks by dividing the task to be processed, so that both suspension and resumption are for the subtasks under the task to be processed, so as to achieve the purpose of executing the suspended subtasks. Before the task to be processed is processed, the task to be processed can be divided into multiple subtasks. When the executing task to be processed is suspended, that is, when the executing subtask is suspended, it is only necessary to suspend the unprocessed subtasks. When resuming the suspended subtasks, it is only necessary to execute the unprocessed suspended subtasks, and there is no need to execute the processed subtasks. In other words, it is not necessary to recalculate all the subtasks divided by the task to be processed, so as to avoid waste of computing resources.

[0047] Furthermore, as a Figure 1In step S101, the tasks to be processed are divided by using preset rules to obtain the refinement and expansion of the operation methods of multiple first tasks with a processing order. The tasks to be processed are divided more finely by analyzing the execution steps. In this way, a task can be divided into multiple stage tasks. When the stage tasks in execution are subsequently suspended and resumed, it is only necessary to execute the stage tasks in execution among the multiple stage tasks after division, and it is not necessary to execute the processed stage tasks among the multiple stage tasks, so as not to waste execution resources. Figure 2 For a flowchart of dividing the tasks to be processed in the embodiment of this application, see Figure 2 As shown, the above step S102 may include:

[0048] Step S1021: Analyze the execution steps of the task to be processed.

[0049] The execution steps corresponding to different pending tasks are not the same, and the execution steps of each pending task need to be parsed.

[0050] Exemplarily, the task to be processed is task a, and the execution steps of parsing task a are step A, step B and step C.

[0051] Step S1022: split the task to be processed into multiple stage tasks according to the execution steps.

[0052] Among them, multiple stage tasks include at least first stage tasks, second stage tasks and third stage tasks. The processing results corresponding to the first stage tasks are used for processing the second stage tasks and / or the third stage tasks. The processing results of the second stage tasks are used for processing the third stage tasks. Each stage task includes at least one task, and at least one task is a first task.

[0053] Specifically, according to the execution steps analyzed in step S1021, the task to be processed is divided into multiple stage tasks.

[0054] The number of split stage tasks is the same as the number of execution steps. Since the splitting is carried out according to the execution steps, there is a sequence of execution between the execution steps. Therefore, there is also a sequence of execution between the multiple stage tasks after the splitting, and the processing results of the stage tasks executed first are used for the stage tasks executed later. Each stage task after the splitting includes one or more tasks. For a stage task including multiple tasks, multiple tasks in the stage task can be executed in parallel. For example, the stage task can be a task of filtering dashboard information. There are two tasks in the dashboard filtering task, namely, the task of filtering dashboard data information and the task of filtering dashboard image information. The task of filtering dashboard data information and the task of filtering dashboard image information can be executed in parallel.

[0055] Exemplarily, step A, step B and step C are used to split task a into three stage tasks, namely task a1, task a2 and task a3. The processing order of the three stage tasks is task a1, task a2 and task a3.

[0056] Furthermore, as a refinement and extension of the above-mentioned step S1022, it is necessary to determine the data to be processed and the processing method corresponding to different stages according to each execution step, and generate the stage tasks corresponding to each stage according to the data to be processed and the processing method. In this way, the different data to be processed and the processing method determined by each different step can be used to generate the stage tasks corresponding to each stage, making the divided tasks of each stage more accurate.

[0057] Specifically, the above step S1022 may include:

[0058] Step A1: Determine the data to be processed and the processing method corresponding to different stages according to each execution step.

[0059] The pending task may be a task for exporting data table information or a task for exporting dashboard information. The execution steps corresponding to the data table information export task may be a step for querying data table information, a step for combining data table information, and a step for exporting data table information. The execution steps corresponding to the dashboard information export task may be a step for obtaining dashboard information, a step for filtering dashboard information, a step for combining dashboard information, and a step for exporting dashboard information. There may be multiple pending tasks and execution steps corresponding to pending tasks, which are not limited here.

[0060] Exemplarily, when the task to be processed is the task of exporting dashboard information, according to the four execution steps of the dashboard information, it is necessary to determine the four different data to be processed and the processing methods corresponding to the four stages; specifically, according to the step of obtaining the dashboard information, it is determined that the data to be processed corresponding to this stage is all the data in the database, and the processing method is the acquisition processing method; according to the screening step of the dashboard information, it is determined that the data to be processed corresponding to this stage is the acquired dashboard information data, and the processing method is the screening processing method; according to the combination step of the dashboard information, it is determined that the data to be processed corresponding to this stage is the screened dashboard information data, and the processing method is the combination processing method; according to the export step of the dashboard information, it is determined that the data to be processed corresponding to this stage is the combined dashboard information data, and the processing method is the export processing method.

[0061] Exemplarily, when the task to be processed is an export task of data table information, it is necessary to determine three different data to be processed and processing methods corresponding to the three stages according to the three execution steps of the data table information; specifically, according to the query step of the data table information, it is determined that the data to be processed corresponding to this stage is all the data in the database, and the processing method is the query processing method; according to the combination step of the data table information, it is determined that the data to be processed corresponding to this stage is the queried data table information data, and the processing method is the combination processing method; according to the export step of the data table information, it is determined that the data to be processed corresponding to this stage is the combined data table information data, and the processing method is the export processing method.

[0062] Step A2: Generate the corresponding stage tasks for each stage according to the data to be processed and the processing method.

[0063] Specifically, the stage tasks corresponding to each stage are generated according to the data to be processed and the processing method determined in step A1.

[0064] Continuing with the example of step A1, the first stage task corresponding to this stage is generated based on all the data in the database and the acquisition processing method; the second stage task corresponding to this stage is generated based on the acquired dashboard information data and the filtering processing method; the third stage task corresponding to this stage is generated based on the filtered dashboard information data and the combined processing method; the fourth stage task corresponding to this stage is generated based on the combined dashboard information data and the export processing method.

[0065] Continuing with the example of step A1, the first stage task corresponding to this stage is generated based on all the data in the database and the query processing method; the second stage task corresponding to this stage is generated based on the queried data table information data and the combined processing method; the third stage task corresponding to this stage is generated based on the combined data table information data and the export processing method.

[0066] Furthermore, by determining the processing order of the first stage tasks, the second stage tasks and the third stage tasks in the division process, it is convenient to process the divided tasks or the tasks resumed after being suspended in this order, and there is no need to determine the processing order of the tasks again in the processing process of the divided tasks or the tasks resumed after being suspended, which can save the processing time of the tasks and improve the processing efficiency of the tasks. Specifically, after step A2 (generating the stage tasks corresponding to each stage according to the data to be processed and the processing method), it can also include:

[0067] Step A3: Determine the processing sequence corresponding to the first stage tasks as the first processing sequence.

[0068] Since there is a dependency relationship between the generated tasks at each stage, that is, the tasks at the next stage need to use the processing results of the tasks at the previous stage, the processing order needs to be determined for the generated tasks at each stage. The processing order corresponding to the generated first stage tasks is determined as the first processing order, which is the order that is processed first.

[0069] Following the example of step A2, the processing order corresponding to the first-stage tasks generated according to all the data in the database and the query processing method is determined as the order to be processed first.

[0070] Step A4: Determine the processing sequence corresponding to the second stage tasks as the second processing sequence.

[0071] The processing sequence corresponding to the generated second-stage tasks is determined as the second processing sequence, and the second processing sequence is the processing sequence after the first processing sequence.

[0072] Following the example of step A2, the processing order corresponding to the second-stage tasks generated according to the queried data table information data and the combined processing method is determined to be the processing order after the first processing order.

[0073] Step A5: Determine the processing sequence corresponding to the third stage tasks as the third processing sequence.

[0074] Among them, the priority of the first processing order is higher than the priority of the second processing order, and the priority of the second processing order is higher than the priority of the third processing order.

[0075] The processing sequence corresponding to the generated third-stage tasks is determined as the third processing sequence, and the third processing sequence is the processing sequence after the second processing sequence.

[0076] By determining the priorities of the first processing sequence, the second processing sequence and the third processing sequence, the first stage tasks, the second stage tasks and the third stage tasks are processed in sequence.

[0077] Following the example of step A2, the processing order corresponding to the third-stage tasks generated according to the combined data table information data and the export processing method is determined to be the processing order after the second processing order.

[0078] Furthermore, as a refinement and extension of the above step S102, tasks at each stage can be processed in a priority order, without having to determine the task processing order again during the processing process, which can save task processing time and improve task processing efficiency.

[0079] Specifically, the above step S102 may include:

[0080] Step B1: Process the first stage task and obtain the first processing result of the first stage task.

[0081] According to the determined processing order priorities of the first processing order, the second processing order and the third processing order, the first stage task is processed first to obtain the first processing result of the first stage task.

[0082] Following the example of step A3, the first stage task is queried and processed, and the processing result of the first stage task is the queried data table information data.

[0083] Step B2: Process the second stage task according to the first processing result to obtain a second processing result of the second stage task.

[0084] Specifically, according to the first processing result obtained in step B1, the second stage task is processed to obtain the second processing result of the second stage task.

[0085] Following the example of steps A4 and B1, the queried data table information data is combined to achieve the second stage task, and the processing result of the second stage task is the combined data table information data.

[0086] Step B3: Process the third stage task according to the first processing result and / or the second processing result.

[0087] Specifically, the third stage task is processed according to the first processing result obtained in step B1 and / or the second processing result in step B2.

[0088] Following the example of steps A5 and B1, the combined data table information data is exported to achieve the third stage of processing tasks.

[0089] Furthermore, as a refinement and extension of the above-mentioned step S103, the execution status of the second task being executed and the second task in the queue can be modified, and the second task can be paused according to the modified execution status. In this way, the task can be paused by searching for the modified execution status, and there is no need to click the pause button for each paused task one by one to pause it, thus saving pause time.

[0090] Specifically, the above step S103 may include:

[0091] Step C1: Determine the second task that can be paused according to the importance of the second task.

[0092] The execution state corresponding to the second task that can be paused is the first state.

[0093] In the process of processing tasks, when the latest urgent task needs to be processed urgently, the tasks being executed and the tasks in the queue need to be paused to give priority to the urgent tasks. When the tasks being executed and the tasks in the queue are paused, there may be tasks that cannot be paused, and the tasks that cannot be paused may be the tasks that need to be executed first.

[0094] When determining the second task that can be paused, it is necessary to determine the second task that can be paused according to the importance of the second task. A task with a small importance is a task that can be paused, while a task with a large importance is a task that cannot be paused.

[0095] Exemplarily, the tasks to be processed are Task 1 and Task 2, the unprocessed subtasks divided under Task 1 are Task 1a, Task 1b, and Task 1c, the unprocessed subtasks divided under Task 2 are Task 2a and Task 2b, Task 1 and Task 2 have the same importance, Task 1a has a high importance, Task 1b and Task 1c have a low importance, Task 2a has a high importance, and Task 2b has a low importance, it can be determined that the second tasks that can be suspended are Task 1b, Task 1c, and Task 2b.

[0096] Step C2: modify the first state to the second state, and suspend the processing of the second task that can be suspended according to the second state.

[0097] The second state is different from the first state, and the second state is used to determine the second task that is not executed due to suspension.

[0098] Specifically, the first state corresponding to the second task that can be paused determined in step C1 is modified to the second state, and the second task that can be paused is paused according to the second state.

[0099] The first execution state corresponding to the second task being executed and the second task in the queue that can be paused is modified to a second execution state different from the first execution state, and the second task being executed and the second task in the queue that can be paused are paused according to the second state.

[0100] The execution status of a task can be divided into an executing status, a queued status, an execution failure status, and an execution success status. The executing status of the second task being executed and the queued status of the second task in the queue can both be modified to an execution failure status, and the second task being executed and the second task in the queue that can be suspended can be suspended according to the execution failure status.

[0101] Following the example of step C1, the execution statuses corresponding to task 1b, task 1c, and task 2b are modified to execution failure status.

[0102] When resuming execution of the paused second task, the status of the subtasks under the paused task to be processed can be queried, and the subtasks with a status of failed execution can be queried. The failed execution status of the subtask can be modified to the corresponding executing status or queued status before the subtask was paused. The subtasks in the modified executing status or queued status can be executed in the processing order, and the processing results of the successfully executed subtasks can be stored in the cache. When all subtasks are successfully executed, the task created by the user is successfully executed.

[0103] For tasks that are resumed after being paused, only the paused subtasks that are being processed and queued need to be executed, and the subtasks that have been processed do not need to be executed. In other words, it is not necessary to execute all subtasks divided under the task to be processed, which can save the task execution time after the task is resumed.

[0104] Based on the same inventive concept, as an implementation of the above-mentioned task execution method, an embodiment of the present invention further provides a task execution device. Figure 3 The structure of the device in the embodiment of the present invention is Figure 1 , see Figure 3 As shown, the device may include:

[0105] A division module 301 is used to divide the tasks to be processed by using a preset rule to obtain a plurality of first tasks with a processing order;

[0106] A storage module 302, configured to process the plurality of first tasks obtained by the division module 301 according to the processing sequence obtained by the division module 301, and store the processing results of the first tasks that have been processed into a cache;

[0107] The pause module 303 is used to determine the first task whose processing result is not stored in the cache stored in the storage module 302 as the second task according to the received pause request, and suspend the processing of the second task;

[0108] The execution module 304 is used to execute the second task that is suspended determined by the suspension module 303 according to the processing sequence obtained by the division module 301 according to the received resumption request.

[0109] exist Figure 3 Based on the present invention, another embodiment of the device is provided, see Figure 4 As shown, Figure 4 The structure of the device in the embodiment of the present invention is Figure 2 , the device may include:

[0110] The division module 301 includes:

[0111] The parsing module 3011 is used to parse the execution steps of the task to be processed;

[0112] The splitting module 3012 is used to split the task to be processed into multiple stage tasks according to the execution steps parsed by the parsing module 3011, and the multiple stage tasks include at least a first stage task, a second stage task and a third stage task. The processing result corresponding to the first stage task is used for processing the second stage task and / or the third stage task, and the processing result of the second stage task is used for processing the third stage task. Each stage task includes at least one task, and the at least one task is the first task.

[0113] Furthermore, the splitting module 3012 includes:

[0114] The first determination module 30121 is used to determine the to-be-processed data and processing methods corresponding to different stages according to each execution step;

[0115] The generation module 30122 is used to generate the stage tasks corresponding to each stage according to the data to be processed and the processing method determined by the first determination module 30121.

[0116] Furthermore, the device also includes:

[0117] The second determining module 30123 is used to determine the processing sequence corresponding to the first stage task generated by the generating module 30122 as the first processing sequence after generating the stage tasks corresponding to each stage according to the data to be processed and the processing method;

[0118] The third determining module 30124 is used to determine the processing sequence corresponding to the second-stage tasks generated by the generating module 30122 as the second processing sequence;

[0119] The fourth determination module 30125 is used to determine the processing order corresponding to the third stage task generated by the generation module 30122 as the third processing order, the priority of the first processing order is higher than the priority of the second processing order, and the priority of the second processing order is higher than the priority of the third processing order.

[0120] Furthermore, the storage module 302 is specifically used to process the first stage task to obtain a first processing result of the first stage task; process the second stage task according to the first processing result to obtain a second processing result of the second stage task; and process the third stage task according to the first processing result and / or the second processing result.

[0121] Furthermore, the pause module 303 is specifically used to determine a second task that can be paused according to the importance of the second task, and the execution state corresponding to the second task that can be paused is the first state; modify the first state to the second state, and suspend the processing of the second task that can be paused according to the second state, the second state is different from the first state, and the second state is used to determine the second task that is not executed due to the pause.

[0122] Based on the same inventive concept, an embodiment of the present invention further provides an electronic device. Figure 5 is a structural diagram of an electronic device in an embodiment of the present invention, see Figure 5 As shown, the electronic device 50 may include: at least one processor 501; and at least one memory 502 and a bus 503 connected to the processor 501; wherein the processor 501 and the memory 502 communicate with each other via the bus 503; the processor 501 is used to call the program instructions in the memory 502 to execute the execution method of the tasks in one or more of the above-mentioned embodiments.

[0123] It should be noted that the description of the query request processing device embodiment is similar to the description of the method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the memory cleaning device embodiment of the present invention, please refer to the description of the method embodiment of the present invention for understanding.

[0124] Based on the same inventive concept, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is running, the device where the storage medium is located is controlled to execute the method in one or more of the above embodiments.

[0125] It should be noted here that the description of the above computer-readable storage medium embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the embodiment of the computer-readable storage medium of the embodiment of the present invention, please refer to the description of the method embodiment of the present invention for understanding.

[0126] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A method for executing a task, characterized in that: The method comprises: Dividing the tasks to be processed by using a preset rule to obtain a plurality of first tasks with a processing order; Processing the plurality of first tasks in the processing order, and storing the processing results of the first tasks that have been processed into a cache; According to the received suspension request, determining the first task whose processing result is not stored in the cache as the second task, and suspending the processing of the second task; According to the received resumption request, the suspended second task is executed according to the processing order.

2. The method according to claim 1, characterized in that: The method of dividing the tasks to be processed by using a preset rule to obtain a plurality of first tasks with a processing order includes: Analyze the execution steps of the task to be processed; According to the execution steps, the task to be processed is split into multiple stage tasks, and the multiple stage tasks include at least a first stage task, a second stage task and a third stage task. The processing result corresponding to the first stage task is used for processing the second stage task and / or the third stage task, and the processing result of the second stage task is used for processing the third stage task. Each stage task includes at least one task, and the at least one task is the first task.

3. The method according to claim 2, characterized in that According to the execution steps, the task to be processed is divided into multiple stage tasks, including: Determine the data to be processed and the processing method corresponding to different stages according to each execution step; Generate stage tasks corresponding to each stage according to the data to be processed and the processing method.

4. The method according to claim 3, characterized in that: After generating the stage tasks corresponding to each stage according to the data to be processed and the processing method, the method further includes: Determine the processing sequence corresponding to the tasks in the first stage as the first processing sequence; Determine the processing order corresponding to the second-stage tasks as the second processing order; The processing sequence corresponding to the third stage tasks is determined as the third processing sequence, the priority of the first processing sequence is higher than the priority of the second processing sequence, and the priority of the second processing sequence is higher than the priority of the third processing sequence.

5. The method according to claim 4, characterized in that The processing of the plurality of first tasks in the processing order includes: Processing the first-stage task to obtain a first processing result of the first-stage task; Process the second-stage task according to the first processing result to obtain a second processing result of the second-stage task; Process the third stage task according to the first processing result and / or the second processing result.

6. The method according to claim 1, characterized in that The suspending the processing of the second task comprises: Determine a second task that can be paused according to the importance of the second task, wherein the execution state corresponding to the second task that can be paused is the first state; The first state is modified into a second state, and the processing of the second task that can be paused is suspended according to the second state, where the second state is different from the first state, and the second state is used to determine the second task that is not executed due to the suspension.

7. A task execution device, characterized in that: The device comprises: A division module, used for dividing the tasks to be processed by using a preset rule to obtain a plurality of first tasks with a processing order; A storage module, configured to process the plurality of first tasks in the processing order, and store the processing results of the first tasks that have been processed into a cache; a pause module, configured to determine, according to the received pause request, a first task whose processing result is not stored in the cache as a second task, and to pause processing of the second task; An execution module is used to execute the suspended second task according to the processing order according to the received resumption request.

8. The device according to claim 7, characterized in that The division module comprises: A parsing module, used for parsing the execution steps of the task to be processed; A splitting module is used to split the task to be processed into multiple stage tasks according to the execution steps, and the multiple stage tasks include at least a first stage task, a second stage task and a third stage task. The processing result corresponding to the first stage task is used for processing the second stage task and / or the third stage task, and the processing result of the second stage task is used for processing the third stage task. Each stage task includes at least one task, and the at least one task is the first task.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and at least one memory and bus connected to the processor; The processor and the memory communicate with each other via the bus; the processor is used to call program instructions in the memory to execute the task execution method as described in any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: The storage medium includes a stored program, wherein when the program is executed, the device where the storage medium is located is controlled to execute the execution method of the task as described in any one of claims 1 to 6.