A workflow execution method and device, electronic equipment and storage medium

CN122331997BActive Publication Date: 2026-08-21CHANGSHA YIZHI INTELLIGENT TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202610787987.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-06-03
Publication Date
2026-08-21
Estimated Expiration
2046-06-03

AI Technical Summary

Benefits of technology

本申请在获取目标工作流后,根据目标工作流中各节点的拓扑关系生成拓扑结构图,并识别拓扑结构图中的可递归节点,按照拓扑结构图执行目标工作流,当执行流程进入可递归节点时,为当前执行流程创建子执行器,并利用子执行器执行当前执行流程,其中,可递归节点包括循环节点、批处理节点和子流程节点。采用本申请的方案,能够在不预设固定嵌套层数的前提下,实现工作流中多类节点稳定互嵌执行。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122331997B_ABST
    Figure CN122331997B_ABST
Patent Text Reader

Abstract

The application discloses a workflow execution method and device, electronic equipment and a storage medium. After a target workflow is acquired, a topological structure diagram is generated according to the topological relationship of each node in the target workflow, and a recursive node in the topological structure diagram is identified, the target workflow is executed according to the topological structure diagram, a sub-executor is created for the current execution process when the execution process enters the recursive node, and the current execution process is executed by using the sub-executor, wherein the recursive node includes a loop node, a batch processing node and a sub-process node. According to the scheme, stable mutual embedding execution of multiple types of nodes in the workflow can be realized without presetting a fixed nesting layer number.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a workflow execution method, apparatus, electronic device and storage medium. Background Technology

[0002] Workflow refers to the automation of part or all of a business process in a computer application environment. It is an abstract and generalized description of the workflow and the business rules between its various operational steps. With the increasing digitalization of business, workflow engines have emerged. Workflow engines can receive structured workflow data input and transform it into a work process that runs on electronic devices.

[0003] Existing workflow engines typically implement process control using single-level loops or predefined fixed nesting depths. As business process complexity increases and execution levels deepen, it is often necessary to manually break down the process or use external orchestration tools and script splicing to achieve multi-level control logic.

[0004] Therefore, how to provide a solution to the above-mentioned technical problems is a technical problem that needs to be solved by those in the relevant technical field. Summary of the Invention

[0005] To address the aforementioned technical problems, this application provides a workflow execution method, apparatus, electronic device, and storage medium, which can achieve stable inter-node execution in a workflow without pre-setting a fixed nesting level.

[0006] To achieve the above objectives, the first aspect of this application provides a workflow execution method, comprising: Obtain the target workflow and generate a topology diagram based on the topological relationships of each node in the target workflow; Identify recursive nodes in the topology graph; where recursive nodes include loop nodes, batch processing nodes, and subprocess nodes. Execute the target workflow according to the topology diagram and determine whether the execution process enters a recursive node; If so, a sub-executor is created for the current execution flow, and the current execution flow is executed using the sub-executor.

[0007] Preferably, the method further includes: Generate iteration coordinates to uniquely identify the current execution flow.

[0008] Preferably, the iterative coordinates include the target workflow's running identifier, the path of the current node, the hierarchical position of the current node, the loop iteration, the batch entry number, and the retry number.

[0009] Preferably, the method further includes: Once the current execution process is complete, the iteration coordinates will be marked as complete.

[0010] Preferably, the method further includes: Receive control signals used to adjust the current execution flow; The corresponding control action is executed according to the control signal in the current execution process.

[0011] Preferably, the control signal includes at least one of the following: Skip the current iteration and proceed to the next round; Terminate the current loop; Terminate the current execution process; Retry the current execution process.

[0012] Preferably, the method further includes: Obtain monitoring metrics during the execution of the target workflow; among which, the monitoring metrics include at least one of the following: the nesting depth of the current execution process, the cumulative number of execution rounds for each node, the scale of parallel batch processing, and the duration of a single loop execution. Determine whether the monitoring indicator is greater than the monitoring threshold; If so, execute the corresponding preset measures.

[0013] A second aspect of this application provides a workflow execution apparatus, comprising: The generation module is used to acquire the target workflow and generate a topology diagram based on the topological relationships of each node in the target workflow. The identification module is used to identify recursive nodes in the topology graph; where recursive nodes include loop nodes, batch processing nodes, and subprocess nodes. The judgment module is used to execute the target workflow according to the topology diagram and determine whether the execution process enters a recursive node. The execution module is used to create a sub-executor for the current execution flow when the execution flow enters a recursive node, and to use the sub-executor to execute the current execution flow.

[0014] A third aspect of this application provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to execute the steps of the workflow execution method described above when executing the computer program.

[0015] A fourth aspect of this application provides a storage medium storing a computer program, which, when executed by a processor, implements the steps of the workflow execution method described above.

[0016] This application has at least the following beneficial effects: After obtaining the target workflow, this application generates a topology diagram based on the topological relationships of each node in the target workflow, identifies recursive nodes in the topology diagram, and executes the target workflow according to the topology diagram. When the execution process enters a recursive node, a sub-executor is created for the current execution process, and the sub-executor is used to execute the current execution process. Recursive nodes include loop nodes, batch processing nodes, and sub-process nodes. Using the solution of this application, stable inter-node execution within a workflow can be achieved without pre-setting a fixed nesting level. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a hardware structure diagram of a computer device implementing a workflow execution method according to an embodiment of this application; Figure 2 This is a flowchart illustrating a workflow execution method according to an embodiment of this application; Figure 3 This is a schematic diagram of the structure of a workflow execution device according to an embodiment of this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of this application clearer, the application is described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the application. All other embodiments obtained by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application. Furthermore, it is understood that although the efforts made in such a development process may be complex and lengthy, for those skilled in the art related to the content disclosed in this application, modifications to design, manufacturing, or production based on the technical content disclosed in this application are merely conventional technical means and should not be construed as insufficient disclosure of the content of this application.

[0020] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment that is mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0021] Unless otherwise defined, the technical or scientific terms used in this application shall have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms “a,” “an,” “an,” “the,” and similar words used in this application do not indicate quantity limitation and may indicate singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units not listed, or may include other steps or units inherent to these processes, methods, products, or devices. The terms “connected,” “linked,” “coupled,” and similar words used in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. “Multiple” used in this application means two or more. “And / or” describes the relationship between related objects, indicating that three relationships may exist; for example, “A and / or B” can represent: A alone, A and B simultaneously, and B alone. The terms “first,” “second,” “third,” etc., used in this application are merely to distinguish similar objects and do not represent a specific ordering of the objects.

[0022] The method embodiments provided in this application can be executed in a terminal, computer device, or similar computing device. Taking running on a computer device as an example, Figure 1 This is a hardware structure diagram of the computer device implementing the workflow execution method in the embodiments of this application. For example... Figure 1As shown, the computer device includes a processor A01, a network interface A02, a display screen A04, an input device A05, and a memory (not shown) connected via a system bus. The processor A01 provides computing and control capabilities. The memory includes internal memory A03 and a non-volatile storage medium A06. The non-volatile storage medium A06 stores an operating system B01 and a computer program B02. The internal memory A03 provides an environment for the operation of the operating system B01 and the computer program B02 stored in the non-volatile storage medium A06. The network interface A02 is used to communicate with external terminals via a network connection. When the computer program is executed by the processor A01, it implements the workflow execution method of this embodiment. The display screen A04 can be a liquid crystal display or an e-ink display. The input device A05 can be a touch layer covering the display screen, a button, trackball, or touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.

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

[0024] This application provides a workflow execution method. Please refer to [link / reference]. Figure 2 , Figure 2 This is a flowchart illustrating the workflow execution method provided in this embodiment. The method may include the following steps: Step S210: Obtain the target workflow and generate a topology diagram based on the topological relationships of each node in the target workflow.

[0025] In this embodiment, the topological relationship of each node in the target workflow can represent the dependencies and execution order between nodes, such as the parent-child execution relationship between parent and child nodes. The topology graph can be any graph model that can clearly describe the dependencies and execution order between nodes in the workflow, such as a directed acyclic graph.

[0026] Step S220: Identify recursive nodes in the topology diagram; wherein, recursive nodes include loop nodes, batch processing nodes, and subprocess nodes.

[0027] In this embodiment, a loop node is a node in a workflow that repeatedly executes a specific operation according to preset rules until a termination condition is met; a batch processing node is a node that processes multiple task items simultaneously through a parallel execution mechanism; and a subprocess node is a control node used to break down a complex process into reusable and independently manageable subprocesses.

[0028] Step S230: Execute the target workflow according to the topology diagram and determine whether the execution process enters a recursive node. If so, proceed to step S240.

[0029] In this embodiment, during the execution of the target workflow, a depth-first search method is used to traverse each branch chain from front to back through the topology graph. Each node performs a corresponding operation based on the received input and passes the output to the successor node until the target workflow is completed. That is, each branch chain in the topology graph is recursively executed in a "parent chain nested in child chain" manner. After the child chain is completed, the execution backtracks to the parent chain to achieve the gradual advancement of data and tasks. When the execution flow enters a recursive node, i.e., a loop node, batch processing node, or sub-process node, the execution method used in this embodiment differs from the prior art; please refer to step S240 for details. It is understood that when the execution flow enters a regular node other than a recursive node, the execution method used in this embodiment is the same as the prior art.

[0030] Step S240: Create a sub-executor for the current execution flow and use the sub-executor to execute the current execution flow.

[0031] In this embodiment, when the execution flow enters a recursive node, i.e., a loop node, a batch processing node, or a sub-process node, its internal logic is not directly expanded. Instead, a new sub-executor is cloned for the current execution flow, and the sub-executor is used to execute the current execution flow. Each sub-executor maintains an independent execution frame, which includes at least: the target workflow's running identifier, the identifier of the current execution frame, the identifier of the parent execution frame, the path of the current node, local state and inherited state references, the current iteration cursor, the output aggregation reference, and the control signal queue, etc.

[0032] Logically, the current nesting depth can be abstractly represented as: Current nesting depth = Hierarchical position of the current execution frame in the execution frame chain. This representation is used to illustrate nesting relationships and does not limit the specific data structure or implementation method. By default, child execution frames inherit only the state allowed to be inherited from the parent execution frame in a read-only manner. Write operations only affect the local state; only variables explicitly declared as write-back can be written back to the parent execution frame after the child execution is completed. Through execution frame isolation and explicit write-back mechanisms, state pollution and result reproducibility between parent and child execution domains can be avoided.

[0033] Understandably, existing workflow execution methods directly expand the internal logic of a recursive node when the execution flow enters it, continuing the current execution flow using the current executor. This can achieve flow control when the target workflow has only a single loop or a preset fixed nesting level. However, when the target workflow has multiple loops or no preset fixed nesting level, it is necessary to manually split the process or use external orchestration tools and script splicing to achieve multi-level control logic. The workflow execution method provided in this application clones a new sub-executor for the current execution flow whenever it enters a recursive node, and uses the new sub-executor to execute the current execution flow. This allows for unified support of deep interleaving execution of loop nodes, batch processing nodes, and sub-process nodes without a preset fixed nesting level.

[0034] As described above, the workflow execution method provided in this application, after obtaining the target workflow, generates a topology diagram based on the topological relationships of each node in the target workflow, identifies recursive nodes in the topology diagram, and executes the target workflow according to the topology diagram. When the execution process enters a recursive node, a sub-executor is created for the current execution process, and the sub-executor is used to execute the current execution process. The recursive nodes include loop nodes, batch processing nodes, and sub-process nodes. Using the solution of this application, stable inter-node execution within a workflow can be achieved without pre-setting a fixed nesting level.

[0035] Optionally, in the above embodiments, the method further includes the following step: generating iteration coordinates to uniquely identify the current execution flow.

[0036] In practice, the iteration coordinates include the target workflow's running identifier, the path of the current node, the hierarchical position of the current node, the loop iteration, the batch entry number, and the retry number.

[0037] In this embodiment, the system assigns a structured iterative coordinate to each specific process execution instance to uniquely identify that execution. The iterative coordinate includes at least the following information: the target workflow's run identifier, the path of the current node, the hierarchical position of the current node, the loop iteration number, the batch entry number, and the retry number. It is understood that when an interruption occurs, the execution instance can be directly located using the iterative coordinate, eliminating the need to re-execute from the node or process level. This reduces the granularity of interruption recovery from the node or process level to the iterative coordinate level, significantly lowering the cost of redundant computation.

[0038] Furthermore, in the above embodiments, the method further includes the following step: after the current execution process is completed, the iteration coordinates are marked as completed.

[0039] In this embodiment, the system continuously maintains a set of completed iteration coordinates during process execution. Whenever an execution instance successfully completes, the corresponding iteration coordinates are recorded as completed. When an interruption occurs, the system persists the current iteration coordinate state, completion flag, and result aggregation snapshot. Upon resumption of execution, by determining whether the iteration coordinates are complete, execution continues only for incomplete iteration coordinates, thereby achieving recovery accurate to the single iteration level.

[0040] Logically, the recovery decision can be abstracted as follows: if the iteration coordinate ∈ the completed set, then skip execution; otherwise, continue execution. Here, the above abstraction describes the semantics of the recovery decision and does not limit the specific judgment method.

[0041] Optionally, in the above embodiments, the method further includes the following steps: Receive control signals used to adjust the current execution flow; The corresponding control action is executed according to the control signal in the current execution process.

[0042] In specific implementation, the control signals include at least one of the following: skip the current iteration and proceed to the next round; terminate the current loop; terminate the current execution flow; retry the current execution flow.

[0043] In this embodiment, control signals are used to dynamically adjust process behavior during execution. Each control signal includes at least an action type, a target scope, a source scope, a signal number, and a generation time. Actions supported by control signals include, but are not limited to: skipping the current iteration and proceeding to the next round; terminating the loop within a specified scope; terminating the current process execution; and retrying the current execution instance. The processing rules for control signals are as follows: when the current execution level hits the target scope, the signal is consumed and the corresponding action is executed; when it misses, the signal is passed through to the parent execution frame; duplicate signals with the same signal number are deduplicated according to idempotency rules; and the control signal number is required to monotonically increase to prevent control rollback.

[0044] It is understandable that in the execution of workflows with multi-layered nested structures, existing execution methods can easily misapply control actions such as termination and skipping to non-target levels. The workflow execution method provided in this application, through structured control signals and scope constraint mechanisms, can achieve precise targeting of control actions.

[0045] Optionally, in the above embodiments, the method further includes the following steps: Obtain monitoring metrics during the execution of the target workflow; among which, the monitoring metrics include at least one of the following: the nesting depth of the current execution process, the cumulative number of execution rounds for each node, the scale of parallel batch processing, and the duration of a single loop execution. Determine whether the monitoring indicator is greater than the monitoring threshold; If so, execute the corresponding preset measures.

[0046] In this embodiment, the system continuously monitors the following metrics during process execution: current nesting depth, cumulative execution rounds per node, parallel batch processing scale, and single-round execution duration. When the monitored metrics exceed the corresponding preset thresholds, the system can adopt strategies such as rate limiting, pausing sub-executor creation, degrading execution, or fast failure, while preserving recoverable execution points. By controlling runtime governance thresholds such as nesting depth, loop rounds, and concurrency scale, system instability caused by abnormal nesting or excessive iteration can be prevented.

[0047] In practice, after each round of execution, the system extracts the declared output fields and writes them into the aggregation container by field name. The aggregation container supports ordered list aggregation and set aggregation and is bound to the iteration coordinates. Through this mechanism, the system can ensure that the output results remain consistent with the execution order and content when no interruption occurred after the system resumes operation.

[0048] This application also provides a workflow execution apparatus. Please refer to... Figure 3 , Figure 3 This is a schematic diagram of the structure of a workflow execution device in an embodiment of this application. The execution device may include: The generation module 310 is used to acquire the target workflow and generate a topology diagram based on the topological relationships of each node in the target workflow. The identification module 320 is used to identify recursive nodes in the topology diagram; wherein, recursive nodes include loop nodes, batch processing nodes and subprocess nodes. The judgment module 330 is used to execute the target workflow according to the topology diagram and determine whether the execution process enters a recursive node. The execution module 340 is used to create a sub-executor for the current execution flow when the execution flow enters a recursive node, and to use the sub-executor to execute the current execution flow.

[0049] It should be noted that the apparatus provided in the above embodiments is only illustrated by the division of the above program modules when performing related operations. In actual applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the terminal can be divided into different program modules to complete all or part of the processing described above. In addition, the apparatus provided in the above embodiments and the method embodiments in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.

[0050] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiments of this application, the embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to implement the steps of the above workflow execution method when executing the computer program.

[0051] In an exemplary embodiment, the processor may be implemented by one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers (MCUs), microprocessors, or other electronic components to perform the aforementioned method.

[0052] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memories described in the embodiments of this application are intended to include, but are not limited to, these and any other suitable types of memories.

[0053] In one embodiment, this application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the workflow execution method described above.

[0054] It is understood that the computer-readable storage medium in the embodiments of this application includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device. As defined herein, computer-readable storage media does not include transient media, such as modulated data signals and carrier waves.

[0055] Those skilled in the art should understand that this application is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of this application. Various changes and modifications can be made to this application without departing from the spirit and scope thereof, and all such changes and modifications fall within the scope of this application as claimed. The scope of protection of this application is defined by the appended claims and their equivalents.

Claims

1. A workflow execution method, characterized in that, include: Obtain the target workflow and generate a topology diagram based on the topological relationships of each node in the target workflow; Identify recursive nodes in the topology graph; wherein, the recursive nodes include loop nodes, batch processing nodes, and subprocess nodes; The target workflow is executed according to the topology diagram, and it is determined whether the execution process enters the recursive node. If so, a new sub-executor is cloned for the current execution flow, and the current execution flow is executed using the new sub-executor; wherein, each sub-executor maintains an independent execution frame, the execution frame containing: the run identifier of the target workflow, the identifier of the current execution frame, the identifier of the parent execution frame, and the path of the current node.

2. The workflow execution method according to claim 1, characterized in that, The method further includes: Generate iteration coordinates to uniquely identify the current execution flow.

3. The workflow execution method according to claim 2, characterized in that, The iterative coordinates include the running identifier of the target workflow, the path of the current node, the hierarchical position of the current node, the loop round, the batch entry number, and the retry number.

4. The workflow execution method according to claim 2, characterized in that, The method further includes: Once the current execution process is complete, the iterative coordinates will be marked as completed.

5. The workflow execution method according to claim 1, characterized in that, The method further includes: Receive control signals used to adjust the current execution flow; The corresponding control action is executed on the current execution flow according to the control signal.

6. The workflow execution method according to claim 5, characterized in that, The control signal includes at least one of the following: Skip the current iteration and proceed to the next round; Terminate the current loop; Terminate the current execution process; Retry the current execution process.

7. The workflow execution method according to claim 1, characterized in that, The method further includes: Obtain monitoring metrics during the execution of the target workflow; wherein, the monitoring metrics include at least one of the following: the nesting depth of the current execution process, the cumulative execution rounds of each node, the scale of parallel batch processing, and the duration of a single loop execution; Determine whether the monitored indicator is greater than the monitoring threshold; If so, execute the corresponding preset measures.

8. A workflow execution device, characterized in that, include: The generation module is used to acquire the target workflow and generate a topology diagram based on the topological relationships of each node in the target workflow. The identification module is used to identify recursive nodes in the topology graph; wherein, the recursive nodes include loop nodes, batch processing nodes, and subprocess nodes; The judgment module is used to execute the target workflow according to the topology diagram and determine whether the execution process enters the recursive node; The execution module is used to clone a new sub-executor for the current execution process when the execution process enters the recursive node, and to use the new sub-executor to execute the current execution process; wherein, each sub-executor maintains an independent execution frame, the execution frame containing: the running identifier of the target workflow, the identifier of the current execution frame, the identifier of the parent execution frame, and the path of the current node.

9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the workflow execution method according to any one of claims 1 to 7.

10. A storage medium, characterized in that, The storage medium stores a computer program, wherein the computer program is configured to execute the workflow execution method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method and apparatus for device testing using multiple processing paths

    CN105190334A

  • Workflow alarm method and device based on event driving, equipment and medium

    CN117707898A