Method and device for processing workflow

Through preprocessing and dynamic pruning technology, it solves the problem of low performance of traditional workflow engines in high concurrency scenarios, realizes support for multi-layer nesting and dynamic parameter condition nodes, and improves the efficiency of workflow scheduling and execution.

CN118567796AInactive Publication Date: 2024-08-30DITU (BEIJING) TECH CO LTD

Patent Information

Application Number
CN202310832192.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-07-06
Publication Date
2024-08-30
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional workflow engines are difficult to support multi-layer nested workflows and dynamic parameter condition nodes in high-concurrency scenarios, resulting in low scheduling execution performance and unable to meet the needs of online high-concurrency scenarios.

Method used

By preprocessing the source workflow, convert it into the target workflow, dynamically determine the successor nodes to be executed, remove unreachable branches during the execution process, and prune the workflow to achieve efficient business process control.

Benefits of technology

Improved the workflow engine's support for multi-layer nested workflows and dynamic parameter condition nodes, improved the performance and efficiency of workflow scheduling execution, and is suitable for online high-concurrency scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567796A
    Figure CN118567796A
Patent Text Reader

Abstract

According to the embodiment of the invention, a method, device and equipment for processing workflow, a computer readable storage medium and a computer program product are provided. The method comprises the steps that a source workflow used for a business process is acquired, the source workflow is preprocessed to obtain a target workflow, the target workflow comprises a target condition node, and the target condition node at least comprises a first subsequent node and a second subsequent node; and during the execution period of the target condition node, determining a to-be-executed first subsequent node in the target workflow according to the target value of the target condition node. Updating the target workflow to at least remove a connection between the target condition node and the second subsequent node; and controlling execution of the business process based on the updated target workflow. Therefore, the execution performance of the workflow can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Example embodiments of the present disclosure generally relate to the field of computers, and more particularly, to methods, apparatuses, devices, computer-readable storage media, and computer program products for processing workflows. Background Art

[0002] Workflow refers to the automation of part or all of a business process in a computer application environment. It is an abstract and general description of the business rules between the workflow and its various operation steps.

[0003] A workflow engine is a tool used to design and drive workflows. The workflow engine extracts complex business processes from business systems and uses workflows to define the business processes. The business system can then call the workflow engine to execute the business process according to the pre-defined workflow. In order to improve the scheduling performance of the workflow engine, an efficient scheduling execution algorithm needs to be provided. Summary of the invention

[0004] In a first aspect of the present disclosure, a method for processing a workflow is provided. The method comprises: obtaining a source workflow for a business process, preprocessing the source workflow to obtain a target workflow, wherein the target workflow comprises a target condition node, and the target condition node has at least a first successor node and a second successor node. During the execution of the target condition node, a first successor node to be executed in the target workflow is determined according to a target value of the target condition node. The target workflow is updated to at least remove a connection between the target condition node and the second successor node; and based on the updated target workflow, the execution of the business process is controlled.

[0005] In a second aspect of the present disclosure, there is provided an apparatus for processing a workflow, comprising: a source workflow acquisition module, configured to acquire a source workflow for a business process; a preprocessing module, configured to preprocess the source workflow to obtain a target workflow, the target workflow comprising a target condition node, the target condition node having at least a first successor node and a second successor node. A successor node determination module to be executed, configured to determine a first successor node to be executed in the target workflow according to a target value of the target condition node during the execution of the target condition node. A target workflow update module, configured to update the target workflow to at least remove the connection between the target condition node and the second successor node; and a control module, configured to control the execution of the business process based on the updated target workflow.

[0006] In a third aspect of the present disclosure, an electronic device is provided. The device includes at least one processing unit; and at least one memory, the at least one memory is coupled to the at least one processing unit and stores instructions for execution by the at least one processing unit. When the instructions are executed by the at least one processing unit, the device executes the method of the first aspect.

[0007] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided, wherein a computer program is stored on the computer-readable storage medium, and the computer program can be executed by a processor to implement the method of the first aspect.

[0008] In a fifth aspect of the present disclosure, a computer program product is provided, which includes computer executable instructions, and when the computer executable instructions are executed by a processor, the method of the first aspect is implemented.

[0009] It should be understood that the contents described in the summary of the present invention are not intended to limit the key features or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. In the accompanying drawings, the same or similar reference numerals represent the same or similar elements, wherein:

[0011] Figure 1 A schematic diagram showing an example environment in which embodiments of the present disclosure can be implemented;

[0012] Figure 2 An exemplary architecture diagram of a workflow engine according to an embodiment of the present disclosure is shown;

[0013] Figure 3 A schematic diagram showing an example data structure of a workflow according to some embodiments of the present disclosure;

[0014] Figure 4 A schematic diagram showing an example of a multi-layer nested workflow according to some embodiments of the present disclosure;

[0015] Figure 5 and Figure 6 A schematic diagram showing an example of converting a multi-layer nested workflow into a single workflow according to some embodiments of the present disclosure;

[0016] 7A to 7E A schematic diagram of the execution process of a workflow according to some embodiments of the present disclosure is shown;

[0017] Figure 8A flowchart of a method for processing a workflow according to some embodiments of the present disclosure is shown;

[0018] Fig. 9 A block diagram showing an apparatus for processing a workflow according to some embodiments of the present disclosure; and

[0019] Fig.10 A block diagram of a device capable of implementing various embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0020] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. On the contrary, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.

[0021] It should be noted that the titles of any sections / subsections provided herein are not restrictive. Various embodiments are described throughout this article, and any type of embodiment may be included under any section / subsection. In addition, the embodiments described in any section / subsection may be combined in any manner with any other embodiments described in the same section / subsection and / or different sections / subsections.

[0022] In the description of the embodiments of the present disclosure, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The term "some embodiments" should be understood as "at least some embodiments". Other explicit and implicit definitions may be included below. The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may be included below.

[0023] The embodiments of the present disclosure may involve user data, data acquisition and / or use, etc. These aspects are subject to the corresponding laws, regulations and relevant provisions. In the embodiments of the present disclosure, all data collection, acquisition, processing, processing, forwarding, use, etc. are carried out on the premise that the user knows and confirms. Accordingly, when implementing each embodiment of the present disclosure, the type, scope of use, usage scenario, etc. of the data or information that may be involved should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with the relevant laws and regulations. The specific notification and / or authorization method can vary according to the actual situation and application scenario, and the scope of the present disclosure is not limited in this respect.

[0024] The solutions described in this specification and in the examples, if they involve the processing of personal information, will be processed on the premise of having a legal basis (such as obtaining the consent of the subject of personal information, or being necessary for the performance of a contract, etc.), and will only be processed within the scope of regulations or agreements. If a user refuses to process personal information other than the necessary information for basic functions, it will not affect the user's use of basic functions.

[0025] The term workflow in the embodiments of the present disclosure refers to the automation of part or all of a business process in a computer application environment, and is an abstract and general description of the business rules between the workflow and its various operation steps. Usually, in order to complete a business, a set of related tasks need to be completed according to a certain process. Each task corresponds to a node in the workflow. According to the position of the node in the workflow, the workflow includes the following types of nodes:

[0026] Head node: It can also be described as the starting node. It generally refers to the first node executed in the workflow. The head node does not have a predecessor node.

[0027] Tail node: It can also be described as the end node. It generally refers to the last node executed in the workflow. After the tail node is executed, it indicates the end of the workflow execution. The tail node does not have a successor node.

[0028] Predecessor node and successor node: Among two adjacent nodes that are executed in a sequential order, the node that is executed first is the predecessor node of the node that is executed later. Correspondingly, the node that is executed later is the successor node of the node that is executed first. It is understandable that a node may be a predecessor node of another node and also a successor node of other nodes. For example, node A is the predecessor node of node B adjacent to it, and correspondingly, node B is the successor node of node A. At the same time, node A can also be the successor node of node C adjacent to it. In addition, a node may have multiple predecessor nodes, for example, node A has multiple predecessor nodes in a parallel relationship. A node may also have multiple successor nodes, for example, node A has multiple successor nodes in a parallel relationship.

[0029] Conditional node: It can also be called a decision node or a judgment node. A conditional node predefines a set of conditions. When the workflow reaches this node, it will make a judgment based on the conditions, and the path that meets the conditions will be executed.

[0030] Traditional workflow engines are generally used in low-concurrency scenarios such as office automation. Tasks scheduled in workflows generally take minutes, hours, or even days to complete. The duration of tasks is not the primary consideration. The main challenge lies in the ability to allocate and schedule machine resources and executed tasks in a distributed environment. Unlike traditional workflow engines, online workflow engines are generally used in high-concurrency scenarios such as the Internet, and the scheduling of tasks in workflows is performed on a single machine. In order to meet business needs, the task scheduling of a single node in a workflow generally takes milliseconds. The main challenge of online workflow engines lies in the scheduling and execution performance of multiple threads in a multi-CPU environment. Due to the above differences, traditional workflow engines cannot be applied to online high-concurrency scenarios. However, most online workflow engines have weak support capabilities for workflows that can be easily implemented in traditional workflow engines, such as workflows with conditional branches and support for sub-workflows.

[0031] For example, in online high-concurrency scenarios, workflows with conditional branches are often encountered. In order to support multiple conditional branches, such workflows generally contain conditional nodes. In addition, in actual business scenarios, there are often conditional nodes containing dynamic parameters. That is, the values ​​of some conditional nodes depend on the values ​​of parameters dynamically generated during the execution of the workflow. For example: the value of a conditional node depends on the value of a parameter calculated by a certain node after the workflow starts executing and before the conditional node starts executing. For workflows containing such conditional nodes, the scheduling and execution algorithm of the workflow becomes more complicated because the values ​​of such conditional nodes need to be dynamically calculated during the workflow scheduling and execution process. Due to implementation difficulty and performance considerations, there are not many workflow engines that can effectively support conditional nodes containing dynamic parameters in online high-concurrency scenarios. Therefore, as discussed above, in order to improve the performance of the workflow engine, it is necessary to provide an efficient workflow scheduling algorithm.

[0032] In view of this, the present application proposes a solution for processing workflows. According to the solution, a source workflow for a business process can be obtained, and a target workflow is obtained after preprocessing the source workflow, wherein the target workflow includes a target condition node, and the target condition node has at least a first successor node and a second successor node. During the execution of the target condition node, the first successor node to be executed in the target workflow can be determined according to the target value of the target condition node. Further, the target workflow is updated to at least remove the connection between the target condition node and the second successor node. Then, based on the updated target workflow, the execution of the business process is controlled.

[0033] In this way, during the execution of the workflow, according to the value of the conditional node, the connection between the successor node that is not executed and the conditional node is removed. In other words, deleting the unreachable branches in the workflow is equivalent to "pruning" the workflow. The business continues to be executed based on the "pruned" workflow, thereby realizing the support of the workflow engine for conditional nodes containing dynamic parameters.

[0034] In the following, we will first refer to Figure 1 An example environment is described in which embodiments according to the present disclosure can be implemented.

[0035] Example Environment

[0036] Figure 1 1 shows a block diagram of an example environment 100 in which embodiments of the present disclosure can be implemented. The example environment 100 includes a workflow management system 110, a configuration distribution layer 120, and a workflow engine 130.

[0037] The workflow management system 110 is used by users to configure workflows, such as creating, deleting, modifying, viewing, importing, and exporting workflows. Users can also review and publish workflows through the workflow management system 110. The configuration information of the workflow can be stored in the database 140. As an example, Figure 1 The database 140 in the workflow management system 110 is independent of the workflow management system 110. In other examples, the database 140 can also be used as a submodule of the workflow management system 100 and integrated in the workflow management system 100. The embodiment of the present disclosure does not limit the implementation form of the database 140. In addition, the workflow management system 110 is also used to distribute the configuration information of the workflow to the configuration distribution layer 120.

[0038] The configuration distribution layer 120 is used to obtain the configuration information of the workflow from the workflow management system 110 and distribute it through different channels, such as publishing it to different storage media such as redis cluster, zookeeper cluster and other distributed caches, global configuration center or local disk, etc. It can also be directly exported to a file in a specific format, such as a json file, and then the developer copies the exported json file to the relevant project directory and runs it in a local loading mode. As an example, Figure 1 The two types of distribution channels, storage media and files, are given as examples. The present disclosure does not limit the types, quantity, etc. of channels for distributing workflows.

[0039] The workflow engine 130 is generally embedded in the service provided by the application system in the form of a component (or SDK). It provides a method to load workflow configuration information from the configuration distribution layer to build a workflow engine instance (or described as a workflow engine object). After the instance or object is built, the service can be provided with the ability to schedule and execute workflows. As an example, Figure 1 Three different services (service 1, service 2, service 3) and the corresponding workflow engines are given as examples.

[0040] The workflow management system 110 can be implemented as different devices or device clusters. The device or device cluster can be a terminal device or a terminal device cluster, or a server or a server cluster. For example, the workflow management system is a server cluster composed of one server or multiple servers.

[0041] The workflow management system 110 , the configuration distribution layer 120 , and the workflow engine 130 may be integrated into one platform, such as a workflow platform.

[0042] It should be understood that the functions of various systems or modules in the environment 100 are described for exemplary purposes only and do not imply any limitation on the scope of the present disclosure.

[0043] Figure 2 A schematic diagram of an architecture for processing workflows according to some embodiments of the present disclosure is shown. The architecture can be implemented in Figure 1 In the workflow engine 130. Figure 2 In the example of , the architecture 200 includes three parts: a pre-processing module 210 , a core processing module 220 , and an operator library 230 .

[0044] It is understandable that the architecture 200 may also include more or fewer modules. The above two or more modules may be integrated into one module, or one of the above modules may be divided into more sub-modules. The functions of a module described below may be implemented in the module or in other modules. The embodiments of the present disclosure do not limit the division method and function implementation of the modules in the architecture.

[0045] The functions of each module are described below by way of example.

[0046] The preprocessing module 210 is used to preprocess the workflow to be scheduled for execution, including loading the workflow, setting the head and tail nodes, setting the predecessor node, linking the parent and child workflows, etc., in order to help the subsequent core processing module simplify the processing logic and improve performance. The core processing module 220 is used to be called when providing services to the outside after the workflow engine is initialized. The module is divided into two modules: the initialization module 221 and the scheduling execution module 222. The initialization module 221 is responsible for completing the initialization of the context information. The scheduling execution module 222 includes three submodules: a workflow scheduling submodule D, a node execution submodule E, and a node removal submodule P (which can also be described as a node pruning submodule in the embodiment of the present disclosure). The operator library 230 contains two types of operators, one of which is the general operator built into the engine, such as the conditional judgment operator; the other is the business operator provided by the application layer. In some embodiments of the present disclosure, the operator name is the same as the node name in the workflow. All operators provide an execution method with the same name (the method name is defined by the engine layer, such as Run, Execute, etc., and the upper business layer implements the business logic according to the name defined by the engine layer). When executing a node below, the default method of the operator with the same name as the node is actually executed.

[0047] In some embodiments of the present disclosure, the pre-processing module 210 is called when the workflow engine is initialized.

[0048] In some embodiments of the present disclosure, the pre-processing module 210 first obtains or loads one or more workflows to be scheduled for execution.

[0049] Optionally, the preprocessing module 210 reads the configuration information of all workflows (also described as workflow sets) currently to be executed from a data source used to store workflows (for example, the distributed cache, global configuration center, or local disk involved in the configuration distribution layer 120 mentioned above) into memory and generates a workflow set of a specific data structure.

[0050] refer to Figure 3 , exemplarily showing an example of a workflow with a map structure. The data format of the map structure is a key-value pair format. In this example, the configuration information of the workflow is deserialized into a workflow 300 with a map structure, wherein the key 310 is the identifier of the workflow (workflowId), and the value 320 is the workflow object (workflow).

[0051] Optionally, a workflow object includes a workflow chart, for example, an object workflowChart of the WorkflowChart type.

[0052] Optionally, for each workflowChart object of type WorkflowChart, process it according to the following rules:

[0053] First, you can set the head and tail nodes.

[0054] The head node is a node that does not have a predecessor node. Therefore, the head node can be determined in the following way: for the node set Actions in the workflowChart, if there is a node Action that is not a successor node of any node, then set the node Action as the head node of the workflowChart.

[0055] The tail node is a node that has no successor node. Therefore, for the node set Actions in the workflowChart, if there is a node Action whose successor node list is empty, the node Action is set to the tail node of the workflowChart.

[0056] Furthermore, a predecessor node may be set.

[0057] In some embodiments of the present disclosure, there is a corresponding relationship between the predecessor node and the successor node. For example, for the first node, if the second node is the successor node of the first node, the corresponding first node must be the predecessor node of the second node. Then, through the successor node list of a certain node, the node can be marked as the predecessor node of all nodes in the successor node list. There is no need to traverse all nodes to obtain all predecessor nodes of the node. In this way, the speed of node search can be improved. In other words, the present disclosure marks the first node as the predecessor node of the second node in response to the successor node of the first node being the second node.

[0058] Therefore, for the workflow of the map structure mentioned above, the node set Actions in each object workflowChart of the WorkflowChart type is traversed, and each node Action in the node set Actions is processed according to the following rules: find the successor node list (NextActionIds) of the node Action, and for the node (NextAction) corresponding to each identifier (Id) in the successor node list (NextActionIds), add the identifier (ActionId) of the node (Action) to the predecessor node list (PrevActionIds) of each node (NextAction).

[0059] Through the above two processes, the head node, tail node, and predecessor node of each node are marked in advance, which facilitates the rapid access to nodes during the subsequent workflow scheduling and execution.

[0060] In some embodiments of the present disclosure, a multi-layer nested workflow is provided. For example, a workflow may be used in multiple similar business scenarios. In order to improve the reusability of the workflow, the workflow is set independently and can be nested as a sub-workflow in multiple other workflows to form a workflow with a nested relationship. For another example, for a complex workflow, in order to simplify the workflow, a part of the complex workflow is used as a sub-workflow and nested.

[0061] For ease of description, in the embodiments of the present disclosure, workflows in a nested relationship are described as parent workflows and child workflows, respectively. Among them, the parent workflow contains a node for linking the child workflow. In the embodiments of the present disclosure, the node is described as a child workflow node. Therefore, the parent workflow is a workflow containing a child workflow node; the child workflow is a workflow linked to the child workflow node. That is, the workflow nested in the parent workflow is described as a child workflow. In addition, there can be multiple child workflow nodes contained in the parent workflow. The child workflow corresponding to a child workflow node can further nest the child workflow, that is, form a multi-layer nested workflow.

[0062] refer to Figure 4 , an example of a workflow with two layers of nesting is given. Figure 4 In the example shown, workflow 400 includes 9 nodes, namely, node 1 to node 9. Among them, node 4 is a sub-workflow node. The sub-workflow corresponding to or linked to sub-workflow node 4 is workflow 410. Therefore, workflow 400 is the parent workflow of workflow 410, and correspondingly, workflow 410 is the sub-workflow of workflow 400. Workflow 410 includes nodes 41 to 45, among which node 44 is a sub-workflow node, and the sub-workflow corresponding to or linked to it is workflow 420. Therefore, workflow 410 can also be called the parent workflow of workflow 420, and correspondingly, workflow 420 is the sub-workflow of workflow 410.

[0063] It should be understood that Figure 4 This is just an exemplary description. Figure 4 In the example shown, workflow 420 includes nodes 441 to 446. Workflow 420 does not include a sub-workflow node. It is understandable that if workflow 420 includes a sub-workflow node, that is, there is a sub-workflow node in nodes 441 to 446, then workflow 420 can further nest sub-workflows. The present disclosure does not limit the number and number of layers of nested sub-workflows.

[0064] Currently, in high-concurrency scenarios, due to performance limitations, most workflow engines have limited support for the above-mentioned multi-layer nested workflows.

[0065] In some embodiments of the present disclosure, in order to enhance the workflow engine's support for the above-mentioned multi-layer nested workflows, after obtaining the source workflow for the business process, if the source workflow is a multi-layer nested workflow, the multi-layer nested workflow (which may also be described as a parent workflow in the embodiments of the present disclosure) is preprocessed.

[0066] In some embodiments of the present disclosure, a parent workflow includes a child workflow node, and the child workflow node corresponds to the child workflow. The preprocessing module 210 preprocesses the workflow containing multiple layers of nesting to link the parent and child workflows, and converts the workflow containing multiple layers of nesting into a single workflow. The specific process includes:

[0067] Replaces a child workflow node in a parent workflow with a set of nodes in the child workflow.

[0068] refer to Figure 4 and Figure 5 , the parent workflow 400 includes a child workflow node 4, and the child workflow node 4 corresponds to the child workflow 410. The child workflow 410 includes nodes 41 to 45, and the node 4 is replaced by the group of nodes 41 to 45 included in the child workflow 410 to obtain the workflow 500.

[0069] Further, refer to Figure 5 and Figure 6 , the workflow 500 also includes a sub-workflow node 44, which corresponds to the sub-workflow 420, and the sub-workflow 420 includes a group of nodes 441 to 446. Then the group of nodes 441 to 446 included in the sub-workflow 420 replaces the node 44 to obtain the workflow 600. At this point, the parent workflow 400 with nested sub-workflows is converted into a single workflow 600 without nested sub-workflows.

[0070] It should be understood that, for the convenience of display, in the embodiments of the present disclosure, Figure 4 , Figure 5 , Figure 6 In the figure, only the one-way connection line between the predecessor node and the successor node is shown, that is, the one-way connection arrow in the figure. In actual applications, the connection lines in the preprocessed workflow diagram are bidirectional.

[0071] In some embodiments of the present disclosure, for different types of replaced sub-workflow nodes, it is also necessary to set the association relationship of nodes associated with the replaced sub-workflow node (such as the predecessor node of the replaced sub-workflow node in the parent workflow and the head node of the sub-workflow, the successor node of the replaced sub-workflow node in the parent workflow and the tail node of the sub-workflow) as follows:

[0072] In some embodiments, if the child workflow node is the head node in the parent workflow, it means that the head node in the parent workflow is replaced, and the head node needs to be reset. That is, a group of nodes in the child workflow replaces the head node of the parent workflow, and the head node of the child workflow is used as the head node of the replaced workflow (the workflow obtained by linking the parent and child workflows).

[0073] In some embodiments, if the child workflow node is not the head node of the parent workflow, since the child workflow node is replaced, it is necessary to set the relationship between the predecessor node of the replaced child workflow node and the head node of the child workflow. Therefore, a group of predecessor nodes of the child workflow node in the parent workflow is determined; the head node in the child workflow is set as the successor node of the group of predecessor nodes; and the predecessor node of the head node in the child workflow is set as the above group of predecessor nodes.

[0074] For example, reference Figure 4 and Figure 5 After the sub-workflow 410 replaces the sub-workflow node 4 in the parent workflow 400 to obtain the workflow 500, since the sub-workflow node 4 is replaced, it is necessary to set the association relationship between the predecessor node 1 of the sub-workflow node 4 and the head node 41 of the sub-workflow 400. In this example, the successor node of the predecessor node 1 of the sub-workflow node 4 is set to the head node 41 of the sub-workflow 400. Correspondingly, the predecessor node of the head node 41 of the sub-workflow in the workflow 500 is set to node 1.

[0075] In some embodiments, if the child workflow node is the tail node in the parent workflow, it means that the tail node in the parent workflow is replaced, and the tail node needs to be reset. Therefore, a group of nodes in the child workflow replaces the tail node of the parent workflow, that is, the tail node of the child workflow is set to the tail node of the replaced workflow (the workflow obtained by linking the parent and child workflows).

[0076] In some embodiments, if the child workflow node is not the tail node of the parent workflow, since the child workflow node that is not the tail node is replaced, it is necessary to set the relationship between the successor node of the replaced child workflow node in the parent workflow and the tail node of the child workflow. Therefore, a group of successor nodes of the child workflow node in the parent workflow is determined; the tail node in the child workflow is set as the predecessor node of this group of successor nodes. And the successor node of the tail node in the child workflow is set as this group of successor nodes.

[0077] For example, reference Figure 4 and Figure 5 After replacing the sub-workflow node 4 in the workflow 400 with the sub-workflow 410 to obtain the workflow 500, since the sub-workflow node 4 is not the tail node in the workflow 400, it is necessary to set the association relationship between the successor node 5 of the sub-workflow node 4 and the tail node 45 of the sub-workflow 400. In this example, the tail node 45 of the sub-workflow 400 is set as the predecessor node of the successor node 5 of the sub-workflow node 4 in the workflow 500. Accordingly, the successor node of the tail node 45 of the sub-workflow 410 in the workflow 500 is set as node 5.

[0078] Combined with the following Figure 3 The data structure shown describes an example process of converting a parent workflow containing nesting into a single sub-workflow without nesting by linking sub-workflows.

[0079] exist Figure 3 In the example shown, n (n≥1) workflows are stored in a map data structure 310. For any workflow, for example, workflow i, its data structure 320 includes the following elements:

[0080] Identifier i (ID) represents the unique identifier of workflow i; scene identifier (SceneId) i is the identifier of the business scenario corresponding to workflow i. Usually there may be multiple business scenarios in an application system, and multiple different workflows may need to be configured in each business scenario. When the application system provides services to the outside world, it is necessary to choose to use different workflows according to the actual business scenarios. The workflow diagram represents the object workflowChart of the WorkflowChart type corresponding to the workflow i; the value of IsDefault is used to indicate that when the business system does not find a matching workflow, this workflow is used by default for execution. Update time (UpdateTime) is used to indicate the update time of the workflow configuration information.

[0081] Optionally, an experiment group name (GroupName) may also be included. When the business system performs a specific experiment, a workflow may be configured for each group (the experiment group name is not shown in the figure).

[0082] Furthermore, for a workflow chart (WorkflowChart), its data structure 330 includes the following elements:

[0083] The identifier of the head node (FirstActionId) indicates the ID of the first node executed in the workflow diagram; the identifier of the tail node (LastActionId) indicates the ID of the last node executed in the workflow diagram; the node set (Actions) composed of all nodes contained in the workflow diagram is represented by a Key-Value structure. The content of the Key is the identifier of the node object; the content of the Value is the content description of each node. Figure 5 Node identifiers and node contents of p (p≥2) nodes (node ​​1, node 2, ... node p) are exemplarily shown.

[0084] Furthermore, for each node in the node set, taking node k as an example, its corresponding data structure 340 includes the following elements:

[0085] Node type (ActionType), including task node, condition node, sub-workflow node (which can also be described as sub-process node in the embodiment of the present disclosure), etc.; node identifier (ActionId), which indicates the unique identifier of the node; parameters (Params) contained in the node; list of successor node execution conditions (NextConditions); list of predecessor node identifiers (PrevActionIds); node name (ActionName); list of successor node identifiers (NextActionIds); identifier of the referenced sub-workflow (RefWorkflowId), which indicates the identifier of the sub-workflow referenced by the workflow (which can also be described as linked or nested in the embodiment of the present disclosure). If the default value is 0, it means that no sub-workflow is referenced; and node description information (Description).

[0086] In some embodiments of the present disclosure, the pre-processing module 210 processes the linking of parent and child workflows for each workflow type object workflow according to the following steps:

[0087] First, initialize an empty set S. Traverse the node set Actions in the workflow diagram workflowChart of workflow, find all node Actions of the "sub-process" type, and add them to S. If the number of elements in the set S is 0, return. Alternatively or additionally, if the number of elements in the set S is not 0, for each element FA in the set S, find the sub-process refWorkflow referenced by FA, ​​take out all the nodes refActions in refWorkflow, and copy them to the node set Actions of the flowchart workflowChart of workflow.

[0088] In some embodiments, if FA is the head node of workflowChart, the head node of the workflow graph of refWorkflow is set to the head node of the workflow graph of workflowChart.

[0089] Alternatively or additionally, if FA is not the head node of workflowChart, for each predecessor node PA of FA, replace the FA node in the successor node list of PA with the head node of the workflow diagram of refWorkflow. Accordingly, set the predecessor node list of the head node of the newly added sub-workflow diagram in workflowChart to the predecessor node list of FA.

[0090] Alternatively or additionally, if FA is the tail node of workflowChart, the tail node of the workflow graph of refWorkflow is set to the tail node of the workflow graph of workflowChart.

[0091] Alternatively or additionally, if FA is not the tail node of workflowChart, perform the following operations: for each successor node NA of FA, replace the FA node in the predecessor node list of NA with the tail node of the workflow diagram of refWorkflow. Accordingly, set the successor node list of the tail node of the newly added sub-workflow diagram in workflowChart to the successor node list of FA.

[0092] Finally, since the FA node is replaced, the FA node is deleted from the node collection Actions of the workflowChart.

[0093] Repeat the above steps until all workflow objects of the Workflow type are processed.

[0094] Through the above process, the parent workflow containing multiple layers of nesting is converted into a single workflow, thereby supporting the scheduling and execution of the parent workflow containing multiple layers of nesting. In addition, since the above work is performed in the preprocessing stage, the speed of workflow scheduling and execution is also improved.

[0095] After the above preprocessing, the subsequent online service can select the corresponding workflow for scheduling and execution according to the current request after receiving the request.

[0096] Still combined Figure 2 The architecture shown in the figure is described below. The process of scheduling workflow execution business is described below.

[0097] In some embodiments of the present disclosure, the core processing module 220 is used to be called when providing services to the outside after the workflow engine is initialized. For example, the core processing module 220 is used to receive a scheduling request for a service, and select a workflow for a business process corresponding to the request in response to the scheduling request for the service, and control the execution of the business process based on the obtained workflow.

[0098] The following description is made by taking the workflow obtained as a workflow containing a conditional node (which may also be described as a source workflow in the embodiment of the present disclosure) as an example. Optionally, the conditional node may be the conditional node containing dynamic parameters as mentioned above.

[0099] Before the business process is executed, the core processing module 220 obtains the workflow for the business process. For example, there may be multiple business scenarios in an application system, and multiple different workflows may be configured in each scenario. When the application system provides services to the outside world, it is necessary to select a workflow according to the actual business scenario.

[0100] Optionally, the core processing module 220 obtains the workflow preprocessed by the preprocessing module 210. In some embodiments of the present disclosure, the obtained workflow (source workflow) is preprocessed to obtain a target workflow, which includes a target condition node, and the target condition node has at least a first successor node and a second successor node.

[0101] Exemplary, reference Fig. 7A The obtained workflow 700 includes a group of nodes, namely, node 0 to node 7. In this group of nodes, node 1, node 3 and node 4 are target condition nodes. Node 1 has two successor nodes, node 2 and node 4. Node 4 has two successor nodes, node 5 and node 6. Node 3 has two successor nodes, node 4 and node 6.

[0102] After the core processing module 220 obtains the target workflow, during the execution of the target condition node, according to the target value of the target condition node, the successor node to be executed in the target workflow is determined to be the first successor node, and then the branch to be executed is determined. After that, the target workflow is updated to at least remove the connection between the target condition node and the second successor node. That is, the unexecuted branches in the updated target workflow are "pruned". Then, based on the updated target workflow, the execution of the business process is controlled.

[0103] Combined with the following Figure 2 The structure of the core processing module 220 in FIG. 2 describes the above process in detail.

[0104] See also Figure 2 As an example, the core processing module 220 includes two sub-modules: an initialization module 221 and a scheduling execution module 222 .

[0105] The initialization module 221 is responsible for completing the initialization of the context information.

[0106] Before each scheduling and execution of the workflow graph, an initialization method InitContext needs to be executed to pass some context information into the workflow scheduling and execution function in the form of parameters. The specific initialization work includes:

[0107] In some embodiments, the initialization work includes business context (Ctx) initialization: business information required during workflow execution is stored in Ctx. Optionally, intermediate results during subsequent workflow scheduling execution can also be stored in Ctx.

[0108] Additionally or alternatively, the initialization work also includes initializing the coroutine synchronizer (CA) corresponding to the node: traversing the workflow graph, creating a coroutine synchronizer for each node containing multiple predecessor nodes. Exemplarily, the initial value of the internal counter of the coroutine synchronizer is set to the total number of predecessor nodes of the current node, and the created coroutine synchronizer will be stored in the CA.

[0109] Additionally or alternatively, the initialization work also includes initializing a workflow state synchronizer (CF): creating a coroutine synchronizer for synchronizing the workflow execution state. The initial value of the internal counter of the coroutine synchronizer is set to 1.

[0110] The coroutine synchronizer in the above initialization work is a tool for synchronizing multiple concurrently executed coroutines, which can be implemented in different programming languages. For example: WaitGroup implemented in golang, CountDownLatch implemented in Java, etc. The coroutine synchronizer generally provides an initialization operation: set the count of the built-in counter, and the initial value of the counter is the number of coroutines to be synchronized. Alternatively or additionally, the coroutine synchronizer can also provide a counting operation: in all concurrently executed coroutines, this method is called after each coroutine is executed, and the counter is reduced by 1. Alternatively or additionally, the coroutine synchronizer can also provide a waiting operation: usually after multiple concurrent coroutines are started in the main coroutine, the waiting method will be called to block the main coroutine. When all concurrent coroutines are executed, the counter becomes 0, and the main coroutine will be awakened and continue to execute.

[0111] Additionally or alternatively, the initialization work also includes initializing the nodes to be executed: creating an empty set W for storing the identifiers (IDs) of the nodes waiting to be executed.

[0112] Additionally or alternatively, the initialization work also includes initializing the head node: assigning the head node of the workflow graph to parameter A, which is of type Action.

[0113] In some embodiments of the present disclosure, the following initialization is also required: Initialization of pruned edges: Create an empty set F to store pruned edges. In the embodiments of the present disclosure, an "edge" is a line connecting a predecessor node and a successor node, which can also be called a connection, such as:<PA,A> It is the connection between node PA and node A.

[0114] After the initialization module 221 completes parameter initialization, the parameters are passed to the scheduling execution module 222 for scheduling and executing the workflow.

[0115] Reference Figure 2 As an example, the scheduling execution module 222 includes three main submodules: a workflow scheduling submodule D, a node execution submodule E, and a node removal submodule P (which can also be described as a node pruning submodule in the embodiment of the present disclosure). In addition, Figure 2 , six coroutines G1 to G6 are shown, each of which includes a workflow scheduling submodule D, a node execution submodule E, and a node removal submodule P. Moreover, the present disclosure does not limit the number of coroutines G.

[0116] The workflow scheduling submodule D schedules nodes in the target workflow based on an algorithm. The node execution submodule E is responsible for the execution of the node and calls the node removal submodule P during the execution of the node.

[0117] In some embodiments of the present disclosure, during the execution of a workflow, for a conditional node, a node to be executed is determined from a plurality of successor nodes corresponding to the conditional node according to the target value of the conditional node. Taking the case where a conditional node corresponds to two successor nodes as an example, in an embodiment of the present disclosure, the node to be executed is described as the first successor node, and the successor node that is not executed is described as the second successor node. Since the second successor node is not executed, the connection between the target conditional node and the second successor node is removed, so that the target workflow is changed, that is, updated. The update process may be executed multiple times during the execution of the target workflow. For example, if the target workflow includes multiple target conditional nodes, the target workflow will be updated each time the target conditional node is executed. The execution of the business process continues to be controlled based on the updated target workflow until the target workflow is executed.

[0118] In some embodiments of the present disclosure, during this execution, the second successor node is not executed, and therefore, the association relationship between the second successor node and the target condition node is cancelled. That is, the second successor node is removed from the successor node list of the target condition node; and the target condition node is removed from the predecessor node list of the second successor node.

[0119] In some embodiments of the present disclosure, a coroutine counter of the second successor node is decremented, and the coroutine counter is configured to trigger execution of the second successor node.

[0120] In some embodiments of the present disclosure, a set for storing pruned connections can be created, and after a connection is removed, the removed connection is moved into the set. Therefore, it is determined whether the connection between the target condition node and the second successor node is in the pruned connection set; if it is in the set, it indicates that the connection has been "pruned" and no "pruning" is required. If it is not in the set, it indicates that the connection has not been pruned, and the "pruning" of the connection is completed by adding the above connection to the pruned connection set.

[0121] In some embodiments of the present disclosure, if the predecessor node list of the second successor node is empty and the second successor node is not the head node, it indicates that the second successor node has no in-degree and will not be executed. Accordingly, the second successor node can be deleted from the target workflow.

[0122] In the embodiment of the present disclosure, the predecessor node list of the second successor node is described as the first predecessor node list.

[0123] After the second successor node is removed, it is also necessary to judge the successor node of the second successor node to further determine whether to "prune" the successor node of the second successor node.

[0124] For ease of description, in the disclosed embodiment, a node to be removed is described as a preceding node, and a successor node of the node to be removed is described as a node to be pruned. A predecessor node list of the node to be pruned is described as a second predecessor node list.

[0125] For example, after the second successor node is removed, the second successor node is a preceding node, and at least one successor node of the second successor node is a node to be pruned.

[0126] For the node to be pruned, first, since the preceding node is a node removed from the workflow, that is, the preceding node is not executed, the relationship between the preceding node and the successor node is released. That is, the preceding node is removed from the predecessor node list (second predecessor node list) of the node to be pruned. Afterwards, if there is no predecessor node for the node to be pruned, it indicates that the node to be pruned does not have an in-degree and will not be executed, then the node to be pruned needs to be "pruned". That is, if the second predecessor node list is empty, remove the node to be pruned from the target workflow. Finally, the preceding node is determined as the node to be pruned next time, and the successor node of the node to be pruned is determined as the node to be pruned next time. Execute the above process again. In this way, the pruning process is continuously iterated.

[0127] In addition, in some embodiments of the present disclosure, a "parallel breadth traversal algorithm" is adopted. According to the "parallel breadth traversal algorithm" of the present disclosure, if a node has multiple successor nodes to be executed, the multiple successor nodes to be executed can be executed in parallel using multiple coroutines, thereby improving the execution efficiency of the node.

[0128] Alternatively or additionally, according to the “parallel breadth traversal algorithm” of the present disclosure, if the current node has only a single successor node, the coroutine used to execute the current node can be used to continue executing the successor node, thereby saving coroutine resources.

[0129] Alternatively or additionally, according to the “parallel breadth traversal algorithm” of the present disclosure, a coroutine synchronizer may also be used to reduce the overhead of synchronization between coroutines.

[0130] The specific implementation of the "Parallel Breadth Traversal Algorithm" will be introduced in detail below.

[0131] In some embodiments of the present disclosure, the coroutine creation rule may include the following cases: If the number of successor nodes of the current node is equal to 0, there is no need to create a new coroutine. If the number of successor nodes of the current node is equal to 1, there is no need to create a new coroutine, and the coroutine executing the current node executes the successor node, which can save the number of coroutines. If the number of successor nodes of the current node is equal to N (N>1), the coroutine executing the current node creates N new coroutines to execute the successor nodes in parallel.

[0132] In some embodiments of the present disclosure, the coroutine creation rule also includes the following situation: for the current node of the coroutine to be assigned, if the current node has multiple predecessor nodes, a coroutine is selected from the multiple coroutines assigned to the multiple predecessor nodes according to a certain rule, and the selected coroutine is assigned to the node of the coroutine to be assigned. The rule may be to select the earliest completed coroutine among the multiple coroutines according to the execution completion time of the multiple coroutines assigned to the multiple predecessor nodes.

[0133] The following is a detailed description of the workflow scheduling execution algorithm, which can be executed by the workflow scheduling submodule D as follows:

[0134] The workflow scheduling submodule executes executeFlow(Ctx,CA,CF,W,A,F) according to the initialization parameters Ctx,CA,CF,W,A,F, where:

[0135] If the number of predecessor nodes of the current node A is greater than 1, then if A exists in the set of nodes to be executed W, then return. If A does not exist in the set of nodes to be executed W, then add the current node A to the set of nodes to be executed W. In addition, use A's coroutine synchronizer CA(A) to wait for all predecessor nodes to be executed.

[0136] Additionally or alternatively, the workflow scheduling submodule D executes the current node L=executeAction(Ctx, CA, CF, A, F) to further determine a list of nodes to be executed after the execution of node A. Wherein L is the list of nodes to be executed returned after the execution of the method is completed.

[0137] Additionally or alternatively, if the length of list L is 0, it indicates that there is no node to be executed, and the node is the tail node, then it returns directly and the workflow execution ends. If the length of list L is 1, then for the only node L(0) in L, recursively call executeFlow(Ctx,CA,CF,W,L(0),F), and then return. If the length of L is greater than 1, for each node L(i) to be executed in L, start a new coroutine, and recursively call executeFlow(Ctx,CA,CF,W,L(i),F) in the new coroutine.

[0138] Additionally or alternatively, during the process of scheduling the workflow, the workflow state synchronizer (CF) is blocked, waiting for the workflow to be executed and completed. After the workflow is executed and completed, the workflow state synchronizer is released.

[0139] For each node, the node execution submodule E is responsible for the execution of the corresponding node. The specific execution process of the node execution submodule E is as follows:

[0140] The node execution submodule E executes executeAction(Ctx,CA,CF,A,F) according to the initialization parameters Ctx,CA,CF,A,F.

[0141] The node execution submodule E initializes an empty node list L, which is used to store the list of nodes to be executed after the current node A is executed.

[0142] If the current node A is a conditional node, the operator with the same name as node A in the operator library is executed. If the execution is successful, the next node to be executed that matches the execution result is found according to the execution result (i.e. the result of the conditional judgment, such as "Y", "N", etc.), and the node is added to L; if the execution fails, the default node is selected from the list of nodes to be executed as the node to be executed, and the node is added to L.

[0143] Alternatively or additionally, if the current node A is a non-conditional node and the process state in Ctx is not set to skip, the following operations are performed: Execute the operator with the same name as the node A in the operator library 230. Add all successor nodes of the node A to L.

[0144] Alternatively or additionally, if the number of successor nodes of the current node A is greater than 0, the following logic is executed for each successor node NA of A:

[0145] (1) If node A is a conditional node, call the node removal submodule P for all nodes in A's successor nodes that are not in L, and execute the pruning function: Prune(Ctx,CA,CF,A,NA,F). The execution logic of this pruning function is: if node PA or A is empty, return. If the number of predecessor nodes of node A is greater than 1, determine the edge<PA,A> (also called the connection between PA and A) is in F, if the edge<PA,A> If it is not in F, then the edge<PA,A> Add to F, and decrement the count value of A's coroutine synchronizer CA(A) by 1. If the count becomes 0 after decrement, all coroutines blocked on CA(A) will be awakened by CA(A). In addition, delete PA from A's predecessor node list, and delete A from PA's successor node list. Alternatively, or additionally, if the number of A's predecessor nodes is greater than 0, return. If the number of A's successor nodes is greater than 0, prune each successor node NA of A, that is, execute the recursive function: Prune(Ctx,CA,CF,A,NA,F).

[0146] (2) If the current node A is not a conditional node and the number of predecessor nodes of NA is greater than 1, the counter value of NA's coroutine synchronizer CA(NA) is reduced by 1. If the counter value becomes 0, all coroutines blocked on NA's coroutine synchronizer CA(NA) will be awakened by NA's coroutine synchronizer CA(NA).

[0147] Alternatively or additionally, if the current node A is the tail node of the workflow graph to which it belongs, the count of the workflow state synchronizer (CF) is reduced by 1. If the counter value becomes 0 after reduction by 1, the main coroutine of the upstream blocked workflow scheduling is awakened by the workflow state synchronizer (CF).

[0148] Alternatively or additionally, the node execution submodule E returns to L after executing the above steps.

[0149] In order to explain the present disclosure more clearly, a workflow in a business scenario is as follows: Fig. 7A As shown, the three conditional nodes (node ​​1, node 3 and node 4) all contain dynamic parameters.

[0150] For ease of description, Figure 7A to Figure 7E In the workflow, each node is marked with two attributes: node identifier (such as Figures 7A to 7E Node 1, Node 2, etc.) and the identifier of the code module corresponding to the node (such as Figure 7A to Figure 7E Module 0, module A, module B, module C, module EQ and module D).

[0151] Combination Figure 7A to Figure 7E , the workflow engine will schedule the execution of the workflow diagram according to the order in Table 1 below.

[0152] Table 1

[0153] step operate 1 Node execution: Node 0, execution module: Module 0 2 Node execution: Node 1, execution module: Module EQ, execution result: N 3 Node pruning: Node 1, disassociating successor node: [Node 4] 4 Node execution: Node 2, execution module: Module A 5 Node execution: Node 3, execution module: EQ, execution result: N 6 Node pruning: Node 3, disassociating successor node: [Node 4] 7 Node pruning: Node 4, disassociating successor node: [Node 5] 8 Node pruning: Node 5, disassociating successor node: [Node 6] 9 Node pruning: Node 4, disassociating successor node: [Node 6] 10 Node execution: Node 6, execution module: Module C 11 Node execution: Node 7, execution module: Module D.

[0154] Combination Figure 7A to Figure 7E , showing the execution process of each step in the above table in turn, where the nodes marked in white represent the nodes to be executed, the nodes with black bold borders represent the executed nodes, and the nodes marked in black represent the nodes that become isolated and do not need to be executed after pruning.

[0155] Combination Fig. 7A , shows the workflow 700 that has not been executed yet, or the initial state of the workflow 700.

[0156] Combination Figure 7B , node 0 in workflow 700 is executed first, that is, the corresponding code module: module 0 is executed. Figure 7B The state of the workflow at this time is represented as workflow state diagram 701.

[0157] Furthermore, after node 0 in workflow 700 is executed, node 1 is further executed, that is, after the corresponding code module: module EQ is executed, the state of the workflow at this time is represented as workflow state diagram 702 .

[0158] Further, if the execution result of node 1 is N, the connection between node 1 and the successor node: [node 4] is deleted, and the workflow is updated. In the workflow state diagram 703, the connection between node 1 and node 4 is cancelled.

[0159] Combination Figure 7C , since the execution result of node 1 is N, after node 1 is executed, node 2 is executed, that is, the corresponding code module: module A. The state of the workflow at this time is represented as a workflow state diagram 704.

[0160] It is understandable that the above workflow state diagrams 703 and 704 are only examples, and the present disclosure does not limit the order of the above-mentioned cancellation of the associated successor node of node 1: [node 4], and the execution of the two processes of node 2.

[0161] Further, combined with Figure 7C After node 2 is executed, the successor node of node 2 is executed: node 3, which is the corresponding module EQ. The state of the workflow at this time is represented as a workflow state diagram 705.

[0162] Combination Figure 7C , the execution result of node 3 is N, then the connection between node 3 and the associated successor node: [node 4] is deleted, and the state of the workflow at this time is updated and represented as a workflow state diagram 706. As shown in the figure, the connection between node 3 and node 4 is cancelled.

[0163] Further, combined with Fig.7D , node 4 does not have in-degree, then the iterative pruning process can be performed on the successor nodes of node 4. Fig.7D As shown, during the pruning process, the connection between node 4 and node 5 can be deleted.

[0164] Furthermore, since node 5 is updated to a non-head node without in-degree, pruning can be further performed on the successor node 6 of node 5. Accordingly, the connection between node 5 and node 6 can be deleted.

[0165] Similarly, combined Fig.7D , pruning can also be performed on the successor node 6 of node 4, and accordingly, the connection between node 4 and node 6 can be deleted.

[0166] Based on this iterative pruning process, Fig. 7E As shown, nodes 4 and 5 will become nodes without in-degree and out-degree, that is, isolated nodes that do not need to be executed. In order to reduce the scheduling complexity of the workflow, such nodes 4 and 5 can be removed from the workflow.

[0167] Further, combined with Fig. 7E, node 6 is executed accordingly, and the state of the workflow at this time is represented as a workflow state diagram 710.

[0168] Further, combined with Fig. 7E , node 7 is executed, and the state of the workflow at this time is represented as workflow state diagram 711.

[0169] At this point, the entire workflow has been scheduled and executed.

[0170] Based on the process described above, the embodiments of the present disclosure can utilize the “dynamic pruning” process to achieve efficient scheduling and execution of workflows containing conditional nodes with dynamic parameters.

[0171] Example Process

[0172] Figure 8 800 for processing a workflow according to some embodiments of the present disclosure. The process 800 may be implemented at the workflow engine 130. For ease of discussion, reference will be made to Figure 1 Process 300 is described with reference to environment 100. It should be understood that process 800 may include additional actions not shown and / or may omit actions shown, and the scope of the present disclosure is not limited in this respect.

[0173] At block 810 , the workflow engine 130 obtains a source workflow for a business process.

[0174] In block 820 , the workflow engine 130 preprocesses the source workflow to obtain a target workflow, wherein the target workflow includes a target condition node, and the target condition node has at least a first successor node and a second successor node.

[0175] In block 830 , during the execution of the target condition node, the workflow engine 130 determines a first successor node to be executed in the target workflow according to the target value of the target condition node.

[0176] At block 840 , the workflow engine 130 updates the target workflow to remove at least the connection between the target condition node and the second successor node; and

[0177] At block 850 , the workflow engine 130 controls the execution of the business process based on the updated target workflow.

[0178] In some embodiments, updating the target workflow includes: removing the second successor node from a successor node list in the target condition node; and removing the target condition node from a predecessor node list of the second successor node.

[0179] In some embodiments, process 800 further includes: decrementing a coroutine counter of the second successor node, wherein the coroutine counter is configured to trigger execution of the second successor node.

[0180] In some embodiments, updating the target workflow includes: determining whether a connection between the target condition node and the second successor node is in a pruned connection set; and in response to the connection not being in the pruned connection set, adding the connection to the pruned connection set.

[0181] In some embodiments, updating the target workflow includes: if a predecessor node list of the second successor node is empty, deleting the second successor node from the target workflow.

[0182] In some embodiments, the predecessor node list of the second successor node is the first predecessor node list, the preceding node is the second successor node; the node to be pruned is at least one successor node of the second successor node, and updating the target workflow includes: iteratively executing the following process at least once: removing the preceding node from the second predecessor node list of the node to be pruned; if the second predecessor node list is empty, removing the node to be pruned from the target workflow; determining the node to be pruned as the preceding node; and determining the successor node of the node to be pruned as the node to be pruned.

[0183] In some embodiments, the source workflow is a parent workflow, the parent workflow includes child workflow nodes, and the child workflow nodes correspond to the child workflows; preprocessing the source workflow includes: replacing the child workflow nodes in the parent workflow with a group of nodes in the child workflow.

[0184] In some embodiments, replacing a sub-workflow node in a parent workflow with a group of nodes in the sub-workflow includes: if the sub-workflow node is the head node in the parent workflow, replacing the head node of the parent workflow with a group of nodes in the sub-workflow, and the head node of the sub-workflow is the head node of the replaced workflow.

[0185] In some embodiments, replacing a sub-workflow node in a parent workflow with a group of nodes in the sub-workflow includes: if the sub-workflow node is not the head node of the parent workflow, determining a group of predecessor nodes of the sub-workflow node in the parent workflow; setting the head node in the sub-workflow as a successor node of the group of predecessor nodes; and setting the predecessor node of the head node in the sub-workflow to the group of predecessor nodes.

[0186] In some embodiments, replacing a sub-workflow node in a parent workflow with a group of nodes in the sub-workflow includes: if the sub-workflow node is the tail node in the parent workflow, replacing the tail node of the parent workflow with a group of nodes in the sub-workflow, and the tail node of the sub-workflow is the tail node of the replaced workflow.

[0187] In some embodiments, replacing a sub-workflow node in a parent workflow with a group of nodes in the sub-workflow includes: if the sub-workflow node is not the tail node of the parent workflow, determining a group of successor nodes of the sub-workflow node in the parent workflow; setting the tail node in the sub-workflow as a predecessor node of the group of successor nodes; and setting the successor node of the tail node in the sub-workflow to the group of successor nodes.

[0188] Example devices and equipment

[0189] Fig. 9 A schematic structural block diagram of an apparatus 900 for processing a workflow according to some embodiments of the present disclosure is shown. The apparatus 900 may be implemented as or included in a business application system 130. Each module / component in the apparatus 900 may be implemented by hardware, software, firmware, or any combination thereof.

[0190] like Fig. 9 As shown, the apparatus 900 includes a source workflow acquisition module 910 configured to acquire a source workflow for a business process.

[0191] The apparatus 900 further includes a preprocessing module 920 configured to preprocess the source workflow to obtain a target workflow, wherein the target workflow includes a target condition node, and the target condition node has at least a first successor node and a second successor node.

[0192] The apparatus 900 further includes a to-be-executed successor node determination module 930 configured to determine, during the execution of the target condition node, a first to-be-executed successor node in the target workflow according to a target value of the target condition node.

[0193] The apparatus 900 further includes a target workflow updating module 940 configured to update the target workflow to at least remove a connection between the target condition node and the second successor node; and

[0194] The apparatus 900 further includes a control module 950 configured to control the execution of the business process based on the updated target workflow.

[0195] In some embodiments, the target workflow update module 940 is further configured to remove the second successor node from the successor node list in the target condition node; and remove the target condition node from the predecessor node list of the second successor node.

[0196] In some embodiments, the apparatus 900 further includes a counting module configured to decrement a coroutine counter of the second successor node, wherein the coroutine counter is configured to trigger execution of the second successor node.

[0197] In some embodiments, the target workflow update module 940 is further configured to determine whether the connection between the target condition node and the second successor node is in the pruned connection set; and in response to the connection not being in the pruned connection set, add the connection to the pruned connection set.

[0198] In some embodiments, the target workflow updating module 940 is further configured to delete the second successor node from the target workflow if the predecessor node list of the second successor node is empty.

[0199] In some embodiments, the predecessor node list of the second successor node is the first predecessor node list, and the preceding node is the second successor node; the node to be pruned is at least one successor node of the second successor node, and the target workflow update module 940 is also configured to iteratively perform the following process at least once: remove the preceding node from the second predecessor node list of the node to be pruned; if the second predecessor node list is empty, remove the node to be pruned from the target workflow; determine the node to be pruned as the preceding node; and determine the successor node of the node to be pruned as the node to be pruned.

[0200] In some embodiments, the source workflow is a parent workflow for a business process, wherein the parent workflow includes a child workflow node, and the child workflow node corresponds to the child workflow; and the preprocessing module 920 is further configured to replace the child workflow node in the parent workflow with a set of nodes in the child workflow.

[0201] In some embodiments, the preprocessing module 920 is further configured to replace the head node of the parent workflow with a set of nodes in the child workflow if the child workflow node is the head node in the parent workflow, and the head node of the child workflow is the head node of the replaced workflow.

[0202] In some embodiments, the preprocessing module 920 is also configured to, if the child workflow node is not the head node of the parent workflow, determine a group of predecessor nodes of the child workflow node in the parent workflow; set the head node in the child workflow as the successor node of this group of predecessor nodes; and set the predecessor node of the head node in the child workflow to this group of predecessor nodes.

[0203] In some embodiments, the preprocessing module 920 is further configured to replace the tail node of the parent workflow with a group of nodes in the child workflow if the child workflow node is the tail node in the parent workflow, and the tail node of the child workflow is the tail node of the replaced workflow.

[0204] In some embodiments, the preprocessing module 920 is further configured to, if the child workflow node is not the tail node of the parent workflow, determine a group of successor nodes of the child workflow node in the parent workflow; set the tail node in the child workflow as the predecessor node of this group of successor nodes; and set the successor node of the tail node in the child workflow to this group of successor nodes.

[0205] Fig.10 A block diagram illustrating a computing device 1000 in which one or more embodiments of the present disclosure may be implemented is shown. It should be understood that Fig.10 The computing device 1000 shown is merely exemplary and should not constitute any limitation on the functionality and scope of the embodiments described herein. Fig.10 The computing device 1000 shown may be used to implement Figure 1 Workflow engine 130.

[0206] like Fig.10 As shown, computing device 1000 is in the form of a general-purpose computing device. Components of computing device 1000 may include, but are not limited to, one or more processors or processing units 1010, memory 1020, storage device 1030, one or more communication units 1040, one or more input devices 1050, and one or more output devices 1060. Processing unit 1010 may be an actual or virtual processor and is capable of performing various processes according to a program stored in memory 1020. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to increase the parallel processing capabilities of computing device 1000.

[0207] The computing device 1000 typically includes a plurality of computer storage media. Such media may be any accessible media that is accessible to the computing device 1000, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 1020 may be a volatile memory (e.g., a register, a cache, a random access memory (RAM)), a non-volatile memory (e.g., a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 1030 may be a removable or non-removable medium, and may include a machine-readable medium, such as a flash drive, a disk, or any other medium, which may be capable of being used to store information and / or data (e.g., training data for training) and may be accessed within the computing device 1000.

[0208] The computing device 1000 may further include additional removable / non-removable, volatile / non-volatile storage media. Fig.10As shown in , a disk drive for reading or writing from a removable, non-volatile disk (e.g., a "floppy disk") and an optical drive for reading or writing from a removable, non-volatile optical disk may be provided. In these cases, each drive may be connected to the bus (not shown) by one or more data media interfaces. Memory 1020 may include a computer program product 1025 having one or more program modules that are configured to perform various methods or actions of various embodiments of the present disclosure.

[0209] The communication unit 1040 enables communication with other computing devices via a communication medium. Additionally, the functions of the components of the computing device 1000 can be implemented in a single computing cluster or multiple computing machines that can communicate via a communication connection. Therefore, the computing device 1000 can operate in a networked environment using a logical connection with one or more other servers, a network personal computer (PC), or another network node.

[0210] Input device 1050 may be one or more input devices, such as a mouse, keyboard, tracking ball, etc. Output device 1060 may be one or more output devices, such as a display, a speaker, a printer, etc. Computing device 1000 may also communicate with one or more external devices (not shown) through communication unit 1040 as needed, such as storage devices, display devices, etc., communicate with one or more devices that allow a user to interact with computing device 1000, or communicate with any device that allows computing device 1000 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface (not shown).

[0211] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, wherein the computer-executable instructions are executed by a processor to implement the method described above. According to an exemplary implementation of the present disclosure, a computer program product is also provided, which is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, and the computer-executable instructions are executed by a processor to implement the method described above.

[0212] Various aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of the methods, devices, equipment, and computer program products implemented according to the present disclosure. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer-readable program instructions.

[0213] These computer-readable program instructions can be provided to a processing unit of a general-purpose computer, a special-purpose computer, or other programmable data processing device, thereby producing a machine, so that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device that implements the functions / actions specified in one or more boxes in the flowchart and / or block diagram is generated. These computer-readable program instructions can also be stored in a computer-readable storage medium, and these instructions cause the computer, programmable data processing device, and / or other equipment to work in a specific manner, so that the computer-readable medium storing the instructions includes a manufactured product, which includes instructions for implementing various aspects of the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0214] Computer-readable program instructions can be loaded onto a computer, other programmable data processing apparatus, or other device so that a series of operational steps are performed on the computer, other programmable data processing apparatus, or other device to produce a computer-implemented process, so that the instructions executed on the computer, other programmable data processing apparatus, or other device implement the functions / actions specified in one or more boxes in the flowchart and / or block diagram.

[0215] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to multiple implementations of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of a module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some implementations as replacements, the function marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square boxes can actually be executed substantially in parallel, and they can sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be realized by a special hardware-based system that performs the function or action of the specification, or can be realized by a combination of special hardware and computer instructions.

[0216] The above descriptions of various implementations of the present disclosure are exemplary, non-exhaustive, and not limited to the disclosed implementations. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described implementations. The selection of terms used herein is intended to best explain the principles of the implementations, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the various implementations disclosed herein.

Claims

1. A method for processing a workflow, comprising: Get the source workflow for the business process; Preprocessing the source workflow to obtain a target workflow, wherein the target workflow includes a target condition node, and the target condition node has at least a first successor node and a second successor node; During the execution of the target condition node, determining the first successor node to be executed in the target workflow according to the target value of the target condition node; updating the target workflow to remove at least a connection between the target condition node and the second successor node; as well as Based on the updated target workflow, the execution of the business process is controlled.

2. The method according to claim 1, wherein updating the target workflow comprises: Remove the second successor node from the successor node list in the target condition node; as well as The target condition node is removed from a predecessor node list of the second successor node.

3. The method according to claim 2, further comprising: Decrement a coroutine counter of the second successor node, wherein the coroutine counter is configured to trigger execution of the second successor node.

4. The method according to claim 2, wherein updating the target workflow comprises: Determining whether the connection between the target condition node and the second successor node is in a pruned connection set; as well as In response to the connection not being in the pruned connection set, the connection is added to the pruned connection set.

5. The method according to claim 2, wherein updating the target workflow comprises: If the predecessor node list of the second successor node is empty, deleting the second successor node from the target workflow.

6. The method according to claim 5, wherein the predecessor node list of the second successor node is the first predecessor node list, and the preceding node is the second successor node; The node to be pruned is at least one successor node of the second successor node, and updating the target workflow includes: Iteratively perform the following process at least once: Remove the previous node from the second predecessor node list of the node to be pruned; If the second predecessor node list is empty, remove the to-be-pruned node from the target workflow; Determining the node to be pruned as a previous node; and The successor node of the node to be pruned is determined as the node to be pruned.

7. The method according to claim 1, wherein the source workflow is a parent workflow, the parent workflow includes a child workflow node, and the child workflow node corresponds to the child workflow; preprocessing the source workflow comprises: The sub-workflow nodes in the parent workflow are replaced with a set of nodes in the sub-workflow.

8. The method according to claim 7, wherein replacing the sub-workflow node in the parent workflow with a group of nodes in the sub-workflow comprises: If the child workflow node is the head node in the parent workflow, a group of nodes in the child workflow replaces the head node of the parent workflow, and the head node of the child workflow is the head node of the replaced workflow.

9. The method according to claim 7, wherein replacing the sub-workflow node in the parent workflow with a group of nodes in the sub-workflow comprises: If the child workflow node is not the head node of the parent workflow, determining a set of predecessor nodes of the child workflow node in the parent workflow; Setting the head node in the sub-workflow as the successor node of the group of predecessor nodes; as well as The predecessor node of the head node in the sub-workflow is set as the group of predecessor nodes.

10. The method according to claim 7, wherein replacing the sub-workflow nodes in the parent workflow with a group of nodes in the sub-workflow comprises: If the child workflow node is the tail node in the parent workflow, a group of nodes in the child workflow replaces the tail node of the parent workflow, and the tail node of the child workflow is the tail node of the replaced workflow.

11. The method according to claim 7, wherein replacing the sub-workflow nodes in the parent workflow with a group of nodes in the sub-workflow comprises: If the child workflow node is not the tail node of the parent workflow, determining a set of successor nodes of the child workflow node in the parent workflow; Setting the tail node in the sub-workflow as the predecessor node of the group of successor nodes; as well as The successor node of the tail node in the sub-workflow is set as the group of successor nodes.

12. An apparatus for processing a workflow, comprising: A source workflow acquisition module, configured to acquire a source workflow for a business process; A preprocessing module is configured to preprocess the source workflow to obtain a target workflow, wherein the target workflow includes a target condition node, and the target condition node has at least a first successor node and a second successor node; a successor node determination module to be executed, configured to determine the first successor node to be executed in the target workflow according to the target value of the target condition node during the execution of the target condition node; a target workflow updating module, configured to update the target workflow to at least remove a connection between the target condition node and the second successor node; as well as The control module is configured to control the execution of the business process based on the updated target workflow.

13. An electronic device comprising: at least one processing unit; as well as At least one memory, the at least one memory being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions causing the electronic device to perform the method according to any one of claims 1 to 11 when executed by the at least one processing unit.

14. A computer-readable storage medium having a computer program stored thereon, wherein the computer program can be executed by a processor to implement the method according to any one of claims 1 to 11.

15. A computer program product comprising computer executable instructions, wherein the computer executable instructions, when executed by a processor, implement the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Process pattern based dynamic workflow planning system and method

    CN102446309A

  • Server cluster monitoring method and system

    CN106357478A

  • Business information updating method and device, computer equipment and storage medium

    CN110750267A

  • Multi-task concurrent processing method and device

    CN111666146A

  • Topological graph tree layout generation method in network management system

    CN111669286A

Cited By

  • Workflow scheduling method and device, execution engine, equipment and program product

    CN119919083A