Workflow execution method and system, carrier rocket and storage medium
By providing a workflow execution method and system in industrial software, complex workflows can be analyzed and executed, solving the problem of lack of complex workflow execution capabilities in traditional industrial software, and achieving efficient application in commercial aerospace, drones, smart factories and other fields.
Patent Information
- Application Number
- CN202411923296.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-11
AI Technical Summary
The lack of execution solutions with complex workflow execution capabilities in industrial software is unable to be embedded in traditional industrial software, which limits its application in commercial aerospace, drones, smart factories and other fields.
Provides a workflow execution method and system to execute the workflow according to the graph type by obtaining the initial file, parsing and determining the graph type of the workflow. The method includes obtaining the initial file, parsing the pending data, determining the graphic type of the workflow, and executing the workflow based on the graphic type.
It realizes the ability to implement complex workflows in traditional industrial software, supports short small workflows and multi-node aggregation, multi-branch, conditional branch, and lengthy large workflows, and has fast, efficient and concurrent workflow processing capabilities, suitable for commercial aerospace, drones, smart factories and other fields.
Smart Images

Figure CN119806690A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of data processing. Specifically, the present application relates to a workflow execution method, system, launch vehicle and storage medium. Background Art
[0002] Industrial software often requires the use of automated process building and execution systems to implement unattended or complex and fast automation functions, minimizing manual intervention and waiting time.
[0003] However, in the field of industrial software, such as commercial aerospace, drones, smart factories and other industries, there is no execution solution that can be embedded in traditional industrial software and has the ability to execute complex workflows. Summary of the invention
[0004] The embodiments of the present application provide a workflow execution method, system, launch vehicle, and storage medium for solving the technical problem that industrial software does not have an execution solution with complex workflow execution capabilities.
[0005] In a first aspect, an embodiment of the present application provides a workflow execution method, including: Obtaining an initial file, parsing the initial file to obtain data to be processed; the data to be processed includes at least one workflow, each workflow includes at least two nodes and at least one edge, each node is used to represent an action to be executed, and each edge is used to represent a preset execution condition of two nodes connected to the edge; For each workflow, determine the graph type of the workflow based on the nodes and edges of the workflow; Based on the workflow's graph type, the workflow is executed.
[0006] In a possible implementation, determining the graph type of the workflow based on the nodes and edges of the workflow includes at least one of the following: If, based on the nodes and edges of the workflow, it is determined that the workflow has a start node and an end node, and each intermediate node has only one forward node and one reverse node, then the graph type of the workflow is determined to be a first-class graph; If, based on the nodes and edges of the workflow, it is determined that the workflow has a start node and at least two end nodes, and at least one intermediate node has at least two forward nodes and each intermediate node has only one reverse node, then the graph type of the workflow is determined to be a second-type graph; If it is determined based on the nodes and edges of the workflow that the graph type of the workflow does not belong to the first type of graph or the second type of graph, then the graph type of the workflow is determined to be the third type of graph; Among them, the forward direction is from the current node to the next node, the reverse direction is from the current node to the previous node, and the two nodes connected by an edge are adjacent nodes.
[0007] In a possible implementation, based on the graphical type of the workflow, executing the workflow includes: For each workflow, add a cursor at the start node; Based on the graph type of the workflow, the control cursor moves from the start node and executes the node's action each time the cursor moves to a node.
[0008] In a possible implementation, if the graph type of the workflow is a first-class graph, the cursor is controlled to move from the start node, and the action of the node is executed each time the cursor moves to a node, including: Control the cursor to move from the start node to the next node in sequence, and execute the node action each time the cursor moves to a node until it reaches the end node and deletes the cursor of the end node.
[0009] In a possible implementation, if the graph type of the workflow is a second-type graph or a third-type graph, then after executing the action of the node each time the cursor moves to a node, the method further includes: When it is determined that the number of next nodes N to which the current node jumps exceeds one, N-1 new cursors are added so that each next node to be jumped has a corresponding cursor; N is an integer greater than 1; Control the parallel movement of each cursor, and when any cursor reaches the end node, delete the cursor of the end node.
[0010] In a possible implementation, when it is determined that the number N of next nodes to which the current node jumps exceeds one, N-1 new cursors are added, including: Traverse the jump conditions of the edges connected to the current node to see if they are met; the execution conditions include the jump conditions; If the number of edges that meet the jump condition exceeds one, it is determined that the number N of next nodes to which the current node jumps exceeds one.
[0011] In a possible implementation, if the graph type of the workflow is a third-type graph, the action of the node is executed each time the cursor moves to a node, including: For each node to which the cursor moves, check whether the dependency conditions of the edges connected to the node are met; the execution conditions include the dependency conditions; If the dependency condition of any edge connected to the node is not met, the control node is in a waiting state; if the dependency conditions of all edges connected to the node are met, the node action is executed.
[0012] In a possible implementation, whether the dependency conditions of the edges connecting the traversal nodes are satisfied includes: For each edge, obtain the execution status value of the previous node of the node in the parameter cache and / or the running status value of the device corresponding to the dependency condition; Determine whether the dependency condition of the edge is satisfied based on the execution status value of the previous node and / or the running status value of the device corresponding to the dependency condition; After executing the node's actions, it also includes: Based on the execution status of the node, modify the execution status value corresponding to the node in the parameter cache.
[0013] In a possible implementation, for each workflow, after adding a cursor at the start node, the following is further included: Create a cursor log corresponding to each cursor; The movement information and exception information of the cursor are added to the movement log; the movement information is the record information of the cursor moving at each node, and the exception information is the information when an exception occurs in the execution of the workflow.
[0014] In a possible implementation, determining the graph type of the workflow based on the nodes and edges of the workflow further includes: Based on the nodes and edges of the workflow, determining whether there is a loop in the workflow; the loop includes a circular path from the current node through at least one edge and at least one intermediate node back to the current node; If there is a loop in the workflow, the workflow is executed based on the workflow graph type, including: When the cyclic execution time of the loop exceeds a first predetermined time, the execution of the loop is stopped.
[0015] In a possible implementation, executing the workflow based on the graphical type of the workflow also includes: When it is determined that an abnormality occurs in the execution of the workflow, an abnormality prompt message is issued; The execution exception includes at least one of the following: There are isolated nodes in the workflow; isolated nodes are nodes that have no edges connected to them; The key node of the workflow has no connected edge or the execution time of the action of the key node exceeds the second predetermined time; the key node is a workflow where there is no path that can be connected after the key node is removed; There are unreachable nodes in the workflow; the dependency conditions of the unreachable nodes are always not satisfied or do not exist; the dependency conditions include the conditions that the execution of the current node depends on the execution of the previous node and / or the conditions of the operating status of the device corresponding to the dependency conditions.
[0016] In a possible implementation, the definition information of each node includes at least one of the following: node name, node delay, weight coefficient, node type, node identification code, traversal state, node state, and action information; And / or, the definition information of each edge includes at least one of the following: an edge identification code, a preset execution condition; the execution condition includes a jump condition and / or a dependency condition, the jump condition includes a condition of the operating status of the device corresponding to the jump condition, and the dependency condition includes a condition that the execution of the current node depends on the execution of the previous node and / or a condition of the operating status of the device corresponding to the dependency condition.
[0017] In a second aspect, an embodiment of the present application provides a workflow execution system, including: A parser, used for obtaining an initial file, parsing the initial file to obtain data to be processed and storing the data in a data structure; the data to be processed includes at least one workflow, each workflow includes at least two nodes and at least one edge, each node is used to represent an action to be executed, and each edge is used to represent an execution condition of two nodes connected with the edge; An analyzer, connected to the parser, for determining, for each workflow, a graph type of the workflow based on nodes and edges of the workflow; The executor is connected to the analyzer and is used to execute the workflow based on the graph type of the workflow.
[0018] In a third aspect, an embodiment of the present application provides a launch vehicle, comprising: the workflow execution system of the second aspect.
[0019] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the workflow execution method of the first aspect when the computer program is executed by a processor.
[0020] The beneficial effects of the technical solution provided by the embodiment of the present application are: The embodiment of the present application can parse the initial file to obtain the data to be processed. Since the data to be processed can be obtained by parsing the initial file written by the user, the data to be processed can include the workflow that the user needs to execute. Each workflow includes at least two nodes and at least one edge. Each node is used to represent the action to be executed, and each edge is used to represent the preset execution condition of the two nodes connected to the edge. Then, based on the nodes and edges of the workflow, the graphical type of the workflow can be determined, that is, each workflow can be classified, so as to execute the workflow based on the graphical type of the workflow. Therefore, the embodiment of the present application can be embedded in traditional industrial software, and the workflow can be classified according to the graphical type, so that different types of workflows can be executed in a targeted manner.
[0021] Furthermore, the embodiments of the present application support both short and small workflows, and can also support multi-node convergence, or multi-branch, conditional branching, and lengthy large workflows, so that the embodiments of the present application have the ability to execute complex workflows and the ability to process workflows with fast, efficient, and concurrent characteristics, and can be applied in fields such as commercial aerospace, drones, smart factories, etc. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.
[0023] Figure 1 A flowchart of a workflow execution method provided in an embodiment of the present application; Figure 2 A schematic diagram of a first workflow provided in an embodiment of the present application; Figure 3a to Figure 3c Schematic diagrams of the second workflow, the third workflow, and the fourth workflow provided in the embodiments of the present application; Figure 4 A schematic diagram of a fifth workflow provided in an embodiment of the present application; Figure 5a to Figure 5c Schematic diagrams of the sixth workflow, the seventh workflow, and the eighth workflow provided in the embodiments of the present application; Figure 6 A flowchart of a workflow execution system provided in an embodiment of the present application; Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0024] The embodiments of the present application are described below in conjunction with the drawings in the present application. It should be understood that the implementation methods described below in conjunction with the drawings are exemplary descriptions for explaining the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions of the embodiments of the present application.
[0025] It will be understood by those skilled in the art that, unless specifically stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the terms "including" and "comprising" used in the embodiments of the present application refer to that the corresponding features can be implemented as the presented features, information, data, steps, operations, elements and / or components, but do not exclude the implementation as other features, information, data, steps, operations, elements, components and / or combinations thereof supported by the technical field. It should be understood that when we say that an element is "connected" or "coupled" to another element, the one element may be directly connected or coupled to the other element, or it may refer to that the one element and the other element establish a connection relationship through an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein indicates at least one of the items defined by the term, for example, "A and / or B" indicates that it is implemented as "A", or is implemented as "A", or is implemented as "A and B".
[0026] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0027] First, several terms involved in this application are introduced and explained: Executor: An executor is a class that provides methods to perform actions.
[0028] Analyzer: An Analyzer is a class that provides methods for analyzing a graph.
[0029] Forward: The direction from the current node to the next node is forward.
[0030] Reverse: The direction from the current node to the previous node is reverse.
[0031] Linear workflow: A linear workflow is a linear chain structure. From the start node to the end node, the nodes are arranged in order, forming a single path, similar to a linked list. There is no branch or loop, and there is only one path.
[0032] Tree-shaped workflow: The tree structure has no cycles and is an acyclic connected graph. There is a unique path connecting any two nodes in the graph.
[0033] Graphical workflow: If a workflow is neither linear nor tree-like, it is a graphical workflow.
[0034] Among the related technologies, there are several types of automated workflow executor technologies and applications: Automated script executors for artificial intelligence and big data analysis built on DAG (directed acyclic graph), such as Apache Airflow, Luigi, Apache Taverna, etc., are usually developed based on Java / Python, and the engine is only suitable for artificial intelligence and big data analysis scenarios.
[0035] Business process management workflow, such as the Activiti workflow engine, etc. This type of engine does not have execution capabilities. It is a management engine with visualization functions, supports the BPMN protocol, and is used for enterprise process approval.
[0036] However, a workflow executor that can be embedded in traditional industrial software, has the ability to execute complex workflows, and has fast, efficient, and concurrent features is urgently needed in the field of industrial software, such as commercial aerospace, drones, smart factories and other industries, and there is currently no such technology.
[0037] The workflow execution method, system, launch vehicle and storage medium provided in this application are intended to solve the above technical problems of the prior art.
[0038] See also Figure 1 As shown, the present application embodiment provides a flowchart of a workflow execution method. The workflow execution method can be executed by the workflow execution system of the present application embodiment, and the workflow execution method includes: step S101 to step S103.
[0039] S101. Obtain an initial file, and parse the initial file to obtain data to be processed; the data to be processed includes at least one workflow, each workflow includes at least two nodes and at least one edge, each node is used to represent an action to be executed, and each edge is used to represent a preset execution condition of two nodes connected to the edge.
[0040] Optionally, the initial file can be a script, which is written by the user and input through the external interface of the terminal device. The terminal device stores the script in json format and can store multiple workflows. For example, the initial file can be parsed by a json parser, and the script is stored in a data structure as data to be processed.
[0041] S102: For each workflow, determine the graph type of the workflow based on the nodes and edges of the workflow.
[0042] Optionally, the workflows may be classified and stored in the form of a graph through nodes and edges, and the graph type may be a linear, tree, or other complex workflows.
[0043] S103: Execute the workflow based on the graphic type of the workflow.
[0044] Optionally, based on the graph type of each workflow, different execution modes may be designed, for example, different executors may be designed, such as a linear executor, a tree executor, a graph executor, and the like.
[0045] The embodiment of the present application can parse the initial file to obtain the data to be processed. Since the data to be processed can be obtained by parsing the initial file written by the user, the data to be processed may include the workflow that the user needs to execute. Each workflow includes at least two nodes and at least one edge. Each node is used to represent the action to be executed, and each edge is used to represent the preset execution condition of the two nodes connected to the edge. Then, based on the nodes and edges of the workflow, the graphic type of the workflow can be determined, that is, each workflow can be classified, so as to execute the workflow based on the graphic type of the workflow.
[0046] Therefore, the embodiment of the present application can classify workflows according to graphic types, so that different types of workflows can be executed in a targeted manner, and then different execution modes can be used for execution optimization, solving the scalability problem of the workflow engine, and can be embedded in traditional industrial software.
[0047] Furthermore, the embodiments of the present application support both short and small workflows, and can also support multi-node convergence, or multi-branch, conditional branching, and lengthy large workflows, so that the embodiments of the present application have the ability to execute complex workflows and the ability to process workflows with fast, efficient, and concurrent characteristics, and can be applied in fields such as commercial aerospace, drones, and smart factories.
[0048] In some embodiments, the definition information of each node includes at least one of the following: node name, node delay, weight coefficient, node type, node identification code, traversal status, node status, and action information; And / or, the definition information of each edge includes at least one of the following: an edge identification code, a preset execution condition; the execution condition includes a jump condition and / or a dependency condition, the jump condition includes a condition of the operating status of the device corresponding to the jump condition, and the dependency condition includes a condition that the execution of the current node depends on the execution of the previous node and / or a condition of the operating status of the device corresponding to the dependency condition.
[0049] Optionally, each workflow can include many actions, each action can correspond to a node, each node contains name, delay, weight combination (time weight, cost weight, fault weight, etc.), node type (including start node, end node, intermediate node), action description, global UUID (Universally Unique Identifier), whether to traverse the state, node state (sleeping, waiting, running, end), etc. The weight combination is the weight coefficient, which is the weight combination in the script. The definition of each edge includes the following: global UUID, forward jump condition, reverse dependency condition.
[0050] Optionally, the action corresponding to the node may be to open a valve, and the jump condition may be whether the acquired operating state value meets the requirement, for example, the jump condition is that the operating state value is greater than 5. The operating state value corresponds to the operating state of the device, such as the parameter values of the operating state of the external device, such as the air pressure, voltage, current, etc.
[0051] Optionally, the dependency condition may be that the current node requires the action of its previous node to be completed. Whether the action of the previous node is completed can be determined by the execution status value, and / or whether the operating status value of the device corresponding to the dependency condition meets the requirements, for example: the operating status value is less than 3.
[0052] Optionally, both the execution status value and the running status value are stored as parameter values in a parameter cache, and corresponding parameter values are obtained when conditional judgment is performed.
[0053] In the embodiment of the present application, a complete workflow can be described by at least two nodes and at least one edge, and the workflow is stored in the form of a graph.
[0054] In some embodiments, determining the graph type of the workflow based on the nodes and edges of the workflow includes at least one of the following: if, based on the nodes and edges of the workflow, it is determined that the workflow has a start node and an end node, and each intermediate node has only one forward node and one reverse node, then determining that the graph type of the workflow is a first-class graph.
[0055] If, based on the nodes and edges of the workflow, it is determined that the workflow has a start node and at least two end nodes, and at least one intermediate node has at least two forward nodes and each intermediate node has only one reverse node, then the graph type of the workflow is determined to be a second type of graph.
[0056] If it is determined based on the nodes and edges of the workflow that the graph type of the workflow does not belong to the first type of graph or the second type of graph, then the graph type of the workflow is determined to be the third type of graph.
[0057] Among them, the forward direction is from the current node to the next node, the reverse direction is from the current node to the previous node, and the two nodes connected by an edge are adjacent nodes.
[0058] Optionally, the first type of graphics corresponds to a linear workflow, the second type of graphics corresponds to a tree workflow, and the third type of graphics is a complex workflow graphics, which is referred to as a graphical workflow in the embodiment of the present application.
[0059] See also Figure 2 As shown, the present application embodiment provides a schematic diagram of the first workflow. Figure 2 As shown, the forward nodes of node A are node B and node C. The reverse nodes of node B and node C are node A.
[0060] See also Figure 3a to Figure 3c As shown, the present application embodiment provides schematic diagrams of the second workflow, the third workflow, and the fourth workflow. Figure 3a As shown, the second workflow is a linear workflow, node A is the start node, node B is the middle node, node C is the end node, and nodes A, B and C form a single linear path.
[0061] See also Figure 3b As shown, the third workflow is a tree-shaped workflow, with node A as the start node, nodes D, E, F and G as the end nodes, and there is a unique path connecting any two nodes in the figure, and nodes B and C are intermediate nodes.
[0062] See also Figure 3c As shown, the fourth workflow is a graphical workflow. Figure 3c and Figure 3b The difference is that the execution of node F depends on the reverse dependency conditions of node B and node C. As shown by the dotted arrow in the figure, node C can jump to node F if the jump condition on the edge connected to node F is met.
[0063] In practical applications, it is necessary to determine whether the current graph is a linear workflow, that is, there is only one start node and one end node, and each of the other nodes has only one forward node and one reverse node. This workflow is executed sequentially from front to back, and there are no other edges.
[0064] Determine whether the current graph is a tree-shaped workflow, that is, there is only one start node, but multiple end nodes are allowed. Except for the end node, each node can have multiple forward nodes, but only one reverse node is allowed. This workflow starts from the start node and executes forward sequentially. For a node, each edge is a branch. If the condition is true, this branch is executed; if the condition is false, this branch is not executed. Compared with linear workflows, tree-shaped workflows have more forward branch judgments.
[0065] If this diagram is neither linear nor tree-shaped, it is considered to be a graphical workflow. Compared with the tree-shaped workflow, the graphical workflow has more reverse dependency judgments. If A AND B, both AB conditions must be met. If A OR B, only one of AB conditions needs to be met. If NOT A, then the A condition must be false.
[0066] In some embodiments, based on the graphical type of the workflow, executing the workflow includes: For each workflow, add a cursor at the start node; based on the graph type of the workflow, control the cursor to move from the start node and execute the node action each time the cursor moves to a node.
[0067] Optionally, the cursor definition includes the following: the UUID of the node, the record to be moved, the workflow graph is defined by nodes and edges, and also includes a cursor list, which allows adding, deleting, and moving cursors, and provides related algorithms for traversing the graph.
[0068] In some embodiments, if the graph type of the workflow is a first-type graph, the cursor is controlled to move from the start node, and the action of the node is executed each time the cursor moves to a node, including: Control the cursor to move from the start node to the next node in sequence, and execute the node action each time the cursor moves to a node until it reaches the end node and deletes the cursor of the end node.
[0069] In some embodiments, if the graphic type of the workflow is a second-type graphic or a third-type graphic, after executing the action of the node each time the cursor moves to a node, the process further includes: When it is determined that the number of next nodes N to which the current node jumps exceeds one, N-1 new cursors are added so that each next node to be jumped has a corresponding cursor; N is an integer greater than 1; Control the parallel movement of each cursor, and when any cursor reaches the end node, delete the cursor of the end node.
[0070] In some embodiments, when it is determined that the number N of next nodes to which the current node jumps exceeds one, N-1 new cursors are added, including: traversing whether the jumping conditions of the edges connected to the current node are met; the execution conditions include the jumping conditions; if the number of edges that meet the jumping conditions exceeds one, determining that the number N of next nodes to which the current node jumps exceeds one.
[0071] In some embodiments, if the graph type of the workflow is a third-type graph, then each time the cursor moves to a node, an action of the node is executed, including: for each node to which the cursor moves, traversing whether the dependency conditions of the edges connected by the nodes are satisfied; the execution conditions include the dependency conditions; If the dependency condition of any edge connected to the node is not met, the control node is in a waiting state; if the dependency conditions of all edges connected to the node are met, the node action is executed.
[0072] In some embodiments, traversing whether the dependency conditions of the edges connecting the nodes are met includes: for each edge, obtaining the execution status value of the previous node of the node in the parameter cache and / or the operating status value of the device corresponding to the dependency condition; based on the execution status value of the previous node and / or the operating status value of the device corresponding to the dependency condition, determining whether the dependency condition of the edge is met.
[0073] After the action of executing the node, the method further includes: modifying the execution state value corresponding to the node in the parameter cache based on the execution state of the node.
[0074] Optionally, the execution status value of the previous node can be 0 and 1, 0 indicates that the action of the previous node has not been executed, and 1 indicates that the action of the previous node has been executed.
[0075] Optionally, the parameter cache is a hash table that stores parameter keys and values. The parameter cache allows concurrent reading and writing. Each thread needs to continuously obtain and modify the status value in the cache when moving the cursor.
[0076] The embodiment of the present application can execute the workflow according to the graphical type of the workflow and executors of different execution modes. For example, executors can be divided into linear executors, tree executors, and graphical executors.
[0077] (1) The linear executor does not judge the forward jump condition and the reverse dependency condition. It is suitable for small and simple workflows. The executor automatically adds a cursor, which moves from the start node. Each time it moves to a node, it executes the action in the node until it reaches the end node and deletes the current cursor.
[0078] (2) The tree executor only determines the forward jump conditions. At the beginning, the executor automatically adds a cursor, and the cursor moves from the start node. Each time it moves to a node, it first executes the action in the node, and then traverses all the jump conditions. When more than one condition is true, a new cursor is automatically added and parallel execution begins. When a cursor reaches an end node, the cursor is deleted. When all cursors are deleted, the execution ends.
[0079] (3) The graph executor determines both the forward jump condition and the reverse dependency condition. At the beginning, the executor automatically adds a cursor, and the cursor moves from the start node. Each time it moves to a node, it traverses all the reverse dependency conditions of this node, that is, the preconditions. If a condition is not met, this node is in a waiting state. The state of each dependency condition is placed in the parameter cache, so there is no need to obtain the information of the previous node. Only the required parameter value in the parameter cache is determined; if the condition is met, the action in this node is executed, and then all the jump conditions are traversed. When more than one condition is true, a new cursor is automatically added and parallel execution begins. After execution, the execution state value in the corresponding parameter cache is modified. When a cursor reaches an end node, the cursor is deleted. When all cursors are deleted, the execution ends.
[0080] In some embodiments, for each workflow, after adding a cursor at the start node, it also includes: creating a cursor log corresponding to each cursor; adding the cursor's movement information and exception information to the movement log; the movement information is the record information of the cursor moving at each node, and the exception information is the information when an exception occurs in the execution of the workflow.
[0081] Optionally, each cursor has a corresponding cursor log. Each move not only adds a record of the move to the cursor log, but also allows the system to recover from the log and continue execution if a system crashes due to an abnormality. Exception information that occurs within the system is also added to the cursor log for easy tracing.
[0082] In order to implement a concurrent mechanism, in the embodiment of the present application, each thread controls the movement of a cursor and does not modify the data structure, so concurrent access does not require locking, and efficient parallel execution can be achieved.
[0083] In some embodiments, determining the graph type of the workflow based on the nodes and edges of the workflow further includes: determining whether there is a loop in the workflow based on the nodes and edges of the workflow; the loop includes a circular path from the current node through at least one edge and at least one intermediate node back to the current node; If the workflow has a loop, the workflow is executed based on the graph type of the workflow, including: when the cyclic execution time of the loop exceeds a first predetermined time, the execution of the loop is stopped.
[0084] See also Figure 4 As shown, the present application embodiment provides a schematic diagram of the fifth workflow. Figure 4 As shown, the path from node B to node E and then back to node B is a circular path, and the fifth workflow has a loop.
[0085] The embodiment of the present application can search for a loop. If there is no loop, the graph is a directed acyclic graph. The present application allows loops to exist in the graph, i.e., loop execution statements. A timeout parameter is added for this situation. If the loop execution exceeds a certain time (such as 1 minute), it can jump out directly, or jump out in the condition of a statement in the loop, or jump out according to a parameter condition of the parameter cache. This design increases flexibility.
[0086] In some embodiments, based on the graphical type of the workflow, executing the workflow further includes: When it is determined that an exception occurs in the execution of the workflow, an exception prompt message is issued.
[0087] The execution exception includes at least one of the following: There are isolated nodes in the workflow; isolated nodes are nodes that have no edges connected to them; The key node of the workflow has no connected edge or the execution time of the action of the key node exceeds the second predetermined time; the key node is a workflow where there is no path that can be connected after the key node is removed; There are unreachable nodes in the workflow; the dependency conditions of the unreachable nodes are always not satisfied or do not exist; the dependency conditions include the conditions that the execution of the current node depends on the execution of the previous node and / or the conditions of the operating status of the device corresponding to the dependency conditions.
[0088] See also Figure 5a to Figure 5c As shown, the present application embodiment provides schematic diagrams of the sixth workflow, the seventh workflow, and the eighth workflow. Figure 5a As shown in , node H is an isolated node, and there is no edge connected to node H; Figure 5b As shown, node F is a key node. If node F has no connected edge or the execution time of the key node action exceeds the second predetermined time, the execution is abnormal; Figure 5c As shown, node H is an unreachable node and there is no dependency condition for node H.
[0089] The present application embodiment provides a method for finding isolated nodes, key nodes, and unreachable nodes. The specific method is as follows: (1) An isolated node is also a type of unreachable node. The system will directly throw an exception for such a node but continue to execute. An isolated node is meaningless.
[0090] (2) A key node is a special node. Once deleted (unreachable), the original graph will be split into two isolated graphs. Every path from the start node to the end node will contain the key node. The reachability and execution time of the key node will affect the execution of the entire graph. If the key node is unreachable or the execution time is too long, an exception is thrown.
[0091] (3) The reverse dependency conditions of some nodes are always false, or there is no reverse dependency condition. Even if they are connected nodes, they are still unreachable. In this case, the system eliminates the exception but continues to execute.
[0092] Based on the above embodiments, the embodiments of the present application can solve the following four problems: (1) To solve the defect that current workflow engines do not support topology with loops, that is, to allow loop execution to solve the scalability problem of workflow engines, supporting both short and small workflows as well as multi-node convergence, or multi-branch, conditional branch, and lengthy large workflows, while maintaining execution efficiency; (2) Solve optimization problems for different types of workflows and global optimization algorithms (3) Solve various branching situations during backward execution, such as conditional execution, selective execution, multiple execution, etc. (4) Solve the problem of complex dependencies before executing an action, such as when there are multiple conditions and logical operations (AND, OR, NOT).
[0093] See also Figure 6 As shown, the embodiment of the present application provides a flowchart of a workflow execution system 60. The workflow execution system 60 includes: a parser 610, an analyzer 620 and an executor 630.
[0094] The parser 610 is used to obtain an initial file, parse the initial file to obtain data to be processed and store it in a data structure; the data to be processed includes at least one workflow, each workflow includes at least two nodes and at least one edge, each node is used to represent an action to be executed, and each edge is used to represent the execution condition of two nodes connected with the edge; The analyzer 620 is connected to the parser 610 , and is used to determine the graph type of each workflow based on the nodes and edges of the workflow.
[0095] The executor 630 is connected to the analyzer 620 , and is used to execute the workflow based on the graphic type of the workflow.
[0096] Optionally, the executor 630 is further used to determine that the graph type of the workflow is a first type of graph if it is determined based on the nodes and edges of the workflow that the workflow has a start node and an end node, and each intermediate node has only one forward node and one reverse node. If it is determined based on the nodes and edges of the workflow that the workflow has a start node and at least two end nodes, and at least one intermediate node has at least two forward nodes and each intermediate node has only one reverse node, then the graph type of the workflow is determined to be a second type of graph. If it is determined based on the nodes and edges of the workflow that the graph type of the workflow does not belong to the first type of graph and the second type of graph, then the graph type of the workflow is determined to be a third type of graph. Among them, the forward direction is the direction from the current node to the next node, the reverse direction is the direction from the current node to the previous node, and the two nodes connected by the edge are adjacent nodes.
[0097] Optionally, the executor 630 is further configured to add a cursor at the start node for each workflow; based on the graph type of the workflow, control the cursor to move from the start node, and execute an action of the node each time the cursor moves to a node.
[0098] Optionally, if the graphic type of the workflow is a first-class graphic, the executor 630 is also used to control the cursor to move from the start node, and execute the node action each time the cursor moves to a node, including: controlling the cursor to move from the start node to the next node in sequence, and executing the node action each time the cursor moves to a node until reaching the end node, and deleting the cursor of the end node.
[0099] Optionally, if the graph type of the workflow is a second-type graph or a third-type graph, then after executing the action of the node each time the cursor moves to a node, it also includes: when it is determined that the number N of the next nodes to which the current node jumps exceeds one, adding N-1 new cursors so that each next node to be jumped has a corresponding cursor; N is an integer greater than 1; controlling the cursors to move in parallel, and deleting the cursor of the end node when any cursor reaches the end node.
[0100] Optionally, the executor 630 is also used to traverse whether the jump conditions of the edges connected to the current node are met; the execution conditions include the jump conditions; if the number of edges that meet the jump conditions exceeds one, it is determined that the number N of the next nodes to which the current node jumps exceeds one.
[0101] Optionally, if the graph type of the workflow is a third-type graph, the executor 630 is also used to execute the action of the node each time the cursor moves to a node, including: for each node to which the cursor moves, traversing whether the dependency conditions of the edges connected to the node are met; the execution condition includes the dependency condition; if the dependency condition of any edge connected to the node is not met, the node is controlled to be in a waiting state; if the dependency conditions of all edges connected to the node are met, the action of the node is executed.
[0102] Optionally, the executor 630 is also used to traverse whether the dependency conditions of the edges connecting the nodes are met, including: for each edge, obtaining the execution status value of the previous node of the node in the parameter cache and / or the operating status value of the device corresponding to the dependency condition; based on the execution status value of the previous node and / or the operating status value of the device corresponding to the dependency condition, determining whether the dependency condition of the edge is met; after executing the action of the node, it also includes: based on the execution status of the node, modifying the execution status value corresponding to the node in the parameter cache.
[0103] Optionally, the executor 630 is also used to create a cursor log corresponding to each cursor; add the cursor movement information and exception information to the movement log; the movement information is the record information of the cursor movement at each node, and the exception information is the information when an exception occurs in the execution of the workflow.
[0104] Optionally, the executor 630 is further configured to determine whether there is a loop in the workflow based on the nodes and edges of the workflow; the loop includes a circular path from the current node through at least one edge and at least one intermediate node and then back to the current node; Optionally, the executor 630 is further configured to execute the workflow based on the graph type of the workflow if a loop exists in the workflow, including: stopping execution of the loop when the cyclic execution time of the loop exceeds a first predetermined time.
[0105] Optionally, the executor 630 is also used to issue an abnormal prompt message when determining that the execution of the workflow is abnormal. The execution abnormality includes at least one of the following: there is an isolated node in the workflow; an isolated node is an edge that does not exist with it; a key node of the workflow has no edge connected to it or the execution time of the action of the key node exceeds the second predetermined time; the key node is a workflow that does not have a path that can be connected after removing the key node; there is an unreachable node in the workflow; the dependency condition of the unreachable node is always not satisfied or the dependency condition does not exist; the dependency condition includes the condition that the execution of the current node depends on the execution of the previous node and / or the condition of the running state of the device corresponding to the dependency condition.
[0106] The workflow execution system 60 of the embodiment of the present application may include six parts: data structure, parser 610, analyzer 620, executor 630, script, and parameter cache. The user writes the execution script according to the rules, the parser 610 reads the script and puts the result in the data structure, the analyzer 620 analyzes the data structure for classification, and the executor 630 is responsible for the final execution.
[0107] The workflow execution system 60 of the embodiment of the present application uses a mathematical parser to define and parse conditions. First, the software needs to provide a calling interface, such as DoTask1, and a mathematical parsing library such as MuParser, ExprTk, ExprEval, etc. The mathematical parsing library can execute statements such as jump conditions and dependency conditions. The workflow execution system 60 also provides a get interface and a set interface for modifying the parameter cache.
[0108] The workflow execution system 60 of the embodiment of the present application implements a lightweight, scalable automated executor system that can be built into the software. By writing scripts, the automated execution of a software can be realized, which is suitable for the automation scenario of industrial software. At the same time, through the analysis of the data structure, the workflow is divided into three categories, and relatively simple workflows are executed with optimized executors to improve the execution efficiency. Moreover, through open interfaces and script design, the workflow execution system 60 is compatible with highly customized existing software, and mature application software can be automated at the lowest cost.
[0109] The workflow execution system 60 of the embodiment of the present application can execute the workflow execution method provided by the embodiment of the present application, and the implementation principle is similar. The actions performed by each device in the workflow execution system 60 of each embodiment of the present application correspond to the steps in the method of each embodiment of the present application. For the detailed functional description of each device of the device, please refer to the description in the corresponding method shown in the previous text, which will not be repeated here.
[0110] An embodiment of the present application provides a launch vehicle, including: a workflow execution system of an embodiment of the present application.
[0111] The launch vehicle of the embodiment of the present application includes the workflow execution system 60 of the embodiment of the present application. The detailed functional description of the launch vehicle of the present application can be found in the description of the corresponding workflow execution system shown in the previous text, which will not be repeated here.
[0112] An embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory, and the processor executes the above-mentioned computer program to implement the steps of workflow execution.
[0113] See also Figure 7As shown, the present application embodiment provides a structural diagram of an electronic device 4000. Figure 7 As shown, the electronic device 4000 includes: a processor 4001 and a memory 4003. The processor 4001 and the memory 4003 are connected, such as through a bus 4002. Optionally, the electronic device 4000 may also include a transceiver 4004, which may be used for data interaction between the electronic device and other electronic devices, such as data transmission and / or data reception. It should be noted that in actual applications, the transceiver 4004 is not limited to one, and the structure of the electronic device 4000 does not constitute a limitation on the embodiments of the present application.
[0114] Processor 4001 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 4001 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.
[0115] The bus 4002 may include a path to transmit information between the above components. The bus 4002 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 4002 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0116] The memory 4003 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory) or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), magnetic disk storage media, other magnetic storage devices, or any other medium that can be used to carry or store computer programs and can be read by a computer, without limitation herein.
[0117] The memory 4003 is used to store the computer program for executing the embodiment of the present application, and the execution is controlled by the processor 4001. The processor 4001 is used to execute the computer program stored in the memory 4003 to implement the steps shown in the above method embodiment.
[0118] Among them, electronic devices include but are not limited to: tablet computers, desktop computers, servers and other smart devices.
[0119] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the workflow execution method of the embodiment of the present application are implemented.
[0120] The computer-readable medium of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0121] In an embodiment of the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device, or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction execution system, device, or device. The program code contained on a computer-readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0122] It should be understood that, although each operation step is indicated by arrows in the flowchart of the embodiment of the present application, the implementation order of these steps is not limited to the order indicated by the arrows. Unless clearly stated herein, in some implementation scenarios of the embodiment of the present application, the implementation steps in each flowchart can be performed in other orders according to demand. In addition, some or all of the steps in each flowchart may include multiple sub-steps or multiple stages based on actual implementation scenarios. Some or all of these sub-steps or stages may be executed at the same time, and each sub-step or stage in these sub-steps or stages may also be executed at different times respectively. In different scenarios of execution time, the execution order of these sub-steps or stages may be flexibly configured according to demand, and the embodiment of the present application does not limit this.
[0123] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0124] The above is only an optional implementation method for some implementation scenarios of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the technical concept of the solution of the present application, other similar implementation methods based on the technical ideas of the present application are also within the protection scope of the embodiments of the present application.
Claims
1. A workflow execution method, characterized in that: include: Obtaining an initial file, and parsing the initial file to obtain data to be processed; The data to be processed includes at least one workflow, each of which includes at least two nodes and at least one edge, each of which is used to represent an action to be performed, and each of which is used to represent a preset execution condition of two nodes connected to the edge; For each of the workflows, determining a graph type of the workflow based on the nodes and edges of the workflow; Based on the graph type of the workflow, the workflow is executed.
2. The workflow execution method according to claim 1, characterized in that: Determining a graph type of the workflow based on the nodes and edges of the workflow includes at least one of the following: If, based on the nodes and edges of the workflow, it is determined that the workflow has a start node and an end node, and each intermediate node has only one forward node and one reverse node, then the graph type of the workflow is determined to be a first-type graph; If, based on the nodes and edges of the workflow, it is determined that the workflow has a start node and at least two end nodes, and at least one intermediate node has at least two forward nodes and each intermediate node has only one reverse node, then the graph type of the workflow is determined to be a second type of graph; If it is determined based on the nodes and edges of the workflow that the graph type of the workflow does not belong to the first type of graph and the second type of graph, then the graph type of the workflow is determined to be a third type of graph; The forward direction is from the current node to the next node, the reverse direction is from the current node to the previous node, and the two nodes connected by an edge are adjacent nodes.
3. The workflow execution method according to claim 2, characterized in that: Based on the graphical type of the workflow, executing the workflow includes: For each of the workflows, a cursor is added at the start node; Based on the graphical type of the workflow, the cursor is controlled to move from a start node, and an action of the node is executed each time the cursor moves to a node.
4. The workflow execution method according to claim 3, characterized in that: If the graph type of the workflow is a first-type graph, the cursor is controlled to move from the start node, and an action of the node is executed each time the cursor moves to a node, including: The cursor is controlled to move from the start node to the next node in sequence, and the action of the node is executed each time the cursor moves to a node, until the end node is reached, and the cursor of the end node is deleted.
5. The workflow execution method according to claim 3, characterized in that: If the graphic type of the workflow is a second-type graphic or a third-type graphic, after the cursor executes the action of the node each time it moves to a node, the method further includes: When it is determined that the number of next nodes N to which the current node jumps exceeds one, N-1 new cursors are added so that each next node to be jumped has a corresponding cursor; N is an integer greater than 1; Control the cursors to move in parallel, and when any of the cursors reaches an end node, delete the cursor of the end node.
6. The workflow execution method according to claim 5, characterized in that: When it is determined that the number of next nodes to which the current node jumps exceeds one, N-1 new cursors are added, including: Traversing whether the jump condition of the edge connected to the current node is satisfied; the execution condition includes the jump condition; If the number of edges that meet the jump condition exceeds one, it is determined that the number N of next nodes to which the current node jumps exceeds one.
7. The workflow execution method according to claim 3, characterized in that: If the graphic type of the workflow is a third-type graphic, then each time the cursor moves to a node, an action of the node is executed, including: For each node to which the cursor moves, traverse whether the dependency conditions of the edges connected to the node are satisfied; the execution condition includes the dependency conditions; If the dependency condition of any edge connected to the node is not satisfied, the node is controlled to be in a waiting state; if the dependency conditions of all edges connected to the node are satisfied, the action of the node is executed.
8. The workflow execution method according to claim 7, characterized in that: Traversing the edges connected to the node to see whether the dependency conditions are met, including: For each edge, obtaining the execution status value of the previous node of the node in the parameter cache and / or the running status value of the device corresponding to the dependency condition; Determining whether the dependency condition of the edge is satisfied based on the execution status value of the previous node and / or the operation status value of the device corresponding to the dependency condition; After executing the action of the node, it also includes: Based on the execution state of the node, the execution state value corresponding to the node in the parameter cache is modified.
9. The workflow execution method according to claim 3, characterized in that: For each of the workflows, after adding a cursor at the start node, it also includes: Create a cursor log corresponding to each cursor; The movement information and exception information of the cursor are added to the movement log; the movement information is the record information of the movement of the cursor at each node, and the exception information is the information when an exception occurs in the execution of the workflow.
10. The workflow execution method according to claim 1, characterized in that: Determining a graph type of the workflow based on the nodes and edges of the workflow further includes: Based on the nodes and edges of the workflow, determining whether there is a loop in the workflow; the loop includes a circular path from a current node through at least one edge and at least one intermediate node back to the current node; If the workflow has a loop, executing the workflow based on the graph type of the workflow includes: When the cyclic execution time of the loop exceeds a first predetermined time, the execution of the loop is stopped.
11. The workflow execution method according to claim 1, characterized in that: Based on the graphical type of the workflow, executing the workflow further includes: When it is determined that an abnormality occurs in the execution of the workflow, an abnormality prompt message is issued; The execution exception includes at least one of the following: There are isolated nodes in the workflow; the isolated nodes are nodes that have no edges connected to them; The key node of the workflow has no connected edge or the execution time of the action of the key node exceeds the second predetermined time; the key node is the workflow where there is no path that can be connected after removing the key node; There are unreachable nodes in the workflow; the dependency conditions of the unreachable nodes are always not satisfied or there are no dependency conditions; the dependency conditions include the conditions that the execution of the current node depends on the execution of the previous node and / or the conditions of the operating status of the device corresponding to the dependency conditions.
12. The workflow execution method according to claim 1, characterized in that: The definition information of each node includes at least one of the following: node name, node delay, weight coefficient, node type, node identification code, traversal status, node status, and action information; And / or, the definition information of each edge includes at least one of the following: an edge identification code, a preset execution condition; the execution condition includes a jump condition and / or a dependency condition, the jump condition includes a condition of the operating status of the device corresponding to the jump condition, and the dependency condition includes a condition that the execution of the current node depends on the execution of the previous node and / or a condition of the operating status of the device corresponding to the dependency condition.
13. A workflow execution system, characterized in that: include: A parser, used for obtaining an initial file, parsing the initial file to obtain data to be processed and storing the data in a data structure; The data to be processed includes at least one workflow, each of which includes at least two nodes and at least one edge, each of which is used to represent an action to be performed, and each of which is used to represent an execution condition of two nodes connected to the edge; an analyzer, connected to the parser, for determining, for each of the workflows, a graph type of the workflow based on the nodes and edges of the workflow; An executor, connected to the analyzer, is used to execute the workflow based on the graph type of the workflow.
14. A launch vehicle, characterized in that: include: The workflow execution system as claimed in claim 13.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the workflow execution method according to any one of claims 1 to 12 are implemented.