Task processing method and device, computer device and storage medium

CN116204291BActive Publication Date: 2026-09-04KINGDEE SOFTWARE(CHINA) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310139451.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-02
Publication Date
2026-09-04
Estimated Expiration
2043-02-02

AI Technical Summary

Technical Problem

然而,现有的任务处理方式需要频繁调用资源执行任务,比如,分步执行任务时需要多次调用数据库,任务处理耗时长,从而导致了任务处理效率低的问题

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116204291B_ABST
    Figure CN116204291B_ABST
Patent Text Reader

Abstract

The application relates to a task processing method and device and a computer device. The method comprises the following steps: obtaining a service request, the service request comprising various to-be-executed subtasks and corresponding task execution information; determining a delayed execution subtask set and a batch execution subtask set from the various to-be-executed subtasks based on a dependency relationship; obtaining a resource type corresponding to each batch execution subtask, and classifying each batch execution subtask to obtain various category subtask sets; generating batch task execution instructions corresponding to each category subtask set based on the task execution information, and performing task execution to obtain batch task execution results corresponding to each category subtask set; performing each delayed execution subtask in the delayed execution subtask set to obtain delayed task execution results; and obtaining an execution result of the service request based on the batch task execution results and the delayed task execution results. The method can improve the task processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a task processing method, apparatus, computer equipment, storage medium, and computer program product. Background Technology

[0002] With the development of random computing technology, computers are becoming increasingly efficient at processing data tasks. Current task processing methods break down data tasks into smaller processing units for step-by-step processing. However, these methods require frequent resource calls to execute tasks; for example, step-by-step task execution may require multiple database calls, resulting in long processing times and low overall efficiency. Summary of the Invention

[0003] Therefore, it is necessary to provide a task processing method, apparatus, computer equipment, computer-readable storage medium, and computer program product that can improve task processing efficiency in response to the above-mentioned technical problems.

[0004] Firstly, this application provides a task processing method. The method includes:

[0005] Obtain the business request, which includes each subtask to be executed and the corresponding task execution information;

[0006] Based on the task execution information, determine the dependencies of each subtask to be executed, and based on the dependencies, determine the set of delayed execution subtasks and the set of batch execution subtasks from each subtask to be executed;

[0007] Obtain the resource type corresponding to each batch execution subtask in the batch execution subtask set, classify each batch execution subtask based on the resource type, and obtain subtask sets of each category;

[0008] Based on the task execution information corresponding to each category of sub-task set, generate batch task execution instructions for each category of sub-task set, execute tasks based on batch task execution instructions, and obtain batch task execution results for each category of sub-task set.

[0009] Based on the batch task execution results, each delayed subtask in the delayed execution subtask set is executed to obtain the delayed task execution results;

[0010] The execution results of the business request are obtained based on the results of batch task execution and delayed task execution.

[0011] Secondly, this application also provides a task processing apparatus. The apparatus includes:

[0012] The acquisition module is used to acquire business requests, which include various subtasks to be executed and their corresponding task execution information.

[0013] The determination module is used to determine the dependencies of each subtask to be executed based on the task execution information, and to determine the set of delayed execution subtasks and the set of batch execution subtasks from each subtask to be executed based on the dependencies;

[0014] The classification module is used to obtain the resource type corresponding to each batch execution subtask in the batch execution subtask set, and classify each batch execution subtask based on the resource type to obtain subtask sets of each category;

[0015] The batch execution module is used to generate batch task execution instructions for each category of sub-task set based on the task execution information of each category of sub-task set, execute tasks based on the batch task execution instructions, and obtain the batch task execution results for each category of sub-task set.

[0016] The delayed execution module is used to execute each delayed execution subtask in the delayed execution subtask set based on the batch task execution results, and obtain the delayed task execution results;

[0017] The results module is used to obtain the execution results of business requests based on the results of batch task execution and delayed task execution.

[0018] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:

[0019] Obtain the business request, which includes each subtask to be executed and the corresponding task execution information;

[0020] Based on the task execution information, determine the dependencies of each subtask to be executed, and based on the dependencies, determine the set of delayed execution subtasks and the set of batch execution subtasks from each subtask to be executed;

[0021] Obtain the resource type corresponding to each batch execution subtask in the batch execution subtask set, classify each batch execution subtask based on the resource type, and obtain subtask sets of each category;

[0022] Based on the task execution information corresponding to each category of sub-task set, generate batch task execution instructions for each category of sub-task set, execute tasks based on batch task execution instructions, and obtain batch task execution results for each category of sub-task set.

[0023] Based on the batch task execution results, each delayed subtask in the delayed execution subtask set is executed to obtain the delayed task execution results;

[0024] The execution results of the business request are obtained based on the results of batch task execution and delayed task execution.

[0025] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:

[0026] Obtain the business request, which includes each subtask to be executed and the corresponding task execution information;

[0027] Based on the task execution information, determine the dependencies of each subtask to be executed, and based on the dependencies, determine the set of delayed execution subtasks and the set of batch execution subtasks from each subtask to be executed;

[0028] Obtain the resource type corresponding to each batch execution subtask in the batch execution subtask set, classify each batch execution subtask based on the resource type, and obtain subtask sets of each category;

[0029] Based on the task execution information corresponding to each category of sub-task set, generate batch task execution instructions for each category of sub-task set, execute tasks based on batch task execution instructions, and obtain batch task execution results for each category of sub-task set.

[0030] Based on the batch task execution results, each delayed subtask in the delayed execution subtask set is executed to obtain the delayed task execution results;

[0031] The execution results of the business request are obtained based on the results of batch task execution and delayed task execution.

[0032] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the following steps:

[0033] Obtain the business request, which includes each subtask to be executed and the corresponding task execution information;

[0034] Based on the task execution information, determine the dependencies of each subtask to be executed, and based on the dependencies, determine the set of delayed execution subtasks and the set of batch execution subtasks from each subtask to be executed;

[0035] Obtain the resource type corresponding to each batch execution subtask in the batch execution subtask set, classify each batch execution subtask based on the resource type, and obtain subtask sets of each category;

[0036] Based on the task execution information corresponding to each category of sub-task set, generate batch task execution instructions for each category of sub-task set, execute tasks based on batch task execution instructions, and obtain batch task execution results for each category of sub-task set.

[0037] Based on the batch task execution results, each delayed subtask in the delayed execution subtask set is executed to obtain the delayed task execution results;

[0038] The execution results of the business request are obtained based on the results of batch task execution and delayed task execution.

[0039] The aforementioned task processing method, apparatus, computer equipment, storage medium, and computer program product ensure the execution order of dependent subtasks by identifying delayed execution subtasks and batch execution subtasks within each set of subtasks to be executed. Then, based on the resource types corresponding to each batch execution subtask, sets of subtasks of various categories are obtained. Batch task execution instructions corresponding to each category of subtasks are generated based on the task execution information for that category. Executing these batch task execution instructions allows for the simultaneous batch execution of subtasks within each category, quickly yielding the batch task execution results for each category, thereby improving the execution efficiency of tasks with different resource types. Finally, each delayed execution subtask is executed to obtain delayed task execution results. Based on the batch task execution results and the delayed task execution results, the execution result of the business request is obtained, further improving task processing efficiency. Attached Figure Description

[0040] Figure 1 This is an application environment diagram of a task processing method in one embodiment;

[0041] Figure 2 This is a flowchart illustrating a task processing method in one embodiment;

[0042] Figure 3 This is a flowchart illustrating the processing of tasks that depend on execution in one embodiment;

[0043] Figure 4 This is a schematic diagram of task processing in one embodiment;

[0044] Figure 5 This is a structural block diagram of a task processing device in one embodiment;

[0045] Figure 6 This is an internal structural diagram of a computer device in one embodiment;

[0046] Figure 7 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0047] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0048] The task processing method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal 102 communicates with server 104 via a network. Server 104 can obtain the service request sent by terminal 102 through the network. The service request includes various sub-tasks to be executed and corresponding task execution information. Server 104 determines the dependencies of each sub-task to be executed based on the task execution information, and determines a set of delayed execution sub-tasks and a set of batch execution sub-tasks from the sub-tasks to be executed based on the dependencies. Server 104 obtains the resource types corresponding to each batch execution sub-task in the batch execution sub-task set, and classifies each batch execution sub-task based on the resource types to obtain sub-task sets of each category. Server 104 generates batch task execution instructions corresponding to each category of sub-task set based on the task execution information corresponding to each category of sub-task set, and performs task execution based on the batch task execution instructions to obtain batch task execution results corresponding to each category of sub-task set. Server 104 executes each delayed execution sub-task in the delayed execution sub-task set based on the batch task execution results to obtain delayed task execution results. Server 104 obtains the execution result of the service request based on the batch task execution results and the delayed task execution results, and then sends the execution result to terminal 102 corresponding to the service request. The terminal 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can include smart speakers, smart TVs, smart air conditioners, and smart in-vehicle systems. Portable wearable devices can include smartwatches, smart bracelets, and head-mounted devices. The server 104 can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0049] In one embodiment, such as Figure 2 As shown, a task processing method is provided. This embodiment illustrates the method applied to a server. It is understood that this method can also be applied to a terminal, or to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0050] Step 202: Obtain the business request, which includes each subtask to be executed and the corresponding task execution information.

[0051] Here, a business request refers to a request submitted by the user client to perform a task. A subtask to be executed refers to a pre-divided subtask corresponding to the business request, awaiting execution. Task execution information is used to instruct the subtasks to be executed to proceed with task processing.

[0052] Specifically, the server receives a business request sent by the requesting client. The business request includes at least three subtasks to be executed and corresponding task execution information for each subtask. Upon receiving a business request, the server can generate a corresponding business request identifier and associate each subtask to be executed with that identifier. Alternatively, the server can generate task identifiers for each subtask based on the business request identifier and associate these identifiers with the corresponding task identifiers. This allows the server to determine the corresponding subtask based on the business request identifier and process it when it subsequently receives at least one business request.

[0053] Step 204: Determine the dependencies of each subtask to be executed based on the task execution information, and determine the set of delayed execution subtasks and the set of batch execution subtasks from each subtask to be executed based on the dependencies.

[0054] In this context, dependency refers to the task execution relationship where the execution of the current task depends on the execution result of a preceding task. Delayed execution subtasks are subtasks that need to be executed later. Batch execution subtasks are subtasks that need to be executed in batches.

[0055] Specifically, the task execution information for each subtask to be executed also includes task invocation information. Task invocation information refers to pre-defined information indicating whether a subtask depends on any task during its execution; that is, whether the subtask needs to invoke the execution result of a task corresponding to that task. The server can determine whether a subtask has dependent subtasks based on the task invocation information. When a subtask has dependent subtasks, the subtask that depends on the execution result of the already executed task is designated as a delayed execution subtask, meaning the dependent subtask needs to be executed beforehand. The server iterates through the task invocation information corresponding to each subtask, designating those that depend on the execution result of the already executed task as delayed execution subtasks, thus obtaining a set of delayed execution subtasks. Subtasks that do not depend on the execution result of the already executed task are designated as batch execution subtasks, thus obtaining a set of batch execution subtasks.

[0056] Step 206: Obtain the resource type corresponding to each batch execution subtask in the batch execution subtask set, and classify each batch execution subtask based on the resource type to obtain subtask sets of each category.

[0057] Step 208: Generate batch task execution instructions for each category of sub-task set based on the task execution information for each category of sub-task set, execute the tasks based on the batch task execution instructions, and obtain the batch task execution results for each category of sub-task set.

[0058] Here, "resource type" refers to the type of resources required for processing each batch execution subtask. "Category subtask set" refers to a collection of batch execution subtasks with the same resource type. "Batch task execution instruction" refers to the execution instructions for each batch execution category subtask set. "Batch task execution result" refers to the task execution result corresponding to each category subtask set.

[0059] Specifically, the server obtains the resource types corresponding to each pre-defined batch execution subtask, and classifies the batch execution subtasks according to the resource types to obtain subtask sets of each category. The server then obtains the task execution information corresponding to each batch of subtasks to be executed in each category, and merges the parameters of the task execution information for each batch of subtasks to be executed in each category to obtain the batch task execution instructions corresponding to each category. The server determines the resources corresponding to each category of subtask based on the resource types, and uses the resources corresponding to each category of subtask to execute the batch task execution instructions corresponding to each category, obtaining the batch task execution results for each category of subtask.

[0060] Step 210: Execute each delayed subtask in the delayed execution subtask set based on the batch task execution results to obtain the delayed task execution results.

[0061] The result of delayed task execution refers to the execution result of the delayed subtask.

[0062] Specifically, the server obtains the resource types corresponding to each delayed subtask in the delayed subtask set, and determines the resources corresponding to each delayed subtask based on the resource types. The server determines the dependent subtasks based on the task invocation field of each delayed subtask, and obtains the task execution results of the dependent subtasks from the batch task execution results. The server uses the task execution results of the dependent subtasks and invokes the resources corresponding to each delayed subtask to execute each delayed subtask, thus obtaining the delayed task execution results for each delayed subtask.

[0063] Step 212: Obtain the execution result of the business request based on the batch task execution result and the delayed task execution result.

[0064] Specifically, the server obtains the batch task execution results corresponding to each category of subtask set and the delayed task execution results corresponding to each delayed execution subtask, and uses the batch task execution results and delayed task execution results as the execution results corresponding to the business request. The server can then return the execution results corresponding to the business request to the requesting client.

[0065] In the above task processing method, by identifying the delayed execution subtasks and batch execution subtasks within each set of subtasks to be executed, the execution order of dependent subtasks is guaranteed. Then, based on the resource types corresponding to each batch execution subtask, sets of subtasks of various categories are obtained. Batch task execution instructions corresponding to each category of subtasks are generated based on the task execution information for that category. Executing these batch task execution instructions allows for the simultaneous batch execution of subtasks within each category, quickly yielding the batch task execution results for each category, thereby improving the execution efficiency of tasks with different resource types. Finally, each delayed execution subtask is executed to obtain delayed task execution results. Based on the batch task execution results and the delayed task execution results, the execution result of the business request is obtained, further improving task processing efficiency.

[0066] In one embodiment, step 204, determining the set of delayed-execution subtasks and the set of batch-execution subtasks from the various subtasks to be executed based on dependencies, includes:

[0067] Based on dependencies, determine the dependent execution subtask set and the non-dependent execution subtask set in each subtask to be executed. The dependent execution subtask set includes the priority execution subtask set and the deferred execution subtask set.

[0068] Prioritize the execution of subtask sets and execute non-dependent subtask sets as batch execution subtask sets.

[0069] The dependent execution subtask set refers to the set of subtasks to be executed that have dependencies on each other, and the set of subtasks to be executed that they depend on. The non-dependent execution subtask set refers to the set of subtasks to be executed that do not depend on the execution results of already executed tasks. The priority execution subtask set refers to the set of subtasks to be executed that require priority execution, and may be a set of subtasks to be executed that are dependent on it. The deferred execution subtask set may be a set of subtasks to be executed that depend on the execution results of already executed tasks.

[0070] Specifically, the server iterates through the task invocation fields corresponding to each subtask to be executed, dividing the set of subtasks into dependent subtask sets and non-dependent subtask sets. Task invocation information can be in the form of fields, i.e., task invocation fields. The server iterates through the task invocation fields corresponding to each subtask to be executed, and identifies the subtasks whose task invocation fields are task identifiers and the subtasks corresponding to those task identifiers as dependent execution subtask sets. The subtasks whose task invocation fields are task identifiers are designated as delayed execution subtasks, and the subtasks corresponding to those task identifiers are designated as priority execution subtasks, indicating that the execution of delayed execution subtasks depends on the execution result of priority execution subtasks. Then, the subtasks whose task invocation fields are empty and not dependent on any task identifier are designated as non-dependent execution subtask sets.

[0071] The server then extracts the priority execution subtasks and the delayed execution subtasks from the dependent execution subtask set, and combines the priority execution subtasks with the unexecuted subtasks from the non-dependent execution subtask set to form a batch execution subtask set. The server then obtains the delayed execution subtask set and the batch execution subtask set corresponding to the business request.

[0072] In one specific embodiment, the delayed execution subtask in the dependent execution subtask set could be "statistics on the grades of each class in the grade," and the priority execution subtask corresponding to the delayed execution subtask could be "statistics on the student grades of class 1," "statistics on the student grades of class 2," etc. The individual subtasks to be executed in the non-dependent execution subtask set could be "statistics on the total score of student A in class 1," "statistics on the total score of student B in class 1," "statistics on the total score of each student A in class 2," "statistics on the total score of each student B in class 2," etc.

[0073] The batch execution subtask set includes a non-dependent execution subtask set and a deferred execution subtask set. There can be an execution order among the batch execution subtasks within the set. This execution order can be the execution order among batch execution subtasks of the same resource type. For example, the execution order of the batch execution subtasks corresponding to the database resource, such as "Calculate the total score of student A in class 1", "Calculate the total score of student B in class 1", "Calculate the total score of all students A in class 2", and "Calculate the total score of all students B in class 2", takes precedence over the batch execution subtasks "Calculate the student grades in class 1" and "Calculate the student grades in class 2". The execution order of the batch execution subtasks corresponding to the database resource could also be, for example, "Get student ID 'a' of student A in class 1" → "Get the scores for each subject corresponding to student ID 'a'" → "Calculate the sum of the scores for each subject corresponding to student ID 'a'" → "Get the total score corresponding to student ID 'a'".

[0074] After the server executes the batch of subtasks and obtains the batch task execution results, it checks whether there are any delayed execution subtasks. If they exist, the delayed execution subtasks are executed; otherwise, the batch task execution results are used as the execution results corresponding to the business request. For example, if the delayed execution subtask is "to calculate the grades of each class in the grade," the server retrieves the task execution results corresponding to each batch of subtasks to be executed, such as "to calculate the student grades of class 1" and "to calculate the student grades of class 2," from the database. Then, it executes the delayed execution subtask "to calculate the grades of each class in the grade" according to the task execution information, thus obtaining the delayed task execution result for "to calculate the grades of each class in the grade."

[0075] In this embodiment, by determining the dependent execution subtask set and the non-dependent execution subtask set in each subtask to be executed according to the dependency relationship, the dependent execution subtask set is executed sequentially according to the dependency relationship, which satisfies the task execution logic of the dependent execution subtask set and thus ensures the accuracy of task execution.

[0076] In one embodiment, such as Figure 3 The diagram illustrates a process flow chart for task execution. The task processing method also includes:

[0077] Step 302: Based on dependencies, determine the priority execution subtask set and the target batch execution subtask set from each subtask to be executed. The target batch execution subtask set includes the delayed execution subtask set and the non-dependent execution subtask set.

[0078] Step 304: Execute each priority subtask in the priority subtask set to obtain the priority task execution results;

[0079] Step 306: Obtain the resource type corresponding to each target batch execution subtask in the target batch execution subtask set, and classify each target batch execution subtask based on the resource type to obtain the target category subtask set;

[0080] Step 308: Generate target batch task execution instructions for each target category sub-task set based on the task execution information for each target category sub-task set; execute tasks based on the target batch task execution instructions and priority task execution results to obtain target batch task execution results for each target category sub-task set.

[0081] Step 310: Obtain the execution result of the business request based on the execution results of the priority task and the execution results of the target batch task.

[0082] Among them, the target batch execution subtasks refer to the individual subtasks to be executed in the target batch execution subtask set, which can be the subtasks to be executed in the delayed execution subtask set or the non-dependent execution subtask set.

[0083] Specifically, the server iterates through the task call information corresponding to each set of subtasks to be executed, obtains the task identifiers from the task call information, and designates the subtasks to be executed corresponding to the task identifiers as priority subtasks. When multiple task identifiers are obtained, a set of priority subtasks is obtained. After determining the priority subtasks among the various subtasks to be executed, the server uses the remaining subtasks to be executed as the target set of batch-executed subtasks. Alternatively, the server can determine the dependent and independent subtask sets among the various subtasks to be executed based on the task call information, extract the priority subtask set from the dependent subtask set, and then use each delayed subtask and independent subtask set in the dependent subtask set as the target set of batch-executed subtasks.

[0084] The server then executes each priority subtask in the priority execution subtask set, obtaining the execution results of the priority tasks. The server retrieves the resource types corresponding to each target batch execution subtask in the target batch execution subtask set, and categorizes the target batch execution subtasks according to resource types, obtaining subtask sets for each target category. Resource types can be database resource types, file system resource types, network transmission system resources, etc.

[0085] The server generates target batch task execution instructions for each target category sub-task set based on the task execution information for each target category sub-task set, obtains the priority task execution results, and executes the target batch task execution instructions using the priority task execution results to obtain the target batch task execution results for each target category sub-task set. Then, the server obtains the execution result of the business request based on the priority task execution results and the target batch task execution results.

[0086] In one specific embodiment, the server obtains the resource type corresponding to each priority subtask, determines the task processing resource based on the resource type, such as an I / O device (input / output device) like a database, disk file system, or network transmission system, and generates a task execution instruction corresponding to the priority subtask based on the task execution information of the priority subtask. The server then sends the task execution instruction to the corresponding task processing resource for task processing, such as data storage, data reading, data calculation, file addition / removal, and data transmission, to obtain the priority task execution result corresponding to the priority subtask.

[0087] The target batch execution subtasks in the target batch execution subtask set have a preset execution order. This preset execution order can be the execution order of the subtasks corresponding to different resource types, such as a pre-set execution order for database resources. The execution order of the subtasks corresponding to different resource types is independent of each other. The server can obtain the resource types corresponding to each target batch execution subtask in the target batch execution subtask set, and classify the target batch execution subtasks according to the resource types to obtain subtask sets for each target category.

[0088] The server obtains the execution order and task execution information of each batch execution subtask in each target category subtask set, and generates a task execution queue for each target category subtask set according to the execution order based on the task execution information of each batch execution subtask.

[0089] The server generates target batch task execution instructions for each target category sub-task set based on the task execution queue corresponding to each target category sub-task set. Then, the server determines the task processing resources based on the resource type corresponding to each target category sub-task set, and sends the target batch task execution instructions to the corresponding task processing resources for task processing, obtaining the target batch task execution results for each target category sub-task set. Specifically, when a task processing resource detects that a target batch execution sub-task in a target category sub-task set is a delayed execution sub-task, it obtains the priority task execution result of its corresponding priority execution sub-task, and uses the priority task execution result to execute the delayed execution sub-task, obtaining the task execution result for that delayed execution sub-task.

[0090] In this embodiment, by determining whether to execute subtasks in priority or in batches and executing them sequentially, the execution logic of subtasks with dependencies can be satisfied, thereby ensuring the accuracy of task execution.

[0091] In one embodiment, step 206 involves obtaining the resource type corresponding to each batch execution subtask in the batch execution subtask set, and classifying each batch execution subtask based on the resource type to obtain subtask sets of each category, including:

[0092] When an execution order is detected between the batch execution subtasks corresponding to the respective categories of subtask sets;

[0093] Obtain the preset execution order and task execution information corresponding to each batch execution subtask in each category of subtask set, and determine the corresponding rollback subtask and the target task corresponding to the rollback subtask in each category of subtask set based on the task execution information and the preset execution order;

[0094] The rollback subtask and the target subtask are deleted from each category subtask set to obtain each update category subtask set, and each update category subtask set is used as the category subtask set.

[0095] Here, a rollback subtask refers to a subtask to be executed that undergoes a rollback operation, indicating a rollback to a state where no task processing has occurred. The target subtask is the subtask to be executed that has been restored by the rollback subtask. The preset execution order refers to the pre-defined execution order among the various batch of subtasks to be executed.

[0096] Specifically, when the server detects an execution order among the batch execution subtasks in a category subtask set, it obtains the preset execution order corresponding to each batch execution subtask in the category subtask set. Based on the task execution information corresponding to each batch execution subtask in the category subtask set, it generates a batch task execution queue corresponding to the category subtask set according to the preset execution order. This process is repeated to obtain the batch task execution queues corresponding to each category subtask set.

[0097] The server iterates through the batch task execution queues corresponding to each category of subtask set in the execution order. Specifically, it iterates through the operation information in the task execution information of each batch execution subtask in the batch task execution queue, and determines the rollback subtask and the target subtask corresponding to each category of subtask set based on the operation information. For example, in the batch task execution queue corresponding to file system resources, the operation information for task 1 is to create file A. According to the preset execution order, the operation information for task 2, which follows task 1, is to delete file A. Therefore, task 2 is determined to be the rollback subtask, and task 1 is determined to be the target subtask.

[0098] The server deletes the corresponding rollback subtasks and target subtasks in each category subtask set, obtains the updated category subtask set corresponding to each category subtask set, and uses the updated category subtask set as the category subtask set to be processed subsequently.

[0099] In this embodiment, by analyzing offset resource access, offsetting means that operations cancel each other out, which is equivalent to no operation being performed. This can optimize unnecessary resource access and thus improve task processing efficiency.

[0100] In one embodiment, the task processing method further includes:

[0101] When a request cancellation instruction sent by the requesting end corresponding to a business request is detected, a delayed subtask cancellation instruction is generated based on the task execution information corresponding to the delayed subtask, the delayed subtask cancellation instruction is executed, and the delayed task cancellation result corresponding to the delayed subtask is obtained.

[0102] Batch task cancellation instructions are generated based on batch task execution instructions, and the batch task cancellation instructions are executed to obtain the batch task cancellation results;

[0103] The task cancellation result corresponding to the business request is obtained based on the delayed task cancellation result and the batch task cancellation result.

[0104] Among them, the request cancellation instruction is an instruction sent by the requesting end to interrupt the service request. The delayed subtask cancellation instruction is used to instruct delayed subtasks to be rolled back. The batch task cancellation instruction is used to instruct batch subtasks to be rolled back.

[0105] Specifically, when the server receives a request cancellation instruction from the requesting end corresponding to the business request, and detects the existence of a set of delayed execution subtasks, it generates a delayed subtask cancellation instruction based on the task execution information of each delayed subtask in the set, executes the delayed subtask cancellation instruction, and obtains the delayed task cancellation result for each delayed subtask in the set. The specific steps may involve the server sending each delayed subtask cancellation instruction to the corresponding task processing end based on the resource type of each delayed subtask. The task processing end searches for the delayed execution result of the corresponding delayed subtask based on the task identifier in each delayed subtask cancellation instruction. If no delayed execution result is found, no processing is performed. If a delayed execution result is found, the delayed subtask cancellation instruction corresponding to the task identifier is executed, and reverse processing is performed based on the operation information corresponding to the delayed subtask. For example, if the delayed subtask is "create file 1 in the database" and file 1 is detected in the database, then the delayed subtask cancellation instruction corresponding to this delayed subtask is "delete file 1 in the database", and the delayed subtask cancellation result corresponding to this task identifier is obtained, such as "file 1 creation cancelled successfully".

[0106] Based on the above execution steps, the server generates a batch task cancellation instruction according to the batch task execution instruction, executes the batch task cancellation instruction, and obtains the batch task cancellation result. The server then generates the task cancellation result corresponding to the business request based on the delayed task cancellation result and the batch task cancellation result, such as "Request cancelled," and returns the task cancellation result to the requesting client corresponding to the business request for display.

[0107] When the server receives a request cancellation instruction from the requesting client corresponding to a business request, it can also check whether there are task execution results for each pending subtask. Subtasks with execution results are designated as pending cancellation subtasks, indicating tasks that need to be cancelled. Based on the task execution information of the pending cancellation subtasks, a corresponding task cancellation instruction is generated, executed, and the task cancellation result for the business request is obtained.

[0108] In one specific embodiment, after the server generates the batch task execution queues corresponding to each category of subtask sets, and before executing any subtasks to be executed, the server detects the request cancellation instruction sent by the requesting end corresponding to the business request, deletes the batch task execution queues corresponding to each category of subtask sets, generates the task cancellation result corresponding to the business request, and sends the task cancellation result to the requesting end corresponding to the business request for display.

[0109] The server can also detect when an execution error occurs in a pending subtask. For example, if the pending subtasks "Order Generation," "Inventory Update," and "Shipping Order Generation" in the "Order Placement" process are completed, and the "Deduction" task fails, the server can generate task cancellation instructions for each pending subtask. This will cancel the pending subtasks "Order Generation," "Inventory Update," and "Shipping Order Generation," and obtain the task cancellation result corresponding to the business request.

[0110] In this embodiment, by reversing the execution of tasks, the task states of each subtask to be executed are restored, avoiding contradictions in task processing logic and ensuring the accuracy of subsequent task processing.

[0111] In one embodiment, step 208, generating batch task execution instructions corresponding to each category of subtask set based on the task execution information corresponding to each category of subtask set, includes:

[0112] Determine the current category of subtask set from each category of subtask set, and extract the operation information corresponding to each batch execution subtask based on the task execution information corresponding to each batch execution subtask in the current category of subtask set;

[0113] The operation information corresponding to each batch execution subtask is concatenated to obtain the concatenated operation information;

[0114] Generate batch task execution instructions corresponding to the current category of subtask set based on the splicing operation information;

[0115] Iterate through each category of subtask set to obtain the batch task execution instructions corresponding to each category of subtask set.

[0116] Operation information refers to information used to instruct how the subtasks to be executed should be performed. Concatenated operation information refers to the information obtained by concatenating the operation information of each batch of executed subtasks.

[0117] Specifically, the server randomly determines the current category subtask set from each category subtask set, or it can use the category subtask set with the largest number of tasks as the current category subtask set. Then, it obtains the operation information corresponding to each batch execution subtask in the current category subtask set, and concatenates the operation information corresponding to each batch execution subtask to obtain the concatenated operation information corresponding to the current category subtask set, such as "data identifier + data storage + data calculation + data acquisition", where "+" represents the concatenation symbol.

[0118] The server then generates batch task execution instructions corresponding to the current category of subtasks based on the concatenation operation information. The server iterates through each category of subtasks, obtaining the batch task execution instructions for each category of subtasks according to the above execution steps. Finally, the batch task execution instructions are sent to the corresponding task processing resources for processing, yielding the batch task execution results.

[0119] In this embodiment, by concatenating the operation information of each batch execution subtask, concatenated operation information is obtained. Batch task execution instructions are generated based on the concatenated operation information, and task processing is performed based on the batch task execution instructions to obtain batch task execution results. This enables the batch completion of tasks, thereby improving task processing efficiency.

[0120] In one embodiment, batch task execution instructions are generated for each category of sub-task set based on the task execution information, and tasks are executed based on the batch task execution instructions to obtain batch task execution results for each category of sub-task set, including:

[0121] Obtain the resource types corresponding to each category of subtask set, and determine the task processing resources corresponding to each category of subtask set based on the resource types;

[0122] Generate batch task execution instructions for each category of subtask set based on the task execution information corresponding to each category of subtask set;

[0123] The batch execution instructions are sent to the task processing resources corresponding to each category of sub-task set, and the task processing resources are controlled to execute the tasks according to the batch task execution instructions to obtain the batch task execution results corresponding to each category of sub-task set.

[0124] Among them, task processing resources refer to task execution devices used for task processing, which can be external devices.

[0125] Specifically, the server sends the batch task execution instructions corresponding to each category of subtask set to the corresponding task processing resources. These resources may be I / O devices (input / output devices) such as databases, disk file systems, network transmission systems, and printers. The task processing resources then respond to the batch task execution instructions to process each batch execution subtask within the category of subtask set. The server obtains the batch task execution results for each category of subtask set returned by the task processing resources, which may include task completion information.

[0126] In one specific embodiment, the resource type of a delayed subtask can be the same as the resource type of its dependent subtasks, meaning that the delayed subtask and its dependent subtasks can be processed within the same task processing resource. The server generates a delayed task execution instruction based on the task execution information corresponding to the delayed subtask and obtains the resource type corresponding to the delayed subtask. The server determines the corresponding task processing resource based on the resource type of the delayed subtask and sends the delayed task execution instruction to the corresponding task processing resource. The task processing resource searches for and retrieves the task execution results of the dependent subtasks of the delayed task execution instruction, and uses these results to execute the delayed task execution instruction, obtaining the delayed task execution result corresponding to the delayed subtask. The server receives the delayed task execution results returned by the task processing resource for each delayed subtask.

[0127] In one specific embodiment, the server may also pre-instruct the task processing resource to enable transaction mode, indicating automatic transaction commit. When the task processing resource receives a task execution instruction and detects errors in related parameters of the instruction (e.g., incorrect data storage address), the task processing resource automatically calls the appropriate correct resource to perform task processing in transaction mode. For example, when processing database resources, transaction mode is enabled for batch write operations.

[0128] In this embodiment, by generating batch task execution instructions and sending them to the corresponding task processing resources for processing, it is equivalent to merging tasks that access task processing resources multiple times into one process. This reduces the overhead of task processing resource initialization. For example, input resource access and I / O access require opening and associating handles during access, and releasing handles after saving. This is especially true for network output or database output, where connection initialization is required for each access. Executing batch task execution instructions through task processing resources reduces the frequency of resource contention and the probability of resource deadlock. Resource locks indicate that when a resource can only be accessed once or a limited number of times at a time, lock control is required.

[0129] In one specific embodiment, such as Figure 4The diagram illustrates a task processing approach. The dashed boxes on the right represent specific steps in the flowchart. A batch invocation mechanism is pre-configured in the server, representing a mechanism that invokes task processing resources to execute various subtasks within the same batch. A batch refers to a group of business requests initiated at once by the requesting end. The batch invocation mechanism includes an invocation association mechanism, a preset batch task execution queue, a preset callback queue, an isolation mechanism, and a submission mechanism. The invocation association mechanism establishes the association between business requests and subtasks to be executed. The preset batch task execution queue stores batch-executed subtasks. The callback queue stores deferred-execution subtasks. The isolation mechanism manages the subtasks to be executed and includes a resource access control center for invoking the resources corresponding to each subtask. The submission mechanism executes the task. Resource access can be considered as assigning a specified task (e.g., data) to processing resources for processing, such as saving output data.

[0130] When the server receives a business request from the requesting client, it initiates a batch invocation mechanism. This mechanism establishes associations between the business request and its corresponding subtask to be executed, as well as between individual business requests within a group. The association mechanism can establish these associations using context, thread identifiers, invocation identifiers, etc.

[0131] The batch execution device determines the number of pending subtasks corresponding to a business request. If the number of pending subtasks is less than a preset task quantity threshold, the isolation device is not activated, and the submission device is invoked to immediately execute the pending subtasks. If the number of pending subtasks exceeds the preset task quantity threshold, the isolation device is activated. The isolation device extracts the task execution information corresponding to each pending subtask. Based on the task execution information and the preset execution order, delayed execution subtasks and batch execution subtasks are determined among the pending subtasks, i.e., the task category of each pending subtask is determined. Then, the resource access control center stores the task execution information corresponding to the delayed execution subtask in a preset callback queue, and records it in an orderly manner into the preset batch task execution queue corresponding to the resource type, based on the resource type of the batch execution subtask, thus determining the task processing resources that each batch task execution queue needs to call.

[0132] Once the batch invocation device detects and determines the task category and task processing resources corresponding to each subtask to be executed, the batch invocation ends. The submission device then merges the batch task execution queues corresponding to each category of subtask set into batch task execution instructions for each category of subtask set, and invokes the output resources corresponding to each category of subtask set for execution. The output resources represent task processing resources. If a delayed execution subtask is detected in the preset callback queue, that delayed execution subtask is executed.

[0133] In this embodiment, resource access is uniformly controlled and intercepted by a resource access control center. Interception means pausing the output task to the resource for processing after the isolation device is activated, thereby improving the batch processing efficiency of the subtasks to be executed. Furthermore, by executing batch task execution instructions, the number of times the output resource is called is reduced, thereby reducing the loss and blockage caused by frequent resource access.

[0134] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0135] Based on the same inventive concept, this application also provides a task processing apparatus for implementing the task processing method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more task processing apparatus embodiments provided below can be found in the limitations of the task processing method described above, and will not be repeated here.

[0136] In one embodiment, such as Figure 5 As shown, a task processing device 500 is provided, including: an acquisition module 502, a determination module 504, a classification module 506, a batch execution module 508, a delayed execution module 510, and a result module 512, wherein:

[0137] The acquisition module 502 is used to acquire business requests, which include various subtasks to be executed and corresponding task execution information;

[0138] The determination module 504 is used to determine the dependency relationship corresponding to each subtask to be executed based on the task execution information, and to determine the set of delayed execution subtasks and the set of batch execution subtasks from each subtask to be executed based on the dependency relationship;

[0139] The classification module 506 is used to obtain the resource type corresponding to each batch execution subtask in the batch execution subtask set, and classify each batch execution subtask based on the resource type to obtain subtask sets of each category;

[0140] The batch execution module 508 is used to generate batch task execution instructions for each category of sub-task set based on the task execution information corresponding to each category of sub-task set, execute tasks based on the batch task execution instructions, and obtain batch task execution results for each category of sub-task set.

[0141] The delayed execution module 510 is used to execute each delayed execution subtask in the delayed execution subtask set based on the batch task execution result, and obtain the delayed task execution result;

[0142] Result module 512 is used to obtain the execution result of the business request based on the batch task execution result and the delayed task execution result.

[0143] In one embodiment, determining module 504 includes:

[0144] The dependency partitioning unit is used to determine the dependent execution subtask set and the non-dependent execution subtask set in each subtask to be executed based on the dependency relationship. The dependent execution subtask set includes the priority execution subtask set and the delayed execution subtask set; the priority execution subtask set and the non-dependent execution subtask set are used as the batch execution subtask set.

[0145] In one embodiment, the task processing device 500 further includes:

[0146] The priority execution unit is used to determine the priority execution subtask set and the target batch execution subtask set from each pending subtask based on dependencies. The target batch execution subtask set includes the delayed execution subtask set and the non-dependent execution subtask set. It executes each priority execution subtask in the priority execution subtask set to obtain the priority task execution result; it obtains the resource type corresponding to each target batch execution subtask in the target batch execution subtask set, and classifies each target batch execution subtask based on the resource type to obtain each target category subtask set; it generates target batch task execution instructions corresponding to each target category subtask set based on the task execution information corresponding to each target category subtask set; it executes the tasks based on the target batch task execution instructions and the priority task execution results to obtain the batch task execution results corresponding to each target category subtask set; and it obtains the execution result of the business request based on the priority task execution result and the target batch task execution result.

[0147] In one embodiment, the classification module 506 includes:

[0148] The task update unit is used to: when an execution order is detected between the batch execution subtasks corresponding to each category of subtask set; obtain the preset execution order and task execution information corresponding to each batch execution subtask in each category of subtask set; determine the corresponding rollback subtask and the target task corresponding to the rollback subtask in each category of subtask set based on the task execution information and the preset execution order; delete the rollback subtask and the target subtask in each category of subtask set to obtain each updated category of subtask set; and use each updated category of subtask set as the category of subtask set.

[0149] In one embodiment, the task processing device 500 further includes:

[0150] The task cancellation unit is used to generate a delayed subtask cancellation instruction based on the task execution information corresponding to the delayed subtask when a request cancellation instruction is detected from the requesting end corresponding to the business request; execute the delayed subtask cancellation instruction to obtain the delayed task cancellation result corresponding to the delayed subtask; generate a batch task cancellation instruction based on the batch task execution instruction; execute the batch task cancellation instruction to obtain the batch task cancellation result; and obtain the task cancellation result corresponding to the business request based on the delayed task cancellation result and the batch task cancellation result.

[0151] In one embodiment, the batch execution module 508 includes:

[0152] The information splicing unit is used to determine the current category of subtask set from each category of subtask set, extract the operation information corresponding to each batch execution subtask based on the task execution information corresponding to each batch execution subtask in the current category of subtask set, splice the operation information corresponding to each batch execution subtask to obtain spliced ​​operation information, generate batch task execution instructions corresponding to the current category of subtask set based on the spliced ​​operation information, and traverse each category of subtask set to obtain the batch task execution instructions corresponding to each category of subtask set.

[0153] In one embodiment, the batch execution module 508 includes:

[0154] The resource processing unit is used to obtain the resource types corresponding to each category of subtask sets, determine the task processing resources corresponding to each category of subtask sets based on the resource types, generate batch task execution instructions corresponding to each category of subtask sets based on the task execution information corresponding to each category of subtask sets, send the batch task execution instructions to the task processing resources corresponding to each category of subtask sets, control the task processing resources to execute tasks according to the batch task execution instructions, and obtain the batch task execution results corresponding to each category of subtask sets.

[0155] Each module in the aforementioned task processing device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can invoke and execute the operations corresponding to each module.

[0156] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 6 As shown, this computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores task execution information. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a task processing method.

[0157] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 7As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When the computer program is executed by the processor, it implements a task processing method. The display unit of the computer device is used to form a visually visible image. It can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.

[0158] Those skilled in the art will understand that Figure 6-7 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0159] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0160] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0161] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0162] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data shall comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0163] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0164] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0165] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A task processing method, characterized in that, The method includes: Obtain a business request, which includes various subtasks to be executed and corresponding task execution information; Based on the task execution information, the dependencies of each subtask to be executed are determined, and based on the dependencies, a set of delayed execution subtasks and a set of batch execution subtasks are determined from each subtask to be executed. Obtain the resource type corresponding to each batch execution subtask in the batch execution subtask set, and classify the batch execution subtasks based on the resource type to obtain subtask sets of each category; wherein, the process of determining each category of subtask sets includes: When an execution order is detected between the batch execution subtasks corresponding to each category of subtask set, the preset execution order and task execution information corresponding to each batch execution subtask in each category of subtask set are obtained. According to the preset execution order, traverse the operation information in the task execution information of each batch execution subtask in the batch task execution queue corresponding to each category of subtask set; Based on the conflict between the operation information, the rollback subtasks and the target subtasks corresponding to each category of subtasks are determined in each batch execution subtask; wherein, the rollback subtask refers to the subtask to be executed that performs the rollback operation, indicating that it is rolled back to a state where no task processing has been performed; the target subtask refers to the subtask to be executed that has been restored by the rollback subtask. Delete the rollback subtask and the target subtask from each category subtask set to obtain each update category subtask set, and use each update category subtask set as the category subtask set; Based on the task execution information corresponding to each category of subtask set, generate batch task execution instructions corresponding to each category of subtask set, execute tasks based on the batch task execution instructions, and obtain batch task execution results corresponding to each category of subtask set. Based on the batch task execution results, each delayed execution subtask in the delayed execution subtask set is executed to obtain the delayed task execution results; The execution result of the business request is obtained based on the execution results of the batch task and the execution results of the delayed task.

2. The method according to claim 1, characterized in that, The step of determining the set of delayed execution subtasks and the set of batch execution subtasks from the various subtasks to be executed based on the dependencies includes: Based on the dependencies, a set of dependent execution subtasks and a set of non-dependent execution subtasks are determined in each subtask to be executed. The set of dependent execution subtasks includes a set of priority execution subtasks and a set of delayed execution subtasks. The set of priority execution subtasks and the set of non-dependent execution subtasks are used as the set of batch execution subtasks.

3. The method according to claim 2, characterized in that, The method further includes: Based on the dependencies, a set of priority execution subtasks and a target batch execution subtask set are determined from the various subtasks to be executed. The target batch execution subtask set includes the set of delayed execution subtasks and the set of non-dependent execution subtasks. Execute each of the priority subtasks in the priority subtask set to obtain the priority task execution results; Obtain the resource type corresponding to each target batch execution subtask in the target batch execution subtask set, and classify each target batch execution subtask based on the resource type to obtain a target category subtask set; Based on the task execution information corresponding to each target category sub-task set, a target batch task execution instruction corresponding to each target category sub-task set is generated. Based on the target batch task execution instruction and the priority task execution result, the task is executed to obtain the target batch task execution result corresponding to each target category sub-task set. The execution result of the business request is obtained based on the execution results of the priority task and the execution results of the target batch task.

4. The method according to claim 3, characterized in that, The target batch execution subtasks refer to each subtask to be executed in the target batch execution subtask set, including the subtasks to be executed in the delayed execution subtask set or the non-dependent execution subtask set; The step of obtaining the execution result of the business request based on the execution result of the priority task and the execution result of the target batch task includes: Iterate through the task call information corresponding to each set of subtasks to be executed, obtain the task identifier in the task call information, and take the subtasks to be executed corresponding to the task identifier as the priority subtasks to be executed. When multiple subtasks to be executed corresponding to multiple task identifiers are obtained, a set of priority subtasks to be executed is obtained. After determining the priority subtasks to be executed among the various subtasks to be executed, the remaining subtasks to be executed are used as the target batch execution subtask set; Alternatively, based on the task invocation information, determine the set of dependent execution subtasks and the set of non-dependent subtasks in each subtask to be executed, and extract the set of priority execution subtasks from the set of dependent execution subtasks; Use each delayed execution subtask in the dependent execution subtask set and the independent execution subtask set as the target batch execution subtask set.

5. The method according to claim 1, characterized in that, The method further includes: When a request cancellation instruction sent by the requesting end corresponding to the service request is detected, a delayed subtask cancellation instruction is generated based on the task execution information corresponding to the delayed execution subtask, the delayed subtask cancellation instruction is executed, and the delayed task cancellation result corresponding to the delayed execution subtask is obtained; A batch task cancellation instruction is generated based on the batch task execution instruction, and the batch task cancellation instruction is executed to obtain the batch task cancellation result; The task cancellation result corresponding to the business request is obtained based on the delayed task cancellation result and the batch task cancellation result.

6. The method according to claim 1, characterized in that, The step of generating batch task execution instructions corresponding to each category of subtask set based on the task execution information of each category of subtask set includes: Determine the current category subtask set from the various category subtask sets, and extract the operation information corresponding to each batch execution subtask based on the task execution information corresponding to each batch execution subtask in the current category subtask set; The operation information corresponding to each batch execution subtask is concatenated to obtain concatenated operation information. Based on the splicing operation information, generate batch task execution instructions corresponding to the current category of sub-task set; By traversing each category of subtask set, batch task execution instructions corresponding to each category of subtask set are obtained.

7. The method according to claim 1, characterized in that, The process of generating batch task execution instructions corresponding to each category of subtask set based on the task execution information of each category of subtask set, executing tasks based on the batch task execution instructions, and obtaining batch task execution results corresponding to each category of subtask set includes: Obtain the resource types corresponding to each category of subtask set, and determine the task processing resources corresponding to each category of subtask set based on the resource types; Generate batch task execution instructions corresponding to each category of subtask set based on the task execution information corresponding to each category of subtask set; The batch task execution instruction is sent to the task processing resources corresponding to each category of sub-task set, and the task processing resources are controlled to execute tasks according to the batch task execution instruction to obtain the batch task execution results corresponding to each category of sub-task set.

8. A task processing device, characterized in that, The device includes: The acquisition module is used to acquire business requests, which include various subtasks to be executed and corresponding task execution information; The determination module is used to determine the dependency relationship corresponding to each subtask to be executed based on the task execution information, and to determine a set of delayed execution subtasks and a set of batch execution subtasks from each subtask to be executed based on the dependency relationship; The classification module is used to obtain the resource type corresponding to each batch execution subtask in the batch execution subtask set, and classify the batch execution subtasks based on the resource type to obtain subtask sets of each category; wherein, the process of determining each subtask set of each category includes: When an execution order is detected between the batch execution subtasks corresponding to each category of subtask set, the preset execution order and task execution information corresponding to each batch execution subtask in each category of subtask set are obtained. According to the preset execution order, traverse the operation information in the task execution information of each batch execution subtask in the batch task execution queue corresponding to each category of subtask set; Based on the conflict between the operation information, the rollback subtasks and the target subtasks corresponding to each category of subtasks are determined in each batch execution subtask; wherein, the rollback subtask refers to the subtask to be executed that performs the rollback operation, indicating that it is rolled back to a state where no task processing has been performed; the target subtask refers to the subtask to be executed that has been restored by the rollback subtask. Delete the rollback subtask and the target subtask from each category subtask set to obtain each update category subtask set, and use each update category subtask set as the category subtask set; The batch execution module is used to generate batch task execution instructions corresponding to each category of sub-task set based on the task execution information corresponding to each category of sub-task set, perform task execution based on the batch task execution instructions, and obtain batch task execution results corresponding to each category of sub-task set. The delayed execution module is used to execute each delayed execution subtask in the delayed execution subtask set based on the batch task execution result, so as to obtain the delayed task execution result; The results module is used to obtain the execution result of the business request based on the execution results of the batch tasks and the execution results of the delayed tasks.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • ETL task scheduling method, system and device and storage medium

    CN110362392A

  • Batch task processing method and device, computer equipment and storage medium

    CN110704170A