CN116204291A - Task processing method, device, computer equipment and storage medium - Google Patents

Task processing method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116204291A
CN116204291A CN202310139451.2A CN202310139451A CN116204291A CN 116204291 A CN116204291 A CN 116204291A CN 202310139451 A CN202310139451 A CN 202310139451A CN 116204291 A CN116204291 A CN 116204291A
Authority
CN
China
Prior art keywords
execution
task
subtask
batch
category
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310139451.2A
Other languages
Chinese (zh)
Inventor
贾武阳
高放
邓忠乾
周斌
陈松
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN202310139451.2A priority Critical patent/CN116204291A/en
Publication of CN116204291A publication Critical patent/CN116204291A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5066Algorithms for mapping a plurality of inter-dependent sub-tasks onto a plurality of physical CPUs
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multi Processors (AREA)

Abstract

The application relates to a task processing method, a task processing device and computer equipment. The method comprises the following steps: acquiring a service request, wherein the service request comprises each subtask to be executed and corresponding task execution information; determining a delayed execution subtask set and a batch execution subtask set from all subtasks to be executed based on the dependency relationship; acquiring resource types corresponding to all batch execution subtasks, and classifying all batch execution subtasks to obtain all class subtask sets; generating batch task execution instructions respectively corresponding to the sub-task sets of each category based on the task execution information, and executing the tasks to obtain batch task execution results respectively corresponding to the sub-task sets of each category; executing each delayed execution subtask in the delayed execution subtask set to obtain a delayed task execution result; and obtaining the execution result of the service request based on the batch task execution result and the delay task execution result. By adopting the method, the task processing efficiency can be improved.

Description

Task processing method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technology, and in particular, to a task processing method, apparatus, computer device, storage medium, and computer program product.
Background
The development of random computer technology, the processing efficiency of computers on data tasks is higher and higher. The existing task processing mode is to decompose the data task into small-level processing units for step-by-step processing. However, the existing task processing method needs to frequently call resources to execute tasks, for example, when the tasks are executed step by step, a database needs to be called multiple times, and the task processing is long, so that the problem of low task processing efficiency is caused.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a task processing method, apparatus, computer device, computer-readable storage medium, and computer program product that can improve task processing efficiency.
In a first aspect, the present application provides a task processing method. The method comprises the following steps:
acquiring a service request, wherein the service request comprises each subtask to be executed and corresponding task execution information;
determining a dependency relationship corresponding to each subtask to be executed based on the task execution information, and determining a delayed execution subtask set and a batch execution subtask set from each subtask to be executed based on the dependency relationship;
acquiring resource types corresponding to all batch execution subtasks in the batch execution subtasks, and classifying all batch execution subtasks based on the resource types to obtain all class subtask sets;
Generating batch task execution instructions respectively corresponding to the sub-task sets of each category based on task execution information respectively corresponding to the sub-task sets of each category, and executing tasks based on the batch task execution instructions to obtain batch task execution results respectively corresponding to the sub-task sets of each category;
executing each delayed execution subtask in the delayed execution subtask set based on the batch task execution result to obtain a delayed task execution result;
and obtaining the execution result of the service request based on the batch task execution result and the delay task execution result.
In a second aspect, the present application further provides a task processing device. The device comprises:
the acquisition module is used for acquiring a service request, wherein the service request comprises each subtask to be executed and corresponding task execution information;
the determining module is used for determining the dependency relationship corresponding to each subtask to be executed based on the task execution information, and determining a delayed execution subtask set and a batch execution subtask set from each subtask to be executed based on the dependency relationship;
the classification module is used for acquiring the resource types corresponding to the batch execution subtasks in the batch execution subtasks, classifying the batch execution subtasks based on the resource types, and obtaining various class subtask sets;
The batch execution module is used for generating batch task execution instructions respectively corresponding to the sub-task sets of each category based on task execution information respectively corresponding to the sub-task sets of each category, and executing tasks based on the batch task execution instructions to obtain batch task execution results respectively corresponding to the sub-task sets of each category;
the delay execution module is used for executing each delay execution subtask in the delay execution subtask set based on the batch task execution result to obtain a delay task execution result;
and the result module is used for obtaining the execution result of the service request based on the batch task execution result and the delay task execution result.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
acquiring a service request, wherein the service request comprises each subtask to be executed and corresponding task execution information;
determining a dependency relationship corresponding to each subtask to be executed based on the task execution information, and determining a delayed execution subtask set and a batch execution subtask set from each subtask to be executed based on the dependency relationship;
Acquiring resource types corresponding to all batch execution subtasks in the batch execution subtasks, and classifying all batch execution subtasks based on the resource types to obtain all class subtask sets;
generating batch task execution instructions respectively corresponding to the sub-task sets of each category based on task execution information respectively corresponding to the sub-task sets of each category, and executing tasks based on the batch task execution instructions to obtain batch task execution results respectively corresponding to the sub-task sets of each category;
executing each delayed execution subtask in the delayed execution subtask set based on the batch task execution result to obtain a delayed task execution result;
and obtaining the execution result of the service request based on the batch task execution result and the delay task execution result.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring a service request, wherein the service request comprises each subtask to be executed and corresponding task execution information;
determining a dependency relationship corresponding to each subtask to be executed based on the task execution information, and determining a delayed execution subtask set and a batch execution subtask set from each subtask to be executed based on the dependency relationship;
Acquiring resource types corresponding to all batch execution subtasks in the batch execution subtasks, and classifying all batch execution subtasks based on the resource types to obtain all class subtask sets;
generating batch task execution instructions respectively corresponding to the sub-task sets of each category based on task execution information respectively corresponding to the sub-task sets of each category, and executing tasks based on the batch task execution instructions to obtain batch task execution results respectively corresponding to the sub-task sets of each category;
executing each delayed execution subtask in the delayed execution subtask set based on the batch task execution result to obtain a delayed task execution result;
and obtaining the execution result of the service request based on the batch task execution result and the delay task execution result.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
acquiring a service request, wherein the service request comprises each subtask to be executed and corresponding task execution information;
determining a dependency relationship corresponding to each subtask to be executed based on the task execution information, and determining a delayed execution subtask set and a batch execution subtask set from each subtask to be executed based on the dependency relationship;
Acquiring resource types corresponding to all batch execution subtasks in the batch execution subtasks, and classifying all batch execution subtasks based on the resource types to obtain all class subtask sets;
generating batch task execution instructions respectively corresponding to the sub-task sets of each category based on task execution information respectively corresponding to the sub-task sets of each category, and executing tasks based on the batch task execution instructions to obtain batch task execution results respectively corresponding to the sub-task sets of each category;
executing each delayed execution subtask in the delayed execution subtask set based on the batch task execution result to obtain a delayed task execution result;
and obtaining the execution result of the service request based on the batch task execution result and the delay task execution result.
The task processing method, the device, the computer equipment, the storage medium and the computer program product ensure the execution sequence of the subtasks to be executed with the dependency relationship by determining the delayed execution subtasks and the batch execution subtasks in each subtask to be executed. And then, obtaining each category subtask set according to the resource type corresponding to each batch execution subtask, generating batch task execution instructions corresponding to each category subtask set according to the task execution information corresponding to each category subtask set, and executing the batch task execution instructions can be used for executing the subtasks to be executed in each category subtask set in batch at one time, so that the batch task execution results corresponding to each category subtask set can be obtained quickly, and the execution efficiency of the tasks with different resource types is improved. And then executing each delayed execution subtask to obtain a delayed task execution result, and obtaining the execution result of the service request according to the batch task execution result and the delayed task execution result, thereby improving the task processing efficiency.
Drawings
FIG. 1 is an application environment diagram of a task processing method in one embodiment;
FIG. 2 is a flow diagram of a task processing method in one embodiment;
FIG. 3 is a flow diagram of a process for relying on executing tasks in one embodiment;
FIG. 4 is a schematic diagram of task processing in one embodiment;
FIG. 5 is a block diagram of a task processing device in one embodiment;
FIG. 6 is an internal block diagram of a computer device in one embodiment;
fig. 7 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The task processing method provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The server 104 may acquire, through the network, an acquisition service request sent by the terminal 102, where the service request includes each subtask to be executed and corresponding task execution information; the server 104 determines the corresponding dependency relationship of each subtask to be executed based on the task execution information, and determines a delayed execution subtask set and a batch execution subtask set from each subtask to be executed based on the dependency relationship; the server 104 obtains the resource types corresponding to all the batch execution subtasks in the batch execution subtasks, classifies all the batch execution subtasks based on the resource types, and obtains all the category subtask sets; the server 104 generates batch task execution instructions corresponding to the sub-task sets of each category based on the task execution information corresponding to the sub-task sets of each category, and performs task execution based on the batch task execution instructions to obtain batch task execution results corresponding to the sub-task sets of each category; the server 104 executes each delayed execution subtask in the delayed execution subtask set based on the batch task execution result to obtain a delayed task execution result; the server 104 obtains the execution result of the service request based on the batch task execution result and the delayed task execution result, and then sends the execution result to the terminal 102 corresponding to the service request. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In one embodiment, as shown in fig. 2, a task processing method is provided, where this embodiment is applied to a server for illustration, it is understood that the method may also be applied to a terminal, and may also be applied to a system including a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the steps of:
step 202, obtaining a service request, wherein the service request comprises each subtask to be executed and corresponding task execution information.
The service request refers to a request, which is applied by a user end and needs to execute a task. The subtasks to be executed refer to subtasks to be executed corresponding to the service requests which are split in advance. The task execution information is information for instructing subtasks to be executed to perform task processing.
Specifically, the server acquires a service request sent by a service request end, wherein the service request comprises at least three sub-tasks to be executed and task execution information corresponding to each sub-task to be executed. The server may generate a corresponding service request identifier when receiving the service request, and associate each subtask to be executed in the service request with the generated service request identifier. The server can also generate task identifiers corresponding to the sub-tasks to be executed according to the service request identifiers, and associate the service request identifiers with the task identifiers corresponding to the sub-tasks to be executed so as to determine the corresponding sub-tasks to be executed according to the service request identifiers and process the tasks when the subsequent server receives at least one service request.
Step 204, determining a dependency relationship corresponding to each subtask to be executed based on the task execution information, and determining a delayed execution subtask set and a batch execution subtask set from each subtask to be executed based on the dependency relationship.
The dependency relationship refers to a task execution relationship that the execution of a current task depends on the execution result of a previous task in the task processing process. The delayed execution subtask refers to a subtask requiring delayed execution. Batch execution subtasks refer to subtasks that need to be performed in batch.
Specifically, the task execution information corresponding to each sub-task to be executed further includes task call information, where the task call information refers to preset information used for indicating whether a task on which the sub-task to be executed depends when executed exists, that is, whether the sub-task to be executed needs to be called when executed, and the information of the sub-task to be executed corresponding to a task execution result. The server can determine whether the subtasks to be executed have dependent subtasks to be executed according to the task call information, and when the dependent subtasks to be executed exist in the subtasks to be executed, which need to depend on the execution results of the executed tasks, are used as delayed execution subtasks, namely the dependent subtasks to be executed need to be executed in advance. The server traverses task call information corresponding to each sub task to be executed, takes the sub task to be executed which needs to depend on the execution result of the executed task as a delayed execution sub task, and obtains a delayed execution sub task set. And taking the subtasks to be executed which do not need to depend on the execution results of the executed tasks as batch execution subtasks to obtain batch execution subtask sets.
And 206, acquiring the resource types corresponding to the batch execution subtasks in the batch execution subtasks, and classifying the batch execution subtasks based on the resource types to obtain the category subtask sets.
And step 208, generating batch task execution instructions corresponding to the sub-task sets of each category based on the task execution information corresponding to the sub-task sets of each category, and executing tasks based on the batch task execution instructions to obtain batch task execution results corresponding to the sub-task sets of each category.
The resource type refers to the type of resources needed to be used when each batch execution subtask performs task processing. A category subtask set refers to a collection of batch execution subtasks of the same resource type. The batch task execution instruction refers to execution instructions of sub-task sets of each execution category in batch. The batch task execution results refer to task execution results corresponding to the sub-task sets of each category.
Specifically, the server acquires preset resource types corresponding to all batch execution subtasks, classifies all batch execution subtasks according to the resource types, and obtains all class subtask sets. The server respectively acquires task execution information corresponding to each batch of subtasks to be executed in each category subtask set, respectively carries out parameter combination on the task execution information corresponding to each batch of subtasks to be executed in each category subtask set, and obtains batch task execution instructions respectively corresponding to each category subtask set. The server determines the resources corresponding to the sub-task sets of each category according to the resource types corresponding to the sub-task sets of each category, and executes the batch task execution instructions corresponding to the sub-task sets of each category by using the resources corresponding to the sub-task sets of each category, so as to obtain the batch task execution results corresponding to the sub-task sets of each category.
And step 210, executing each delayed execution subtask in the delayed execution subtask set based on the batch task execution result to obtain a delayed task execution result.
The execution result of the delayed task refers to an execution result corresponding to the delayed execution sub-task.
Specifically, the server acquires the resource types corresponding to the execution-delayed subtasks in the execution-delayed subtasks, and determines the resources corresponding to the execution-delayed subtasks according to the resource types. And the server determines the dependent sub-task to be executed of the delayed execution sub-task according to the task call field corresponding to the delayed execution sub-task, and acquires the task execution result of the dependent sub-task to be executed from the batch task execution result. The server uses the task execution results of the dependent sub-tasks to be executed, and invokes the resources corresponding to the sub-tasks to execute the sub-tasks to obtain the execution results of the sub-tasks.
And step 212, obtaining an execution result of the service request based on the batch task execution result and the delayed task execution result.
Specifically, the server acquires a batch task execution result corresponding to each category subtask set and a delayed task execution result corresponding to each delayed execution subtask, and takes the batch task execution result and the delayed task execution result as execution results corresponding to the service request. The server may return the execution result corresponding to the service request to the request end corresponding to the service request.
In the task processing method, the execution sequence of the sub-tasks to be executed with the dependency relationship is ensured by determining the delayed execution sub-tasks and the batch execution sub-tasks in the sub-tasks to be executed. And then, obtaining each category subtask set according to the resource type corresponding to each batch execution subtask, generating batch task execution instructions corresponding to each category subtask set according to the task execution information corresponding to each category subtask set, and executing the batch task execution instructions can be used for executing the subtasks to be executed in each category subtask set in batch at one time, so that the batch task execution results corresponding to each category subtask set can be obtained quickly, and the execution efficiency of the tasks with different resource types is improved. And then executing each delayed execution subtask to obtain a delayed task execution result, and obtaining the execution result of the service request according to the batch task execution result and the delayed task execution result, thereby improving the task processing efficiency.
In one embodiment, step 204, determining a delayed execution subtask set and a batch execution subtask set from each subtask to be executed based on the dependency relationship, includes:
Determining a dependent execution subtask set and a non-dependent execution subtask set in each subtask to be executed based on the dependency relationship, wherein the dependent execution subtask set comprises a priority execution subtask set and a delayed execution subtask set;
and taking the preferentially-executed subtask set and the non-dependent execution subtask set as batch execution subtask sets.
The dependent execution subtask set refers to a set of subtasks to be executed with a dependency relationship and subtasks to be executed which are dependent on the dependent execution subtask set. A set of non-dependent execution sub-tasks refers to a set of sub-tasks to be executed that do not need to depend on the execution results of the executed tasks. The set of subtasks to be executed with priority refers to a set of subtasks to be executed with priority, and may be a set of dependent subtasks to be executed. The delayed execution sub-task set may be a set of sub-tasks to be executed that need to depend on the execution results of the executed tasks.
Specifically, the server traverses task call fields corresponding to the sub-tasks to be executed to divide the sub-task sets to be executed into a dependent sub-task set and a non-dependent sub-task set. The task call information may be in the form of a field, i.e., a task call field. The server traverses task call fields corresponding to all the subtasks to be executed, takes the subtasks to be executed, which are task call fields as task identifications, and the subtasks to be executed, which are corresponding to the task identifications, as dependent execution subtask sets, wherein the task call fields are the subtasks to be executed, which are task identifications, as delayed execution subtasks, and the subtasks to be executed, which are corresponding to the task identifications, are preferential execution subtasks, and represent task execution results of the dependent preferential execution subtasks for the execution of the delayed execution subtasks. The independent execution subtask set is then treated as a to-be-executed subtask with each task call field empty and not being relied upon.
And then the server extracts each priority execution subtask and each delay execution subtask from the dependent execution subtask set, and takes each subtask to be executed in each priority execution subtask and the independent execution subtask set as a batch execution subtask set. The server obtains a delayed execution subtask set and a batch execution subtask set corresponding to the service request.
In a specific embodiment, the delayed execution subtask in the dependent execution subtask set may be "statistics of class performance situations", and the priority execution subtask corresponding to the delayed execution subtask may be "statistics of class 1 student performance situations", "statistics of class 2 student performance situations", and so on. The subtasks to be executed in the independent execution subtask set may be "count score of student a of class 1", "count score of student B of class 1", "count score of student a of class 2", "count score of student B of class 2", and the like.
The batch execution subtask set includes an independent execution subtask set and a deferred execution subtask set. An execution order may exist between the batch execution subtasks in the batch execution subtask set, and the execution order may be an execution order between batch execution subtasks having the same resource type, for example, the batch execution subtask corresponding to the database resource "statistics of the score total score of the student a of the class 1", "statistics of the score total score of the student B of the class 1", "statistics of the score total score of the student a of the class 2", "statistics of the score total score of the student B of the class 2" may be prioritized over the batch execution subtask "statistics of the student score condition of the class 1", "statistics of the student score condition of the class 2". The batch execution subtasks and execution orders corresponding to the database resources may be, for example, "obtain the number a of the student a of the class 1" → "obtain the score of each department corresponding to the number a" → "calculate the sum of the scores of each department corresponding to the number a" → "obtain the score sum corresponding to the number a".
After the server executes the batch execution subtask set and obtains the batch task execution result, detecting whether the delayed execution subtask exists, if so, executing the delayed execution subtask, and if not, taking the batch execution task result as an execution result corresponding to the service request. For example, if the delayed execution subtask is "statistics of class performance conditions", task execution results corresponding to each batch of subtasks to be executed such as "statistics of class 1 student performance conditions", "statistics of class 2 student performance conditions" are obtained from the database, and execution is performed according to task execution information corresponding to the delayed execution subtask "statistics of class performance conditions", so as to obtain delayed task execution results corresponding to "statistics of class performance conditions".
In the embodiment, the dependent execution subtask set and the independent execution subtask set are determined in each subtask to be executed according to the dependency relationship, so that the dependent execution subtask set is executed successively according to the dependency relationship, task execution logic of the dependent execution subtask set is met, and accuracy of task execution is guaranteed.
In one embodiment, as shown in FIG. 3, a process flow diagram is provided that relies on executing tasks. The task processing method further comprises the following steps:
Step 302, determining a priority execution subtask set and a target batch execution subtask set from all subtasks to be executed based on a dependency relationship, wherein the target batch execution subtask set comprises a delayed execution subtask set and an independent execution subtask set;
step 304, executing each priority execution subtask in the priority execution subtask set to obtain a priority task execution result;
step 306, obtaining the resource types corresponding to each target batch execution subtask in the target batch execution subtask set, and classifying each target batch execution subtask based on the resource types to obtain each target class subtask set;
step 308, generating target batch task execution instructions corresponding to the target class subtask sets respectively based on task execution information corresponding to the target class subtask sets respectively, and executing tasks based on the target batch task execution instructions and the priority task execution results to obtain target batch task execution results corresponding to the target class subtask sets respectively;
step 310, obtaining the execution result of the service request based on the priority task execution result and the target batch task execution result.
The target batch execution subtasks refer to all subtasks to be executed in the target batch execution subtask set, and may be delayed execution subtask set or independent execution subtasks to be executed in the target batch execution subtask set.
Specifically, the server traverses task call information corresponding to each sub task set to be executed, obtains task identifiers in the task call information, takes the sub tasks to be executed corresponding to the task identifiers as sub tasks to be executed preferentially, and obtains the sub task set to be executed preferentially when the sub tasks to be executed corresponding to the task identifiers are obtained. And after determining the subtasks to be executed preferentially in each subtask to be executed, the server takes the rest subtasks to be executed as a target batch execution subtask set. The server can also determine a dependent execution subtask set and a non-dependent relation subtask set in each subtask to be executed according to the task call information, extract a priority execution subtask set in the dependent execution subtask set, and then take each delayed execution subtask and the non-dependent execution subtask set in the dependent execution subtask set as target batch execution subtask sets.
And then the server executes each priority execution subtask in the priority execution subtask set to obtain a priority task execution result. The server acquires the resource types corresponding to all the target batch execution subtasks in the target batch execution subtasks, classifies all the target batch execution subtasks according to the resource types, and obtains all the target class subtask sets. The resource type may be a database resource type, a file system resource type, a network transport system resource, etc.
The server generates target batch task execution instructions respectively corresponding to the target class subtask sets according to the task execution information respectively corresponding to the target class subtask sets, obtains priority task execution results, and executes the target batch task execution instructions by using the priority task execution results to obtain target batch task execution results respectively corresponding to the target class subtask sets. And then the server obtains the execution result of the service request according to the priority task execution result and the target batch task execution result.
In a specific embodiment, a server obtains a resource type corresponding to each of the tasks to be executed preferentially, determines task processing resources according to the resource type, where the task processing resources are, for example, input/output devices (i.e., IO devices) such as a database, a disk file system, a network transmission system, etc., generates a task execution instruction corresponding to the tasks to be executed preferentially according to task execution information corresponding to the tasks to be executed preferentially, and sends the task execution instruction to the corresponding task processing resources to perform task processing, for example, task processing such as data storage, data reading, data calculation, file addition and subtraction, data transmission, etc., so as to obtain a task execution result corresponding to the tasks to be executed preferentially.
The preset execution sequence exists in each target batch execution subtask in the target batch execution subtask set, and the preset execution sequence can be the execution sequence of the subtasks to be executed corresponding to each resource type respectively, for example, the execution sequence of the subtasks to be executed corresponding to the preset database resources. The execution sequence of the subtasks to be executed, which are respectively corresponding to the resource types, are mutually independent. The server can acquire the resource types corresponding to the target batch execution subtasks in the target batch execution subtasks, and classify the target batch execution subtasks according to the resource types to obtain target class subtask sets.
The server obtains the execution sequence and task execution information corresponding to each target batch execution subtask in each target class subtask set, and generates a task execution queue corresponding to each target class subtask set according to the execution sequence according to the task execution information corresponding to each target batch execution subtask.
And the server generates target batch task execution instructions corresponding to the target class subtask sets according to the task execution queues corresponding to the target class subtask sets. And then the server determines task processing resources according to the resource types corresponding to the subtask sets of each target category, and sends target batch task execution instructions to the corresponding task processing resources to perform task processing, so as to obtain target batch task execution results corresponding to the subtask sets of each target category. When the task processing resource detects that the target batch execution subtask in the target class subtask set is the delayed execution subtask, a priority task execution result of the corresponding priority execution subtask is obtained, the delayed execution subtask is executed by using the priority task execution result, and a task execution result corresponding to the delayed execution subtask is obtained.
In the embodiment, by judging the subtasks to be executed preferentially and the subtasks to be executed in batches and executing the subtasks successively, the execution logic of the subtasks to be executed with the dependency relationship can be met, so that the accuracy of task execution is ensured.
In one embodiment, step 206, obtaining a resource type corresponding to each batch execution subtask in the batch execution subtask set, classifying each batch execution subtask based on the resource type, and obtaining each class subtask set, including:
when detecting that an execution sequence exists among all batch execution subtasks corresponding to all the class subtask sets respectively;
acquiring preset execution sequences and task execution information corresponding to batch execution subtasks in each category subtask set, and determining corresponding rollback subtasks and target tasks corresponding to the rollback subtasks in each category subtask set based on the task execution information and the preset execution sequences;
deleting the rollback subtask and the target subtask in each category subtask set to obtain each update category subtask set, and taking each update category subtask set as each category subtask set.
The rollback subtask is a subtask to be executed for executing rollback operation, and represents rollback to a state of not performing task processing. The target subtask refers to a subtask to be executed that is restored by the rollback subtask. The preset execution sequence refers to the preset execution sequence among all batches of sub-tasks to be executed.
Specifically, when the server detects that an execution sequence exists among all batch execution subtasks in the category subtask set, a preset execution sequence corresponding to all batch execution subtasks in the category subtask set is obtained, and according to task execution information corresponding to all batch execution subtasks in the category subtask set, a batch task execution queue corresponding to the category subtask set is generated according to the preset execution sequence. And executing the task to obtain a batch task execution queue corresponding to each category of subtask set.
The server traverses batch task execution queues corresponding to the sub-task sets of each category according to the execution sequence, specifically traverses operation information in task execution information corresponding to each batch execution sub-task in the batch task execution queues, and determines rollback sub-tasks corresponding to the sub-task sets of each category and target sub-tasks corresponding to the rollback sub-tasks in each batch execution sub-task according to the operation information. For example, in a batch task execution queue corresponding to a file system resource, if operation information corresponding to a task 1 is a file a creation, and according to a preset execution sequence, operation information corresponding to a task 2 after the task 1 is a deletion file a, the task 2 is determined to be a rollback sub-task, and the task 1 is determined to be a target sub-task.
The server deletes the corresponding rollback subtask and the target subtask in each category subtask set to obtain an updated category subtask set corresponding to each category subtask set, and takes the updated category subtask set as a category subtask set to be processed subsequently.
In this embodiment, by analyzing and withholding the resource accesses, the withholding indicates that the operations are withheld from each other, which is equivalent to not performing any operation, and unnecessary resource accesses can be optimized, thereby improving task processing efficiency.
In one embodiment, the task processing method further includes:
when a request cancellation instruction sent by a request end corresponding to a service request is detected, generating a delay subtask cancellation instruction based on task execution information corresponding to a delay execution subtask, and executing the delay subtask cancellation instruction to obtain a delay task cancellation result corresponding to the delay execution subtask;
generating a batch task revocation instruction based on the batch task execution instruction, and executing the batch task revocation instruction to obtain a batch task revocation result;
and obtaining a task revocation result corresponding to the service request based on the delayed task revocation result and the batch task revocation result.
The request revocation instruction is an instruction of service request interruption sent by the request end. The deferred subtask undo instruction is an instruction for instructing the deferred execution of the subtask to perform a rollback operation. The batch task cancel instruction is an instruction for instructing batch execution subtasks to perform a rollback operation.
Specifically, when a server receives a request revocation instruction sent by a request end corresponding to a service request and detects that a delayed execution subtask set exists, generating a delayed subtask revocation instruction according to task execution information corresponding to each delayed execution subtask in the delayed execution subtask set, and executing the delayed subtask revocation instruction to obtain a delayed task revocation result corresponding to each delayed execution subtask in the delayed execution subtask set. The specific steps may be that the server sends each delayed subtask cancellation instruction to a task processing end corresponding to each delayed execution subtask according to the resource type corresponding to each delayed execution subtask. Searching a delayed task execution result of the delayed execution subtask corresponding to the task identifier by the task processing end according to the task identifier in each delayed subtask withdrawal instruction, and if the delayed task execution result corresponding to the task identifier is not searched, not processing; if the delayed task execution result corresponding to the task identifier is found, executing a delayed subtask cancellation instruction corresponding to the task identifier, and performing reverse processing according to operation information corresponding to the delayed execution subtask, for example, the delayed execution subtask is "creating file 1 in a database", and if the file 1 is detected in the database, the delayed subtask cancellation instruction corresponding to the delayed execution subtask is "deleting file 1 in the database", so as to obtain a delayed task cancellation result of the delayed execution subtask corresponding to the task identifier, for example, "creating file 1 cancellation succeeds".
According to the executing step, the server generates a batch task cancel instruction according to the batch task execute instruction, and executes the batch task cancel instruction to obtain a batch task cancel result. And the server generates a task revocation result corresponding to the service request according to the delayed task revocation result and the batch task revocation result, for example, the task revocation result is returned to a request end corresponding to the service request for display.
The server can also detect whether a task execution result corresponding to each sub-task to be executed exists when acquiring a request cancellation instruction sent by a request end corresponding to the service request, and take the sub-task to be executed with the task execution result as the sub-task to be cancelled, which indicates the task to be cancelled. And generating a corresponding task revocation instruction according to task execution information corresponding to the subtasks to be revoked, and executing the task revocation instruction to obtain a task revocation result corresponding to the service request.
In a specific embodiment, after generating a batch task execution queue corresponding to each category subtask set, and when any subtask to be executed is not executed, the server detects a request cancellation instruction sent by a request end corresponding to a service request, deletes the batch task execution queue corresponding to each category subtask set, generates a task cancellation result corresponding to the service request, and sends the task cancellation result to the request end corresponding to the service request for display.
The server may also generate task cancellation instructions corresponding to each sub-task to be executed when detecting that the sub-task to be executed is abnormal in execution, for example, after the sub-tasks to be executed of "order generation", "stock update" and "shipment order generation" in "order placing service" are completed, and when detecting that the task to be executed of "deduction" fails, that is, cancel the sub-tasks to be executed of "order generation", "stock update" and "shipment order generation" to obtain a task cancellation result corresponding to the service request.
In this embodiment, the task state of each sub-task to be executed is restored by performing reverse processing on the executed task, so that the task processing logic contradiction is avoided, and the accuracy of the subsequent task processing is ensured.
In one embodiment, step 208 generates a batch task execution instruction corresponding to each category subtask set based on the task execution information corresponding to each category subtask set, including:
determining a current category subtask set from each category subtask set, and extracting operation information corresponding to each batch execution subtask based on task execution information corresponding to each batch execution subtask in the current category subtask set;
Splicing the operation information corresponding to each batch execution subtask to obtain splicing operation information;
generating batch task execution instructions corresponding to the current category subtask set based on the splicing operation information;
traversing each category subtask set to obtain batch task execution instructions respectively corresponding to each category subtask set.
The operation information is information indicating how the sub-task to be executed is executed. The splicing operation information is information obtained after the operation information of each batch execution subtask is spliced.
Specifically, the server randomly determines the current category subtask set in each category subtask set, and can also take the category subtask set with the largest task number as the current category subtask set. And then acquiring operation information corresponding to each batch execution subtask in the current class subtask set, and splicing the operation information corresponding to each batch execution subtask to obtain splicing operation information corresponding to the current class subtask set, wherein 'data identification + data storage + data calculation + data acquisition' and 'plus' represent splicing symbols.
And then the server generates batch task execution instructions corresponding to the current class subtask set according to the splicing operation information. The server traverses each category subtask set, and according to the executing steps, batch task executing instructions respectively corresponding to each category subtask set are obtained. And then, sending the batch task execution instruction to the corresponding task processing resource to process the task, and obtaining a batch task execution result.
In this embodiment, the operation information of each batch execution subtask is spliced to obtain the splicing operation information, a batch task execution instruction is generated according to the splicing operation information, task processing is performed according to the batch task execution instruction, a batch task execution result is obtained, batch completion of tasks can be achieved, and therefore task processing efficiency is improved.
In one embodiment, generating a batch task execution instruction corresponding to each category subtask set based on task execution information corresponding to each category subtask set, performing task execution based on the batch task execution instruction, and obtaining a batch task execution result corresponding to each category subtask set, includes:
acquiring resource types respectively corresponding to the subtask sets of each category, and determining task processing resources respectively corresponding to the subtask sets of each category based on the resource types;
generating batch task execution instructions respectively corresponding to the sub-task sets of each category based on task execution information respectively corresponding to the sub-task sets of each category;
and sending the task batch execution instruction to task processing resources respectively corresponding to the sub-task sets of each category, and controlling the task processing resources to execute tasks according to the batch task execution instruction to obtain batch task execution results respectively corresponding to the sub-task sets of each category.
The task processing resource refers to task execution equipment for performing task processing, and may be external equipment.
Specifically, the server sends batch task execution instructions corresponding to each category subtask set to task processing resources corresponding to each category subtask set, wherein the task processing resources are such as IO devices (input and output devices) of databases, disk file systems, network transmission systems, printers and the like, and the batch execution subtasks in the category subtask sets are processed by the task processing resources in response to the batch task execution instructions. The server obtains the batch task execution results corresponding to the sub-task sets of each category returned by the task processing resource, and the batch task execution results can be task execution completion information.
In a specific embodiment, the resource type of the delayed execution subtask and the resource type of the dependent subtask to be executed may be the same, i.e. the delayed execution subtask and the dependent subtask to be executed may perform task processing in the same task processing resource. The server can generate a delayed task execution instruction according to the task execution information corresponding to the delayed execution subtask, and acquire the resource type corresponding to the delayed execution subtask. And the server determines corresponding task processing resources according to the resource types corresponding to the delayed execution subtasks and sends the delayed task execution instructions to the corresponding task processing resources. And searching and acquiring a task execution result of the subtask to be executed, which is dependent on the delayed task execution instruction, through the task processing resource, and executing the delayed task execution instruction by using the execution result to acquire a delayed task execution result corresponding to the delayed execution subtask. And the server receives the delayed task execution results corresponding to each delayed execution subtask returned by the task processing resource.
In a specific embodiment, the server may also instruct the task processing resource in advance to turn on the transaction mode, indicating that the transaction is automatically committed. When the task processing resource receives the task execution instruction and detects that related parameters in the task execution instruction are wrong (such as data storage address errors), the task processing resource automatically calls corresponding correct resources to perform task processing in a transaction mode, for example, when a database resource is processed, the transaction mode is started to perform batch write operation and the like.
In this embodiment, by generating a batch task execution instruction and sending the batch task execution instruction to a corresponding task processing resource to perform task processing, which is equivalent to merging tasks that access the task processing resource multiple times into one process, the cost of initializing the task processing resource is reduced, for example, the input resource access, the IO access, and the like, the opening required to be performed during the access is associated with the handle, the handle needs to be released after the storage, and especially the network output or the database output needs to be performed first for each access. And the frequency of resource racing and the probability of resource deadlock are reduced by executing batch task execution instructions by the task processing resources. Resource lock means that when some resources can only be called once or limited times at the same time, lock control is needed for the resources.
In one embodiment, as shown in FIG. 4, a schematic diagram of task processing is provided. The dashed boxes in the figure represent specific steps corresponding to the right-hand flow chart. The server is preset with a batch calling device which is used for calling task processing resources to execute all sub-tasks to be executed in the same batch, and the batch refers to a group of service requests initiated by a request end at one time. The batch calling device comprises a calling association device, a preset batch task execution queue, a preset callback queue, an isolation device and a submitting device. The calling association device is used for establishing an association relationship between the service request and the subtasks to be executed. The preset batch task execution queue is used for storing batch execution subtasks. The callback queue is used for storing the delayed execution subtasks. The isolation device is used for managing the subtasks to be executed and comprises a resource access control center used for calling the resources corresponding to each subtask to be executed. The submitting means is for executing the task. Resource access may be considered as handing a specified task (such as data) to a processing resource for processing, such as outputting data for storage.
When the server receives the service request sent by the request end, a batch calling device is started, and the association relation between the service request and the corresponding subtasks to be executed and the association relation between each service request in a group of service requests are established by calling the association device. The call association device can establish association relationship by using a context, a thread identifier, a call identifier and the like.
The batch calling device judges the number of subtasks to be executed corresponding to the service request, if the number of subtasks to be executed is smaller than a preset task number threshold value, the isolation device is not started, and the submitting device is called to immediately execute the subtasks to be executed. And if the number of the subtasks to be executed exceeds a preset task number threshold, starting the isolation device. Extracting task execution information corresponding to each sub-task to be executed through an isolation device, and determining delayed execution sub-tasks and batch execution sub-tasks in each sub-task to be executed according to the task execution information and a preset execution sequence, namely determining task types of each sub-task to be executed. And storing task execution information corresponding to the delayed execution subtasks into a preset callback queue through a resource access control center, orderly recording the resource types corresponding to the batch execution subtasks into preset batch task execution queues corresponding to the resource types, and determining task processing resources required to be called by each batch task execution queue.
After the batch calling device detects that the task category and the task processing resource corresponding to each sub-task to be executed are determined to be completed, the batch calling is finished. And respectively merging the batch task execution queues corresponding to the sub-task sets of each category into batch task execution instructions corresponding to the sub-task sets of each category through the submitting device, calling output resources corresponding to the sub-task sets of each category to execute, wherein the output resources represent task processing resources. And if the delayed execution subtask exists in the preset callback queue, executing the delayed execution subtask.
In the embodiment, the resource access control center uniformly controls the resource access and the resource access interception control, and the interception shows that the output task is suspended to the resource for processing after the isolation device is started, so that the batch processing efficiency of the subtasks to be executed is improved. And by executing batch task execution instructions, the calling times of output resources are reduced, so that the loss and blockage caused by frequent resource access are reduced.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a task processing device for realizing the task processing method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation of one or more embodiments of the task processing device provided below may refer to the limitation of the task processing method hereinabove, and will not be repeated herein.
In one embodiment, as shown in FIG. 5, there is provided a task processing device 500 comprising: 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:
the acquiring module 502 is configured to acquire a service request, where the service request includes each subtask to be executed and corresponding task execution information;
the determining module 504 is configured to determine, based on the task execution information, a dependency relationship corresponding to each sub-task to be executed, and determine, based on the dependency relationship, a delayed execution sub-task set and a batch execution sub-task set from each sub-task to be executed;
the classification module 506 is configured to obtain resource types corresponding to each batch execution subtask in the batch execution subtask set, classify each batch execution subtask based on the resource types, and obtain each class subtask set;
The batch execution module 508 is configured to generate batch task execution instructions corresponding to the respective category subtask sets based on task execution information corresponding to the respective category subtask sets, and perform task execution based on the batch task execution instructions to obtain batch task execution results corresponding to the respective category subtask sets;
the delayed execution module 510 is configured to execute each delayed execution subtask in the delayed execution subtask set based on the batch task execution result, to obtain a delayed task execution result;
the result module 512 is configured to obtain an execution result of the service request based on the batch task execution result and the delayed task execution result.
In one embodiment, the determining module 504 includes:
the dependency relationship dividing unit is used for determining a dependent execution subtask set and a non-dependent execution subtask set in each subtask to be executed based on the dependency relationship, wherein the dependent execution subtask set comprises a priority execution subtask set and a delayed execution subtask set; and taking the preferentially-executed subtask set and the non-dependent execution subtask set as batch execution subtask sets.
In one embodiment, the task processing device 500 further includes:
the priority execution unit is used for determining a priority execution subtask set and a target batch execution subtask set from all subtasks to be executed based on the dependency relationship, wherein the target batch execution subtask set comprises a delayed execution subtask set and an independent execution subtask set; executing each priority execution subtask in the priority execution subtask set to obtain a priority task execution result; acquiring resource types corresponding to all target batch execution subtasks in the target batch execution subtasks, and classifying all target batch execution subtasks based on the resource types to obtain all target class subtask sets; generating target batch task execution instructions respectively corresponding to the target class subtask sets based on task execution information respectively corresponding to the target class subtask sets, and performing task execution based on the target batch task execution instructions and the priority task execution results to obtain target batch task execution results respectively corresponding to the target class subtask sets; and obtaining the execution result of the service request based on the priority task execution result and the target batch task execution result.
In one embodiment, classification module 506 includes:
the task updating unit is used for detecting that an execution sequence exists among all batch execution subtasks corresponding to all class subtask sets respectively; acquiring preset execution sequences and task execution information corresponding to batch execution subtasks in each category subtask set, and determining corresponding rollback subtasks and target tasks corresponding to the rollback subtasks in each category subtask set based on the task execution information and the preset execution sequences; and deleting the rollback subtask and the target subtask in each category subtask set to obtain each update category subtask set, and taking each update category subtask set as each category subtask set.
In one embodiment, the task processing device 500 further includes:
the task cancellation unit is used for generating a delayed subtask cancellation instruction based on task execution information corresponding to the delayed execution subtask when a request cancellation instruction sent by a request end corresponding to the service request is detected, and executing the delayed subtask cancellation instruction to obtain a delayed task cancellation result corresponding to the delayed execution subtask; generating a batch task revocation instruction based on the batch task execution instruction, and executing the batch task revocation instruction to obtain a batch task revocation result; and obtaining a task revocation result corresponding to the service request based on the delayed task revocation result and the batch task revocation result.
In one embodiment, batch executive module 508 includes:
the information splicing unit is used for determining a current category subtask set from each category subtask set, and extracting operation information corresponding to each batch execution subtask based on task execution information corresponding to each batch execution subtask in the current category subtask set; splicing the operation information corresponding to each batch execution subtask to obtain splicing operation information; generating batch task execution instructions corresponding to the current category subtask set based on the splicing operation information; traversing each category subtask set to obtain batch task execution instructions respectively corresponding to each category subtask set.
In one embodiment, batch executive module 508 includes:
the resource processing unit is used for acquiring the resource types respectively corresponding to the sub-task sets of each category and determining task processing resources respectively corresponding to the sub-task sets of each category based on the resource types; generating batch task execution instructions respectively corresponding to the sub-task sets of each category based on task execution information respectively corresponding to the sub-task sets of each category; and sending the task batch execution instruction to task processing resources respectively corresponding to the sub-task sets of each category, and controlling the task processing resources to execute tasks according to the batch task execution instruction to obtain batch task execution results respectively corresponding to the sub-task sets of each category.
The various modules in the task processing device described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used for storing task execution information. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a task processing method.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 7. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a task processing method. The display unit of the computer equipment is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device, wherein the display screen can be a liquid crystal display screen or an electronic ink display screen, the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on a shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structures shown in fig. 6-7 are block diagrams of only some of the structures that are relevant to the present application and are not intended to limit the computer device on which the present application may be implemented, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data are required to comply with the related laws and regulations and standards of the related countries and regions.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples only represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.

Claims (10)

1. A method of task processing, the method comprising:
acquiring a service request, wherein the service request comprises each subtask to be executed and corresponding task execution information;
determining a dependency relationship corresponding to each subtask to be executed based on the task execution information, and determining a delayed execution subtask set and a batch execution subtask set from each subtask to be executed based on the dependency relationship;
Acquiring resource types corresponding to all batch execution subtasks in the batch execution subtasks, classifying all batch execution subtasks based on the resource types, and obtaining all class subtask sets;
generating batch task execution instructions respectively corresponding to the sub-task sets of each category based on task execution information respectively corresponding to the sub-task sets of each category, and performing task execution based on the batch task execution instructions to obtain batch task execution results respectively corresponding to the sub-task sets of each category;
executing each delayed execution subtask in the delayed execution subtask set based on the batch task execution result to obtain a delayed task execution result;
and obtaining an execution result of the service request based on the batch task execution result and the delay task execution result.
2. The method of claim 1, wherein the determining a delayed execution subtask set and a batch execution subtask set from the respective subtasks to be executed based on the dependency relationship comprises:
determining a dependent execution subtask set and a non-dependent execution subtask set in each subtask to be executed based on the dependency relationship, wherein the dependent execution subtask set comprises a priority execution subtask set and the delayed execution subtask set;
And taking the priority execution subtask set and the independent execution subtask set as the batch execution subtask set.
3. The method according to claim 2, characterized in that the method further comprises:
determining a priority execution subtask set and a target batch execution subtask set from the subtasks to be executed based on the dependency relationship, wherein the target batch execution subtask set comprises the delayed execution subtask set and the independent execution subtask set;
executing each priority execution subtask in the priority execution subtask set to obtain a priority task execution result;
acquiring resource types corresponding to all target batch execution subtasks in the target batch execution subtasks, classifying all target batch execution subtasks based on the resource types, and obtaining all target class subtask sets;
generating target batch task execution instructions respectively corresponding to the target class subtask sets based on task execution information respectively corresponding to the target class subtask sets, and executing tasks based on the target batch task execution instructions and the priority task execution results to obtain target batch task execution results respectively corresponding to the target class subtask sets;
And obtaining an execution result of the service request based on the priority task execution result and the target batch task execution result.
4. The method of claim 1, wherein the obtaining the resource type corresponding to each batch execution subtask in the batch execution subtask set, classifying each batch execution subtask based on the resource type, and obtaining each class subtask set includes:
when detecting that an execution sequence exists among all batch execution subtasks corresponding to all the class subtask sets respectively;
acquiring preset execution sequences and task execution information corresponding to batch execution subtasks in each category subtask set, and determining corresponding rollback subtasks and target tasks corresponding to the rollback subtasks in each category subtask set based on the task execution information and the preset execution sequences;
deleting the rollback subtask and the target subtask in each category subtask set to obtain each update category subtask set, and taking each update category subtask set as each category subtask set.
5. The method according to claim 1, characterized in that the method further comprises:
When a request cancellation instruction sent by a request end corresponding to the service request is detected, generating a delay subtask cancellation instruction based on task execution information corresponding to the delay execution subtask, and executing the delay subtask cancellation instruction to obtain a delay task cancellation result corresponding to the delay execution subtask;
generating a batch task revocation instruction based on the batch task execution instruction, and executing the batch task revocation instruction to obtain the batch task revocation result;
and obtaining a task revocation result corresponding to the service request based on the delayed task revocation result and the batch task revocation result.
6. The method of claim 1, wherein generating the batch task execution instruction respectively corresponding to the respective category subtask sets based on the task execution information respectively corresponding to the respective category subtask sets, comprises:
determining a current category subtask set from the category subtask sets, and extracting operation information corresponding to each batch execution subtask based on task execution information corresponding to each batch execution subtask in the current category subtask set;
splicing the operation information corresponding to each batch execution subtask to obtain splicing operation information;
Generating batch task execution instructions corresponding to the current category subtask set based on the splicing operation information;
traversing the sub-task sets of each category to obtain batch task execution instructions respectively corresponding to the sub-task sets of each category.
7. The method of claim 1, wherein the generating, based on the task execution information respectively corresponding to the respective category subtask sets, a batch task execution instruction respectively corresponding to the respective category subtask sets, performing task execution based on the batch task execution instruction, and obtaining a batch task execution result respectively corresponding to the respective category subtask sets, includes:
acquiring resource types respectively corresponding to the sub-task sets of each category, and determining task processing resources respectively corresponding to the sub-task sets of each category based on the resource types;
generating batch task execution instructions respectively corresponding to the sub-task sets of each category based on task execution information respectively corresponding to the sub-task sets of each category;
and sending the task batch execution instruction to task processing resources respectively corresponding to the sub-task sets of each category, and controlling the task processing resources to execute tasks according to the batch task execution instruction to obtain batch task execution results respectively corresponding to the sub-task sets of each category.
8. A task processing device, the device comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a service request, and the service request comprises each subtask to be executed and corresponding task execution information;
the determining module is used for determining the dependency relationship corresponding to each subtask to be executed based on the task execution information, and determining a delayed execution subtask set and a batch execution subtask set from each subtask to be executed based on the dependency relationship;
the classification module is used for acquiring the resource types corresponding to all the batch execution subtasks in the batch execution subtasks, classifying all the batch execution subtasks based on the resource types, and obtaining all the class subtask sets;
the batch execution module is used for generating batch task execution instructions respectively corresponding to the sub-task sets of each category based on task execution information respectively corresponding to the sub-task sets of each category, and executing tasks based on the batch task execution instructions to obtain batch task execution results respectively corresponding to the sub-task sets of each category;
the delay execution module is used for executing each delay execution subtask in the delay execution subtask set based on the batch task execution result to obtain a delay task execution result;
And the result module is used for obtaining the execution result of the service request based on the batch task execution result and the delayed task execution result.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202310139451.2A 2023-02-02 2023-02-02 Task processing method, device, computer equipment and storage medium Pending CN116204291A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310139451.2A CN116204291A (en) 2023-02-02 2023-02-02 Task processing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310139451.2A CN116204291A (en) 2023-02-02 2023-02-02 Task processing method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116204291A true CN116204291A (en) 2023-06-02

Family

ID=86515546

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310139451.2A Pending CN116204291A (en) 2023-02-02 2023-02-02 Task processing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116204291A (en)

Similar Documents

Publication Publication Date Title
CN110321958B (en) Training method of neural network model and video similarity determination method
US9348677B2 (en) System and method for batch evaluation programs
CN108280150B (en) Distributed asynchronous service distribution method and system
CN109564566B (en) Discovery of calling applications for controlling file hydration behavior
WO2023040612A1 (en) Order processing method and apparatus
CN110673959A (en) System, method and apparatus for processing tasks
US10997158B2 (en) Techniques for updating big data tables using snapshot isolation
CN113051055A (en) Task processing method and device
US20160125003A1 (en) Secondary queue for index process
CN113094125A (en) Business process processing method, device, server and storage medium
EP3995973A2 (en) File moving method, apparatus, and medium
CN115373822A (en) Task scheduling method, task processing method, device, electronic equipment and medium
CN116204291A (en) Task processing method, device, computer equipment and storage medium
CN114816684A (en) Business processing method, device, equipment, readable storage medium and product
CN107705089B (en) Service processing method, device and equipment
CN112231290A (en) Method, device and equipment for processing local log and storage medium
CN114546705B (en) Operation response method, operation response device, electronic apparatus, and storage medium
CN107209882B (en) Multi-stage de-registration for managed devices
US11442668B2 (en) Prioritizing volume accesses in multi-volume storage device based on execution path of a service
CN116010126B (en) Service aggregation method, device and system
CN114969042A (en) Table service management method, system and device based on data lake and electronic equipment
CN116909705A (en) Batch task processing method and system
CN117311930A (en) Task scheduling method, device, equipment, storage medium and program product
CN116775284A (en) Task processing method, device, computer equipment and storage medium
CN117453415A (en) Data auditing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination