Workflow optimization method and device, electronic equipment and storage medium

By building and optimizing the workflow topology diagram, identifying and merging nodes, the mixed orchestration problem of synchronous and asynchronous services is solved, efficient task execution and orchestration is achieved, and processing efficiency in complex task scenarios is improved.

CN120492132AActive Publication Date: 2025-08-15BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202510984358.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-17
Publication Date
2025-08-15
Estimated Expiration
2045-07-17

AI Technical Summary

Technical Problem

The existing technology cannot effectively solve the mixed orchestration and efficient execution of synchronous and asynchronous services in complex task scenarios. The synchronous scheduling engine is poorly load balancing, and the asynchronous scheduling engine cannot handle synchronous node scheduling and merge execution.

Method used

By building a topology diagram of the workflow, identify mergeable and non-merged nodes, determine node levels and dependencies, perform merging processing, generate merged nodes, build target topology diagrams and perform task scheduling, and realize serial or parallel orchestration of synchronous and asynchronous nodes.

Benefits of technology

The hybrid orchestration of synchronous and asynchronous services is realized, the efficiency of pipeline orchestration and task execution efficiency is improved, the problem of hybrid orchestration of synchronous and asynchronous services is solved, and the processing efficiency in complex task scenarios is significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120492132A_ABST
    Figure CN120492132A_ABST
Patent Text Reader

Abstract

The invention relates to a workflow optimization method and device, electronic equipment and a storage medium. The method comprises the following steps: determining a topological graph of a workflow, wherein the topological graph comprises nodes corresponding to mergeable node types and nodes corresponding to non-mergeable node types; hierarchies corresponding to all the nodes in the topological graph and a dependent node set and a target node set corresponding to all the nodes are determined, the dependent node set of any node comprises all dependent nodes of the node, and the target node set comprises all the nodes depending on the node; on the basis of the node type and level of each node in the topological graph and the dependent node set and the target node set corresponding to each node, performing merging processing on each node to obtain a plurality of merged nodes; and determining a target topological graph of the workflow based on the plurality of merged nodes, and performing task scheduling of the workflow based on the target topological graph. By adopting the method, the workflow arrangement efficiency and the task execution efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a workflow optimization method, device, electronic device, and storage medium. Background Art

[0002] In complex task processing scenarios (such as image and video data processing), tasks typically involve multiple stages, each of which presents different bottlenecks in resources such as memory, video memory, computing, and bandwidth. Based on resource usage characteristics, related services can be divided into two categories: compute-intensive and IO (Input / Output)-intensive.

[0003] In related technologies, compute-intensive services often adopt an asynchronous pull model to achieve efficient resource utilization. I / O-intensive services often use synchronous RPC (Remote Procedure Call) services to reduce the time consumed by asynchronous scheduling. There are orchestration and scheduling engines for synchronous calls in the industry, which coordinate service interactions and processes. There are also engines that support asynchronous scheduling, using a coordinator to manage task status and workers (work nodes) to execute tasks asynchronously and in a distributed manner.

[0004] However, synchronous call orchestration and scheduling engines struggle to balance the load of resource-intensive GPU (Graphics Processing Unit) services, making it difficult to achieve optimal resource utilization. Asynchronous scheduling engines only support asynchronous scheduling and are unable to handle synchronous node scheduling and merged execution. Consequently, these technologies fail to meet the requirements for efficient mixed orchestration and execution of synchronous and asynchronous services in complex task scenarios. Summary of the Invention

[0005] The present disclosure provides a workflow optimization method, device, electronic device, and storage medium to at least address the problem in related technologies that they cannot meet the requirements for hybrid orchestration and efficient execution of synchronous and asynchronous services in complex task scenarios. The technical solutions of the present disclosure are as follows:

[0006] According to a first aspect of an embodiment of the present disclosure, a workflow optimization method is provided, including:

[0007] Determine a topology graph of the workflow, wherein the topology graph includes nodes corresponding to mergeable node types and nodes corresponding to non-mergeable node types;

[0008] Determine the level corresponding to each node in the topology graph and the dependent node set and target node set corresponding to each node, wherein the dependent node set of any node includes the dependent nodes of the node, and the target node set includes the nodes that depend on the node;

[0009] Based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node, each node is merged to obtain multiple merged nodes;

[0010] A target topology graph of the workflow is determined based on the multiple merge nodes, and tasks of the workflow are scheduled based on the target topology graph.

[0011] In one embodiment, the merging of the nodes based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node to obtain multiple merged nodes includes:

[0012] Constructing at least one starting node set based on each of the nodes in the topological graph, wherein the starting node set includes at least one node, the node including the original node and / or the merged node in the topological graph, and the dependent node sets corresponding to the multiple nodes belonging to the same starting node set are the same;

[0013] Determining the target number of nodes, and expanding each of the starting node sets, determining a target starting node set from the expanded starting node sets, wherein the number of nodes in the target starting node set is the target number of nodes;

[0014] Traverse each of the target starting node sets. If there is a mergeable starting node set that meets the merge constraint conditions in the target starting node set, end the traversal, integrate each node in the mergeable starting node set into a merge node, and update the topology graph of the workflow based on the merge node, then jump to the step of determining the hierarchy of each node in the topology graph and the dependent node set and target node set corresponding to each node.

[0015] In one embodiment, the merging constraint conditions include that the target starting node set does not contain a node corresponding to the unmergeable node type, the overall in-degree of the target starting node set is not greater than 1, and the overall out-degree of the target starting node set is not greater than 1.

[0016] In one embodiment, the expanding each of the starting node sets includes:

[0017] For any node in the starting node set, the nodes that depend on the node are added to the starting node set as expansion nodes, and the nodes in the target node set corresponding to the node that are at the same level as the expansion node are also added to the starting node set as expansion nodes.

[0018] In one embodiment, the merging of the nodes based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node to obtain a plurality of merged nodes further includes:

[0019] In the case where the number of target nodes is less than the total number of nodes in the topological graph, if there is no mergeable starting node set that satisfies the merge constraint condition in the target starting node set, then after incrementing the number of target nodes, the process proceeds to the step of expanding each starting node set and determining the target starting node set from the expanded starting node sets until the number of target nodes reaches the total number of nodes in the topological graph;

[0020] Each node that has not been merged is treated as a merge node.

[0021] In one embodiment, determining the level corresponding to each node in the topology graph includes:

[0022] For any node, determine the level N corresponding to each dependent node of the node, and determine the level M corresponding to the node based on each level N, where M is N+1, and the maximum value in M is taken as the level corresponding to the node, where the level corresponding to the node without dependent nodes is 1, where M and N are both positive integers.

[0023] In one embodiment, the scheduling of tasks of the workflow based on the target topology graph includes:

[0024] When the execution state of any merged node in the target topology graph changes, updating the state of each node in the merged node based on the execution state of the merged node;

[0025] When the execution status corresponding to the dependent node of the merge node indicates that the dependent node has been completed, the merge node is added to the task scheduling queue and waits for the working node to schedule and execute it, where the asynchronous working node only executes the tasks of the merge node corresponding to a single node, and the synchronous working node only executes the tasks of the merge node corresponding to multiple nodes.

[0026] In one embodiment, the scheduling execution process of the working node on the merging node includes:

[0027] Based on the nodes included in the merged node, a corresponding subgraph is obtained from the original topology graph, and tasks corresponding to the nodes are sequentially executed based on the dependency relationships between the nodes described in the subgraph.

[0028] According to a second aspect of an embodiment of the present disclosure, there is provided a workflow optimization apparatus, comprising:

[0029] A first determining unit is configured to determine a topology graph of the workflow, wherein the topology graph includes nodes corresponding to mergeable node types and nodes corresponding to non-mergeable node types;

[0030] A second determining unit is configured to determine a level corresponding to each node in the topological graph and a dependent node set and a target node set corresponding to each node, wherein the dependent node set of any node includes the dependent nodes of the node, and the target node set includes the nodes that depend on the node;

[0031] a merging unit configured to perform a merging process on each of the nodes based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node, to obtain a plurality of merged nodes;

[0032] The task scheduling unit is configured to determine a target topology graph of the workflow based on the plurality of merge nodes, and perform task scheduling of the workflow based on the target topology graph.

[0033] In one embodiment, the merging of the nodes based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node to obtain multiple merged nodes includes:

[0034] Constructing at least one starting node set based on each of the nodes in the topological graph, wherein the starting node set includes at least one node, the node including the original node and / or the merged node in the topological graph, and the dependent node sets corresponding to the multiple nodes belonging to the same starting node set are the same;

[0035] Determining the target number of nodes, and expanding each of the starting node sets, determining a target starting node set from the expanded starting node sets, wherein the number of nodes in the target starting node set is the target number of nodes;

[0036] Traverse each of the target starting node sets. If there is a mergeable starting node set that meets the merge constraint conditions in the target starting node set, end the traversal, integrate each node in the mergeable starting node set into a merge node, and update the topology graph of the workflow based on the merge node, then jump to the step of determining the hierarchy of each node in the topology graph and the dependent node set and target node set corresponding to each node.

[0037] In one embodiment, the merging constraint conditions include that the target starting node set does not contain a node corresponding to the unmergeable node type, the overall in-degree of the target starting node set is not greater than 1, and the overall out-degree of the target starting node set is not greater than 1.

[0038] In one embodiment, the expanding each of the starting node sets includes:

[0039] For any node in the starting node set, the nodes that depend on the node are added to the starting node set as expansion nodes, and the nodes in the target node set corresponding to the node that are at the same level as the expansion node are also added to the starting node set as expansion nodes.

[0040] In one embodiment, the merging of the nodes based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node to obtain a plurality of merged nodes further includes:

[0041] In the case where the number of target nodes is less than the total number of nodes in the topological graph, if there is no mergeable starting node set that satisfies the merge constraint condition in the target starting node set, then after incrementing the number of target nodes, the process proceeds to the step of expanding each starting node set and determining the target starting node set from the expanded starting node sets until the number of target nodes reaches the total number of nodes in the topological graph;

[0042] Each node that has not been merged is treated as a merge node.

[0043] In one embodiment, determining the level corresponding to each node in the topology graph includes:

[0044] For any node, determine the level N corresponding to each dependent node of the node, and determine the level M corresponding to the node based on each level N, where M is N+1, and the maximum value in M is taken as the level corresponding to the node, where the level corresponding to the node without dependent nodes is 1, where M and N are both positive integers.

[0045] In one embodiment, the scheduling of tasks of the workflow based on the target topology graph includes:

[0046] When the execution state of any merged node in the target topology graph changes, updating the state of each node in the merged node based on the execution state of the merged node;

[0047] When the execution status corresponding to the dependent node of the merge node indicates that the dependent node has been completed, the merge node is added to the task scheduling queue and waits for the working node to schedule and execute it, where the asynchronous working node only executes the tasks of the merge node corresponding to a single node, and the synchronous working node only executes the tasks of the merge node corresponding to multiple nodes.

[0048] In one embodiment, the scheduling execution process of the working node on the merging node includes:

[0049] Based on the nodes included in the merged node, a corresponding subgraph is obtained from the original topology graph, and tasks corresponding to the nodes are sequentially executed based on the dependency relationships between the nodes described in the subgraph.

[0050] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement any one of the workflow optimization methods provided in the first aspect.

[0051] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute any one of the workflow optimization methods provided in the first aspect.

[0052] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, which includes instructions. When the instructions are executed by a processor of an electronic device, the electronic device is able to perform any one of the workflow optimization methods provided in the first aspect.

[0053] The technical solutions provided by the embodiments of the present disclosure bring at least the following beneficial effects:

[0054] The workflow optimization method, device, electronic device and storage medium provided by the embodiments of the present disclosure can determine the topology of the workflow, which includes nodes corresponding to mergeable node types and nodes corresponding to non-mergeable node types. The hierarchy corresponding to each node in the topology and the dependent node set and target node set corresponding to each node are determined, the dependent node set of any node includes each dependent node of the node, and the target node set includes each node of the dependent node. Based on the node type and hierarchy of each node in the topology and the dependent node set and target node set corresponding to each node, each node is merged to obtain multiple merged nodes. The target topology of the workflow is determined based on the multiple merged nodes, and the tasks of the workflow are scheduled based on the target topology. By adopting the workflow optimization method, device, electronic device and storage medium provided by the embodiments of the present disclosure, during the workflow orchestration process, there is no need to pay attention to whether the node corresponding to the task is a synchronous node or an asynchronous node. Only by identifying the node type (mergeable / non-mergeable), the node can be automatically processed and scheduled, and the synchronous nodes and asynchronous nodes can be serially or parallelly orchestrated into a DAG (Directed Acyclic Graph) workflow; based on the target topology graph obtained after the merging process, task execution is performed, and continuous synchronous nodes can be merged and scheduled for execution without destroying the overall serial and parallel relationship, thereby saving scheduling time, successfully solving the problem of mixed orchestration of synchronous and asynchronous services, significantly improving the pipeline orchestration efficiency and task execution efficiency, and providing a reliable solution for efficient processing in complex task scenarios.

[0055] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute an improper limitation of the present disclosure.

[0057] Figure 1a is a schematic diagram showing a workflow of synchronously calling an orchestration and scheduling engine according to an exemplary embodiment;

[0058] Figure 1b is a schematic diagram showing a workflow of an asynchronous scheduling and orchestration scheduling engine according to an exemplary embodiment;

[0059] Figure 2 is a flowchart of a workflow optimization method according to an exemplary embodiment;

[0060] Figure 3 is a flowchart of step 206 according to an exemplary embodiment;

[0061] Figure 4 is a schematic diagram of a topology diagram according to an exemplary embodiment;

[0062] Figure 5 is a flowchart showing step 204 according to an exemplary embodiment;

[0063] Figure 6 is a schematic diagram of a topology diagram showing a completed merge operation according to an exemplary embodiment;

[0064] Figure 7 is a schematic diagram of a topology diagram showing completion of two merging operations according to an exemplary embodiment;

[0065] Figure 8 is a schematic diagram of a topology diagram showing completion of three merging operations according to an exemplary embodiment;

[0066] Figure 9 is a schematic diagram of a target topology diagram according to an exemplary embodiment;

[0067] Figure 10 is a flowchart showing step 208 according to an exemplary embodiment;

[0068] Figure 11 is a schematic diagram showing a scheduling mechanism based on merging nodes according to an exemplary embodiment;

[0069] Figure 12 is a block diagram of a workflow optimization device according to an exemplary embodiment;

[0070] Figure 13 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0071] It should be noted that the terms "first," "second," and the like in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this manner are interchangeable where appropriate so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure as detailed in the appended claims.

[0072] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0073] At present, the mainstream orchestration and scheduling engines in the industry are mainly divided into two categories: synchronous call and asynchronous scheduling.

[0074] Reference Figure 1a The figure shows the workflow of the synchronous call orchestration and scheduling engine. This type of engine controls the service execution process and coordinates internal and external service interactions to achieve control over data transmission and conversion, service call sequence, etc. Its core process control service receives requests and calls each microservice in sequence according to business logic rules until the entire processing logic is completed. However, this solution has obvious limitations. It only supports the orchestration of synchronous call service nodes. When facing heavy resource services such as GPUs, the synchronous call mode is difficult to achieve efficient load balancing, resulting in difficulty in achieving optimal resource utilization, which restricts the performance of the system when processing heavy resource tasks.

[0075] Reference Figure 1b Figure 2 illustrates the workflow of an asynchronous scheduling and orchestration engine. This type of engine uses a coordinator-worker (worker node) architecture to implement asynchronous distributed task execution. The process engine acts as the coordinator, managing the execution status of each task within the process and controlling task transfer and retry mechanisms. When a task meets the execution conditions, the coordinator dispatches it to a queue. Business workers, based on their own load status, proactively pull tasks from the queue for processing. Upon completion, they update their status, prompting the engine to recalculate the task status and determine subsequent transfer. The entire execution process is fully asynchronous, achieving efficient task processing through a distributed architecture. However, while these engines excel in asynchronous scheduling, they suffer from a single-function problem: they only support asynchronous scheduling and cannot handle the scheduling of synchronous nodes, nor do they have the ability to merge synchronous nodes for execution. This makes them difficult to meet the requirements of mixed orchestration of synchronous and asynchronous services in complex task scenarios. They also lack adaptability and flexibility when dealing with diverse task types.

[0076] The embodiment of the present application provides a workflow optimization method, which can realize serial or parallel orchestration of synchronous nodes and asynchronous nodes into a DAG workflow, and merge continuous synchronous nodes for scheduling and execution without destroying the overall serial and parallel relationship, thereby saving scheduling time, successfully solving the problem of mixed orchestration of synchronous and asynchronous services, significantly improving the efficiency of pipeline orchestration and task execution, and providing a reliable solution for efficient processing in complex task scenarios.

[0077] Figure 2This is a flowchart illustrating a workflow optimization method according to an exemplary embodiment. This embodiment illustrates the method as applied to a terminal. It is understood that the method can also be applied to a server, or to a system including a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps 202 to 208, wherein:

[0078] Step 202: Determine a topology graph of the workflow, where the topology graph includes nodes corresponding to mergeable node types and nodes corresponding to non-mergeable node types.

[0079] In an embodiment of the present application, the workflow topology graph may be a DAG graph, which includes multiple nodes, each of which may correspond to a task, and the directed edges between the nodes represent the dependencies between the nodes. The topology graph may be an original topology graph, i.e., the nodes included therein are all unmerged nodes, or a merged topology graph, i.e., a merged node (a merged node is a node obtained by merging multiple nodes). This is not specifically limited in the embodiments of the present application.

[0080] The node type of each node in the topology graph is used to indicate whether each node can be merged, including when the node type is a mergeable node type, representing the node as a mergeable node, or when the node type is a non-mergeable node type, representing the node as a non-mergeable node.

[0081] For example, synchronous nodes can be identified as mergeable or non-mergeable based on the corresponding tasks, and asynchronous nodes can be identified as non-mergeable. For example, mergeable nodes may include resource-light synchronous RPC service nodes corresponding to cropping, review, and other tasks in the video / image generation workflow; non-mergeable nodes may include resource-heavy asynchronous GPU service nodes such as enc (Encoder), dit (Diffusion in Transformer), and vae (Variational Autoencoder) in the video / image generation workflow.

[0082] Step 204 , determining the level corresponding to each node in the topology graph and the dependent node set and target node set corresponding to each node. The dependent node set of any node includes all dependent nodes of the node, and the target node set includes all nodes of the dependent node.

[0083] In the embodiments of the present application, the level corresponding to a node is used to represent the position and hierarchical relationship of the node in the topological graph structure. The level can be used to clarify the parent-child relationship, sibling relationship, and the hierarchical depth of the entire structure. In an exemplary embodiment, determining the level corresponding to each node in the topological graph may include the following steps:

[0084] For any node, determine the level N corresponding to each dependent node of the node, and determine the level M corresponding to the node based on each level N, where M is N+1, and take the maximum value in M as the level corresponding to the node, where the level corresponding to the node without any dependent nodes is 1, where M and N are both positive integers.

[0085] In the embodiment of the present application, the dependent nodes of each node can be determined first, and then the level of the current node can be determined based on the level corresponding to the dependent node according to the rule of accumulating the levels of the dependent nodes. The specific execution logic is as follows:

[0086] For nodes without dependent nodes, if a node has no dependent nodes, its level is directly set to 1 as the basic starting point of the entire hierarchical system. For nodes with a single dependent node, when a node only depends on one other node, the level of the node is the level value of its dependent node plus 1. For example, if the dependent node level is 1, the current node level is 2, and so on. For nodes with multiple dependent nodes, there are two equivalent ways to determine the level. First, find the node with the largest level value from multiple dependent nodes, add 1 to the maximum level, and the result is the current node level; second, add 1 to the level of each dependent node respectively, and obtain multiple calculation results, among which the maximum value is used as the level of the current node.

[0087] For example, the topology graph can be traversed to determine the dependent nodes of each node (i.e., the nodes that the node depends on), and then a corresponding dependent node set can be constructed based on the dependent nodes of each node. Furthermore, for any node, the target nodes that depend on it (i.e., the dependent nodes of the target node) can be determined, and then a corresponding target node set can be constructed based on these nodes.

[0088] Step 206 : Based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node, each node is merged to obtain a plurality of merged nodes.

[0089] In an embodiment of the present application, after determining the node type and level, dependent node set and target node set corresponding to each node, the mergeable nodes can be determined based on the level corresponding to each node and the dependent node set and target node set, and the merged nodes can be merged to obtain multiple merged nodes.

[0090] For example, a starting node can be determined from all nodes, and traversal can be started from the starting node. For each traversed node, it can be determined whether the node is a mergeable node based on the node type. If the node is a mergeable node, it can be determined whether the node and the starting node can be merged based on the node's dependent node set and target node set. The merging principle is that the in-degree and out-degree of the merged node obtained after the merge is not greater than 1. If the node and the starting node can be merged, the two can be merged to obtain a merged node. Similarly, multiple iterative merging operations can be performed to obtain multiple merged nodes.

[0091] Alternatively, when the node type of the node indicates that it cannot be merged, the starting node can be re-determined and the above process can be repeated until all nodes are traversed.

[0092] Step 208: determining a target topology graph of the workflow based on the multiple merged nodes, and performing task scheduling of the workflow based on the target topology graph.

[0093] In an embodiment of the present application, after obtaining multiple merged nodes, a target topology map of the workflow can be constructed based on the merged nodes (when constructing the target topology map, each unmerged node will also be regarded as a separate merged node), and task scheduling can be performed based on the target topology map with the merged nodes as the dimension. During the task execution process, data flow and transmission are performed according to the nodes contained in the merged nodes as the dimension to complete the task scheduling and execution corresponding to the workflow.

[0094] The workflow optimization method provided by the embodiment of the present disclosure can determine the topology graph of the workflow, which includes nodes corresponding to mergeable node types and nodes corresponding to non-mergeable node types. The hierarchy corresponding to each node in the topology graph and the dependent node set and target node set corresponding to each node are determined, the dependent node set of any node includes each dependent node of the node, and the target node set includes each node of the dependent node. Based on the node type and hierarchy of each node in the topology graph and the dependent node set and target node set corresponding to each node, each node is merged to obtain multiple merged nodes. The target topology graph of the workflow is determined based on the multiple merged nodes, and the tasks of the workflow are scheduled based on the target topology graph. By adopting the workflow optimization method provided by the embodiment of the present disclosure, during the workflow orchestration process, there is no need to pay attention to whether the node corresponding to the task is a synchronous node or an asynchronous node. Only by identifying the node type (mergeable / non-mergeable), the node can be automatically processed and scheduled, and the synchronous nodes and asynchronous nodes can be serially or parallelly orchestrated into a DAG (Directed Acyclic Graph) workflow; based on the target topology graph obtained after the merging process, task execution is performed, and continuous synchronous nodes can be merged and scheduled for execution without destroying the overall serial and parallel relationship, thereby saving scheduling time, successfully solving the problem of mixed orchestration of synchronous and asynchronous services, significantly improving the pipeline orchestration efficiency and task execution efficiency, and providing a reliable solution for efficient processing in complex task scenarios.

[0095] In an exemplary embodiment, referring to Figure 3 As shown, in step 206, based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node, each node is merged to obtain multiple merged nodes, which may include the following steps 302 to 306, wherein:

[0096] Step 302: construct at least one starting node set based on each node in the topology graph. The starting node set includes at least one node, which includes the original node and / or merged node in the topology graph. Multiple nodes in the same starting node set have the same dependent node set.

[0097] Step 304: determine the target number of nodes, expand each starting node set, and determine the target starting node set from the expanded starting node set. The number of nodes in the target starting node set is the target number of nodes.

[0098] Step 306, traverse each target starting node set. If there is a mergeable starting node set that meets the merge constraint conditions in the target starting node set, the traversal is terminated, and each node in the mergeable starting node set is integrated into a merge node. After updating the topology of the workflow based on the merge node, jump to the step of determining the hierarchy of each node in the topology map and the dependent node set and target node set corresponding to each node.

[0099] In an embodiment of the present application, at least one starting node set can be constructed based on each node in the topology graph. The starting node set can include at least one node. For example, each node can be used as a starting node set. Alternatively, the starting node set can include two or more nodes, and the dependent node sets corresponding to the nodes in the same starting node set are the same. The nodes can be the original nodes corresponding to the original topology graph (nodes that have not been merged), or they can include merged nodes obtained in the previous iteration round.

[0100] For example, Figure 4 The original topology graph for a workflow is shown, where nodes 1, 2, ..., and 12 can each serve as a starting node set: {node 1}, {node 2}, ..., {node 12}. Nodes 2 and 3 both depend on node 1, so nodes 2 and 3 can form a starting node set: {node 2, node 3}. Nodes 8 and 9 both depend on node 7, so nodes 8 and 9 can form a starting node set: {node 8, node 9}. In other words, the starting node set that can be constructed based on the original topology graph includes: {node 1}, {node 2}, ..., {node 12}, {node 2, node 3}, {node 8, node 9}.

[0101] In one example, the target number of nodes can be determined first, where the target number of nodes is the expected total number of nodes included in the merged node. For example, the target number of nodes can be increased from 2 to the total number of nodes in the topology map, or the target number of nodes can be decreased from the total number of nodes in the topology map to 2. Figure 4 Taking the example shown as an example, the number of target nodes can be increased from 2 to 12, or can also be decreased from 12 to 2. In the embodiment of the present application, the embodiment of the present application is described below by taking the example of increasing the number of target nodes from 2.

[0102] For example, the number of target nodes may be determined to be 2, and the starting node set may be expanded based on the target node set of each node in the starting node set. In an exemplary embodiment, expanding each starting node set may include the following steps:

[0103] For any node in the starting node set, the nodes that depend on this node are added to the starting node set as expansion nodes, and the nodes in the target node set corresponding to this node that have the same level as the expansion node are also added to the starting node set as expansion nodes.

[0104] In the embodiment of the present application, when expanding the starting node set, the starting node can be expanded based on the dependency relationship. In an exemplary embodiment, when expanding a node to the starting node set, if node j that directly depends on node i is used as an expanded node, then the nodes at the same level that directly depend on node i also need to be included in the starting node set as expanded nodes. Figure 4 For example, the target node set for node 1 includes nodes 2 and 3. Nodes 2 and 3 are at the same level, 2. Therefore, the starting node set {node 1} is expanded to {node 1, node 2, node 3}. Similarly, each starting node set can be expanded once.

[0105] After completing one expansion, the number of target nodes is 2. Then, a starting node set with a total number of nodes of 2 can be determined from each starting node set after expansion as the target starting node set. The target starting node set may include: {node 2, node 3}, {node 6, node 7}, {node 8, node 9}, {node 10, node 12}, {node 11, node 12}.

[0106] Alternatively, each starting node set can be expanded based on the target node number, that is, each starting node set can be expanded to the target node number based on the dependency relationship between the nodes to obtain the expanded starting node set. In the embodiment of the present application, there is no specific limitation on the expansion method of the starting node set. Any method that can obtain the target starting node set corresponding to the target node number is applicable to the embodiment of the present application.

[0107] The target starting node set is traversed. For each target starting node set that is traversed, if the target starting node set satisfies the merge constraint, the nodes in the target starting node set are merged to obtain the corresponding merged node. The merge constraint may include that the target starting node set does not contain any nodes of the corresponding unmergeable node type, the total in-degree of the target starting node set is not greater than 1, and the total out-degree of the target starting node set is not greater than 1.

[0108] That is, for the traversed target starting node set, it can be determined whether there are nodes in the target starting node set that are of a non-mergeable node type (hereinafter referred to as "broken nodes" in the embodiments of the present application). If there are no broken nodes in the target starting node set, the overall in-degree and overall out-degree of the target starting node set are determined, where the overall in-degree can be the total number of dependent nodes of each node in the target starting node set after deduplication, and the overall in-degree is the total number of target nodes of each node in the target starting node set after deduplication.

[0109] For example, Figure 4 Taking the example shown as an example, assuming that the target starting node set is {node 2, node 3}, where the dependent node of node 2 is node 1, and the dependent node of node 3 is also node 1, then the overall in-degree of the target starting node set {node 2, node 3} is 1; the target nodes of node 2 are node 4 and node 5, and the target node of node 3 is node 5, then the overall out-degree of the target starting node set {node 2, node 3} is 2.

[0110] After determining the total in-degree and total out-degree of the target starting node set, if both the total in-degree and the total out-degree are not greater than 1, it can be determined that the nodes in the current target starting node set meet the merge constraint and can be merged to obtain the corresponding merged node, and the traversal stops. After updating the current topology graph based on the merged node, the process jumps to step 204 for iterative optimization.

[0111] If the total in-degree and / or total out-degree is greater than 1, it can be determined that the current target starting node set does not meet the merge constraint. The next target starting node set can be traversed to determine whether the next target starting node set meets the merge constraint. This process continues until a target starting node set that meets the merge constraint is found or all target starting node sets have been traversed. In this way, the synchronization node merge operation can be automatically performed based on the merge constraint, completing the optimization of the topology graph and greatly improving the efficiency of workflow orchestration.

[0112] In an exemplary embodiment, referring to Figure 5 As shown, in step 204, based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node, each node is merged to obtain multiple merged nodes. Steps 502 to 504 may also be included, wherein:

[0113] Step 502: If the number of target nodes is less than the total number of nodes in the topology graph, and if there is no mergeable starting node set that satisfies the merge constraint in the target starting node set, then after incrementing the number of target nodes, the process proceeds to the step of expanding each starting node set and determining the target starting node set from the expanded starting node sets until the number of target nodes reaches the total number of nodes in the topology graph.

[0114] Step 504: Nodes that have not been merged are respectively used as merge nodes.

[0115] In the embodiment of the present application, assuming that the total number of nodes in the topology graph is X, if the target number of nodes is less than X, if there is no mergeable starting node set that satisfies the merge constraint in the target starting node set, the target number of nodes is incremented. For example, if the current target number of nodes is 2, the target number of nodes after incrementing is 3. After re-determining the target number of nodes, each current starting node set can be expanded again (the current starting node set is the result of the previous round of expansion), and a target starting node set with a total number of nodes equal to the target number of nodes is determined from the expanded starting node set, and the operation of the aforementioned step 306 is repeated. In the embodiment of the present application, the subsequent operations are not further described here, and reference is made to the relevant description of the aforementioned embodiment.

[0116] If the current target node number has reached the total number of nodes in the topology, meaning that the current set of starting nodes cannot be expanded further, the merging process ends and the nodes that have not yet been merged are also used as merged nodes. This completes the optimization of the topology, resulting in multiple merged nodes, which can then be used to construct the target topology.

[0117] For example, Figure 4 In the original topology shown, node 6 corresponds to the non-mergeable node type, and the remaining nodes correspond to the mergeable node type. The hierarchy of each node can be determined as follows:

[0118] Level 1: Node 1; Level 2: Node 2 and Node 3; Level 3: Node 4; Level 4: Node 5; Level 5: Node 6; Level 6: Node 7; Level 7: Node 8 and Node 9; Level 8: Node 10 and Node 11; Level 9: Node 12.

[0119] The dependent node set of each node can be determined as follows:

[0120] The dependent node set of node 1 = {}; the dependent node set of node 2 = {node 1}; the dependent node set of node 3 = {node 1}; the dependent node set of node 4 = {node 2}; the dependent node set of node 5 = {node 2, node 3, node 4}; the dependent node set of node 6 = {node 4, node 5}; the dependent node set of node 7 = {node 6}; the dependent node set of node 8 = {node 7}; the dependent node set of node 9 = {node 7}; the dependent node set of node 10 = {node 8}; the dependent node set of node 11 = {node 8, node 9}; the dependent node set of node 12 = {node 9, node 10, node 11}.

[0121] The target node set of each node can be determined as follows:

[0122] The target node set of node 1 = {node 2, node 3}; the target node set of node 2 = {node 4, node 5}; the target node set of node 3 = {node 5}; the target node set of node 4 = {node 5, node 6}; the target node set of node 5 = {node 6}; the target node set of node 6 = {node 7}; the target node set of node 7 = {node 8, node 9}; the target node set of node 8 = {node 10, node 11}; the target node set of node 9 = {node 11, node 12}; the target node set of node 10 = {node 12}; the target node set of node 11 = {node 12}; the target node set of node 12 = {}.

[0123] The set of all starting nodes can be determined as follows:

[0124] The starting node set of a single node includes: {node 1}, {node 2}, {node 3}, {node 4}...{node 12}; the starting node set of multiple nodes includes: {node 2, node 3}, {node 8, node 9}.

[0125] Determine the target number of nodes to be 2, and expand all starting node sets. After expansion, the target starting node sets that meet the target number of nodes include {node 6, node 7}, {node 3, node 5,}, {node 5, node 6}, {node 2, node 3}, {node 8, node 9}, {node 10, node 12}, and {node 11, node 12}. Traverse each target starting node set to ensure that no starting node set in each target starting node set meets the merge constraint.

[0126] Increment the number of target nodes, now the number of target nodes is 3. Perform an expansion traversal on all starting node sets (this includes the original starting node set and the starting node set after the expansion traversal). The target starting node sets that meet the target number of nodes include: {node 1, node 2, node 3}, {node 2, node 4, node 5}, {node 3, node 5, node 6}, {node 4, node 5, node 6}, {node 5, node 6, node 7}, {node 7, node 8, node 9}, {node 8, node 10, node 11}, {node 9, node 11, node 12}, {node 2, node 3, node 5}. Traverse each target starting node set and determine if there is no starting node set in each target starting node set that meets the merge constraint.

[0127] The number of target nodes is continuously increased. When the number of target nodes reaches 4, there is still no starting node set that meets the merging constraint conditions.

[0128] The number of target nodes is increased incrementally, and the number of target nodes is now 5. Expand and traverse all starting node sets, where the target starting node sets that meet the target number of nodes include: {node 1, node 2, node 3, node 4, node 5}, {node 2, node 4, node 5, node 6, node 7}, {node 5, node 6, node 7, node 8, node 9}, {node 7, node 8, node 9, node 10, node 11}, and {node 7, node 8, node 9, node 11, node 12}.

[0129] Traverse each target starting node set and determine that the target starting node set {node 1, node 2, node 3, node 4, node 5} meets the merge constraint. Then, node 1, node 2, node 3, node 4 and node 5 can be merged into the merged node s1. After the merger, determine the new topology graph, refer to Figure 6 shown.

[0130] against Figure 6 The topology shown in the figure can determine the hierarchy of each node as follows:

[0131] Level 1: node s1; Level 2: node 6; Level 3: node 7; Level 4: nodes 8 and 9; Level 5: nodes 10 and 11; Level 6: node 12.

[0132] The dependent node set of each node can be determined as follows:

[0133] The dependent node set of node s1 = {}; the dependent node set of node 6 = {node s1}; the dependent node set of node 7 = {node 6}; the dependent node set of node 8 = {node 7}; the dependent node set of node 9 = {node 7}; the dependent node set of node 10 = {node 8}; the dependent node set of node 11 = {node 8, node 9}; the dependent node set of node 12 = {node 9, node 10, node 11}.

[0134] The target node set of each node can be determined as follows:

[0135] The target node set of node s1 = {node 6}; the target node set of node 6 = {node 7}; the target node set of node 7 = {node 8, node 9}; the target node set of node 8 = {node 10, node 11}; the target node set of node 9 = {node 11, node 12}; the target node set of node 10 = {node 12}; the target node set of node 11 = {node 12}; the target node set of node 12 = {}.

[0136] Determine all starting node sets, including: the starting node set of a single node includes {node s1}, {node 6}, {node 7}...{node 12}, and the starting node set of multiple nodes includes {node 8 and node 9}.

[0137] Determine the target number of nodes to be 2. After expanding and traversing all starting node sets, determine that the target starting node sets that meet the target number of nodes after expansion include {node s1, node 6}, {node 6, node 7}, and {node 8, node 9}. Traverse each target starting node set to confirm that no starting node set in each target starting node set meets the merge constraint.

[0138] Continue to determine the target number of nodes as 3, expand and traverse all starting node sets, and determine that after expansion, the target starting node sets that meet the target number of nodes include {node s1, node 6, node 7}, {node 7, node 8, node 9}, {node 8, node 10, node 11}, and {node 9, node 11, node 12}. Traverse each target starting node set and confirm that no starting node set in each target starting node set meets the merge constraint.

[0139] The number of target nodes is continuously increased. When the number of target nodes reaches 4, there is still no starting node set that meets the merging constraint conditions.

[0140] The number of target nodes is increased, and the number of target nodes is 5. Expand and traverse all starting node sets; determine that the target starting node sets that meet the target number of nodes after expansion include {node s1, node 6, node 7, node 8, node 9}, {node 7, node 8, node 9, node 10, node 11} and {node 7, node 8, node 9, node 11, node 12}. Traverse each target starting node set and determine that the target starting node set {node 7, node 8, node 9, node 10, node 11} meets the node merging constraint. Node 7, node 8, node 9, node 10 and node 11 can be merged into merged node s2. After the merger, determine the new topology graph, refer to Figure 7 shown.

[0141] against Figure 7 The topology shown in the figure can determine the hierarchy of each node as follows:

[0142] Level 1: node s1; Level 2: node 6; Level 3: node s2; Level 4: node 12.

[0143] The dependent node set of each node can be determined as follows:

[0144] The dependent node set of node s1 = {}; the dependent node set of node 6 = {s1}; the dependent node set of node s2 = {6}; the dependent node set of node 12 = {s2}.

[0145] The target node set of each node can be determined as follows:

[0146] The target node set of node s1 = {6}; the target node set of node 6 = {s2}; the target node set of node s2 = {12}; the target node set of node 12 = {}.

[0147] Determine the set of all starting nodes, including the single nodes {node s1}, {node 6}, {node s2}, {node 12}.

[0148] Determine the target number of nodes to be 2, expand and traverse all starting node sets, and determine that the target starting node sets that meet the target number of nodes after expansion include {node s1, node 6}, {node 6, node s2}, and {node s2, node 12}. Traverse each target starting node set and determine that the target starting node set {node s2, node 12} meets the merge constraint. Then merge node 12 into node s2. After the merger, determine the new topology graph. Refer to Figure 8 shown.

[0149] against Figure 8 The topology shown in the figure can determine the hierarchy of each node as follows:

[0150] Level 1: node s1; Level 2: node 6; Level 3: node s2.

[0151] The dependent node set of each node can be determined as follows:

[0152] The dependent node set of node s1 = {}; the dependent node set of node 6 = {node s1}; the dependent node set of node 12 = {node 6}.

[0153] The target node set of each node can be determined as follows:

[0154] The target node set of node s1 = {node 6}; the target node set of node 6 = {node s2}; the target node set of node s2 = {}.

[0155] Determine the set of all starting nodes, including the single nodes {node s1}, {node 6}, and {node s2}.

[0156] Determine the target number of nodes to be 2, expand and traverse all starting node sets, and determine that the starting node sets that meet the target number of nodes after expansion include {node s1, node 6} and {node 6, node s2}. Traverse each target starting node set to ensure that no starting node set in each target starting node set meets the merge constraint.

[0157] Continue to determine the target number of nodes to be 3, expand and traverse all starting node sets, and determine that the target starting node set that meets the target number of nodes after expansion includes {node s1, node 6, node s2}. Traverse each target starting node set and determine that no starting node set in each target starting node set meets the merge constraint.

[0158] Since the current target node number is 3 and the total number of nodes in the topology is 3, it can be determined that the traversal of all possible target nodes has ended and no nodes that can be merged are found. All are ended. Taking node 6 as the merge node s3, we get the merge nodes s1, s2 and s3. Based on the merge nodes s1, s2 and s3, we construct the target topology. Figure 9 shown.

[0159] In an exemplary embodiment, arbitrary combinations can also be made based on the nodes in the topological graph to obtain multiple starting node sets with corresponding node numbers of 1, 2...n (the total number of nodes in the topological graph), and the multiple starting node sets obtained can be traversed to determine whether each starting node set meets the merging constraint conditions, and the topological graph can be merged and updated if the merging constraint conditions are met, and the process of jumping to the aforementioned combined node to obtain the starting node set can be continued until all mergeable nodes are merged.

[0160] The workflow optimization method provided in the embodiment of the present application can automatically merge the mergeable nodes of the topology graph without destroying the serial and parallel relationship of the original topology graph, and realize the mixed orchestration of synchronous and asynchronous nodes, which can greatly improve the orchestration efficiency of the workflow and is suitable for complex task scenarios.

[0161] In an exemplary embodiment, referring to Figure 10 As shown, in step 208, the task scheduling of the workflow based on the target topology graph may include the following steps 1002 to 1004, wherein:

[0162] Step 1002: When the execution state of any merged node in the target topology graph changes, update the state of each node in the merged node based on the execution state of the merged node;

[0163] Step 1004, when the execution status corresponding to the dependent node of the merge node indicates that the dependent node has been completed, the merge node is added to the task scheduling queue and waits for the working node to schedule and execute it, where the asynchronous working node only executes the tasks of the merge node corresponding to a single node, and the synchronous working node only executes the tasks of the merge node corresponding to multiple nodes.

[0164] In an embodiment of the present application, after obtaining the target topology map, task scheduling and execution can be performed based on the target topology map. Exemplarily, the scheduling engine can perform workflow management and scheduling based on the merge nodes in the target topology map. After any merge node is executed, the status of each merge node can be updated, for example: the execution status of the completed merge node is updated from executing to completed, and the execution status of the node that depends on the merge node is updated to pending execution (it should be noted that if the node does not solely depend on the merge node, all the nodes it depends on must be completed before it can be updated to a pending execution state), and the node in the pending execution state is added to the task scheduling queue to wait for the working node to schedule and execute it.

[0165] The working nodes that perform task scheduling and execution may include synchronous working nodes and asynchronous working nodes. Asynchronous working nodes only execute tasks corresponding to single-node merge nodes (merge nodes containing only one node), and synchronous working nodes only execute tasks corresponding to multi-node merge nodes (merge nodes containing more than two nodes).

[0166] In an exemplary embodiment, the scheduling execution process of the working node on the merging node may include:

[0167] Based on the nodes contained in the merged node, the corresponding subgraph is obtained from the original topology graph, and the tasks corresponding to each node are executed sequentially based on the dependency relationships between the nodes described in the subgraph.

[0168] In an embodiment of the present application, after the synchronization working node pulls any merge node from the task execution queue, it can obtain the subgraph corresponding to the merge node from the original topology graph, and execute the tasks corresponding to each node in the merge node in sequence based on the dependency relationship between the nodes described in the subgraph.

[0169] The workflow optimization method provided in the embodiment of the present application uses the heavy resource GPU computing service as a service node in asynchronous pull mode, which greatly improves the thread pool utilization rate. At the same time, it uses the light resource IO service as a service node for synchronous call, which reduces the scheduling time during scheduling and can meet the requirements of hybrid orchestration and efficient execution of synchronous and asynchronous services in complex task scenarios.

[0170] In order to enable those skilled in the art to better understand the embodiments of the present application, the embodiments of the present application are described below with reference to specific examples.

[0171] The workflow optimization method provided by the embodiment of the present invention includes a DAG graph node merging optimization algorithm based on breadth-first search and a scheduling mechanism based on merging nodes (which can also be described as subgraphs (stages)).

[0172] Among them, the DAG graph node merging optimization algorithm based on breadth-first search aims to merge mergeable nodes without destroying the serial and parallel relationship of the entire graph.

[0173] Among them, a node in the DAG graph (a node can also be expressed as a task node) is divided into mergeable nodes and non-mergeable nodes. Mergeable nodes, for example, correspond to light-resource synchronous RPC service nodes such as cropping and review in the video / image generation workflow; non-mergeable nodes, for example, correspond to GPU-heavy resource asynchronous service nodes such as enc, dit, and vae in the video / image generation workflow.

[0174] In the embodiment of the present application, nodes that cannot be merged are regarded as destroyed nodes.

[0175] After merging multiple nodes, a merged node containing multiple nodes can be obtained. The merged node exists in a subgraph in the topology graph (hereinafter, in order to distinguish the merged node from the original node in the topology graph, the merged node is described as a stage and the original node is described as a task). The stage and task can be treated equally in the node merging algorithm.

[0176] The levels can include level 1, level 2, and so on. The level of a node with an in-degree of 0 (i.e., no dependent nodes) is level 1; the level of a node that only depends on level 1 is level 2; the level of a node that only depends on levels 1 and 2 is level 3, and so on. The level corresponding to each node can be obtained by analogy.

[0177] The set of all nodes that node i directly depends on is the dependent node set, and the set of all nodes that directly depend on node i is the target node set.

[0178] Set the merge constraints to:

[0179] 1. The merged data cannot contain any broken points;

[0180] 2. The overall in-degree after merging is 1 or 0;

[0181] 3. After merging, the overall out-degree is 1 or 0.

[0182] The DAG graph node merging optimization algorithm based on breadth-first search will circle some nodes each time and judge whether these nodes as a whole meet the merging constraints. If they meet the conditions, they can be merged; if not, they cannot be merged.

[0183] For traversal of a DAG (directed acyclic graph) with merging as the goal, some starting nodes can be selected, and then the graph nodes can be traversed downward according to their dependencies. If the currently circled nodes already include node i, then a node j that directly depends on node i is added to the circled nodes, and all nodes that directly depend on node i and are at the same level as node j are also added, that is, the target node set based on node i can be expanded.

[0184] When selecting the starting node, you can set the starting node selection constraints of the circled subgraph as follows:

[0185] The starting node can be one or more. If there are multiple starting nodes, the dependencies of the multiple starting nodes must be completely consistent.

[0186] The process of DAG graph node merging optimization algorithm based on breadth-first search is as follows:

[0187] Determine the topology graph with n nodes; number all nodes in the graph based on breadth search; determine the set of dependent nodes for all nodes; determine the set of target nodes for all nodes; and determine the set of all possible starting nodes (which must satisfy the constraints of the starting nodes).

[0188] The algorithm starts with the target number of nodes k=2 and gradually increases the target number of nodes (k=3, 4... until k=n, where n is the total number of nodes in the entire graph). Each iteration operates on a fixed k value.

[0189] Traverse the starting node set. For the current k value, traverse all possible starting node sets, including: the starting node can be a single node or multiple nodes (for example, first select one node, or first select two nodes as the initial subgraph).

[0190] For each starting node set, nodes are added according to the preset expansion principle until the number of nodes in the subgraph reaches the target k. For the subgraphs formed after expansion, it is determined whether they meet the merging constraints. If they do, the nodes in the subgraphs that meet the conditions are merged. After the merging, the topology graph is updated and the process returns to the step of numbering all nodes in the graph based on breadth-based search, and the above steps are repeated.

[0191] If the merge constraint is not met, continue traversing other starting node sets or enter the loop for the next k value.

[0192] When all possible k values (from 2 to n) have been traversed and no mergeable subgraphs are found, the algorithm ends completely and the target topology graph including multiple merged nodes is obtained.

[0193] Based on the scheduling mechanism of merging nodes (also known as subgraph stages), refer to Figure 11 As shown in the figure, the goal is to schedule the execution of the merged stages. The target topology diagram contains only stages, each of which contains one or more tasks. The scheduling engine manages the execution status of each stage in the process based on the stage dimension, controls the flow and retries of stages, and distributes stages that meet the execution conditions to the task execution queue. After the stage completes, it updates the status of the stage and the status of each node task in the stage.

[0194] In this embodiment, data dependencies are handled based on node tasks. After each stage is completed, both the stage status and the task status are updated simultaneously, and data-level dependencies are only related to the task. Based on the stage-based state flow, each time a stage is completed, a determination of the pending stages in the workflow is triggered, and the pending stages that meet the execution conditions are sent to the corresponding queue, waiting to be pulled for execution. The stage is only responsible for driving the flow of tasks.

[0195] The data that workers interact with the scheduling engine are all in the subgraph (stage) dimension. A stage may contain one or more mergeable nodes, or one non-mergeable node. Worker nodes include asynchronous worker nodes and synchronous worker nodes. Asynchronous worker nodes are worker nodes used to perform GPU heavy resource processing. The stages they process are all single-task. They will actively obtain stage tasks from the stage queue, update the stage task status after completion, and trigger the engine to recalculate the task status and flow. Synchronous task nodes are worker nodes that execute synchronous rpc calls. The tasks in the corresponding stage may be one or more. They will actively obtain stage tasks from the stage queue, and then execute all tasks in the stage based on thread scheduling. After execution, they will update the stage task status, triggering the engine to recalculate the stage task status and flow.

[0196] The embodiment of the present application provides a set of process orchestration and scheduling engines. Without destroying the overall serial and parallel relationship of the DAG, the nodes that can be merged in the DAG are merged as much as possible. After the nodes are merged, they become a subgraph (stage). The subgraph can be pulled away by a microservice as a whole and executed through thread scheduling within the process, thereby reducing the scheduling time. After the DAG has been partially merged, the embodiment of the present application further designs a new scheduling mechanism, which performs process management and task flow based on the stage, and relies on data processing in the task dimension. That is, the embodiment of the present application supports both synchronous and asynchronous nodes, and at the same time, for heavy resource GPU computing services as service nodes in asynchronous pull mode, the thread pool utilization rate is greatly improved; for light resource IO services as service nodes for synchronous calls, the scheduling time is reduced during scheduling. Moreover, when the user is doing workflow orchestration, he does not need to care whether the node is synchronous or asynchronous. The node merging algorithm will be automatically executed to optimize the graph to achieve the goal of in-process scheduling execution after continuous synchronous node merging.

[0197] It should be understood that although Figure 2-Figure 11 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. In addition, Figure 2-Figure 11 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The order of execution of these steps or stages is not necessarily one by one, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0198] It can be understood that the same / similar parts between the various embodiments of the above method in this specification can be referred to each other, and each embodiment focuses on the differences from other embodiments. For related parts, please refer to the description of other method embodiments.

[0199] Figure 12 FIG1 is a block diagram of a workflow optimization device 1200 according to an exemplary embodiment. Figure 12 The device includes a first determining unit 1202, a second determining unit 1204, a merging unit 1206, and a task scheduling unit 1208.

[0200] The first determining unit 1202 is configured to determine a topology graph of the workflow, wherein the topology graph includes nodes corresponding to mergeable node types and nodes corresponding to non-mergeable node types;

[0201] The second determining unit 1204 is configured to determine a level corresponding to each node in the topology graph and a dependent node set and a target node set corresponding to each node, wherein the dependent node set of any node includes all dependent nodes of the node, and the target node set includes all nodes that depend on the node;

[0202] A merging unit 1206 is configured to perform a merging process on each node based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node, to obtain a plurality of merged nodes;

[0203] The task scheduling unit 1208 is configured to determine a target topology graph of the workflow based on the multiple merge nodes, and perform task scheduling of the workflow based on the target topology graph.

[0204] By using the workflow optimization device provided by the embodiment of the present disclosure, during the workflow orchestration process, there is no need to pay attention to whether the node corresponding to the task is a synchronous node or an asynchronous node. Only by identifying the node type (mergeable / non-mergeable), the node can be automatically processed and scheduled, and the synchronous nodes and asynchronous nodes can be serially or parallelly orchestrated into a DAG (Directed Acyclic Graph) workflow; based on the target topology graph obtained after the merging process, task execution is performed, and continuous synchronous nodes can be merged and scheduled for execution without destroying the overall serial and parallel relationship, thereby saving scheduling time, successfully solving the problem of mixed orchestration of synchronous and asynchronous services, significantly improving the pipeline orchestration efficiency and task execution efficiency, and providing a reliable solution for efficient processing in complex task scenarios.

[0205] In one embodiment, the merging of the nodes based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node to obtain multiple merged nodes includes:

[0206] Constructing at least one starting node set based on each of the nodes in the topological graph, wherein the starting node set includes at least one node, the node including the original node and / or the merged node in the topological graph, and the dependent node sets corresponding to the multiple nodes belonging to the same starting node set are the same;

[0207] Determining the target number of nodes, and expanding each of the starting node sets, determining a target starting node set from the expanded starting node sets, wherein the number of nodes in the target starting node set is the target number of nodes;

[0208] Traverse each of the target starting node sets. If there is a mergeable starting node set that meets the merge constraint conditions in the target starting node set, end the traversal, integrate each node in the mergeable starting node set into a merge node, and update the topology graph of the workflow based on the merge node, then jump to the step of determining the hierarchy of each node in the topology graph and the dependent node set and target node set corresponding to each node.

[0209] In one embodiment, the merging constraint conditions include that the target starting node set does not contain a node corresponding to the unmergeable node type, the overall in-degree of the target starting node set is not greater than 1, and the overall out-degree of the target starting node set is not greater than 1.

[0210] In one embodiment, the expanding each of the starting node sets includes:

[0211] For any node in the starting node set, the nodes that depend on the node are added to the starting node set as expansion nodes, and the nodes in the target node set corresponding to the node that are at the same level as the expansion node are also added to the starting node set as expansion nodes.

[0212] In one embodiment, the merging of the nodes based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node to obtain a plurality of merged nodes further includes:

[0213] In the case where the number of target nodes is less than the total number of nodes in the topological graph, if there is no mergeable starting node set that satisfies the merge constraint condition in the target starting node set, then after incrementing the number of target nodes, the process proceeds to the step of expanding each starting node set and determining the target starting node set from the expanded starting node sets until the number of target nodes reaches the total number of nodes in the topological graph;

[0214] Each node that has not been merged is treated as a merge node.

[0215] In one embodiment, determining the level corresponding to each node in the topology graph includes:

[0216] For any node, determine the level N corresponding to each dependent node of the node, and determine the level M corresponding to the node based on each level N, where M is N+1, and the maximum value in M is taken as the level corresponding to the node, where the level corresponding to the node without dependent nodes is 1, where M and N are both positive integers.

[0217] In one embodiment, the scheduling of tasks of the workflow based on the target topology graph includes:

[0218] When the execution state of any merged node in the target topology graph changes, updating the state of each node in the merged node based on the execution state of the merged node;

[0219] When the execution status corresponding to the dependent node of the merge node indicates that the dependent node has been completed, the merge node is added to the task scheduling queue and waits for the working node to schedule and execute it, where the asynchronous working node only executes the tasks of the merge node corresponding to a single node, and the synchronous working node only executes the tasks of the merge node corresponding to multiple nodes.

[0220] In one embodiment, the scheduling execution process of the working node on the merging node includes:

[0221] Based on the nodes included in the merged node, a corresponding subgraph is obtained from the original topology graph, and tasks corresponding to the nodes are sequentially executed based on the dependency relationships between the nodes described in the subgraph.

[0222] Figure 13 1 is a block diagram of an electronic device 1300 for use in a workflow optimization method according to an exemplary embodiment. For example, the electronic device 1300 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, or the like.

[0223] Reference Figure 13The electronic device 1300 may include one or more of the following components: a processing component 1302 , a memory 1304 , a power component 1306 , a multimedia component 1308 , an audio component 1310 , an input / output (I / O) interface 1312 , a sensor component 1314 , and a communication component 1316 .

[0224] The processing component 1302 generally controls the overall operation of the electronic device 1300, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 1302 may include one or more processors 1320 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 1302 may include one or more modules to facilitate interaction between the processing component 1302 and other components. For example, the processing component 1302 may include a multimedia module to facilitate interaction between the multimedia component 1308 and the processing component 1302.

[0225] The memory 1304 is configured to store various types of data to support operations on the electronic device 1300. Examples of such data include instructions for any application or method operating on the electronic device 1300, contact data, phone book data, messages, pictures, videos, etc. The memory 1304 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, optical disk, or graphene memory.

[0226] The power supply component 1306 provides power to the various components of the electronic device 1300. The power supply component 1306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 1300.

[0227] The multimedia component 1308 includes a screen that provides an output interface between the electronic device 1300 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, it may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensors can not only sense the boundaries of a touch or slide action, but also detect the duration and pressure associated with the touch or slide action. In some embodiments, the multimedia component 1308 includes a front-facing camera and / or a rear-facing camera. When the electronic device 1300 is in an operating mode, such as a capture mode or a video mode, the front-facing camera and / or the rear-facing camera can receive external multimedia data. Each front-facing camera and the rear-facing camera can have a fixed optical lens system or have focal length and optical zoom capabilities.

[0228] The audio component 1310 is configured to output and / or input audio signals. For example, the audio component 1310 includes a microphone (MIC) that is configured to receive external audio signals when the electronic device 1300 is in an operating mode, such as a call mode, a recording mode, or a voice recognition mode. The received audio signals may be further stored in the memory 1304 or transmitted via the communication component 1316. In some embodiments, the audio component 1310 also includes a speaker for outputting audio signals.

[0229] I / O interface 1312 provides an interface between processing component 1302 and peripheral interface modules, such as a keyboard, click wheel, buttons, etc. These buttons may include, but are not limited to, a home button, volume buttons, a start button, and a lock button.

[0230] The sensor assembly 1314 includes one or more sensors for providing various aspects of the status assessment of the electronic device 1300. For example, the sensor assembly 1314 can detect the open / closed state of the electronic device 1300, the relative positioning of components, such as the display and keypad of the electronic device 1300. The sensor assembly 1314 can also detect changes in the position of the electronic device 1300 or its components, the presence or absence of user contact with the electronic device 1300, the orientation or acceleration / deceleration of the device 1300, and changes in the temperature of the electronic device 1300. The sensor assembly 1314 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 1314 can also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1314 can also include an accelerometer, a gyroscope, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0231] The communication component 1316 is configured to facilitate wired or wireless communication between the electronic device 1300 and other devices. The electronic device 1300 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 6G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 1316 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1316 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0232] In an exemplary embodiment, the electronic device 1300 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0233] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1304 including instructions. The instructions may be executed by the processor 1320 of the electronic device 1300 to perform the above method. For example, the computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.

[0234] In an exemplary embodiment, a computer program product is further provided. The computer program product includes instructions, and the instructions can be executed by the processor 1320 of the electronic device 1300 to implement the above method.

[0235] It should be noted that the above-mentioned devices, electronic devices, computer-readable storage media, computer program products, etc. can also include other implementation methods according to the description of the method embodiments. The specific implementation methods can refer to the description of the relevant method embodiments and will not be described one by one here.

[0236] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.

[0237] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A workflow optimization method, characterized in that: include: Determine a topology graph of the workflow, wherein the topology graph includes nodes corresponding to mergeable node types and nodes corresponding to non-mergeable node types; Determine the level corresponding to each node in the topology graph and the dependent node set and target node set corresponding to each node, wherein the dependent node set of any node includes the dependent nodes of the node, and the target node set includes the nodes that depend on the node; Based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node, each node is merged to obtain multiple merged nodes; A target topology graph of the workflow is determined based on the multiple merge nodes, and tasks of the workflow are scheduled based on the target topology graph.

2. The method according to claim 1, characterized in that The merging of the nodes based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node to obtain multiple merged nodes includes: Constructing at least one starting node set based on each of the nodes in the topological graph, wherein the starting node set includes at least one node, the node including the original node and / or the merged node in the topological graph, and the dependent node sets corresponding to the multiple nodes belonging to the same starting node set are the same; Determining the target number of nodes, and expanding each of the starting node sets, determining a target starting node set from the expanded starting node sets, wherein the number of nodes in the target starting node set is the target number of nodes; Traverse each of the target starting node sets. If there is a mergeable starting node set that meets the merge constraint conditions in the target starting node set, end the traversal, integrate each node in the mergeable starting node set into a merge node, and update the topology graph of the workflow based on the merge node, then jump to the step of determining the hierarchy of each node in the topology graph and the dependent node set and target node set corresponding to each node.

3. The method according to claim 2, characterized in that The merging constraints include that the target starting node set does not contain a node corresponding to the unmergeable node type, the overall in-degree of the target starting node set is not greater than 1, and the overall out-degree of the target starting node set is not greater than 1.

4. The method according to claim 2 or 3, characterized in that The expanding each of the starting node sets includes: For any node in the starting node set, the nodes that depend on the node are added to the starting node set as expansion nodes, and the nodes in the target node set corresponding to the node that are at the same level as the expansion node are also added to the starting node set as expansion nodes.

5. The method according to claim 2 or 3, characterized in that The merging of the nodes based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node to obtain a plurality of merged nodes further includes: In the case where the number of target nodes is less than the total number of nodes in the topological graph, if there is no mergeable starting node set that satisfies the merge constraint condition in the target starting node set, then after incrementing the number of target nodes, the process proceeds to the step of expanding each starting node set and determining the target starting node set from the expanded starting node sets until the number of target nodes reaches the total number of nodes in the topological graph; Each node that has not been merged is treated as a merge node.

6. The method according to claim 1, characterized in that Determining the level corresponding to each node in the topology diagram includes: For any node, determine the level N corresponding to each dependent node of the node, and determine the level M corresponding to the node based on each level N, where M is N+1, and the maximum value in M is taken as the level corresponding to the node, where the level corresponding to the node without dependent nodes is 1, where M and N are both positive integers.

7. The method according to claim 1, characterized in that The performing task scheduling of the workflow based on the target topology graph includes: When the execution state of any merged node in the target topology graph changes, updating the state of each node in the merged node based on the execution state of the merged node; When the execution status corresponding to the dependent node of the merge node indicates that the dependent node has been completed, the merge node is added to the task scheduling queue and waits for the working node to schedule and execute it, where the asynchronous working node only executes the tasks of the merge node corresponding to a single node, and the synchronous working node only executes the tasks of the merge node corresponding to multiple nodes.

8. The method according to claim 7, characterized in that The scheduling execution process of the working node on the merging node includes: Based on the nodes included in the merged node, a corresponding subgraph is obtained from the original topology graph, and tasks corresponding to the nodes are sequentially executed based on the dependency relationships between the nodes described in the subgraph.

9. A workflow optimization device, characterized in that: include: A first determining unit is configured to determine a topology graph of the workflow, wherein the topology graph includes nodes corresponding to mergeable node types and nodes corresponding to non-mergeable node types; A second determining unit is configured to determine a level corresponding to each node in the topological graph and a dependent node set and a target node set corresponding to each node, wherein the dependent node set of any node includes the dependent nodes of the node, and the target node set includes the nodes that depend on the node; a merging unit configured to perform a merging process on each of the nodes based on the node type and level of each node in the topology graph and the dependent node set and target node set corresponding to each node, to obtain a plurality of merged nodes; The task scheduling unit is configured to determine a target topology graph of the workflow based on the plurality of merge nodes, and perform task scheduling of the workflow based on the target topology graph.

10. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the workflow optimization method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the workflow optimization method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Chip multi-processor-oriented program division method and device

    CN105573717A

  • Data processing method and device and script display method and device

    CN110019207A

  • Node combination scheduling method and device, equipment and storage medium

    CN111061551A

  • Visualization method and device of neural network model, equipment and storage medium

    CN112819160A

  • Task dependency graph layout method and device, equipment and storage medium

    CN116595089A