Method and apparatus for processing a workflow

By decomposing the source workflow into candidate workflows for unconditional nodes and using parallel breadth traversal algorithms and coroutine synchronizers, the performance bottleneck of traditional workflow engines in online high concurrency scenarios is solved, and the efficiency of workflow scheduling execution and resource utilization are improved.

CN118567795BActive Publication Date: 2025-07-04DITU (BEIJING) TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310827875.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-07-06
Publication Date
2025-07-04
Estimated Expiration
2043-07-06

AI Technical Summary

Technical Problem

Traditional workflow engines are difficult to effectively support the scheduling and execution of conditional nodes in online high concurrency scenarios, resulting in performance degradation and unable to meet the needs of high concurrent task scheduling.

Method used

By obtaining the source workflow, it is decomposed into multiple candidate workflows based on different value conditions of the condition nodes, the condition nodes are removed, and the parallel breadth traversal algorithm and coroutine synchronizer are used to optimize the scheduling execution to improve the execution performance of the workflow engine.

Benefits of technology

It realizes effective support for workflows containing conditional nodes in online high concurrency scenarios, and improves the scheduling and execution performance of the workflow engine and the efficiency of coroutine resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118567795B_ABST
    Figure CN118567795B_ABST
Patent Text Reader

Abstract

According to an embodiment of the present disclosure, there are provided a method, an apparatus, a device, a computer-readable storage medium, and a computer program product for processing a workflow. The method includes obtaining a source workflow, where the source workflow includes conditional nodes, and each conditional node has a plurality of successor nodes corresponding to different value-taking conditions; decomposing the source workflow into a plurality of candidate workflows based on the different value-taking conditions of a set of conditional nodes, such that none of the plurality of candidate workflows includes conditional nodes; before the execution of a business process, determining a target workflow for the business process from the plurality of candidate workflows according to the value-taking of the business process with respect to a set of conditional nodes; and controlling the execution of the business process according to the target workflow. Thus, 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 particularly to methods, apparatuses, devices, computer-readable storage media, and computer program products for processing workflows. Background Art

[0002] A workflow 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 a workflow and its various operation steps.

[0003] A workflow engine is a tool for implementing and driving a workflow. The workflow engine extracts complex business processes from a business system and uses a workflow to define the business process. Then, the business system can call the workflow engine to execute the business process according to the pre-defined workflow. 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, there is provided a method for processing a workflow, the method including: obtaining a source workflow, the source workflow including a set of conditional nodes, each conditional node having a plurality of successor nodes corresponding to different value conditions; decomposing the source workflow into a plurality of candidate workflows based on different value conditions of the set of conditional nodes, such that none of the plurality of candidate workflows includes conditional nodes; before executing a business process, determining a target workflow for the business process from the plurality of candidate workflows according to the value of the set of conditional nodes in the business process; and controlling the execution of the business process according to the target workflow.

[0005] In a second aspect of the present disclosure, there is provided a device for processing a workflow, the device including: a source workflow obtaining module configured to obtain a source workflow, the source workflow including conditional nodes, each conditional node having a plurality of successor nodes corresponding to different value conditions; a candidate workflow decomposing module configured to decompose the source workflow into a plurality of candidate workflows based on different value conditions of the set of conditional nodes, such that none of the plurality of candidate workflows includes conditional nodes; a target workflow determining module configured to determine a target workflow for the business process from the plurality of candidate workflows according to the value of the set of conditional nodes in the business process before executing the business process; and a control module configured to control the execution of the business process according to the 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 being coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit. The instructions, when executed by the at least one processing unit, cause the device to perform the method of the first aspect.

[0007] In a fourth aspect of the present disclosure, a computer-readable storage medium is provided. A computer program is stored on the computer-readable storage medium, and the computer program is executable 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. The computer program product includes computer-executable instructions that, when executed by a processor, implement the method of the first aspect.

[0009] It should be understood that the content described in the present invention content section is not intended to limit the key features or important features of the embodiments of the present disclosure, nor is it used 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] In conjunction with the accompanying drawings and with reference to the following detailed description, the above and other features, advantages, and aspects of the embodiments of the present disclosure will become more apparent. In the drawings, the same or similar reference numerals denote the same or similar elements, where:

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

[0012] Figure 2 A schematic diagram showing an example architecture of a workflow engine of an embodiment of the present disclosure;

[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 converting a source workflow into multiple candidate workflows according to some embodiments of the present disclosure;

[0015] Figure 5 A schematic diagram showing an example of a path decomposition process for determining a candidate workflow according to some embodiments of the present disclosure;

[0016] Figure 6 A schematic diagram showing an example of a workflow and its corresponding coroutine according to some embodiments of the present disclosure;

[0017] Figure 7A schematic diagram showing an example of a workflow according to some embodiments of the present disclosure;

[0018] Figure 8 Shows according to Figure 7 A schematic diagram showing an example of the execution time of the workflow shown;

[0019] Figure 9 A flowchart showing a method for processing a workflow according to some embodiments of the present disclosure;

[0020] Figure 10 A block diagram showing a device for processing a workflow according to some embodiments of the present disclosure; and

[0021] Figure 11 A block diagram showing a device capable of implementing multiple embodiments of the present disclosure. Detailed implementation manners

[0022] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although some embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. On the contrary, these embodiments are provided to more thoroughly and completely understand the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not used to limit the protection scope of the present disclosure.

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

[0024] In the description of the embodiments of the present disclosure, the term "including" and its like should be understood as an open inclusion, that is, "including but not limited to". The term "based on" should be understood as "at least partially based 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". There may also be other explicit and implicit definitions hereinafter. The terms "first", "second", etc. may refer to different or the same objects. There may also be other explicit and implicit definitions hereinafter.

[0025] Embodiments of the present disclosure may involve user data, data acquisition, and / or data usage, etc. All of these aspects comply with the corresponding laws, regulations, and related provisions. In the embodiments of the present disclosure, the collection, acquisition, processing, processing, forwarding, usage, etc. of all data are carried out on the premise that the user is aware and has confirmed. Correspondingly, when implementing the embodiments of the present disclosure, the types, usage scopes, usage scenarios, etc. of the data or information that may be involved should be informed to the user and the user's authorization should be obtained through appropriate means in accordance with relevant laws and regulations. The specific informing and / or authorization methods may vary according to the actual situation and application scenarios, and the scope of the present disclosure is not limited in this regard.

[0026] In the solutions described in this specification and embodiments, if personal information processing is involved, it will be processed on the premise of having a legal basis (such as obtaining the consent of the personal information subject, or being necessary for performing a contract, etc.), and will only be processed within the specified or agreed scope. If the user refuses to process personal information other than the necessary information required for basic functions, it will not affect the user's use of basic functions.

[0027] 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. The workflow includes the following types of nodes:

[0028] Head node: It can also be described as the start node. Generally, it refers to the node that is first executed in the workflow. The head node does not have a predecessor node.

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

[0030] Predecessor node and successor node: Among two adjacent nodes with a sequential execution 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 can be understood that a node may be the predecessor node of another node while also being the successor node of other nodes. For example, node A is the predecessor node of adjacent node B. Correspondingly, node B is the successor node of node A. At the same time, this node A can also be the successor node of adjacent node C. In addition, a node may have multiple predecessor nodes. For example, node A has multiple predecessor nodes with a parallel relationship. A node may also have multiple successor nodes. For example, node A has multiple successor nodes with a parallel relationship.

[0031] Conditional Node: Also known as decision node or judgment node. By pre - defining a set of conditions, when the workflow execution reaches this node, it will make a judgment and selection based on the conditions therein, and the path that meets the conditions will be executed.

[0032] Traditional workflow engines are generally applied to low - concurrency scenarios such as the office automation field. The tasks scheduled within the workflow generally take minutes, hours, or even days. The time consumption of tasks is not the primary consideration. The main challenge lies in the allocation and scheduling ability between machine resources and executed tasks in a distributed environment. Different from traditional workflow engines, online workflow engines are generally applied to high - concurrency scenarios such as the Internet field, and the task scheduling within the workflow is executed within a single - machine device. To meet the business requirements, the task scheduling time consumption of a single node in the workflow is generally in milliseconds. The main challenge of the online workflow engine lies in the scheduling and execution performance of multi - threads or coroutines in a multi - CPU environment. Due to the above differences, traditional workflow engines are not applicable to online high - concurrency scenarios, and workflows that can be easily implemented in traditional workflow engines, such as workflows with conditional branches and sub - workflows, are poorly supported by most online workflow engines.

[0033] For example, in an online high - concurrency scenario, the workflow is usually a multi - layer serial - parallel hybrid workflow. In a multi - layer serial - parallel hybrid workflow, multiple nodes often need to be executed in parallel simultaneously. Also, situations where one node is selected from multiple nodes for execution are often encountered. In this case, the workflow needs to include conditional nodes.

[0034] However, due to the emergence of conditional nodes, the scheduling and execution algorithm of the workflow becomes more complex. For performance considerations, there are not many workflow engines that can effectively support conditional nodes in an online high - concurrency scenario. Therefore, as discussed above, in order to improve the performance of the workflow engine, the workflow needs to be processed.

[0035] In view of this, the present application proposes a solution for processing workflows. According to this solution, a source workflow can be obtained, where the source workflow includes a set of conditional nodes, and each conditional node has multiple successor nodes corresponding to different value - taking conditions. Correspondingly, based on the different value - taking conditions of the set of conditional nodes, the source workflow can be decomposed into multiple candidate workflows such that the decomposed multiple candidate workflows do not include conditional nodes.

[0036] Furthermore, before the execution of the business process, the target workflow for the business process can be determined from the multiple candidate workflows according to the values of the business process regarding the set of conditional nodes. Correspondingly, the execution of the business process can be controlled according to the target workflow.

[0037] In this way, according to the value of the conditional node in the business process to be executed, the target workflow is selected from the multiple candidate workflows obtained by decomposition to execute the business process. Thus, the workflow engine's support for workflows containing conditional nodes is realized. And because the workflow is decomposed in advance according to the value of the conditional node, it is avoided that the execution path needs to be judged in real time every time scheduling and execution are performed, improving the execution performance of the workflow engine.

[0038] In addition, the present disclosure also provides a scheme for scheduling workflows. In this scheme, the "parallel breadth-first traversal algorithm" is adopted. If a node has multiple successor nodes to be executed, these multiple successor nodes to be executed can start multiple coroutines to execute in parallel, thereby improving the execution efficiency of the node. In some embodiments, if the current node has only a single successor node, the coroutine used to execute the current node can be utilized to continue executing the successor node, thereby saving coroutine resources. In some embodiments, a coroutine synchronizer can also be utilized to reduce the overhead of synchronization between coroutines.

[0039] In the following, reference will first be made to Figure 1 describe an example environment in which embodiments according to the present disclosure can be implemented.

[0040] Example environment

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

[0042] The workflow management system 110 is used for users to configure workflows, such as workflow creation, deletion, modification, viewing, import, and export; users can also perform workflow review and workflow publishing through the workflow management system 110, etc. The configuration information of the workflow can be stored in the database 140. As an example, Figure 1 the database 140 in [] is independent of the workflow management system 110. In other examples, the database 140 can also be used as a sub-module of the workflow management system 100 and integrated in the workflow management system 100. The embodiments of the present disclosure do 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.

[0043] 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 distributed caches like redis clusters, zookeeper clusters, global configuration centers, or local disks, etc. It can also be directly exported as 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 manner. As an example, Figure 1 Two types of distribution channels, namely storage media and files, are exemplarily given. The present disclosure does not limit the type, quantity, etc. of the channels for distributing the workflow.

[0044] The workflow engine 130 is generally embedded in the services provided by the workflow engine 130 in the form of a component (or SDK). It provides a method to load the workflow configuration information from the configuration distribution layer to construct a workflow engine instance (or described as a workflow engine object). After completing the construction of the instance or object, it can provide the ability of workflow scheduling and execution for the service. As an example, Figure 1 Three services (Service 1, Service 2, Service 3) and the corresponding workflow engines are exemplarily given. The types of workflow engines embedded in different services can be the same or different. The present disclosure does not limit the quantity, type of business, and the type and quantity of workflow engines, etc.

[0045] The above-mentioned 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 can also be a server or a server cluster. For example: The workflow management system is a kind of server. The business system is a server cluster composed of multiple servers.

[0046] The above-mentioned workflow management system 110, configuration distribution layer 120, and workflow engine 130 can be integrated into one platform, such as a workflow platform.

[0047] It should be understood that the functions of each system or module in the environment 100 are described only for exemplary purposes, without implying any limitation to the scope of the present disclosure.

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

[0049] It can be understood that the architecture 200 may further include more or fewer modules. Two or more of the above modules may be integrated into one module, or a certain module above may be divided into more sub-modules. The functions of a certain module described below may be implemented in this 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.

[0050] The functions of each module will be exemplarily described below.

[0051] The preprocessing module 210 is used to preprocess the workflow to be scheduled for execution, specifically including loading the workflow, setting the head and tail nodes, setting the predecessor nodes, workflow path decomposition, etc. The purpose is to help the subsequent core processing module simplify the processing logic and improve performance. The core processing module 220 is called when providing services externally after the workflow engine is initialized. The core processing module 220 includes two sub-modules: an initialization module 221 and a scheduling execution module 222. Among them, the initialization module 221 is responsible for completing the initialization of context information. The scheduling execution module 222 includes two main sub-modules: a workflow scheduling sub-module D and a node execution sub-module E. In some embodiments of the present disclosure, the operator library 230 includes two types of operators. One type is the general operators built into the engine, such as conditional judgment operators; the other type is the business operators provided by the business layer. In some embodiments of the present disclosure, the operator names are the same as the node names in the workflow. All operators internally 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). Executing a certain node below actually executes the default method of the operator with the same name as the node.

[0052] In some embodiments of the present disclosure, the preprocessing module 210 is called when the workflow engine is initialized.

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

[0054] Optionally, the preprocessing module 210 reads the configuration information of all workflows to be currently executed (described as a workflow set below) from the data source for storing workflows (for example: the distributed cache, global configuration center, or local disk involved in the previous configuration distribution layer 120) into the memory and generates a workflow set with a specific data structure.

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

[0056] Optionally, a workflow object may include one or more workflow charts, for example, an object workflowChart of the WorkflowChart type.

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

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

[0059] 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.

[0060] 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.

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

[0062] 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.

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

[0064] Through the above two processes, the head node, tail node, and the predecessor nodes of each node are marked in advance, providing convenience for the rapid access of nodes during the subsequent workflow scheduling execution.

[0065] In some embodiments of the present disclosure, based on the workflow diagram workflowChart processed above, if the workflow diagram does not contain conditional nodes, the workflow diagram can be directly scheduled. If the workflow diagram contains conditional nodes, for the workflow diagram containing conditional nodes, path decomposition needs to be performed before scheduling execution to process it into multiple workflow diagrams that do not contain conditional nodes.

[0066] In some embodiments of the present disclosure, for a workflow containing conditional nodes, the preprocessing module 210 decomposes the workflow into multiple workflow diagrams that do not contain conditional nodes based on different value conditions of the conditional nodes.

[0067] The following describes the process of decomposing a workflow containing conditional nodes into workflow diagrams that do not contain conditional nodes.

[0068] For ease of description, in the present disclosure, a workflow containing conditional nodes may also be described as a source workflow, and the workflow diagrams obtained after decomposition that do not contain conditional nodes may be described as candidate workflows.

[0069] The source workflow includes two types of nodes: task nodes and conditional nodes, and each conditional node has multiple successor nodes corresponding to different value conditions.

[0070] Refer to Figure 4, which is an example of a source workflow. The source workflow 400 includes a set of 10 nodes from node 0 to node 9. Among them, node 1 and node 4 are conditional nodes, and the rest are task nodes. For conditional node 1, when its value condition is Y, its corresponding successor node is node 2; when its value condition is N, its corresponding successor node is node 3. For conditional node 4, when its corresponding value condition is Y, its corresponding successor node is node 5; when its value condition is N, its corresponding successor node is node 6.

[0071] In some embodiments of the present disclosure, based on different value conditions of a set of conditional nodes, the source workflow is converted into multiple candidate workflows, such that the multiple candidate workflows do not include conditional nodes.

[0072] This process may include the following steps: Determine the successor node of any node (described as the third node in the embodiments of the present disclosure) in the source workflow. If the successor node is a target conditional node in the source workflow, then determine the successor non-conditional node corresponding to the target conditional node in the source workflow as the successor node of the third node in the corresponding candidate workflow. Among them, the successor non-conditional node is determined based on the target value condition associated with the target conditional node.

[0073] In other words, when the successor node of the third node in the source workflow is a conditional node, the multiple successor non-conditional nodes under different conditional values of this conditional node are respectively decomposed into the successor nodes of the third node in multiple candidate workflows.

[0074] After that, delete the target conditional node from the corresponding candidate workflow.

[0075] For example, referring to Figure 4 , there are two conditional nodes, node 1 and node 4, in the source workflow 400. The values of node 1 and node 4 are both divided into two cases, Y and N. Then, a total of 4 combinations can be obtained: (node 1: Y, node 4: Y), (node 1: Y, node 4: N), (node 1: N, node 4: Y), (node 1: N, node 4: N). Among them, the paths decomposed by the latter two combination methods are exactly the same and can be merged into one: (node 1: N). Then, the source workflow 400 can be decomposed into three candidate workflows, candidate workflow 401, 402, and 403. Among them, candidate workflow 401 is the candidate workflow corresponding to the case of (node 1: Y, node 4: Y). Candidate workflow 402 is the candidate workflow corresponding to the case of (node 1: Y, node 4: N). Candidate workflow 403 is the candidate workflow corresponding to the case of (node 1: N). It can be seen that candidate workflows 401, 402, and 403 do not contain conditional nodes 1 and 4.

[0076] Combined withFigure 3 The following further illustrates the process of decomposing the source workflow into candidate workflows using the workflow shown.

[0077] Specifically, an object WorkflowCharts of the map type can be initialized, where the Key is the identification ID and value of the conditional node, and the Value is the decomposed WorkflowChart object. If there are multiple conditional nodes in the source workflow, the Key is the string concatenated by the identification IDs and values of the multiple conditional nodes.

[0078] Furthermore, all conditional nodes in the workflow diagram can be traversed to obtain. If the number of conditional nodes is 0, the original workflow diagram WorkflowChart is directly stored in WorkflowCharts in the Key-Value format: <*, WorkflowChart>.

[0079] If the number of conditional nodes in the workflow diagram is greater than 0, the workflow diagram is decomposed by paths. The specific process is as follows: all conditional nodes are combined according to their values to obtain all combination cases. For each combination of values, a workflow path, that is, a candidate workflow, can be determined.

[0080] Refer to Figure 5 , taking Figure 4 the candidate workflow 402 in as an example, the detailed construction process of each candidate workflow includes the following steps.

[0081] In box 501, the candidate workflow can be determined. According to the different values of the conditional nodes, the execution path of the candidate workflow is determined. For example, Figure 5 in, when the value of node 1 is Y and the value of node 4 is N, the corresponding execution path is: node 0, node 1, node 2, node 4, node 6, node 9.

[0082] In box 502, the successor nodes can be recursively set. Starting from the head node, recursively traverse backward. If there is a conditional node C in the successor nodes included in a certain node A, then this conditional node C is deleted from the successor node list of A, and the successor node N pointed to by the current execution result of the conditional node C is added to the successor node list of node A.

[0083] For example, Figure 5 in, the successor node of node 0 is the conditional node 1, and the value of node 1 is Y, then node 1 is deleted from the successor node list of node 0, and node 2 is added to the successor node list of node 0. Similarly, node 4 is deleted from the successor node list of node 2, and node 6 is added to the successor node list of node 2.

[0084] At block 503, the predecessor nodes can be set recursively. This process can refer to the "setting predecessor nodes" process described above. That is, starting from the head node, recursively traverse backward, and for each successor node N of node A, set the predecessor node of N to A. The purpose of this operation is to improve the speed of node lookup.

[0085] In other words, the above process for processing the candidate workflow includes: marking the head node in the candidate workflow; marking the tail node in the candidate workflow; marking the predecessor nodes of multiple nodes in the candidate workflow.

[0086] In some embodiments of the present disclosure, marking the predecessor nodes of multiple nodes in the candidate workflow includes: in response to the successor node of the first node in the candidate workflow being the second node, marking the first node as the predecessor node of the second node.

[0087] For example Figure 5 In, in response to the setting of the successor node in block 502, set node 0 as the predecessor node of node 2. Set node 2 as the predecessor node of node 6. Set node 6 as the predecessor node of node 9.

[0088] At block 504, the isolated nodes can be deleted. An isolated node is a non-head node in the source workflow that has no in-degree. That is, for a non-head node that no longer has in-degree, it will never be accessed during the workflow traversal, so it is deleted.

[0089] For example Figure 5 In, nodes 1 and 4 are isolated nodes. Therefore, delete nodes 1 and 4 to obtain the candidate workflow 402.

[0090] Through the above steps 501 - 504, the source workflow can be decomposed into multiple candidate workflows. After that, the decomposed paths (candidate workflows) and the new workflow graph are stored in the created WorkflowCharts object.

[0091] For example, continuing to refer to Figure 3 , it shows an example of the corresponding data structure after decomposing the source workflow into multiple candidate workflows that do not include conditional nodes.

[0092] n (n≥1) workflows are stored in the map data structure 310. For any one of the workflows, taking workflow i as an example, after combining it according to different values of multiple conditional nodes and performing path decomposition, m (m≥2) workflow graphs are obtained. The data structure 320 includes the following elements:

[0093] The identification i (ID) represents the unique identifier of workflow i; the scenario identification (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 under each business scenario. When the application system provides services externally, different workflows need to be selected according to the actual business scenario. The workflow chart set (WorkflowCharts) is used to describe the set of m preprocessed workflow charts. That is, according to the different values of multiple conditional nodes in the workflow chart for combination and path decomposition, a set of multiple workflow charts is obtained. The value of whether it is default (IsDefault) is used to indicate that when the business system cannot find a matching workflow, this workflow is used by default for execution. The update time (UpdateTime) of the workflow configuration is used to represent the update time of the workflow configuration information.

[0094] Optionally, it may further include the experiment group name (GroupName). When the business system conducts a specific experiment, it may configure a workflow for each group (the experiment group name is not shown in the figure).

[0095] Furthermore, for each workflow chart (WorkflowChart), taking workflow chart j as an example, its data structure 330 includes the following elements:

[0096] The identification of the head node (FirstActionId), which represents the ID of the first node to be executed in the workflow chart; the identification of the tail node (LastActionId), which represents the ID of the last node to be executed in the workflow chart; the node set (Actions) composed of all nodes included in this workflow chart, and this node set is represented in a Key-Value structure. Among them, the content of Key is the identification of the node object; the content of Value is the content description of each node. Figure 5 Exemplarily shows the node identifications and node contents of p (p≥2) nodes (node 1, node 2,... node p).

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

[0098] Node type (ActionType), for example, includes two types: task node and condition node; node identifier (ActionId), representing the unique identifier of the node; parameters included in the node (Params); list of execution conditions for successor nodes (NextConditions); list of predecessor node identifiers (PrevActionIds); node name (ActionName); list of successor node identifiers (NextActionIds); and node description information (Description).

[0099] After each path undergoes the above processing, the decomposed workflow diagram no longer contains condition nodes. When the subsequent online service receives a request, it only needs to calculate the current values of each condition node based on the current request parameters, and then select a candidate workflow corresponding to the workflow diagram according to the combination of the values of each condition node for scheduling and execution.

[0100] Still in combination with Figure 2 , the process of scheduling the execution of the workflow service is described below.

[0101] In some embodiments of the present disclosure, the core processing module 220 is used to be called when providing services externally after the workflow engine is initialized.

[0102] In some embodiments of the present disclosure, the core processing module 220 is used to receive a scheduling request for the service, and in response to the scheduling request for the service, select a target workflow corresponding to the request and control the execution of the business process based on the target workflow. For example, usually there may be multiple business scenarios in an application system, and multiple different workflows may be configured under each scenario. When the application system provides services externally, it is necessary to select a target workflow according to the actual business scenario.

[0103] The following takes a candidate workflow obtained by decomposing the source workflow as the target workflow as an example for illustration.

[0104] Before business execution, the core processing module 220 determines a target workflow for the business process from multiple candidate workflows according to the values of a group of condition nodes in the business process; and controls the execution of the business process according to the target workflow.

[0105] Exemplarily, referring to Figure 4 , the target workflow selected by the business process for condition node 1 and condition node 4 is candidate workflow 403.

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

[0107] Among them, the initialization module 221 is responsible for completing the initialization of context information.

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

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

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

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

[0112] 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: setting the built-in counter to count, and the initial value of this counter is the number of coroutines to be synchronized. Optionally or additionally, the coroutine synchronizer can also provide a counting operation: in all concurrently executed coroutines, after each coroutine finishes execution, this method is called to decrement the counter by 1. Optionally or additionally, the coroutine synchronizer can also provide a waiting operation: usually after starting multiple concurrent coroutines in the main coroutine, the waiting method is called to block the main coroutine. When all the concurrent coroutines have finished execution and the counter becomes 0, the main coroutine will be awakened and continue to execute.

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

[0114] Additionally or alternatively, the initialization work further includes the initialization of the head node: assigning the head node of the workflow graph to the parameter A, with the type of Action.

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

[0116] Referring to Figure 2 , as an example, the scheduling execution module 222 includes two main sub-modules: a workflow scheduling sub-module D and a node execution sub-module E. In addition, Figure 2 Six coroutines G1 to G6 are shown in , and each coroutine includes a workflow scheduling sub-module D and a node execution module E. Moreover, the present disclosure does not limit the number of coroutines G.

[0117] When scheduling and executing a workflow, a common practice in the industry is to allocate a separate coroutine for each node to execute. In some embodiments of the present disclosure, an algorithm of "parallel breadth-first traversal" is adopted.

[0118] In some embodiments, according to the "parallel breadth-first traversal algorithm" of the present disclosure, if a node has multiple successor nodes to be executed, these multiple successor nodes to be executed can start multiple coroutines to execute in parallel, thereby improving the execution efficiency of the node.

[0119] Alternatively or additionally, according to the "parallel breadth-first 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 utilized to continue executing the successor node, thereby saving coroutine resources.

[0120] Alternatively or additionally, according to the "parallel breadth-first traversal algorithm" of the present disclosure, a coroutine synchronizer can also be utilized to reduce the overhead of synchronization between coroutines. The specific implementation of the "parallel breadth-first traversal algorithm" will be described in detail below.

[0121] In some embodiments of the present disclosure, the coroutine creation rules may include the following situations: If the number of successor nodes of the current node is equal to 0, no new coroutine needs to be created. If the number of successor nodes of the current node is equal to 1, no new coroutine needs to be created, and the coroutine that executes the current node is used to execute 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 that executes the current node is used to create N new coroutines to execute the successor nodes in parallel.

[0122] For ease of description, the current node is described as the fourth node, and the coroutine that executes the current node is described as the first coroutine. Then, the above coroutine creation rules can be understood as using the first coroutine to process the fourth node in the target workflow.

[0123] Further, if the number of successor nodes of the current node is equal to 0, that is, if the fourth node does not have successor nodes, then after the fourth node finishes, the first coroutine is terminated.

[0124] Exemplarily, in combination withFigure 4 , taking the fourth node as node 9 as an example, in the candidate workflows 401, 402, and 403, node 9 does not have any successor nodes. After node 9 finishes execution, the coroutine allocated to node 9 is terminated.

[0125] Further, if the number of successor nodes of the current node is equal to 1, that is, if the fourth node has a single successor node, the first coroutine is used to continue processing the single successor node.

[0126] Exemplarily, in combination with Figure 4 , taking the fourth node as node 2 as an example, in the candidate workflow 401, node 2 has a single successor node: node 5. Then, the coroutine allocated to node 2 is still used to execute node 5, and there is no need to allocate a new coroutine to node 5. Similarly, in the candidate workflow 402, node 2 has a single successor node: node 6. Then, the coroutine allocated to node 2 is still used to execute node 6, and there is no need to allocate a new coroutine to node 6.

[0127] Further, if the fourth node has multiple successor nodes, the first coroutine is used to create multiple coroutines for executing the multiple successor nodes.

[0128] Exemplarily, in combination with Figure 4 , taking the fourth node as node 2 as an example, in the candidate workflow 403, node 2 has two successor nodes: node 7 and node 8. Then, 2 new coroutines are created using the coroutine allocated to node 2, which are respectively used to execute node 7 and node 8.

[0129] In some embodiments of the present disclosure, the coroutine creation rule further includes the following situation: for the current node to which a coroutine is to be allocated, if the current node has multiple predecessor nodes, one coroutine is selected from the multiple coroutines allocated to the multiple predecessor nodes according to a certain rule, and the selected coroutine is allocated to the node to which the coroutine is to be allocated. Among them, the rule can be to select the coroutine that finishes the earliest among the multiple coroutines according to the execution completion time of the multiple coroutines allocated to the multiple predecessor nodes.

[0130] For ease of description, the current node to which a coroutine is to be allocated is described as the fifth node. Corresponding to the above situation, if the fifth node has multiple predecessor nodes, and the multiple predecessor nodes correspond to multiple coroutines. The coroutine for the fifth node can be allocated in the following way: the second coroutine among the multiple coroutines is used to process the fifth node.

[0131] In some embodiments of the present disclosure, the second coroutine is the coroutine that finishes the earliest among the multiple coroutines.

[0132] Exemplarily, in combination with Figure 4, taking the current node of the coroutine to be allocated as node 9 as an example, in the candidate workflow 403, node 9 has two predecessor nodes, namely node 7 and node 8. Then, among the two coroutines allocated for node 7 and node 8, the coroutine with the earliest completion is used to execute node 9, without allocating a new coroutine for node 9.

[0133] In some embodiments of the present disclosure, in the process of controlling the business process according to the target workflow, a corresponding coroutine synchronizer is set for the nodes in the target workflow to reduce the performance overhead of coroutine synchronization. For example, for the above-mentioned fifth node with multiple predecessor nodes, the timing of executing the fifth node is when all the predecessor nodes of the fifth node have been executed. To this end, a counter associated with the fifth node can be set according to the multiple predecessor nodes as the coroutine synchronizer corresponding to the fifth node. The initial value of this counter can be set to the total number of the predecessor nodes of the fifth node. In response to the completion of the execution of one of the multiple predecessor nodes, the counter is decremented; in this way, when the value of the counter reaches a predetermined value, for example, when it is decremented to 0, in response to the counter reaching the predetermined value, the execution of the fifth node is triggered.

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

[0135] The workflow scheduling sub-module executes executeFlow(Ctx, CA, CF, W, A) according to the initialization parameters Ctx, CA, CF, W, A, where

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

[0137] Additionally or alternatively, the workflow scheduling sub-module D executes the current node A, that is, executes L = executeAction(Ctx, CA, CF, A), where L is the list of nodes to be executed returned after the execution of this method.

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

[0139] Additionally or alternatively, during the scheduling of the workflow, the workflow status synchronizer (CF) is blocked and waits for the completion of the workflow execution. After the workflow execution is completed, release this workflow status synchronizer.

[0140] Refer to Figure 6 , there are 11 nodes to be executed in the workflow graph. In the common solutions in the industry, a coroutine needs to be allocated for each node, and a total of 11 coroutines need to be allocated. While adopting the solution of the present disclosure, allocate a coroutine G1 for node 1, allocate a coroutine G2 and a coroutine G3 for nodes 2 and 3 respectively. Node 4 still uses the coroutine G2 of node 2, node 5 still uses the coroutine G3 of node 3, and allocate a new coroutine G4, G5, and G6 for nodes 6, 7, and 8 respectively; node 9 still uses the coroutine G3 of node 5, node 10 selects a coroutine from the multiple coroutines used by nodes 6, 7, 8, and 9, and there is no need to allocate a new coroutine for node 10. Node 11 then uses the coroutine selected for node 10, and there is no need to allocate a new coroutine for node 11. In this way, adopting the solution of the present disclosure, only 6 coroutines are needed to execute the workflow. Therefore, 5 coroutines can be saved. Even, in some cases, if all nodes between the first node (head node) and the Nth node (tail node) in the workflow graph are serial, then N coroutines need to be created using the common method in the industry. While the present disclosure only needs to create 1 coroutine, which can save N - 1 coroutines compared with the conventional method.

[0141] For each node, the node execution sub-module E is responsible for the execution of the corresponding node. The specific execution process of the node execution sub-module E is detailed as follows:

[0142] The node execution sub-module E executes executeAction(Ctx, CA, CF, A) according to the initialization parameters Ctx, CA, CF, A.

[0143] The node execution sub-module E initializes an empty node list L for storing the list of nodes to be executed after the execution of the current node A.

[0144] Alternatively or additionally, if the process state in Ctx is not set to skip, perform the following operations: Execute the operator with the same name as node A in the operator library 230. Add all successor nodes of node A to L.

[0145] Alternatively or additionally, if the list of nodes to be executed (successor node list) L is not empty after the execution of the current node A is completed, perform the following logic for each successor node NA:

[0146] If the number of predecessor nodes of NA is greater than 1, decrement the counter value of the coroutine synchronizer CA of NA. If the counter value becomes 0, all coroutines blocked on the coroutine synchronizer CA of NA will be woken up by the coroutine synchronizer of NA.

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

[0148] Alternatively or additionally, the node execution sub-module E returns L after executing the above steps.

[0149] To illustrate the present disclosure more clearly, the following takes a simplified version of the workflow of an online retrieval service as an example to illustrate the breadth-first parallel traversal process of the present invention. The specific retrieval process is as Figure 7 shown, Figure 7 where each node in it is marked with the identification ID and name attribute of the node.

[0150] The following table shows the detailed attribute configurations of each node. To better demonstrate the workflow scheduling execution process, the "execution time" of each node is simulated. That is, the "execution time" of the nodes in Table 1 below is artificially controlled to demonstrate the execution progress of each node. In an actual workflow node, the execution time cannot be determined manually in advance before execution.

[0151] Table 1

[0152]

[0153]

[0154] According to the above configuration, the detailed execution process of the above workflow graph is as Figure 8 shown, where the black intervals are the execution intervals of each node.

[0155] The following Table 2 details the execution order of each node in the above figure:

[0156] Table 2

[0157] Time (unit: ms) Node execution event 0.000 Node 1 starts execution 10.100 Node 1 finishes execution 10.134 Node 5 starts execution 10.137 Node 9 starts execution 10.154 Node 6 starts execution 10.213 Node 3 starts execution 40.185 Node 6 finishes execution 40.209 Node 7 starts execution 45.312 Node 9 finishes execution 50.320 Node 3 finishes execution 70.275 Node 5 finishes execution 80.214 Node 7 finishes execution 80.220 Node 8 starts execution 90.222 Node 8 finishes execution 90.225 Node 10 starts execution 105.438 Node 10 finishes execution 105.461 Node 11 starts execution 115.556 Node 11 finishes execution 115.569 Node 12 starts execution 120.588 Node 12 finishes execution

[0158] In the embodiments of the present disclosure, when the workflow engine schedules and executes, an algorithm called "parallel breadth - first traversal" is used to drive the scheduling and execution of the process. Compared with the pure serial mode of the traditional topological sorting algorithm, the present disclosure uses multiple parallel coroutines to execute the parallel nodes in the workflow graph in parallel, and uses a coroutine synchronizer based on the CAS (compare and swap) technology to achieve efficient synchronization of the parallel coroutines, so as to improve the workflow execution speed.

[0159] Example process

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

[0161] At block 910, the workflow engine 130 obtains a source workflow, and the source workflow includes conditional nodes, and each conditional node has a plurality of successor nodes corresponding to different value conditions.

[0162] At block 920, the workflow engine 130 decomposes the source workflow into a plurality of candidate workflows based on the different value conditions of a set of conditional nodes, so that none of the plurality of candidate workflows includes conditional nodes.

[0163] At block 930, before the business process is executed, the workflow engine 130 determines a target workflow for the business process from the plurality of candidate workflows according to the values of a set of conditional nodes in the business process; and

[0164] At block 940, the workflow engine 130 controls the execution of the business process according to the target workflow.

[0165] In some embodiments, the target workflow includes a plurality of nodes, and the process 900 further includes at least one of the following: marking the head node in the target workflow; marking the tail node in the target workflow; marking the predecessor nodes of the plurality of nodes in the target workflow.

[0166] In some embodiments, marking the predecessor nodes of the plurality of nodes in the target workflow includes: in response to the successor node of the first node among the plurality of nodes being the second node, marking the first node as the predecessor node of the second node.

[0167] In some embodiments, decomposing a source workflow into multiple candidate workflows includes: determining successor nodes of a third node in the source workflow; if the successor node is a target conditional node in the source workflow, determining a successor unconditional node corresponding to the target conditional node in the source workflow as the successor node of the third node in the corresponding candidate workflow, where the successor unconditional node is determined based on a target value condition associated with the target conditional node; and deleting the target conditional node from the corresponding candidate workflow.

[0168] In some embodiments, decomposing a source workflow into multiple candidate workflows further includes: deleting isolated nodes in the source workflow, where an isolated node is a non-head node in the workflow that does not have an in-degree.

[0169] In some embodiments, controlling the execution of a business process according to a target workflow includes: using a first coroutine to process a fourth node in the target workflow; if the fourth node has a single successor node, using the first coroutine to continue processing the single successor node.

[0170] In some embodiments, controlling the execution of a business process according to a target workflow includes: if the fourth node has multiple successor nodes, using the first coroutine to create multiple coroutines for executing the multiple successor nodes.

[0171] In some embodiments, controlling the execution of a business process according to a target workflow includes: if the fourth node does not have a successor node, terminating the first coroutine after the fourth node finishes execution.

[0172] In some embodiments, the target workflow includes a fifth node that has multiple predecessor nodes, the multiple predecessor nodes corresponding to multiple coroutines, and controlling the execution of a business process according to the target workflow includes: using a second coroutine among the multiple coroutines to process the fifth node, where the second coroutine is the coroutine that finishes earliest among the multiple coroutines.

[0173] In some embodiments, controlling the execution of a business process according to a target workflow includes: setting a counter associated with the fifth node according to the multiple predecessor nodes; decrementing the counter in response to one of the multiple predecessor nodes finishing execution; and triggering the execution of the fifth node in response to the counter reaching a predetermined value.

[0174] Example device and equipment

[0175] Figure 10 FIG. shows a schematic structural block diagram of an apparatus 1000 for processing a workflow according to certain embodiments of the present disclosure. The apparatus 1000 may be implemented as or included in a business application system 130. Each module / component in the apparatus 1000 may be implemented by hardware, software, firmware, or any combination thereof.

[0176] As shown Figure 10 in FIG. 1, the apparatus 1000 includes a source workflow acquisition module 1010 configured to acquire a source workflow, the source workflow including a set of conditional nodes, each conditional node having a plurality of successor nodes corresponding to different value conditions;

[0177] The apparatus 1000 further includes a candidate workflow decomposition module 1020 configured to decompose the source workflow into a plurality of candidate workflows based on different value conditions of the set of conditional nodes, such that none of the plurality of candidate workflows includes conditional nodes;

[0178] The apparatus 1000 further includes a target workflow determination module 1030 configured to determine, before the execution of a business process, a target workflow for the business process from the plurality of candidate workflows according to the values of the set of conditional nodes in the business process; and

[0179] The apparatus 1000 further includes a control module 1040 configured to control the execution of the business process according to the target workflow.

[0180] In some embodiments, the target workflow includes a plurality of nodes, and the apparatus 1000 further includes a marking module configured to perform at least one of the following: marking a head node in the target workflow; marking a tail node in the target workflow; marking a predecessor node of a plurality of nodes in the target workflow.

[0181] In some embodiments, the marking module is further configured to mark a first node as a predecessor node of a second node in response to a successor node of the first node among the plurality of nodes being the second node.

[0182] In some embodiments, the candidate workflow decomposition module 1020 is further configured to determine a successor node of a third node in the source workflow; if the successor node is a target conditional node in the source workflow, determine a successor non-conditional node corresponding to the target conditional node in the source workflow as the successor node of the third node in the corresponding candidate workflow, where the successor non-conditional node is determined based on a target value condition associated with the target conditional node; and delete the target conditional node from the corresponding candidate workflow.

[0183] In some embodiments, the candidate workflow decomposition module 1020 is further configured to delete orphan nodes in the source workflow, where an orphan node is a non-head node in the source workflow that does not have an in-degree.

[0184] In some embodiments, the control module 1040 is further configured to process a fourth node in the target workflow using a first coroutine; if the fourth node has a single successor node, continue to process the single successor node using the first coroutine.

[0185] In some embodiments, the control module 1040 is further configured to, if the fourth node has multiple successor nodes, create multiple coroutines using a first coroutine for executing the multiple successor nodes.

[0186] In some embodiments, the control module 1040 is further configured to, if the fourth node has no successor nodes, terminate the first coroutine after the fourth node finishes and completes.

[0187] In some embodiments, the target workflow includes a fifth node, and the fifth node has multiple predecessor nodes, and the multiple predecessor nodes correspond to multiple coroutines. And the control module 1040 is further configured to: process the fifth node using a second coroutine among the multiple coroutines, and the second coroutine is the coroutine that finishes earliest among the multiple coroutines.

[0188] In some embodiments, the control module 1040 is further configured to set a counter associated with the fifth node according to the multiple predecessor nodes; decrement the counter in response to one of the multiple predecessor nodes finishing execution; and trigger the execution of the fifth node in response to the counter reaching a predetermined value.

[0189] Figure 11 A block diagram of a computing device 1100 is shown in which one or more embodiments of the present disclosure may be implemented. It should be understood that Figure 11 The illustrated computing device 1100 is merely exemplary and should not impose any limitation on the functions and scope of the embodiments described herein. Figure 11 The illustrated computing device 1100 may be used to implement Figure 1 the workflow engine 130.

[0190] As Figure 11 shown, the computing device 1100 is in the form of a general-purpose computing device. The components of the computing device 1100 may include, but are not limited to, one or more processors or processing units 1110, a memory 1120, a storage device 1130, one or more communication units 1140, one or more input devices 1150, and one or more output devices 1160. The processing unit 1110 may be an actual or virtual processor and be capable of performing various processes according to the programs stored in the memory 1120. In a multi-processor system, multiple processing units execute computer-executable instructions in parallel to improve the parallel processing ability of the computing device 1100.

[0191] The computing device 1100 generally includes multiple computer storage media. Such media can be any accessible media to which the computing device 1100 has access, including but not limited to volatile and non-volatile media, removable and non-removable media. The memory 1120 can be volatile memory (such as registers, caches, random access memory (RAM)), non-volatile memory (such as read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory), or some combination thereof. The storage device 1130 can be removable or non-removable media and can include machine-readable media such as flash drives, magnetic disks, or any other media that can be capable of storing information and / or data (such as training data for training) and can be accessed within the computing device 1100.

[0192] The computing device 1100 can further include additional removable / non-removable, volatile / non-volatile storage media. Although not shown in Figure 11 it, a disk drive for reading from or writing to a removable, non-volatile magnetic disk (such as a "floppy disk") and an optical disk drive for reading from or writing to a removable, non-volatile optical disk can be provided. In these cases, each drive can be connected to a bus (not shown) by one or more data media interfaces. The memory 1120 can include a computer program product 1125 having one or more program modules that are configured to perform the various methods or actions of the various embodiments of the present disclosure.

[0193] The communication unit 1140 enables communication with other computing devices via a communication medium. Additionally, the functions of the components of the computing device 1100 can be implemented in a single computing cluster or multiple computer machines that are capable of communicating via a communication connection. Thus, the computing device 1100 can operate in a networked environment using a logical connection to one or more other servers, network personal computers (PCs), or another network node.

[0194] The input device 1150 can be one or more input devices such as a mouse, keyboard, trackball, etc. The output device 1160 can be one or more output devices such as a display, speaker, printer, etc. The computing device 1100 can also communicate with one or more external devices (not shown) as needed via the communication unit 1140, such as storage devices, display devices, etc., communicate with one or more devices that enable a user to interact with the computing device 1100, or communicate with any device that enables the computing device 1100 to communicate with one or more other computing devices (such as a network card, modem, etc.). Such communication can be performed via an input / output (I / O) interface (not shown).

[0195] According to an exemplary implementation of the present disclosure, a computer-readable storage medium is provided, on which computer-executable instructions are stored, and 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, the computer program product being tangibly stored on a non-transitory computer-readable medium and including computer-executable instructions, and the computer-executable instructions being executed by a processor to implement the method described above.

[0196] Aspects of the present disclosure are described herein with reference to the flowcharts and / or block diagrams of methods, apparatuses, devices, and computer program products implemented according to the present disclosure. It should be understood that each block of the flowcharts and / or block diagrams, and the combinations of blocks in the flowcharts and / or block diagrams, can be implemented by computer-readable program instructions.

[0197] 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 such that when these instructions are executed by the processing unit of the computer or other programmable data processing device, a device is produced that implements the functions / actions specified in one or more blocks of the flowchart and / or block diagram. 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 devices to work in a specific manner. Thus, the computer-readable medium storing the instructions includes a manufacture that includes instructions for implementing various aspects of the functions / actions specified in one or more blocks of the flowchart and / or block diagram.

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

[0199] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various implementations of the present disclosure. In this regard, each block in the flowchart or block diagram may represent a module, a segment of a program, or a portion of an instruction, which contains one or more executable instructions for implementing the specified logical function. In some alternative implementations, the functions noted in the blocks may occur in a different order than noted in the accompanying drawings. For example, two consecutive blocks may in fact be executed substantially in parallel, or they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or actions, or by a combination of dedicated hardware and computer instructions.

[0200] The various implementations of the present disclosure have been described above. The above description is exemplary, not exhaustive, and is 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 choice of terms used herein is intended to best explain the principles of the implementations, the practical application, or improvements made to the technology in the marketplace, or to enable other ordinary skilled in the art to understand the various implementations disclosed herein.

Claims

1. A method for processing a workflow, comprising: Obtaining a source workflow, the source workflow including a set of conditional nodes, each conditional node having a plurality of successor nodes corresponding to different value conditions; Based on the different value conditions of the set of conditional nodes, decomposing the source workflow into a plurality of candidate workflows such that none of the plurality of candidate workflows includes a conditional node, wherein decomposing the source workflow into a plurality of candidate workflows includes: Determining the successor nodes of a third node in the source workflow; If the successor node is a target conditional node in the source workflow, determining the successor non-conditional node corresponding to the target conditional node in the source workflow as the successor node of the third node in the corresponding candidate workflow, wherein the successor non-conditional node is determined based on a target value condition associated with the target conditional node; Before the execution of the business process, determining a target workflow for the business process from the plurality of candidate workflows according to the values of the business process with respect to the set of conditional nodes; and Controlling the execution of the business process according to the target workflow.

2. The method according to claim 1, wherein the target workflow includes a plurality of nodes, and the method further includes at least one of the following: Marking the head node in the target workflow; Marking the tail node in the target workflow; Marking the predecessor nodes of the plurality of nodes in the target workflow.

3. The method according to claim 2, wherein marking the predecessor nodes of the plurality of nodes in the target workflow includes: In response to the successor node of a first node among the plurality of nodes being a second node, marking the first node as the predecessor node of the second node.

4. The method according to claim 1, wherein decomposing the source workflow into a plurality of candidate workflows further includes: Deleting the target conditional node from the corresponding candidate workflow.

5. The method according to claim 4, wherein decomposing the source workflow into a plurality of candidate workflows further includes: Deleting the isolated nodes in the source workflow, the isolated nodes being non-head nodes in the source workflow that do not have an in-degree.

6. The method according to claim 1, wherein controlling the execution of the business process according to the target workflow includes: Using a first coroutine to process a fourth node in the target workflow; If the fourth node has a single successor node, using the first coroutine to continue processing the single successor node.

7. The method according to claim 6, wherein controlling the execution of the business process according to the target workflow includes: If the fourth node has a plurality of successor nodes, using the first coroutine to create a plurality of coroutines for executing the plurality of successor nodes.

8. The method according to claim 6, wherein controlling the execution of the business process according to the target workflow includes: If the fourth node does not have a successor node, terminating the first coroutine after the fourth node is completed.

9. The method according to claim 1, wherein the target workflow includes a fifth node, the fifth node has a plurality of predecessor nodes, the plurality of predecessor nodes correspond to a plurality of coroutines, and controlling the execution of the business process according to the target workflow includes: Processing the fifth node by using a second coroutine among the plurality of coroutines, the second coroutine being the coroutine that finishes execution earliest among the plurality of coroutines.

10. The method according to claim 9, wherein controlling the execution of the business process according to the target workflow includes: Setting a counter associated with the fifth node according to the plurality of predecessor nodes; Decrementing the counter in response to one of the plurality of predecessor nodes finishing execution; And Triggering the execution of the fifth node in response to the counter reaching a predetermined value.

11. An apparatus for processing a workflow, the apparatus includes: A source workflow acquisition module configured to acquire a source workflow, the source workflow includes a set of conditional nodes, and each conditional node has a plurality of successor nodes corresponding to different value conditions; A workflow decomposition module configured to decompose the source workflow into a plurality of candidate workflows based on the different value conditions of the set of conditional nodes, such that none of the plurality of candidate workflows includes conditional nodes, wherein decomposing the source workflow into a plurality of candidate workflows includes: Determining successor nodes of a third node in the source workflow; If the successor node is a target conditional node in the source workflow, determining a successor non-conditional node corresponding to the target conditional node in the source workflow as the successor node of the third node in the corresponding candidate workflow, wherein the successor non-conditional node is determined based on a target value condition associated with the target conditional node; A target workflow determination module configured to determine, before the execution of the business process, a target workflow for the business process from the plurality of candidate workflows according to the values of the business process with respect to the set of conditional nodes; and A control module configured to control the execution of the business process according to the target workflow.

12. An electronic device, including: 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, and when the instructions are executed by the at least one processing unit, the electronic device executes the method according to any one of claims 1 to 10.

13. A computer-readable storage medium, on which a computer program is stored, and the computer program can be executed by a processor to implement the method according to any one of claims 1 to 10.

14. A computer program product, including computer-executable instructions, wherein when the computer-executable instructions are executed by a processor, the method according to any one of claims 1 to 10 is implemented.

Citation Information

Patent Citations

  • Workflow adjusting method and device

    CN112989603A