Task processing method and device, computer equipment and storage medium
By acquiring and processing shared node target processing nodes in multiple pending tasks, the automatic merge processing of multiple tasks is realized, solving the problems of merging processing complexity and increase expansion points in the prior art, and improving processing efficiency and development Simplicity.
Patent Information
- Application Number
- CN202310798058.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2024-12-31
AI Technical Summary
When the prior art merges and processes multiple tasks, it is necessary to add expansion points and manual intervention, resulting in large business development processing volume and difficult to support any number of tasks merging.
By obtaining the target processing node of the shared node in the execution state and processing when all the target nodes are in the execution state, the automatic merge processing of multiple pending tasks is realized to avoid adding expansion points and manual intervention.
It realizes the automatic completion of the merger of multiple pending tasks without affecting the original code, simplifies business development and supports any number of tasks.
Smart Images

Figure CN119228468A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer processing, and in particular to a task processing method, apparatus, computer equipment and storage medium. Background Art
[0002] After a task execution instruction is triggered, there may be multiple corresponding processing tasks. For example, for the combined payment of ordinary goods and pre-sale goods, since the payment processing logic of ordinary goods and pre-sale goods is different, if the payment is combined, multiple processing tasks will need to be combined. Summary of the invention
[0003] In view of this, the present disclosure provides a task processing method, apparatus, computer device and storage medium to solve the problem of merging multiple processing tasks of the same task execution instruction.
[0004] In a first aspect, the present disclosure provides a task processing method, the method comprising:
[0005] In response to a task execution instruction, a plurality of tasks to be processed corresponding to the task execution instruction are acquired, and the plurality of tasks to be processed are executed; wherein each task to be processed includes a plurality of processing nodes;
[0006] For each processing node in the executing state in the task to be processed, if the node type of the processing node in the executing state is a shared node, multiple target processing nodes corresponding to the shared node are obtained; wherein the multiple target processing nodes corresponding to the shared node are respectively a processing node in different tasks to be processed;
[0007] If the multiple target processing nodes corresponding to the shared node are all in an execution state, the multiple target processing nodes corresponding to the shared node are processed.
[0008] In a second aspect, the present disclosure provides a task processing device, the device comprising:
[0009] A task acquisition module, used for acquiring a plurality of pending tasks corresponding to the task execution instruction in response to the task execution instruction; wherein each pending task includes a plurality of processing nodes;
[0010] A target processing node acquisition module is used for acquiring, for each processing node in the execution state in each task to be processed, a plurality of target processing nodes corresponding to the shared node if the node type of the processing node in the execution state is a shared node; wherein the plurality of target processing nodes corresponding to the shared node are respectively a processing node in different tasks to be processed;
[0011] The node processing module is used to process the multiple target processing nodes corresponding to the shared node if the multiple target processing nodes corresponding to the shared node are all in an execution state.
[0012] In a third aspect, the present disclosure provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, computer instructions are stored in the memory, and the processor executes the task processing method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0013] In a fourth aspect, the present disclosure provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the task processing method of the first aspect or any corresponding embodiment thereof.
[0014] The task processing method provided by the embodiment of the present disclosure corresponds to a plurality of tasks to be processed for one task execution instruction, that is, the task execution instruction triggers the processing of a plurality of tasks to be processed. During the processing, the status of the processing node in each task to be processed is marked. For a processing node in an executing state, if its node type is a shared node, multiple target processing nodes corresponding to the shared node are obtained, and these target processing nodes are target processing nodes in different tasks to be processed. When all target processing nodes are in an executing state, these target processing nodes are processed, thereby realizing the merge processing of the shared nodes in the plurality of tasks to be processed, thereby realizing the automatic completion of the merge processing of the plurality of tasks to be processed without affecting the original codes of each task to be processed. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0016] Figure 1a-Figure 1c is a schematic diagram of a task processing method in the related art;
[0017] Figure 2 is a flowchart of a task processing method according to an embodiment of the present disclosure;
[0018] Figure 3 is a flowchart of another task processing method according to an embodiment of the present disclosure;
[0019] Figure 4 is a flowchart of another task processing method according to an embodiment of the present disclosure;
[0020] Figure 5a-5c is a schematic diagram of a task processing method according to an embodiment of the present disclosure;
[0021] Figure 6 is a structural block diagram of a task processing device according to an embodiment of the present disclosure;
[0022] Figure 7 It is a schematic diagram of the hardware structure of the computer device of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0024] In some business scenarios, the same task execution instruction will trigger multiple pending tasks, and accordingly, these multiple pending tasks need to be merged. For example, on a shopping platform, multiple orders need to be merged. If there are pre-sale and non-pre-sale items, the payment process for pre-sale and non-pre-sale orders is different, so it involves merging pending tasks with different payment processes.
[0025] For example, Figure 1a It shows the processing task A of non-pre-sale goods. Figure 1b The processing task B of the pre-sale goods is shown. When the pre-sale goods and non-pre-sale goods are combined for ordering, the processing tasks A and B need to be combined for processing. By comparing the processing tasks A and B, it can be seen that the two have their own unique processing nodes and common processing nodes. Figure 1a as well as Figure 1b As shown, in processing task A and processing task B, the processing nodes filled with lines are unique processing nodes of each, and the rest are common processing nodes of both. In the following description, the unique processing nodes are referred to as non-shared nodes, and the common processing nodes are referred to as shared nodes.
[0026] In the related art, the merging process of multiple processing tasks is to merge the multiple processing tasks into a large and comprehensive task, and then skip the non-shared nodes through the extension point. For example, Figure 1a and Figure 1b The two processing tasks shown in the figure are combined and processed to obtain the following Figure 1cWhen merging, the extension points are used to determine whether each processing task needs to skip a processing node. The specific processing process is as follows: Figure 1c As shown, for each unique processing node of each processing task, the extension point is used to determine whether the remaining processing tasks need to skip the processing node.
[0027] By analyzing the above processing method, it can be seen that in the above method, multiple processing tasks need to be merged into a large and comprehensive task. When a new processing task appears, it is necessary to process the previously merged task and increase the extension point definition, which leads to a large amount of processing for business development.
[0028] Based on this, the embodiment of the present disclosure provides a task processing method, which processes multiple pending tasks corresponding to the same task execution instruction, and based on the processing nodes in the execution state among the multiple pending tasks, if their node types are shared nodes, coordinates the processing of multiple target processing nodes corresponding to the shared nodes to achieve the merging of multiple pending tasks. The method automatically completes the merging of target processing nodes in multiple pending tasks based on shared nodes, does not require adding extension points to skip processing nodes, does not require manual intervention, and supports the merging of any number of processing tasks.
[0029] According to an embodiment of the present disclosure, a task processing method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] In this embodiment, a task processing method is provided, which can be used in computer devices, such as mobile terminals and computers, etc. Figure 2 is a flowchart of a task processing method according to an embodiment of the present disclosure, such as Figure 2 As shown, the process includes the following steps:
[0031] Step S201 , in response to a task execution instruction, obtaining a plurality of tasks to be processed corresponding to the task execution instruction, and executing the plurality of tasks to be processed.
[0032] Each task to be processed includes multiple processing nodes.
[0033] The task execution instruction is triggered by the user based on the current processing needs. For example, in the shopping scenario, the user interacts with the order settlement page and selects multiple products for combined payment. The instruction corresponding to the action that triggers the combined payment is called the task execution instruction, and the multiple pending tasks corresponding to the task execution instruction are the payment of multiple products. For another example, in the business review scenario, the user interacts with the review page and selects the object to be reviewed for review. The instruction corresponding to the action that triggers the submission of the review is called the task execution instruction, and the multiple pending tasks corresponding to the task execution instruction are multiple approval flows.
[0034] Of course, the application scenarios of the task execution instruction and its corresponding multiple tasks to be processed are not limited to those described above, and can be specifically set according to actual needs.
[0035] After receiving the task execution instruction, multiple pending tasks corresponding to the task execution instruction will be triggered to complete the processing of the task execution instruction. For example, in combination with the shopping scenario described above, each commodity corresponds to a pending task. Since it is a combined order of multiple commodities, there will be multiple pending tasks. For another example, in combination with the audit scenario described above, there will be multiple approval processes (including but not limited to financial approval and process approval) for the audited object, and each approval process corresponds to a pending task.
[0036] When processing each pending task, multiple processing nodes are involved. After multiple processing nodes process the task, the processing of the pending task is completed. Figure 1a As shown, the processing nodes corresponding to the pending task A include parameter verification, querying product information, querying address, querying seller information, saving order and payment.
[0037] Step S202 : for each processing node in the executing state in the task to be processed, if the node type of the processing node in the executing state is a shared node, then a plurality of target processing nodes corresponding to the shared node are obtained.
[0038] The multiple target processing nodes corresponding to the shared node are respectively a processing node in different tasks to be processed.
[0039] The types of processing nodes include shared nodes and non-shared nodes. For multiple tasks to be processed, each task to be processed includes multiple processing nodes. These processing nodes may be shared by at least two tasks to be processed, and they are called shared nodes. The shared nodes and non-shared nodes can be marked in the tasks to be processed, that is, which processing nodes are shared nodes and which processing nodes are non-shared nodes are marked in advance in the tasks to be processed. For shared nodes, it is also marked with which processing nodes they are shared with.
[0040] For example, the pending task 1 includes processing nodes 11, 12, and 13, the pending task 2 includes processing nodes 21, 22, and 23, and the pending task 3 includes processing nodes 31, 32, and 33. The processing methods of processing nodes 11 and 21 are the same, so the node types of processing nodes 11 and 21 are shared nodes and correspond. The processing methods of processing nodes 23 and 33 are the same, so the node types of processing nodes 23 and 33 are shared nodes and correspond.
[0041] It should be noted that the determination of shared nodes and non-shared nodes can also be determined after analyzing the processing nodes of each task to be processed during the processing of multiple tasks to be processed. The method for determining shared nodes and non-shared nodes is not limited here and is specifically set according to actual needs.
[0042] For each pending task, if a processing node is being processed, the node is referred to as a processing node in the execution state. The processing state of the processing node can be marked by a processing identifier or by other means, and no limitation is made here. For a processing node in the execution state, if its node type is a shared node, multiple target processing nodes corresponding to the shared node are obtained, and these target processing nodes are respectively a processing node in different pending tasks. For example, continuing with the above example, if the processing node in the execution state of pending task 1 is processing node 11, since the node type of processing node 11 is a shared node, the target processing node corresponding to processing node 11 is obtained, that is, processing node 21 and processing node 11 in pending task 2.
[0043] In the process of processing each task to be processed, the node type of the processing node in the execution state in each task to be processed is determined. That is, before processing each processing node in the execution state, each task to be processed first analyzes the node type of the processing node and then performs subsequent processing.
[0044] The node type may be determined by querying the identifier of the processing node in the execution state, or analyzing it, etc. The specific determination method is not limited here, and it can be set according to the actual situation.
[0045] Step S203: If the multiple target processing nodes corresponding to the shared node are all in the execution state, the multiple target processing nodes corresponding to the shared node are processed.
[0046] When the states of the multiple target processing nodes corresponding to the shared node are all in the executing state, the multiple target processing nodes corresponding to the shared node are processed. Continuing with the above example, for pending tasks 1 and 2, if the states of processing node 11 and its corresponding processing node 21 are both in the executing state, processing node 11 and processing node 21 are merged and processed.
[0047] The coordination of the processing nodes in the execution state of each task to be processed is based on the node type. If the node type of the processing node in the execution state is a shared node, it means that the processing node is a processing node shared by at least two tasks to be processed, and it is merged.
[0048] In some optional real-time methods, if the node type of the processing node in the executing state is a non-shared node, it means that the processing node is unique to the task to be processed. In this case, the processing node in the executing state can be processed without caring about the other tasks to be processed.
[0049] The task processing method provided in this embodiment corresponds to a plurality of tasks to be processed for one task execution instruction, that is, the task execution instruction triggers the processing of a plurality of tasks to be processed. During the processing, the status of the processing node in each task to be processed is marked. For a processing node in the executing state, if its node type is a shared node, multiple target processing nodes corresponding to the shared node are obtained, and these target processing nodes are target processing nodes in different tasks to be processed. When all target processing nodes are in the executing state, these target processing nodes are processed, thereby realizing the merge processing of the shared nodes in the plurality of tasks to be processed, thereby realizing the automatic completion of the merge processing of the plurality of tasks to be processed without affecting the original code of each task to be processed.
[0050] In some optional implementations, the above task processing method further includes:
[0051] Step a1: if there is a target processing node in a non-executing state among the plurality of target processing nodes, the state of the target processing node in the executing state is changed to a suspended state.
[0052] Step a2: If the state of the target processing node in the non-executing state is changed to the executing state, the state of the target processing node in the paused state is changed to the executing state.
[0053] As described above, the premise for merging and processing multiple target processing nodes is that the states of all target processing nodes are in the executing state. If there is a target processing node in the non-executing state among the multiple target processing nodes, it is necessary to wait for its state to be changed to the executing state. That is, the processing of the target processing node in the executing state is suspended, and the state of the target processing node in the non-executing state is waited for and changed to the executing state. Specifically, the state of the target processing node in the executing state is changed to the suspended state, and the current processing state of the target processing node in the non-executing state is monitored. If the state of the target processing node in the non-executing state is changed to the executing state, the state of the target processing node in the suspended state is changed to the executing state.
[0054] If there is a target processing node in a non-executing state, the processing of the target processing node in an executing state is suspended, and the state of the processing node in a non-executing state is waited for to be changed to an executing state. For example, through the signal interaction between pending task 1 and pending task 2, each can know the processing progress of the other party to determine whether the status of all target processing nodes is in an executing state.
[0055] In some optional embodiments, changing the state of the target processing node in the executing state to the paused state in the above step a1 includes: sending a pause processing signal to the pending task corresponding to the target processing node in the executing state to change the state of the target processing node in the executing state to the paused state.
[0056] The state change of the target processing node in the executing state is determined by signal interaction. Specifically, when there is a processing node in the non-executing state, a pause processing signal is sent to the pending task corresponding to the target processing node in the executing state, thereby changing the state of the target processing node in the executing state to a paused state.
[0057] In some optional embodiments, changing the state of the target processing node in the paused state to the executing state in the above step a2 includes: sending a signal to start processing to the pending task that has been paused to change the state of the target processing node in the paused state to the executing state.
[0058] After determining that the state of the target processing node in the non-executing state is changed to the executing state, a signal to start processing is sent to the pending task that has been paused, thereby changing the state of the target processing node in the paused state to the executing state, so as to merge the multiple target processing nodes corresponding to the shared node.
[0059] The processing of multiple target processing nodes is coordinated by signal notification, so that the pending tasks corresponding to the multiple target processing nodes corresponding to the shared node can know each other's current processing progress, thereby ensuring the combined processing of multiple target processing nodes.
[0060] Since the node type of each processing node in the pending task can be determined, and for the corresponding shared node, the multiple target processing nodes corresponding to the shared node can be known. Based on this, in the processing process of each pending task, the node type of the processing node in the execution state is monitored. If it is a shared node, the state of the multiple target processing nodes corresponding to the shared node must be determined, that is, whether the state of the multiple target processing nodes is also in the execution state. When the states of all target processing nodes are in the execution state, the multiple target processing nodes corresponding to the shared node are merged and processed, thereby realizing the automatic merging of multiple pending tasks. Among them, in the case of a target processing node in a non-executing state, the state of the target processing node in the execution state is changed to a suspended state, and the state of the target processing node in the non-executing state is changed to an executing state, so that the multiple target processing nodes corresponding to the shared node can be merged and processed.
[0061] In this embodiment, a task processing method is provided, which can be used in computer devices, such as mobile terminals and computers, etc. Figure 3 is a flowchart of a task processing method according to an embodiment of the present disclosure, such as Figure 3 As shown, the process includes the following steps:
[0062] Step S301 , in response to a task execution instruction, obtaining a plurality of tasks to be processed corresponding to the task execution instruction, and executing the plurality of tasks to be processed.
[0063] Each task to be processed includes multiple processing nodes. Figure 2 The description of step S201 of the illustrated embodiment will not be repeated here.
[0064] Step S302 : for each processing node in the executing state in the task to be processed, if the node type of the processing node in the executing state is a shared node, then a plurality of target processing nodes corresponding to the shared node are obtained.
[0065] The multiple target processing nodes corresponding to the shared node are respectively a processing node in different tasks to be processed. Figure 2 The description of step S202 of the illustrated embodiment will not be repeated here.
[0066] Step S303: If the multiple target processing nodes corresponding to the shared node are all in the execution state, the multiple target processing nodes corresponding to the shared node are processed.
[0067] Specifically, the above step S303 includes:
[0068] Step S3031, processing the shared node to obtain a processing result.
[0069] The processing of the shared node is performed according to the processing logic of the shared node, and the shared node is processed according to its processing logic to obtain a corresponding processing result.
[0070] Step S3032, feeding back the processing result to the pending tasks corresponding to the multiple target processing nodes, so as to change the state of the next processing node of the pending tasks corresponding to the multiple target processing nodes to an executing state.
[0071] After the processing results are obtained, they are fed back to the pending tasks corresponding to the multiple target processing nodes so that the corresponding pending tasks can know the processing results. Since the processing methods of the multiple target processing nodes are consistent with those of the shared nodes, their corresponding processing results are also consistent. Therefore, the combined processing of multiple target processing nodes is achieved by sharing the processing results.
[0072] Step S304: If the node type of the processing node in the executing state is a non-shared node, the processing node in the executing state is processed. Figure 2 The corresponding description in step S203 of the illustrated embodiment will not be repeated here.
[0073] The task processing method provided in this embodiment only needs to perform one processing to obtain the processing result for multiple target processing nodes corresponding to the shared node, and the processing result is fed back to the pending tasks of the multiple target processing nodes. After obtaining the processing result, each pending task can perform subsequent processing to change the state of the next processing node of the pending tasks corresponding to the multiple target processing nodes to the executing state, thereby realizing automatic merging processing of the multiple target processing nodes.
[0074] In this embodiment, a task processing method is provided, which can be used in computer devices, such as mobile terminals and computers, etc. Figure 4 is a flowchart of a task processing method according to an embodiment of the present disclosure, such as Figure 4 As shown, the process includes the following steps:
[0075] Step S401 , in response to a task execution instruction, obtaining a plurality of tasks to be processed corresponding to the task execution instruction, and executing the plurality of tasks to be processed.
[0076] Each task to be processed includes multiple processing nodes.
[0077] Specifically, the above step S401 includes:
[0078] Step S4011, in response to the task execution instruction, obtaining the object to be processed in the task execution instruction.
[0079] For a task execution instruction, it has a corresponding object to be processed. For example, in a shopping scenario, the task execution instruction of combined payment corresponds to the commodity to be paid; in an approval scenario, the task execution instruction of submitting for approval corresponds to the object to be approved.
[0080] Step S4012: Based on the object to be processed, determine a plurality of tasks to be processed and the attributes of the processing nodes in each task to be processed.
[0081] Among them, the attributes include the node type.
[0082] After determining the object to be processed, the task to be processed corresponding to the object to be processed can be determined. For example, in a shopping scenario, multiple commodities to be paid correspond to multiple tasks to be processed; in an approval scenario, multiple tasks to be processed corresponding to the object to be approved can be determined by analyzing the object to be approved. For each task to be processed, the processing nodes included in the task to be processed are determined in advance, so as to obtain the attributes of the processing nodes, which include the node type. Among them, the types of processing nodes include the shared nodes and non-shared nodes described above. Other information may also be included in the attributes. For example, if the node type is a shared node, the processing node also includes the target processing node corresponding to the shared node, that is, it is marked with which processing nodes in the tasks to be processed the shared node corresponds to. Using the object to be processed in the task execution instruction, the attributes of multiple tasks to be processed and the processing nodes in the tasks to be processed are obtained, thereby ensuring the accuracy of the tasks to be processed and the processing nodes.
[0083] In some optional implementations, the above step S4012 includes:
[0084] Step b1, obtaining a preset mapping relationship corresponding to a preset processing object, wherein the preset mapping relationship includes a preset task and attributes of a processing node in the preset task.
[0085] Step b2: using the object to be processed to query the preset mapping relationship, determine the multiple tasks to be processed and the attributes of the processing nodes in each task to be processed.
[0086] The preset processing object is the processing object in the processing task. The preset processing object corresponds to a preset mapping relationship, which includes the preset task and the attributes of the processing node in the preset task. That is, before the task to be processed is processed, the preset mapping relationship corresponding to each preset processing object has been determined in advance. It should be noted that the preset processing objects here are divided according to the type of object. Objects of the same type belong to the same preset processing object, and their corresponding preset mapping relationships are the same. For example, the types of goods include pre-sale goods and non-pre-sale goods. If multiple goods to be paid are non-pre-sale goods, then these multiple goods to be paid correspond to the same preset mapping relationship.
[0087] After the above steps are processed, the to-be-processed object in the task execution instruction is determined, and then by querying the preset mapping relationship, the multiple to-be-processed tasks corresponding to the task execution instruction and the attributes of the processing nodes in the to-be-processed tasks can be determined.
[0088] By determining the preset tasks and the types of processing nodes in the preset tasks in advance, that is, by statically determining the types of processing nodes, the data processing process can be simplified and the task processing efficiency can be improved.
[0089] Step S4013, starting threads corresponding to the tasks to be processed one by one, so as to process the tasks to be processed in parallel.
[0090] The task execution instruction corresponds to a plurality of tasks to be processed, and threads corresponding to the tasks to be processed are started to process the tasks to be processed, thereby realizing parallel processing of the tasks to be processed.
[0091] Step S4014: for each processing node in the executing state in the to-be-processed task, determine the node type of the processing node in the executing state based on the attribute of the processing node in the executing state.
[0092] For each processing node in the execution state in each task to be processed, the processing of the processing node in the execution state is intercepted to obtain the attribute of the processing node in the execution state, and the node type of the processing node in the execution state is determined by using the attribute. The interception process can be implemented based on aspect oriented programming (Aspect Oriented Programming, referred to as AOP) or other methods, which are not limited here.
[0093] Step S402 : for each processing node in the executing state in the task to be processed, if the node type of the processing node in the executing state is a shared node, then a plurality of target processing nodes corresponding to the shared node are obtained.
[0094] The multiple target processing nodes corresponding to the shared node are each a processing node in a different task to be processed. Figure 2 Step S202 of the illustrated embodiment will not be described in detail here.
[0095] Step S403: If the multiple target processing nodes corresponding to the shared node are all in the execution state, the multiple target processing nodes corresponding to the shared node are processed. Figure 3 Step S303 of the illustrated embodiment will not be described in detail here.
[0096] Step S404: If the node type of the processing node in the executing state is a non-shared node, the processing node in the executing state is processed. Figure 2 The corresponding description in step S203 of the illustrated embodiment will not be repeated here.
[0097] After intercepting the processing of the processing node in the executing state, the coordinator coordinates the processing of each pending task based on the node type of the processing node in the executing state. The role of the coordinator is to wait for the status of the other related processing nodes in the non-executing state to change to the executing state before merging all target processing nodes; if the node type of the processing node in the executing state is a non-shared node, it can be directly processed.
[0098] The task processing method provided in this embodiment uses the object to be processed in the task execution instruction to obtain the properties of multiple tasks to be processed and the processing nodes in the tasks to be processed, thereby ensuring the accuracy of the tasks to be processed and the processing nodes. The threads corresponding to the tasks to be processed are used to realize parallel processing of the tasks to be processed, and the processing of the processing nodes in the execution state is intercepted to obtain their node types, thereby realizing coordinated processing of multiple tasks to be processed.
[0099] As a specific application example of the disclosed embodiment, in a shopping scenario, a user selects two items on a shopping platform for combined payment, one of which is a pre-sale item and the other is a non-pre-sale item. After the user selects combined payment, two pending tasks are triggered, namely Figure 5a The pending tasks A and Figure 5b As shown in the pending task B, for each processing node in the pending task A and the pending task B, a coordinator is used for coordination processing. Figure 5a as well as Figure 5b Only one coordinator corresponding to a processing node is shown in FIG. 1 , but a coordinator corresponds to each processing node. Figure 5a and Figure 5bThe processing logic of the coordinator is as follows: Figure 5c As shown, it specifically includes first determining whether the node type of the processing node in the execution state is a shared node. If it is a non-shared node, it is executed immediately. If it is a shared node, it is determined by calculating the node state whether the states of multiple target processing nodes corresponding to the shared node are in the execution state. If the states of all target processing nodes are in the execution state, the multiple target processing nodes are merged and processed. If there is a target processing node in the non-execution state, it is waited for processing by signal notification.
[0100] The task processing method provided by this method only needs to focus on the standard processing flow and the processing nodes in the standard processing flow for the processing platform. For example, the processing task of non-pre-sale goods can be considered as the standard processing flow. For the business, it only needs to focus on the customized flow and customized processing nodes. For example, the processing task of pre-sale goods can be considered as a customized processing task. This method does not need to add extension points to skip the corresponding processing nodes. It implements interception processing through AOP, and there is no need to adjust the existing code.
[0101] As some optional application scenarios of the embodiments of the present disclosure, in the payment scenario, in addition to merging payments, the processing of multiple pending tasks can also be triggered by the need to buy one item at a time when paying for goods. Since the processing flow corresponding to the task of buying one item at a time is relatively simple, a custom process is used to skip a large number of processing nodes in the standard processing flow, thereby achieving the efficiency of merging multiple pending tasks.
[0102] In this embodiment, a task processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0103] This embodiment provides a task processing device, such as Figure 6 As shown, including:
[0104] The task acquisition module 601 is used to respond to a task execution instruction and acquire a plurality of tasks to be processed corresponding to the task execution instruction; wherein each task to be processed includes a plurality of processing nodes.
[0105] The target processing node acquisition module 602 is used to obtain multiple target processing nodes corresponding to the shared nodes for each processing node in the execution state in each task to be processed, if the node type of the processing node in the execution state is a shared node; wherein the multiple target processing nodes corresponding to the shared node are respectively a processing node in different tasks to be processed.
[0106] The node processing module 603 is used to process the multiple target processing nodes corresponding to the shared node if the multiple target processing nodes corresponding to the shared node are all in the execution state.
[0107] In some optional implementations, the node processing module 603 includes:
[0108] The node processing unit is used to process the shared node and obtain the processing result.
[0109] The feedback unit is used to feed back the processing result to the pending tasks corresponding to the multiple target processing nodes, so as to change the state of the next processing node of the pending tasks corresponding to the multiple target processing nodes to an executing state.
[0110] In some optional embodiments, the device further comprises:
[0111] The first state changing module is used for changing the state of the target processing node in the execution state to the pause state if there is a target processing node in the non-execution state among the multiple target processing nodes.
[0112] The second state changing module is configured to change the state of the target processing node in the paused state to the executing state if the state of the target processing node in the non-executing state is changed to the executing state.
[0113] In some optional implementations, the first state changing module includes:
[0114] The pause state changing unit is used to send a pause processing signal to the pending task corresponding to the target processing node in the executing state, so as to change the state of the target processing node in the executing state to the pause state.
[0115] In some optional implementations, the second state change module includes:
[0116] The start state changing unit is used to send a signal for starting processing to the pending task which has been suspended, so as to change the state of the target processing node in the suspended state to the executing state.
[0117] In some optional embodiments, the device further comprises:
[0118] The non-shared node processing module is used to process the processing node in the executing state if the node type of the processing node in the executing state is a non-shared node.
[0119] In some optional implementations, the task acquisition module 601 includes:
[0120] The instruction response unit is used to respond to the task execution instruction and obtain the object to be processed in the task execution instruction.
[0121] The task determination unit is used to determine a plurality of tasks to be processed and the attributes of the processing nodes in each task to be processed based on the object to be processed, wherein the attributes include the node type.
[0122] In some optional implementations, the task determination unit includes:
[0123] The mapping relationship acquisition subunit is used to acquire the preset mapping relationship corresponding to the processing object. The preset mapping relationship includes the preset task and the attributes of the processing node in the preset task.
[0124] The attribute determination subunit is used to query the preset mapping relationship using the object to be processed, and determine the attributes of the multiple tasks to be processed and the processing nodes in each task to be processed.
[0125] In some optional implementations, the task acquisition module 601 includes:
[0126] The thread starting unit is used to start threads corresponding to the tasks to be processed one by one, so as to process the tasks to be processed in parallel.
[0127] The node type determination unit is used to determine the node type of the processing node in the executing state based on the attributes of the processing node in the executing state for each processing node in the to-be-processed task.
[0128] The task processing device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0129] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0130] The present disclosure also provides a computer device having the above Figure 6 The task processing device shown.
[0131] See also Figure 7 , Figure 7 is a schematic diagram of a computer device provided by an optional embodiment of the present disclosure, such as Figure 7As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 7 A processor 10 is taken as an example.
[0132] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0133] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0134] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0135] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0136] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.
[0137] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0138] The embodiments of the present disclosure also provide a computer-readable storage medium. The above-mentioned method according to the embodiments of the present disclosure can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium and downloaded through a network, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0139] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the method embodiment, since it is basically similar to the device and system embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the device and system embodiments.
[0140] It is understandable that in the specific implementation of the present disclosure, it involves collecting data related to tasks to be processed. When the above embodiments of the present disclosure are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0141] Although the embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A task processing method, characterized in that: The method comprises: In response to a task execution instruction, a plurality of tasks to be processed corresponding to the task execution instruction are acquired, and the plurality of tasks to be processed are executed; wherein each task to be processed includes a plurality of processing nodes; For each processing node in the executing state in the task to be processed, if the node type of the processing node in the executing state is a shared node, multiple target processing nodes corresponding to the shared node are obtained; wherein the multiple target processing nodes corresponding to the shared node are respectively a processing node in different tasks to be processed; If the multiple target processing nodes corresponding to the shared node are all in an execution state, the multiple target processing nodes corresponding to the shared node are processed.
2. The method according to claim 1, characterized in that The processing of the multiple target processing nodes corresponding to the shared node includes: Processing the shared node to obtain a processing result; The processing result is fed back to the pending tasks corresponding to the multiple target processing nodes, so as to change the state of the next processing node of the pending tasks corresponding to the multiple target processing nodes to an executing state.
3. The method according to claim 1, characterized in that The method further comprises: If there is a target processing node in a non-executing state among the plurality of target processing nodes, changing the state of the target processing node in the executing state to a suspended state; If the state of the target processing node in the non-executing state is changed to the executing state, the state of the target processing node in the paused state is changed to the executing state.
4. The method according to claim 3, characterized in that Changing the state of the target processing node in the executing state to the suspended state includes: A signal for suspending processing is sent to the to-be-processed task corresponding to the target processing node in the executing state, so as to change the state of the target processing node in the executing state to a suspended state.
5. The method according to claim 3, characterized in that: Changing the state of the target processing node in the paused state to the executing state includes: A signal for starting processing is sent to the suspended task to be processed, so as to change the state of the target processing node in the suspended state to the executing state.
6. The method according to claim 1, characterized in that The method further comprises: If the node type of the processing node in the executing state is a non-shared node, the processing node in the executing state is processed.
7. The method according to any one of claims 1 to 6, characterized in that The step of obtaining, in response to the task execution instruction, a plurality of tasks to be processed corresponding to the task execution instruction includes: In response to the task execution instruction, obtaining the object to be processed in the task execution instruction; Based on the object to be processed, the multiple tasks to be processed and the attributes of the processing nodes in each of the tasks to be processed are determined, wherein the attributes include the node type.
8. The method according to claim 7, characterized in that The determining, based on the object to be processed, the plurality of tasks to be processed and the attributes of the processing nodes in each of the tasks to be processed comprises: Acquire a preset mapping relationship corresponding to a processing object, wherein the preset mapping relationship includes a preset task and attributes of a processing node in the preset task; The preset mapping relationship is queried using the object to be processed to determine the plurality of tasks to be processed and the attributes of the processing node in each of the tasks to be processed.
9. The method according to claim 1, characterized in that: The executing the plurality of tasks to be processed comprises: Starting threads corresponding to the tasks to be processed one by one to process the tasks to be processed in parallel; For each processing node in the executing state in the to-be-processed task, the node type of the processing node in the executing state is determined based on the attribute of the processing node in the executing state.
10. A task processing device, characterized in that: The device comprises: A task acquisition module, used for acquiring a plurality of pending tasks corresponding to the task execution instruction in response to the task execution instruction; wherein each pending task includes a plurality of processing nodes; A target processing node acquisition module is used for acquiring, for each processing node in the execution state in each task to be processed, a plurality of target processing nodes corresponding to the shared node if the node type of the processing node in the execution state is a shared node; wherein the plurality of target processing nodes corresponding to the shared node are respectively a processing node in different tasks to be processed; The node processing module is used to process the multiple target processing nodes corresponding to the shared node if the multiple target processing nodes corresponding to the shared node are all in an execution state.
11. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the task processing method according to any one of claims 1 to 9 by executing the computer instructions.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the task processing method according to any one of claims 1 to 9.
