Search

CN-122021816-A - Task execution method, device, equipment, computer readable storage medium and computer program product

CN122021816ACN 122021816 ACN122021816 ACN 122021816ACN-122021816-A

Abstract

The application provides a task execution method, a device, equipment, a computer readable storage medium and a computer program product, wherein the method comprises the steps of constructing a node multi-way tree corresponding to a task, wherein the node multi-way tree comprises a plurality of layers of nodes, each node corresponds to a subtask in the task, the subtasks corresponding to different nodes are different, traversing the nodes of the node multi-way tree layer by layer, and parallel executing the subtasks corresponding to the node combinations in each layer aiming at the node combinations in the traversing process to obtain a first execution result, wherein the nodes in the node combinations belong to the same father node, and determining a second execution result of the task based on the first execution result corresponding to the node combinations in each layer. The application can improve the task execution efficiency.

Inventors

  • BAI XIAOBO
  • ZHAO WEI
  • GUAN CHAO
  • LUO JIHANG
  • LI FEI

Assignees

  • 马上消费金融股份有限公司

Dates

Publication Date
20260512
Application Date
20241112

Claims (15)

  1. 1. A method of task execution, the method comprising: Constructing a node multi-way tree corresponding to a task, wherein the node multi-way tree comprises a plurality of levels of nodes, each node corresponds to a subtask in one task, and subtasks corresponding to different nodes are different; Traversing the nodes of the node multi-way tree layer by layer, and executing subtasks corresponding to the node combinations in each hierarchy in parallel aiming at the node combinations in the traversing process to obtain a first execution result, wherein the nodes in the node combinations belong to the same father node; and determining a second execution result of the task based on the first execution result corresponding to the node combination in each hierarchy.
  2. 2. The method of claim 1, wherein after traversing the nodes of the node multi-way tree layer by layer, the method further comprises: in the traversing process, for each hierarchy, if the hierarchy comprises a plurality of node combinations, sub-tasks corresponding to the node combinations in the hierarchy are sequentially executed based on the execution sequence of each node combination; And for each node combination in the hierarchy, executing subtasks corresponding to the node combinations in parallel to obtain a first execution result, wherein the first execution result comprises: And aiming at the node combination in each hierarchy, executing the subtasks corresponding to each node in the node combination in parallel to obtain a first execution result.
  3. 3. The method of claim 2, wherein executing the subtasks corresponding to each node in the node combination in parallel, to obtain a first execution result, comprises: aiming at each node in the node combination, acquiring the execution condition of the node; If a first node meeting the execution condition exists in the node combination, executing a subtask corresponding to the first node to obtain a task execution result corresponding to the first node; If a second node which does not meet the execution condition exists in the node combination, updating the node state of the second node into a waiting state, and determining a task execution result corresponding to the second node based on the waiting state of the second node; And combining task execution results corresponding to each node in the node combination, and determining the first execution result.
  4. 4. The method of claim 3, wherein after the obtaining the execution condition of the node, the method further comprises: Determining at least one parent node of the node; If all the subtasks of the node combinations corresponding to the father nodes are executed, determining that the nodes meet the execution conditions; If the subtasks of the node combinations corresponding to the parent nodes in the at least one parent node are not executed yet, determining that the nodes do not meet the execution conditions.
  5. 5. The method of claim 3, wherein the number of parent nodes of the second node in the waiting state is plural, and the determining the task execution result corresponding to the second node based on the waiting state of the second node includes: determining a third execution result of each parent node of the second node based on the waiting state of the second node; and executing the subtasks corresponding to the second nodes based on each third execution result to obtain task execution results corresponding to the second nodes.
  6. 6. The method of claim 1, wherein the constructing the node multi-way tree corresponding to the task comprises: Determining a plurality of nodes required for executing the task, and generating a directed acyclic graph according to the plurality of nodes; determining a connection relationship between the plurality of nodes based on the directed acyclic graph; and constructing the node multi-way tree based on the connection relation among the plurality of nodes.
  7. 7. The method of claim 6, wherein constructing the node multi-way tree based on the connection relationship between the plurality of nodes comprises: Determining a root node of the node multi-way tree based on the task description information of the task; determining the root node as a node to be executed, and iteratively executing the following steps until a plurality of nodes of the task are added to a node multi-way tree: Determining child nodes of the node to be executed based on connection relations among the plurality of nodes, and adding the child nodes to the node multi-way tree; and determining the child node as the node to be executed.
  8. 8. The method of claim 1, wherein the parallel execution of the subtasks corresponding to the node combination, to obtain a first execution result, includes: The following procedure is performed for each node in the node combination: If the execution time length of the subtask of the node exceeds the time length threshold, stopping executing the subtask of the node, and acquiring a first preset execution result serving as the task execution result of the node; and determining the first execution result based on the first preset execution result.
  9. 9. The method of claim 1, wherein the parallel execution of the subtasks corresponding to the node combination, to obtain a first execution result, includes: in the process of executing the subtasks of each node of the node combination, responding to the execution failure of the subtasks of the nodes, and determining the execution failure times; Re-executing the subtasks of the node in response to the execution failure times being less than a preset time threshold; Responding to the execution failure times being greater than or equal to the times threshold value, and acquiring a second preset execution result serving as a task execution result of the node; And determining the first execution result based on the second preset execution result.
  10. 10. The method of claim 1, wherein the determining the second execution result of the task based on the first execution result corresponding to the node combination in each of the tiers comprises: if the subtasks of each node are determined to be successfully executed based on the first execution result, the first execution result of the root node in the node multi-way tree is determined to be the initial execution result of the task; and in the process of traversing the node multi-way tree layer by layer, updating the initial execution result sequentially based on the first execution result of each level to obtain a second execution result of the task.
  11. 11. The method of claim 10, wherein the method further comprises: if it is determined that there is at least one subtask execution failure of the node based on the first execution result, a third preset execution result is obtained, and the third preset execution result is determined to be a second execution result of the task.
  12. 12. A task execution device, the device comprising: the construction module is used for constructing a node multi-way tree corresponding to a task, the node multi-way tree comprises a plurality of levels of nodes, each node corresponds to a subtask in one task, and subtasks corresponding to different nodes are different; The node traversing module is used for traversing the nodes of the node multi-way tree layer by layer, and executing subtasks corresponding to the node combinations in each hierarchy in parallel aiming at the node combinations in the traversing process to obtain a first execution result, wherein the nodes in the node combinations belong to the same father node; and the determining module is used for determining a second execution result of the task based on the first execution result corresponding to the node combination in each hierarchy.
  13. 13. An electronic device, the electronic device comprising: A memory for storing computer executable instructions or computer programs; A processor for implementing the task execution method of any one of claims 1 to 11 when executing computer-executable instructions or computer programs stored in the memory.
  14. 14. A computer-readable storage medium storing computer-executable instructions or a computer program, which when executed by a processor implement the task execution method of any one of claims 1 to 11.
  15. 15. A computer program product comprising computer-executable instructions or a computer program, which, when executed by a processor, implements the task execution method of any one of claims 1 to 11.

Description

Task execution method, device, equipment, computer readable storage medium and computer program product Technical Field The present application relates to the field of computer technology, and in particular, to a task execution method, apparatus, device, computer readable storage medium, and computer program product. Background Along with the rapid development of artificial intelligence technology, the application of intelligent agents in various fields is becoming wider and wider. The agent decomposes the complex task into a plurality of subtasks through the task nodes, so that the task management is more refined and ordered. Each task node represents a stage or a specific work item of a task, so that an agent can execute the task in steps. The task node serves as a basic unit for an agent to execute tasks, and has the meaning of providing a structured task management framework, which is important for the automatic processing of large-scale and complex tasks. In the related art, task nodes are executed in a linked list mode in series, if more task nodes can cause performance degradation of an agent, and response time is too long, user experience is affected, and efficiency of task execution is low. Disclosure of Invention The embodiment of the application provides a task execution method, a device, equipment, a computer readable storage medium and a computer program product, which can improve the task execution efficiency. The technical scheme of the embodiment of the application is realized as follows: the embodiment of the application provides a task execution method, which comprises the following steps: Constructing a node multi-way tree corresponding to a task, wherein the node multi-way tree comprises a plurality of levels of nodes, each node corresponds to a subtask in one task, and subtasks corresponding to different nodes are different; Traversing the nodes of the node multi-way tree layer by layer, and executing subtasks corresponding to the node combinations in each hierarchy in parallel aiming at the node combinations in the traversing process to obtain a first execution result, wherein the nodes in the node combinations belong to the same father node; and determining a second execution result of the task based on the first execution result corresponding to the node combination in each hierarchy. The embodiment of the application provides a task execution device, which comprises: the construction module is used for constructing a node multi-way tree corresponding to a task, the node multi-way tree comprises a plurality of levels of nodes, each node corresponds to a subtask in one task, and subtasks corresponding to different nodes are different; The node traversing module is used for traversing the nodes of the node multi-way tree layer by layer, and executing subtasks corresponding to the node combinations in each hierarchy in parallel aiming at the node combinations in the traversing process to obtain a first execution result, wherein the nodes in the node combinations belong to the same father node; and the determining module is used for determining a second execution result of the task based on the first execution result corresponding to the node combination in each hierarchy. An embodiment of the present application provides an electronic device, including: A memory for storing computer executable instructions or computer programs; And the processor is used for realizing the task execution method provided by the embodiment of the application when executing the computer executable instructions or the computer programs stored in the memory. The embodiment of the application provides a computer readable storage medium, which stores computer executable instructions or a computer program for realizing the task execution method provided by the embodiment of the application when being executed by a processor. The embodiment of the application provides a computer program product, which comprises computer executable instructions or a computer program, wherein the computer executable instructions or the computer program realize the task execution method provided by the embodiment of the application when being executed by a processor. The embodiment of the application has the following beneficial effects: After the node multi-way tree corresponding to the task is constructed, traversing the nodes of the node multi-way tree layer by layer, and concurrently executing the subtasks corresponding to the node combination belonging to the same father node in each level in the traversing process, so that the second execution result of the task is determined based on the obtained first execution result of the node combination in each level. Therefore, compared with the scheme of serially executing the subtasks of the nodes in a linked list mode, the multi-branch task can be dealt with by executing the tasks through the node multi-branch tree, the diversity and flexibility in the task execution process are impr