技术领域Technical field
本发明属于数据处理技术领域,涉及一种有向无环图工作流引擎循环调度方法、装置和设备。The invention belongs to the field of data processing technology and relates to a directed acyclic graph workflow engine cycle scheduling method, device and equipment.
背景技术Background technique
优化设计流程引擎是一种设计辅助系统,常见的有多学科优化设计大型流程调度引擎,也可统称工作流引擎,通过流程中各个计算节点依照用户设计顺序或并行或逐一执行完成优化问题的求解处理。流程中各种顺序结构、分支选择结构、循环结构、开始及结束标志等,都是构成可执行优化设计流程的必要组成部分,是组成优化问题探索流程的基础。由于流程调度引擎一般以顺序调度为主,并通常采用有向无环图DAG作为流程构建以及流程底层运行的基本数据结构,顺序结构及分支选择等无环结构在DAG中能够被很好的实现,但类似于循环结构以及其他环形节点调度需要,有向无环图反而成为了系统功能实现的阻碍,其循环逻辑结构过于复杂,存在着流程调度执行性能不足的技术问题。The optimization design process engine is a design assistance system. It is a common multi-disciplinary optimization design large-scale process scheduling engine, which can also be collectively referred to as a workflow engine. The optimization problem is solved through each computing node in the process according to the user's design sequence or in parallel or one by one. deal with. Various sequence structures, branch selection structures, loop structures, start and end marks, etc. in the process are all necessary components of the executable optimization design process and are the basis of the optimization problem exploration process. Since process scheduling engines generally focus on sequential scheduling, and usually use directed acyclic graph DAG as the basic data structure for process construction and underlying operation of the process, acyclic structures such as sequential structure and branch selection can be well implemented in DAG. , but similar to the loop structure and other ring node scheduling needs, the directed acyclic graph has become an obstacle to the realization of system functions. Its loop logic structure is too complex, and there are technical problems such as insufficient process scheduling execution performance.
发明内容Contents of the invention
针对上述传统方法中存在的问题,本发明提出了一种有向无环图工作流引擎循环调度方法、一种有向无环图工作流引擎循环调度装置和一种计算机设备,能够在不改变工作流调度系统基础数据结构的基础上,大幅提高包含复杂循环结构的流程调度执行性能。In view of the problems existing in the above traditional methods, the present invention proposes a directed acyclic graph workflow engine cyclic scheduling method, a directed acyclic graph workflow engine cyclic scheduling device and a computer device, which can be used without changing Based on the basic data structure of the workflow scheduling system, the performance of process scheduling execution containing complex loop structures is greatly improved.
为了实现上述目的,本发明实施例采用以下技术方案:In order to achieve the above objects, the embodiments of the present invention adopt the following technical solutions:
一方面,提供一种有向无环图工作流引擎循环调度方法,包括步骤:On the one hand, a directed acyclic graph workflow engine cycle scheduling method is provided, including the steps:
在多学科优化设计工作流开始执行时,将工作流解析为有向无环图;工作流中的循环体被解析为相互关联的循环开始节点和循环结束节点;When the multidisciplinary optimization design workflow begins to execute, the workflow is parsed into a directed acyclic graph; the loop body in the workflow is parsed into interrelated loop start nodes and loop end nodes;
根据解析得到的有向无环图逐一加载可执行的计算节点,将计算节点的状态转换为可执行状态并放置于节点执行就绪队列中;Load executable computing nodes one by one according to the directed acyclic graph obtained from analysis, convert the status of the computing nodes into executable status and place them in the node execution ready queue;
通过节点执行器对各计算节点利用相同的调用逻辑,从节点执行就绪队列中逐一执行各计算节点;其中,若遇到循环开始节点,则开始循环调度逻辑的执行;The node executor uses the same calling logic for each computing node to execute each computing node one by one from the node execution ready queue; among them, if the cycle start node is encountered, the execution of the cycle scheduling logic starts;
在工作流的当前计算节点执行完毕后,将计算节点的输出数据同步保存至数据库的任务实例数据表中;其中,循环体执行完毕后保存执行次数信息;After the current computing node of the workflow is executed, the output data of the computing node is synchronously saved to the task instance data table of the database; among them, the execution number information is saved after the loop body is executed;
当前计算节点执行完毕时发出节点执行完成事件;节点执行完成事件中包括结束节点的唯一标识信息;A node execution completion event is issued when the current computing node completes execution; the node execution completion event includes the unique identification information of the end node;
根据结束节点的唯一标识信息以及有向无环图,找到下一计算节点继续执行调度处理,直到工作流执行完毕。According to the unique identification information of the end node and the directed acyclic graph, the next computing node is found and the scheduling process is continued until the workflow is completed.
在其中一个实施例中,上述方法还包括步骤:In one embodiment, the above method further includes the steps:
在工作流引擎的前端界面中,构建待执行的工作流并根据节点间相互依赖关系设置工作流中节点间数据传递关系和数据传递方向;In the front-end interface of the workflow engine, build the workflow to be executed and set the data transfer relationship and data transfer direction between nodes in the workflow according to the interdependencies between nodes;
将构建完毕后的工作流保存至工作流引擎的后端流程数据库。Save the completed workflow to the back-end process database of the workflow engine.
在其中一个实施例中,开始循环调度逻辑的执行的过程,包括:In one embodiment, the process of starting the execution of loop scheduling logic includes:
根据循环开始节点中记录的循环类型确定节点执行操作和循环条件判断操作;Determine the node execution operation and loop condition judgment operation based on the loop type recorded in the loop start node;
若循环类型为while类型循环,则进行循环条件判断操作;If the loop type is a while type loop, the loop condition judgment operation is performed;
若循环条件判断操作为真,则执行有向无环图中循环开始节点的后续节点。If the loop condition judgment operation is true, the subsequent nodes of the loop start node in the directed acyclic graph are executed.
在其中一个实施例中,若循环类型为while类型循环,则进行循环条件判断操作的步骤后,还包括:In one embodiment, if the loop type is a while-type loop, after the step of performing the loop condition judgment operation, it also includes:
若循环条件判断操作为假,则根据循环开始节点中记录的循环结束节点唯一标识信息,直接跳转执行循环结束节点唯一标识信息对应的循环结束节点,完成循环体的执行。If the loop condition judgment operation is false, based on the unique identification information of the loop end node recorded in the loop start node, it will directly jump to the loop end node corresponding to the unique identification information of the loop end node to complete the execution of the loop body.
在其中一个实施例中,开始循环调度逻辑的执行的过程,还包括:In one embodiment, the process of starting the execution of the loop scheduling logic also includes:
若循环类型为do-while类型循环,则结束循环开始节点的执行并转入执行有向无环图中循环开始节点的后续节点;If the loop type is a do-while type loop, the execution of the loop start node ends and the execution of the subsequent nodes of the loop start node in the directed acyclic graph is executed;
在循环体执行一次完毕后在循环结束节点中进行循环条件判断操作;After the loop body is executed once, the loop condition judgment operation is performed in the loop end node;
若循环条件判断操作为真,则将循环开始节点再次加载至节点执行就绪队列中,触发循环体的再次执行。If the loop condition judgment operation is true, the loop start node is loaded into the node execution ready queue again, triggering the loop body to be executed again.
在其中一个实施例中,在循环体执行一次完毕后在循环结束节点中进行循环条件判断操作的步骤后,还包括:In one embodiment, after the loop body is executed once, the step of performing a loop condition judgment operation in the loop end node also includes:
若循环条件判断操作为假,则结束循环体的循环执行操作并跳转至下一计算节点的执行。If the loop condition judgment operation is false, the loop execution operation of the loop body ends and jumps to the execution of the next computing node.
另一方面,还提供一种有向无环图工作流引擎循环调度装置,包括:On the other hand, a directed acyclic graph workflow engine cycle scheduling device is also provided, including:
流解析模块,用于在多学科优化设计工作流开始执行时,将工作流解析为有向无环图;工作流中的循环体被解析为相互关联的循环开始节点和循环结束节点;The flow parsing module is used to parse the workflow into a directed acyclic graph when the multidisciplinary optimization design workflow begins to execute; the loop body in the workflow is parsed into interrelated loop start nodes and loop end nodes;
队列加载模块,用于根据解析得到的有向无环图逐一加载可执行的计算节点,将计算节点的状态转换为可执行状态并放置于节点执行就绪队列中;The queue loading module is used to load executable computing nodes one by one based on the parsed directed acyclic graph, convert the state of the computing node into an executable state and place it in the node execution ready queue;
节点执行模块,用于通过节点执行器对各计算节点利用相同的调用逻辑,从节点执行就绪队列中逐一执行各计算节点;其中,若遇到循环开始节点,则开始循环调度逻辑的执行;The node execution module is used to use the same calling logic for each computing node through the node executor, and execute each computing node one by one from the node execution ready queue; among them, if the cycle start node is encountered, the execution of the cycle scheduling logic starts;
数据同步模块,用于在工作流的当前计算节点执行完毕后,将计算节点的输出数据同步保存至数据库的任务实例数据表中;其中,循环体执行完毕后保存执行次数信息;The data synchronization module is used to synchronously save the output data of the computing node to the task instance data table of the database after the current computing node of the workflow is executed; among them, the execution number information is saved after the loop body is executed;
事件发出模块,用于当前计算节点执行完毕时发出节点执行完成事件;节点执行完成事件中包括结束节点的唯一标识信息;The event issuing module is used to issue a node execution completion event when the current computing node completes execution; the node execution completion event includes the unique identification information of the end node;
执行调度模块,用于根据结束节点的唯一标识信息以及有向无环图,找到下一计算节点继续执行调度处理,直到工作流执行完毕。The execution scheduling module is used to find the next computing node and continue to execute the scheduling process based on the unique identification information of the end node and the directed acyclic graph until the workflow is completed.
在其中一个实施例中,上述装置还包括:In one embodiment, the above device further includes:
流构建模块,用于在工作流引擎的前端界面中,构建待执行的工作流并根据节点间相互依赖关系设置工作流中节点间数据传递关系和数据传递方向;The flow building module is used to build the workflow to be executed in the front-end interface of the workflow engine and set the data transfer relationship and data transfer direction between nodes in the workflow according to the mutual dependencies between nodes;
流存储模块,用于将构建完毕后的工作流保存至工作流引擎的后端流程数据库。The flow storage module is used to save the completed workflow to the back-end process database of the workflow engine.
在其中一个实施例中,开始循环调度逻辑的执行的过程,包括:In one embodiment, the process of starting the execution of loop scheduling logic includes:
根据循环开始节点中记录的循环类型确定节点执行操作和循环条件判断操作;Determine the node execution operation and loop condition judgment operation based on the loop type recorded in the loop start node;
若循环类型为while类型循环,则进行循环条件判断操作;If the loop type is a while type loop, the loop condition judgment operation is performed;
若循环条件判断操作为真,则执行有向无环图中循环开始节点的后续节点。If the loop condition judgment operation is true, the subsequent nodes of the loop start node in the directed acyclic graph are executed.
又一方面,还提供一种计算机设备,包括存储器和处理器,存储器存储有计算机程序,处理器执行计算机程序时实现上述的有向无环图工作流引擎循环调度方法的步骤。In another aspect, a computer device is also provided, including a memory and a processor. The memory stores a computer program. When the processor executes the computer program, it implements the above steps of the directed acyclic graph workflow engine loop scheduling method.
上述技术方案中的一个技术方案具有如下优点和有益效果:One of the above technical solutions has the following advantages and beneficial effects:
上述有向无环图工作流引擎循环调度方法、装置和设备,通过将单个循环节点拆分为两个互相关联的逻辑节点,并基于结构化编程语言中goto(无条件转移)思想,建立了以循环开始节点和循环结束节点为循环结构实现策略的工作流子流程循环调度处理方式,在保留了通用工作流引擎底层有向无环图数据结构的同时,维持流程中各个任务的相对独立性。有效避免了系统开发难度的增加,也将循环结构的执行能力发挥到了极致,不必担心循环体过而大影响流程执行性能,工作流中循环互相嵌套的情况也得以实现。相比于传统工作流引擎,上述方案可以在传统工作流引擎基础上无需大量改进就可以引入高效的循环逻辑结构,是一种新型的工作流循环结构实现方案。The above directed acyclic graph workflow engine loop scheduling method, device and equipment establishes a loop scheduling method by splitting a single loop node into two interconnected logical nodes and based on the goto (unconditional transfer) idea in structured programming languages. The loop start node and loop end node are the workflow sub-process loop scheduling processing method of the loop structure implementation strategy. While retaining the underlying directed acyclic graph data structure of the general workflow engine, the relative independence of each task in the process is maintained. It effectively avoids the increase in the difficulty of system development, and also maximizes the execution capability of the loop structure. There is no need to worry about the loop body being too large, which will greatly affect the process execution performance, and the nesting of loops in the workflow can also be realized. Compared with traditional workflow engines, the above solution can introduce efficient loop logic structures on the basis of traditional workflow engines without extensive improvements. It is a new solution for implementing workflow loop structures.
附图说明Description of drawings
为了更清楚地说明本申请实施例或传统技术中的技术方案,下面将对实施例或传统技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly explain the technical solutions in the embodiments of the present application or the traditional technology, the drawings needed to be used in the description of the embodiments or the traditional technology will be briefly introduced below. Obviously, the drawings in the following description are only for the purpose of explaining the embodiments or the technical solutions of the traditional technology. For some embodiments of the application, those of ordinary skill in the art can also obtain other drawings based on these drawings without exerting creative efforts.
图1为一个实施例中有向无环图工作流引擎循环调度方法的流程示意图;Figure 1 is a schematic flowchart of a directed acyclic graph workflow engine loop scheduling method in one embodiment;
图2为另一个实施例中有向无环图工作流引擎循环调度方法的流程示意图;Figure 2 is a schematic flowchart of a directed acyclic graph workflow engine loop scheduling method in another embodiment;
图3为一个实施例中单个循环节点构建循环结构的示意图;Figure 3 is a schematic diagram of a loop structure constructed by a single loop node in an embodiment;
图4为一个实施例中双循环节点构建循环结构的示意图;Figure 4 is a schematic diagram of a loop structure constructed by double loop nodes in an embodiment;
图5为一个实施例中多学科流程引擎调度逻辑的示意图;Figure 5 is a schematic diagram of the multi-disciplinary process engine scheduling logic in one embodiment;
图6为一个实施例中循环体节点的执行逻辑示意图;Figure 6 is a schematic diagram of the execution logic of the loop body node in one embodiment;
图7为一个实施例中有向无环图工作流引擎循环调度装置的模块框架示意图。Figure 7 is a schematic diagram of a module framework of a directed acyclic graph workflow engine cycle scheduling device in one embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clear, the present application will be further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application and are not used to limit the present application.
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同。在本申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field to which this application belongs. The terms used in the description of the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application.
需要说明的是,在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本发明的至少一个实施例中。在说明书中的各个位置展示该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。It should be noted that reference to "embodiments" herein means that specific features, structures or characteristics described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearances of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments.
本领域技术人员可以理解,本文所描述的实施例可以与其它实施例相结合。在本发明说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。Those skilled in the art will appreciate that the embodiments described herein may be combined with other embodiments. As used in this specification and the appended claims, the term "and/or" means and includes any and all possible combinations of one or more of the associated listed items.
目前常见的工作流引擎循环结构实现方法有:(1)在单个逻辑控制节点中存储循环控制变量、循环条件、循环体信息。此类方法实施步骤如下:加载并计算循环节点的循环条件,判断是否执行节点所包含的循环体;将循环体中的中的任务置为待执行,并添加至待执行集合或数据库中;执行器执行待执行任务并在执行完毕后放回循环节点。Currently, common methods for implementing the loop structure of workflow engines include: (1) Storing loop control variables, loop conditions, and loop body information in a single logical control node. The implementation steps of this method are as follows: load and calculate the loop condition of the loop node, and determine whether to execute the loop body contained in the node; set the tasks in the loop body to be executed and add them to the to-be-executed collection or database; execute The processor executes the pending tasks and puts them back into the loop node after completion.
发明人经过深入研究分析发现,目前已有工作流引擎循环结构实现方法的缺点有:忽视了有向无环图数据结构不能有环形依赖的问题,需要对调度引擎中普遍采用的成熟底层结构进行修改,增加了开发难度,降低系统的稳定性。循环节点中包含循环体节点,增加了循环体节点的复杂性,需要为循环执行结构编写专用模块,不利于节点执行逻辑的通用。循环节点中的循环体可能非常庞大,将循环体包含在循环节点内部不利于复杂循环体的或者是嵌套循环体的执行。After in-depth research and analysis, the inventor found that the shortcomings of the current workflow engine loop structure implementation methods are: ignoring the problem that the directed acyclic graph data structure cannot have cyclic dependencies, and the mature underlying structure commonly used in scheduling engines needs to be improved. Modifications increase the difficulty of development and reduce the stability of the system. The loop node contains a loop body node, which increases the complexity of the loop body node. It is necessary to write a special module for the loop execution structure, which is not conducive to the universality of node execution logic. The loop body in the loop node may be very large. Containing the loop body inside the loop node is not conducive to the execution of complex loop bodies or nested loop bodies.
本申请针对目前工作流调度系统底层采用有向无环图数据结构,缺少对流程中节点循环调用的数据结构支持等缺点,提出了一种保持有向无环图数据结构稳定性且满足节点或子图可循环调度执行的方案,解决了流程调度系统中循环结构实现的问题。This application proposes a method that maintains the stability of the directed acyclic graph data structure and satisfies the requirements of nodes or The solution that subgraphs can be scheduled and executed in a loop solves the problem of loop structure implementation in the process scheduling system.
下面将结合本发明实施例图中的附图,对本发明实施方式进行详细说明。The embodiments of the present invention will be described in detail below with reference to the accompanying drawings of the embodiments of the present invention.
请参阅图1,在一个实施例中,提供了一种有向无环图工作流引擎循环调度方法,包括如下处理步骤S12至S22:Referring to Figure 1, in one embodiment, a directed acyclic graph workflow engine cyclic scheduling method is provided, including the following processing steps S12 to S22:
S12,在多学科优化设计工作流开始执行时,将工作流解析为有向无环图;工作流中的循环体被解析为相互关联的循环开始节点和循环结束节点;S12, when the multidisciplinary optimization design workflow starts to be executed, the workflow is parsed into a directed acyclic graph; the loop body in the workflow is parsed into interrelated loop start nodes and loop end nodes;
S14,根据解析得到的有向无环图逐一加载可执行的计算节点,将计算节点的状态转换为可执行状态并放置于节点执行就绪队列中;S14, load executable computing nodes one by one according to the directed acyclic graph obtained by analysis, convert the status of the computing nodes into executable status and place them in the node execution ready queue;
S16,通过节点执行器对各计算节点利用相同的调用逻辑,从节点执行就绪队列中逐一执行各计算节点;其中,若遇到循环开始节点,则开始循环调度逻辑的执行;S16, use the same calling logic for each computing node through the node executor, and execute each computing node one by one from the node execution ready queue; among them, if the cycle start node is encountered, the execution of the cycle scheduling logic starts;
S18,在工作流的当前计算节点执行完毕后,将计算节点的输出数据同步保存至数据库的任务实例数据表中;其中,循环体执行完毕后保存执行次数信息;S18, after the current computing node of the workflow is executed, the output data of the computing node is synchronously saved in the task instance data table of the database; among them, the execution number information is saved after the loop body is executed;
S20,当前计算节点执行完毕时发出节点执行完成事件;节点执行完成事件中包括结束节点的唯一标识信息;S20, a node execution completion event is issued when the current computing node completes execution; the node execution completion event includes the unique identification information of the end node;
S22,根据结束节点的唯一标识信息以及有向无环图,找到下一计算节点继续执行调度处理,直到工作流执行完毕。S22: Find the next computing node and continue to perform scheduling processing according to the unique identification information of the end node and the directed acyclic graph until the workflow is completed.
可以理解,多学科优化设计工作流可以是根据学科优化设计任务预先构建好的工作流,也可以是根据任务在线构建配置的待执行工作流。基于有向无环图DAG实现工作流引擎循环子图的执行方式,能够保留系统高稳定性及低开发复杂性的同时,实现优化流程执行系统所需的循环调度结构。It can be understood that the multi-disciplinary optimization design workflow can be a pre-built workflow based on the discipline optimization design tasks, or it can be a workflow to be executed that is constructed and configured online based on the tasks. Based on the directed acyclic graph DAG, the execution method of the workflow engine's loop subgraph can be achieved while retaining the high stability and low development complexity of the system and realizing the loop scheduling structure required to optimize the process execution system.
通过在工作流引擎中引入循环开始以及循环结束两种互相关联的逻辑节点,有效的实现了有向无环图中子图循环调度执行,在系统使用者无感知的情况下,为工作流的构建提供了方便、强大的循环结构构建手段。本申请综合考虑了现有工作流调度系统常用数据结构及节点执行调度逻辑,对节点独立性及逻辑节点判断逻辑的通用性进行了深入探讨与研究,基于结构化程序语言(比如汇编语言、C语言)中用到的goto思想,通过双关联逻辑节点的方式,避免对现有系统的重构,避免了循环结构过于复杂等问题。By introducing two interrelated logical nodes, loop start and loop end, into the workflow engine, the cyclic scheduling and execution of subgraphs in the directed acyclic graph is effectively realized, and the workflow is improved without the system user being aware of it. Build provides a convenient and powerful means of constructing loop structures. This application comprehensively considers the commonly used data structures and node execution scheduling logic of existing workflow scheduling systems, and conducts in-depth discussions and research on node independence and the universality of logical node judgment logic. Based on structured programming languages (such as assembly language, C The goto idea used in the language) avoids the reconstruction of the existing system and avoids problems such as overly complex loop structures through dual-associated logical nodes.
具体的,用户触发多学科优化设计工作流开始执行时,工作流引擎开始将多学科优化设计工作流解析为对应的有向无环图DAG,此时,由于工作流中的循环结构被表示为相互关联的循环开始节点和循环结束节点,使得DAG构建流程得以顺利进行,并构建出可正确调度的流程执行数据结构。然后根据解析所得的有向无环图,逐一加载工作流中的可执行节点,将其转换为可执行状态,并放置于节点执行就绪队列中,以便由工作流引擎的节点执行器逐一执行。同时工作流引擎的调度算法也会为每一个计算节点的任务生成一条任务实例数据保存于数据库中。Specifically, when the user triggers the multi-disciplinary optimization design workflow to start execution, the workflow engine begins to parse the multi-disciplinary optimization design workflow into the corresponding directed acyclic graph DAG. At this time, because the loop structure in the workflow is represented as The interrelated loop start nodes and loop end nodes enable the DAG construction process to proceed smoothly and build a process execution data structure that can be scheduled correctly. Then, based on the parsed directed acyclic graph, the executable nodes in the workflow are loaded one by one, converted into executable states, and placed in the node execution ready queue to be executed one by one by the node executor of the workflow engine. At the same time, the scheduling algorithm of the workflow engine will also generate a task instance data for each computing node task and save it in the database.
各计算节点的调度执行利用相同的调用逻辑,以引擎原有的策略模式调用所属节点处理模块以执行节点的处理任务,若遇到循环体的循环开始节点,则开始循环调度逻辑的执行。工作流对应的DAG中每个任务节点执行完毕后,其数据都会被同步保存至数据库的任务实例数据表中,循环体节点执行完毕后也会将执行次数等信息进行保存,以供引擎后续执行过程中查询使用,如确定是否达到执行次数阈值,以继续或跳出循环执行等。在每一节点完成执行时,节点执行器会发出对应于该计算节点的节点执行完成事件,并且该事件中包含有结束节点的唯一标识信息。工作流引擎根据结束节点的唯一标识信息以及DAG的信息,找到下一计算节点继续执行调度,直到工作流执行完毕。The scheduling execution of each computing node uses the same calling logic, and calls the corresponding node processing module in the engine's original strategy mode to execute the node's processing tasks. If the loop start node of the loop body is encountered, the execution of the loop scheduling logic begins. After each task node in the DAG corresponding to the workflow is executed, its data will be synchronously saved to the task instance data table of the database. After the loop body node is executed, information such as the number of executions will also be saved for subsequent execution by the engine. Query is used during the process, such as determining whether the execution count threshold has been reached to continue or jump out of the loop execution, etc. When each node completes execution, the node executor will issue a node execution completion event corresponding to the computing node, and the event contains the unique identification information of the end node. The workflow engine finds the next computing node and continues scheduling based on the unique identification information of the end node and the DAG information until the workflow is completed.
上述有向无环图工作流引擎循环调度方法,通过将单个循环节点拆分为两个互相关联的逻辑节点,并基于结构化编程语言中goto(无条件转移)思想,建立了以循环开始节点和循环结束节点为循环结构实现策略的工作流子流程循环调度处理方式,在保留了通用工作流引擎底层有向无环图数据结构的同时,维持流程中各个任务的相对独立性。有效避免了系统开发难度的增加,也将循环结构的执行能力发挥到了极致,不必担心循环体过而大影响流程执行性能,工作流中循环互相嵌套的情况也得以实现。相比于传统工作流引擎,上述方案可以在传统工作流引擎基础上无需大量改进就可以引入高效的循环逻辑结构,是一种新型的工作流循环结构实现方案。The above directed acyclic graph workflow engine loop scheduling method splits a single loop node into two interconnected logical nodes, and based on the goto (unconditional transfer) idea in structured programming languages, establishes a loop starting node and The loop end node is a workflow sub-process loop scheduling processing method for the loop structure implementation strategy. While retaining the underlying directed acyclic graph data structure of the general workflow engine, it maintains the relative independence of each task in the process. It effectively avoids the increase in the difficulty of system development, and also maximizes the execution capability of the loop structure. There is no need to worry about the loop body being too large, which will greatly affect the process execution performance, and the nesting of loops in the workflow can also be realized. Compared with traditional workflow engines, the above solution can introduce efficient loop logic structures on the basis of traditional workflow engines without extensive improvements. It is a new solution for implementing workflow loop structures.
在一个实施例中,如图2所示,上述有向无环图工作流引擎循环调度方法还可以包括如下处理步骤:In one embodiment, as shown in Figure 2, the above directed acyclic graph workflow engine loop scheduling method may also include the following processing steps:
S10,在工作流引擎的前端界面中,构建待执行的工作流并根据节点间相互依赖关系设置工作流中节点间数据传递关系和数据传递方向;S10, in the front-end interface of the workflow engine, build the workflow to be executed and set the data transfer relationship and data transfer direction between nodes in the workflow according to the mutual dependencies between nodes;
S11,将构建完毕后的工作流保存至工作流引擎的后端流程数据库。S11: Save the completed workflow to the back-end process database of the workflow engine.
可以理解,用户可以通过工作流引擎的前端界面,根据给出的多学科优化设计任务流程构建待执行的多学科优化设计工作流,并根据工作流处理需要设置节点间数据传递的关系及数据传递方向等,从而通过设置各节点间相互依赖关系完成工作流构建,最后保存工作流至后端流程数据库中。若工作流中需要包含循环体结构,用户可通过以下两种方式a)或b)构建循环体结构:It can be understood that users can use the front-end interface of the workflow engine to construct a multi-disciplinary optimization design workflow to be executed according to the given multi-disciplinary optimization design task process, and set the data transfer relationship and data transfer between nodes according to the workflow processing needs. direction, etc., thereby completing the workflow construction by setting the interdependencies between each node, and finally saving the workflow to the back-end process database. If the workflow needs to include a loop body structure, users can construct the loop body structure in the following two ways: a) or b):
a)直接使用单个循环节点(独立节点交互构建方式),如图3所示,工作流引擎的流程解析算法会将循环体节点解析为循环开始节点和相应循环结束节点后再进行保存执行。a) Directly use a single loop node (independent node interaction construction method), as shown in Figure 3. The process parsing algorithm of the workflow engine will parse the loop body node into a loop start node and a corresponding loop end node before saving and executing.
b)(分节点交互构建方式)使用循环开始节点作为循环体结构的开始,使用循环结束节点作为循环体结构的结束,如图4所示。同时用户需要手动关联循环开始节点和循环结束节点,如图4中的虚线部分所示。其中,两个循环节点的关联信息并不会同其他节点的关联信息一样存储于工作流之中,而是作为循环节点自身信息的一部分,存储于自身节点关联字段中。同时循环开始节点和循环结束节点还会包含相同的循环条件字段(用于循环条件判断操作的执行)、do-while或while的循环类型字段、循环执行次数字段等信息。b) (Node-based interactive construction method) Use the loop start node as the beginning of the loop body structure, and use the loop end node as the end of the loop body structure, as shown in Figure 4. At the same time, the user needs to manually associate the loop start node and the loop end node, as shown in the dotted line in Figure 4. Among them, the association information of the two loop nodes is not stored in the workflow like the association information of other nodes, but is stored in the node association field of its own node as part of the loop node's own information. At the same time, the loop start node and the loop end node will also contain the same loop condition field (used for the execution of the loop condition judgment operation), do-while or while loop type field, loop execution times field and other information.
通过前置步骤的处理,可以根据任务需求在线配置工作流的各项参数和处理流程,系统配置方式更加灵活便捷,能够大幅提高节点数据处理效率。Through the processing of pre-steps, various parameters and processing procedures of the workflow can be configured online according to task requirements. The system configuration method is more flexible and convenient, and can greatly improve the efficiency of node data processing.
在一个实施例中,关于上述步骤S16中,开始循环调度逻辑的执行的过程,具体可以包括如下处理步骤:In one embodiment, regarding the process of starting the execution of the loop scheduling logic in step S16 above, the process may specifically include the following processing steps:
根据循环开始节点中记录的循环类型确定节点执行操作和循环条件判断操作;Determine the node execution operation and loop condition judgment operation based on the loop type recorded in the loop start node;
若循环类型为while类型循环,则进行循环条件判断操作;If the loop type is a while type loop, the loop condition judgment operation is performed;
若循环条件判断操作为真,则执行有向无环图中循环开始节点的后续节点。If the loop condition judgment operation is true, the subsequent nodes of the loop start node in the directed acyclic graph are executed.
具体的,对于当前遇到的循环体节点而言,节点执行器根据其循环开始节点中记录的循环类型确定节点执行操作和循环条件判断操作,若循环开始节点所标识逻辑为while类型循环,则进行循环条件判断操作,条件为真(如循环中由前端用户操作设置的循环条件实际上可以是可执行的JavaScript代码,代码返回值为Boolean类型,代码执行结果返回true则条件判断为真,否则判断为假(包括代码执行发生异常也判断为假),下文真假判断同理理解)则正常结束本循环开始节点,自然执行DAG图中循环开始节点的后续节点,从而准确完成该循环逻辑下的节点执行处理。Specifically, for the loop body node currently encountered, the node executor determines the node execution operation and the loop condition judgment operation based on the loop type recorded in the loop start node. If the logic identified by the loop start node is a while type loop, then Perform a loop condition judgment operation, and the condition is true (for example, the loop condition set by the front-end user operation in the loop can actually be an executable JavaScript code. The code return value is of Boolean type. If the code execution result returns true, the condition is judged to be true, otherwise If the judgment is false (including exceptions in code execution, it is also judged as false), and the true and false judgments below are understood in the same way), the start node of this cycle will be ended normally, and the subsequent nodes of the cycle start node in the DAG diagram will be naturally executed, thereby accurately completing the logic of the cycle. The node performs processing.
在一个实施例中,关于前述若循环类型为while类型循环,则进行循环条件判断操作的步骤后,还包括:In one embodiment, after the step of performing the loop condition judgment operation if the loop type is a while type loop, it also includes:
若循环条件判断操作为假,则根据循环开始节点中记录的循环结束节点唯一标识信息,直接跳转执行循环结束节点唯一标识信息对应的循环结束节点,完成循环体的执行。If the loop condition judgment operation is false, based on the unique identification information of the loop end node recorded in the loop start node, it will directly jump to the loop end node corresponding to the unique identification information of the loop end node to complete the execution of the loop body.
可以理解,当循环开始节点中记录的循环类型为while类型循环,并且进行循环条件判断操作时判断到循环条件为假时,节点执行器根据循环开始节点中记录的循环结束节点唯一标识信息,直接跳转至相应的循环结束节点,并由调度算法执行循环结束节点。而由于循环结束节点拥有和循环开始节点一致的循环类型信息及循环条件信息,此时循环结束节点将直接结束自身执行,开始循环体结构的DAG后续节点执行,完成循环。It can be understood that when the loop type recorded in the loop start node is a while type loop, and when the loop condition is judged to be false during the loop condition judgment operation, the node executor directly determines the loop condition based on the unique identification information of the loop end node recorded in the loop start node. Jump to the corresponding loop end node, and the loop end node is executed by the scheduling algorithm. Since the loop end node has the same loop type information and loop condition information as the loop start node, the loop end node will directly end its own execution at this time, start the execution of the DAG subsequent nodes of the loop body structure, and complete the loop.
在一个实施例中,关于上述步骤S16中,开始循环调度逻辑的执行的过程,具体还可以包括如下处理步骤:In one embodiment, the process of starting the execution of the loop scheduling logic in step S16 above may also include the following processing steps:
若循环类型为do-while类型循环,则结束循环开始节点的执行并转入执行有向无环图中循环开始节点的后续节点;If the loop type is a do-while type loop, the execution of the loop start node ends and the execution of the subsequent nodes of the loop start node in the directed acyclic graph is executed;
在循环体执行一次完毕后在循环结束节点中进行循环条件判断操作;After the loop body is executed once, the loop condition judgment operation is performed in the loop end node;
若循环条件判断操作为真,则将循环开始节点再次加载至节点执行就绪队列中,触发循环体的再次执行。If the loop condition judgment operation is true, the loop start node is loaded into the node execution ready queue again, triggering the loop body to be executed again.
可以理解,当循环开始节点中记录的循环类型为do-while类型循环时,节点执行器直接按照普通节点结束逻辑结束本循环开始节点的执行,由此自然进入DAG图中本节点的后续节点的执行处理。循环条件判断操作将在循环体执行一次完毕后在循环结束节点中执行,此时若循环条件判断操作为真,即判断继续执行循环,则循环结束节点将会引导调度算法的后续节点的加载执行,即将循环开始节点再次加载到节点执行就绪队列中去,使得循环体被再一次执行,以此达到了循环体结构的反复执行,直到满足循环结束条件。It can be understood that when the loop type recorded in the loop start node is a do-while type loop, the node executor directly ends the execution of the loop start node according to the ordinary node end logic, thus naturally entering the subsequent nodes of this node in the DAG graph. Execute processing. The loop condition judgment operation will be executed in the loop end node after the loop body is executed once. At this time, if the loop condition judgment operation is true, that is, it is judged to continue executing the loop, the loop end node will guide the loading and execution of subsequent nodes of the scheduling algorithm. , that is, the loop starting node is loaded into the node execution ready queue again, so that the loop body is executed again, thereby achieving repeated execution of the loop body structure until the loop end condition is met.
在一个实施例中,在循环体执行一次完毕后在循环结束节点中进行循环条件判断操作的步骤后,具体还可以包括:In one embodiment, after the loop body is executed once and the loop condition judgment operation is performed in the loop end node, it may also include:
若循环条件判断操作为假,则结束循环体的循环执行操作并跳转至下一计算节点的执行。If the loop condition judgment operation is false, the loop execution operation of the loop body ends and jumps to the execution of the next computing node.
可以理解,循环条件判断操作将在循环体执行一次完毕后在循环结束节点中执行,此时若循环条件判断操作为假,即判断结束继续执行循环,则循环结束节点将会引导调度算法结束执行本节点,并跳转到所属循环体的下一节点的执行处理,从而实现准确的工作流正常引导执行。It can be understood that the loop condition judgment operation will be executed in the loop end node after the loop body is executed once. At this time, if the loop condition judgment operation is false, that is, the loop is judged to end and the loop continues to be executed, the loop end node will guide the scheduling algorithm to end execution. This node, and jumps to the execution processing of the next node of the loop body to which it belongs, thereby achieving accurate normal guidance and execution of the workflow.
本发明已经在多学科优化设计大型流程构建调度系统中应用,成功实现了循环结构及其运行调度。与现有技术相比,工作流处理性能更加稳定且高效,且实现循环嵌套等功能更加强大。以工作流引擎为多学科优化设计流程构建执行引擎为例,如图5所示,为该工作流引擎的具体调度逻辑示意图,其中五角星标识了调度算法的开始,并经过构建DAG,初始化节点执行就绪队列、提交节点执行、解析节点并加入节点执行就绪队列、开始执行各类型节点、完成执行后发送事件等步骤,对整个工作流的流程任务进行执行处理;其中,循环开始节点和循环结束节点的执行依赖于引擎中配置的循环节点执行处理器。在多学科优化设计流程构建的系统界面上,用户可以在该界面上进行工作流构建和设置,其中的循环体节点的执行逻辑可以如图6所示,其中,W表示while类型循环,DW表示do-while类型循环。The present invention has been applied in multi-disciplinary optimization design of large-scale process construction and scheduling systems, and successfully realized the loop structure and its operation scheduling. Compared with existing technology, the workflow processing performance is more stable and efficient, and functions such as loop nesting are more powerful. Taking the workflow engine to build an execution engine for the multi-disciplinary optimization design process as an example, as shown in Figure 5, it is a schematic diagram of the specific scheduling logic of the workflow engine. The five-pointed star marks the start of the scheduling algorithm, and the DAG is constructed to initialize the nodes. Steps such as executing the ready queue, submitting the node for execution, parsing the node and adding it to the node execution ready queue, starting to execute various types of nodes, and sending events after completion of execution are executed to process the process tasks of the entire workflow; among them, the loop start node and the loop end The execution of nodes depends on the loop node execution processor configured in the engine. On the system interface for multi-disciplinary optimization design process construction, users can construct and set up workflows on this interface. The execution logic of the loop body node can be shown in Figure 6, where W represents a while type loop and DW represents do-while type loop.
应该理解的是,虽然上述流程图1和图2中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且上述流程图1和图2的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些子步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the steps in the above flowcharts 1 and 2 are shown in sequence as indicated by arrows, these steps are not necessarily executed in the order indicated by arrows. Unless explicitly stated in this article, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the above-mentioned flow charts 1 and 2 may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but may be executed at different times. These sub-steps or The execution order of the stages is not necessarily sequential, but may be performed in turn or alternately with other steps or sub-steps of other steps or at least part of the stages.
在一个实施例中,如图7所示,提供一种有向无环图工作流引擎循环调度装置100,包括流解析模块11、队列加载模块13、节点执行模块15、数据同步模块17、事件发出模块19和执行调度模块21。其中,流解析模块11用于在多学科优化设计工作流开始执行时,将工作流解析为有向无环图;工作流中的循环体被解析为相互关联的循环开始节点和循环结束节点。队列加载模块13用于根据解析得到的有向无环图逐一加载可执行的计算节点,将计算节点的状态转换为可执行状态并放置于节点执行就绪队列中。节点执行模块15用于通过节点执行器对各计算节点利用相同的调用逻辑,从节点执行就绪队列中逐一执行各计算节点;其中,若遇到循环开始节点,则开始循环调度逻辑的执行。数据同步模块17用于在工作流的当前计算节点执行完毕后,将计算节点的输出数据同步保存至数据库的任务实例数据表中;其中,循环体执行完毕后保存执行次数信息。事件发出模块19用于当前计算节点执行完毕时发出节点执行完成事件;节点执行完成事件中包括结束节点的唯一标识信息。执行调度模块21用于根据结束节点的唯一标识信息以及有向无环图,找到下一计算节点继续执行调度处理,直到工作流执行完毕。In one embodiment, as shown in Figure 7, a directed acyclic graph workflow engine cycle scheduling device 100 is provided, including a stream parsing module 11, a queue loading module 13, a node execution module 15, a data synchronization module 17, an event Issue module 19 and execution scheduling module 21. Among them, the flow parsing module 11 is used to parse the workflow into a directed acyclic graph when the multidisciplinary optimization design workflow starts to be executed; the loop body in the workflow is parsed into interrelated loop start nodes and loop end nodes. The queue loading module 13 is used to load executable computing nodes one by one according to the parsed directed acyclic graph, convert the state of the computing node into an executable state and place it in the node execution ready queue. The node execution module 15 is used to use the same calling logic for each computing node through the node executor, and execute each computing node one by one from the node execution ready queue; wherein, if a cycle start node is encountered, the execution of the cycle scheduling logic is started. The data synchronization module 17 is used to synchronously save the output data of the computing node to the task instance data table of the database after the current computing node of the workflow is executed; wherein, the execution number information is saved after the loop body is executed. The event issuing module 19 is used to issue a node execution completion event when the current computing node completes execution; the node execution completion event includes the unique identification information of the end node. The execution scheduling module 21 is used to find the next computing node and continue to execute the scheduling process according to the unique identification information of the end node and the directed acyclic graph until the workflow is completed.
上述有向无环图工作流引擎循环调度装置100,通过将单个循环节点拆分为两个互相关联的逻辑节点,并基于结构化编程语言中goto(无条件转移)思想,建立了以循环开始节点和循环结束节点为循环结构实现策略的工作流子流程循环调度处理方式,在保留了通用工作流引擎底层有向无环图数据结构的同时,维持流程中各个任务的相对独立性。有效避免了系统开发难度的增加,也将循环结构的执行能力发挥到了极致,不必担心循环体过大而影响流程执行性能,工作流中循环互相嵌套的情况也得以实现。相比于传统工作流引擎,上述方案可以在传统工作流引擎基础上无需大量改进就可以引入高效的循环逻辑结构,是一种新型的工作流循环结构实现方案。The above directed acyclic graph workflow engine loop scheduling device 100 splits a single loop node into two interconnected logical nodes, and based on the goto (unconditional transfer) idea in structured programming languages, establishes a loop starting node The workflow sub-process loop scheduling processing method with the loop end node as the loop structure implementation strategy retains the underlying directed acyclic graph data structure of the general workflow engine while maintaining the relative independence of each task in the process. It effectively avoids the increase in the difficulty of system development, and also maximizes the execution capabilities of the loop structure. There is no need to worry about the loop body being too large, which will affect the process execution performance, and the nesting of loops in the workflow can also be realized. Compared with traditional workflow engines, the above solution can introduce efficient loop logic structures on the basis of traditional workflow engines without extensive improvements. It is a new solution for implementing workflow loop structures.
在一个实施例中,上述有向无环图工作流引擎循环调度装置100还可以包括流构建模块和流存储模块,其中,流构建模块用于在工作流引擎的前端界面中,构建待执行的工作流并根据节点间相互依赖关系设置工作流中节点间数据传递关系和数据传递方向。流存储模块用于将构建完毕后的工作流保存至工作流引擎的后端流程数据库。In one embodiment, the directed acyclic graph workflow engine cycle scheduling device 100 may also include a flow construction module and a flow storage module, where the flow construction module is used to construct the to-be-executed process in the front-end interface of the workflow engine. Workflow and set the data transfer relationship and data transfer direction between nodes in the workflow based on the interdependencies between nodes. The flow storage module is used to save the completed workflow to the back-end process database of the workflow engine.
在一个实施例中,开始循环调度逻辑的执行的过程,包括:In one embodiment, the process of starting the execution of loop scheduling logic includes:
根据循环开始节点中记录的循环类型确定节点执行操作和循环条件判断操作;Determine the node execution operation and loop condition judgment operation based on the loop type recorded in the loop start node;
若循环类型为while类型循环,则进行循环条件判断操作;If the loop type is a while type loop, the loop condition judgment operation is performed;
若循环条件判断操作为真,则执行有向无环图中循环开始节点的后续节点。If the loop condition judgment operation is true, the subsequent nodes of the loop start node in the directed acyclic graph are executed.
在一个实施例中,若循环类型为while类型循环,则进行循环条件判断操作的步骤后,还包括:In one embodiment, if the loop type is a while type loop, after the step of performing the loop condition judgment operation, it also includes:
若循环条件判断操作为假,则根据循环开始节点中记录的循环结束节点唯一标识信息,直接跳转执行循环结束节点唯一标识信息对应的循环结束节点,完成循环体的执行。If the loop condition judgment operation is false, based on the unique identification information of the loop end node recorded in the loop start node, it will directly jump to the loop end node corresponding to the unique identification information of the loop end node to complete the execution of the loop body.
在一个实施例中,开始循环调度逻辑的执行的过程,还包括:In one embodiment, the process of starting the execution of the loop scheduling logic also includes:
若循环类型为do-while类型循环,则结束循环开始节点的执行并转入执行有向无环图中循环开始节点的后续节点;If the loop type is a do-while type loop, the execution of the loop start node ends and the execution of the subsequent nodes of the loop start node in the directed acyclic graph is executed;
在循环体执行一次完毕后在循环结束节点中进行循环条件判断操作;After the loop body is executed once, the loop condition judgment operation is performed in the loop end node;
若循环条件判断操作为真,则将循环开始节点再次加载至节点执行就绪队列中,触发循环体的再次执行。If the loop condition judgment operation is true, the loop start node is loaded into the node execution ready queue again, triggering the loop body to be executed again.
在一个实施例中,在循环体执行一次完毕后在循环结束节点中进行循环条件判断操作的步骤后,还包括:In one embodiment, after the loop body is executed once, the step of performing a loop condition judgment operation in the loop end node also includes:
若循环条件判断操作为假,则结束循环体的循环执行操作并跳转至下一计算节点的执行。If the loop condition judgment operation is false, the loop execution operation of the loop body ends and jumps to the execution of the next computing node.
关于有向无环图工作流引擎循环调度装置100的具体限定,可以参见上文中有向无环图工作流引擎循环调度方法的相应限定,在此不再赘述。上述有向无环图工作流引擎循环调度装置100中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于具备数据处理功能的设备中,也可以软件形式存储于前述设备的存储器中,以便于处理器调用执行以上各个模块对应的操作,前述设备可以是但不限于本领域已有的各型数据计算与处理设备。Regarding the specific limitations of the directed acyclic graph workflow engine cyclic scheduling device 100, please refer to the corresponding limitations of the directed acyclic graph workflow engine cyclic scheduling method mentioned above, which will not be described again here. Each module in the above directed acyclic graph workflow engine cycle scheduling device 100 can be implemented in whole or in part by software, hardware and combinations thereof. Each of the above modules can be embedded in or independent of a device with data processing functions in the form of hardware, or can be stored in the memory of the aforementioned device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules. The aforementioned device can be either It is not limited to various types of data calculation and processing equipment existing in this field.
在一个实施例中,还提供一种计算机设备,包括存储器和处理器,存储器存储有计算机程序,处理器执行计算机程序时实现如下处理步骤:在多学科优化设计工作流开始执行时,将工作流解析为有向无环图;工作流中的循环体被解析为相互关联的循环开始节点和循环结束节点;根据解析得到的有向无环图逐一加载可执行的计算节点,将计算节点的状态转换为可执行状态并放置于节点执行就绪队列中;通过节点执行器对各计算节点利用相同的调用逻辑,从节点执行就绪队列中逐一执行各计算节点;其中,若遇到循环开始节点,则开始循环调度逻辑的执行;在工作流的当前计算节点执行完毕后,将计算节点的输出数据同步保存至数据库的任务实例数据表中;其中,循环体执行完毕后保存执行次数信息;当前计算节点执行完毕时发出节点执行完成事件;节点执行完成事件中包括结束节点的唯一标识信息;根据结束节点的唯一标识信息以及有向无环图,找到下一计算节点继续执行调度处理,直到工作流执行完毕。In one embodiment, a computer device is also provided, including a memory and a processor. The memory stores a computer program. When the processor executes the computer program, the following processing steps are implemented: When the multidisciplinary optimization design workflow starts to be executed, the workflow It is parsed into a directed acyclic graph; the loop body in the workflow is parsed into interrelated loop start nodes and loop end nodes; the executable calculation nodes are loaded one by one according to the parsed directed acyclic graph, and the status of the calculation node is Convert to executable state and place it in the node execution ready queue; use the same calling logic for each computing node through the node executor, and execute each computing node one by one from the node execution ready queue; among them, if the cycle start node is encountered, then Start the execution of the loop scheduling logic; after the current computing node of the workflow is executed, the output data of the computing node is synchronously saved to the task instance data table of the database; among them, the execution number information is saved after the loop body is executed; the current computing node When the execution is completed, a node execution completion event is issued; the node execution completion event includes the unique identification information of the end node; based on the unique identification information of the end node and the directed acyclic graph, the next computing node is found and the scheduling process is continued until the workflow is executed. complete.
可以理解,上述计算机设备除上述述及的存储器和处理器外,还包括其他本说明书未列出的软硬件组成部分,具体可以根据不同应用场景下的具体计算机设备的型号确定,本说明书不再一一列出详述。It can be understood that, in addition to the above-mentioned memory and processor, the above-mentioned computer equipment also includes other software and hardware components not listed in this specification. The details can be determined according to the model of the specific computer equipment in different application scenarios. This specification will not cover List them one by one in detail.
在一个实施例中,处理器执行计算机程序时还可以实现上述有向无环图工作流引擎循环调度方法各实施例中增加的步骤或者子步骤。In one embodiment, when the processor executes the computer program, it can also implement the steps or sub-steps added in the above embodiments of the directed acyclic graph workflow engine loop scheduling method.
在一个实施例中,还提供一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现如下处理步骤:在多学科优化设计工作流开始执行时,将工作流解析为有向无环图;工作流中的循环体被解析为相互关联的循环开始节点和循环结束节点;根据解析得到的有向无环图逐一加载可执行的计算节点,将计算节点的状态转换为可执行状态并放置于节点执行就绪队列中;通过节点执行器对各计算节点利用相同的调用逻辑,从节点执行就绪队列中逐一执行各计算节点;其中,若遇到循环开始节点,则开始循环调度逻辑的执行;在工作流的当前计算节点执行完毕后,将计算节点的输出数据同步保存至数据库的任务实例数据表中;其中,循环体执行完毕后保存执行次数信息;当前计算节点执行完毕时发出节点执行完成事件;节点执行完成事件中包括结束节点的唯一标识信息;根据结束节点的唯一标识信息以及有向无环图,找到下一计算节点继续执行调度处理,直到工作流执行完毕。In one embodiment, a computer-readable storage medium is also provided, with a computer program stored thereon. When the computer program is executed by the processor, the following processing steps are implemented: When the multi-disciplinary optimization design workflow starts to be executed, the workflow is parsed It is a directed acyclic graph; the loop body in the workflow is parsed into interrelated loop start nodes and loop end nodes; the executable computing nodes are loaded one by one according to the parsed directed acyclic graph, and the status of the computing nodes is converted. It is in an executable state and placed in the node execution ready queue; the node executor uses the same calling logic for each computing node to execute each computing node one by one from the node execution ready queue; among them, if the cycle start node is encountered, start Execution of loop scheduling logic; after the current computing node of the workflow is executed, the output data of the computing node is synchronously saved to the task instance data table of the database; among them, the execution number information is saved after the loop body is executed; the current computing node executes When completed, a node execution completion event is issued; the node execution completion event includes the unique identification information of the end node; based on the unique identification information of the end node and the directed acyclic graph, the next computing node is found and the scheduling process is continued until the workflow is completed. .
在一个实施例中,计算机程序被处理器执行时,还可以实现上述有向无环图工作流引擎循环调度方法各实施例中增加的步骤或者子步骤。In one embodiment, when the computer program is executed by the processor, the added steps or sub-steps in the above embodiments of the directed acyclic graph workflow engine loop scheduling method can also be implemented.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink) DRAM(SLDRAM)、存储器总线式动态随机存储器(RambusDRAM,简称RDRAM)以及接口动态随机存储器(DRDRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program may include the processes of the above method embodiments. Any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and/or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Synchlink DRAM (SLDRAM), memory bus dynamic random access memory (RambusDRAM, RDRAM for short) and interface dynamic random access memory (DRDRAM), etc.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined in any way. To simplify the description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, all possible combinations should be used. It is considered to be within the scope of this manual.
以上实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可做出若干变形和改进,都属于本申请保护范围。因此本申请专利的保护范围应以所附权利要求为准。The above embodiments only express several implementation modes of the present application, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the invention patent. It should be noted that, for those of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, which all fall within the protection scope of the present application. Therefore, the scope of protection of this patent application shall be determined by the appended claims.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410094252.9ACN117610320B (en) | 2024-01-23 | 2024-01-23 | Directed acyclic graph workflow engine cyclic scheduling method, device and equipment |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202410094252.9ACN117610320B (en) | 2024-01-23 | 2024-01-23 | Directed acyclic graph workflow engine cyclic scheduling method, device and equipment |
| Publication Number | Publication Date |
|---|---|
| CN117610320Atrue CN117610320A (en) | 2024-02-27 |
| CN117610320B CN117610320B (en) | 2024-04-02 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202410094252.9AActiveCN117610320B (en) | 2024-01-23 | 2024-01-23 | Directed acyclic graph workflow engine cyclic scheduling method, device and equipment |
| Country | Link |
|---|---|
| CN (1) | CN117610320B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117785391A (en)* | 2024-02-28 | 2024-03-29 | 成都索贝视频云计算有限公司 | Service operation logic structuring device |
| CN119292563A (en)* | 2024-08-16 | 2025-01-10 | 南威软件股份有限公司 | A method, device, equipment and medium for enhancing workflow |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103377035A (en)* | 2012-04-12 | 2013-10-30 | 浙江大学 | Pipeline parallelization method for coarse-grained streaming application |
| CN103617066A (en)* | 2013-12-16 | 2014-03-05 | 中国农业银行股份有限公司 | Workflow engine and implementation method thereof |
| CN106600238A (en)* | 2016-12-26 | 2017-04-26 | 上海轻维软件有限公司 | Network service fulfillment realization method based on Activiti flow engine and apparatus thereof |
| CN107015856A (en)* | 2017-03-30 | 2017-08-04 | 青海大学 | Task scheduling approach generation method and device under cloud environment in scientific workflow |
| US20180276040A1 (en)* | 2017-03-23 | 2018-09-27 | Amazon Technologies, Inc. | Event-driven scheduling using directed acyclic graphs |
| CN111597143A (en)* | 2020-03-24 | 2020-08-28 | 中电海康集团有限公司 | Method for converting DAG graph data into workflow engine scheduling file |
| CN112114960A (en)* | 2020-08-06 | 2020-12-22 | 河南大学 | Scheduling strategy for remote sensing image parallel cluster processing suitable for internet scene |
| CN112434061A (en)* | 2020-08-25 | 2021-03-02 | 上海幻电信息科技有限公司 | Task scheduling method and system supporting circular dependence |
| CN113377348A (en)* | 2021-06-10 | 2021-09-10 | 平安科技(深圳)有限公司 | Task adjustment method applied to task engine, related device and storage medium |
| CN114548915A (en)* | 2022-01-26 | 2022-05-27 | 北京金和网络股份有限公司 | Method and system for realizing business cross-organization flow based on process engine |
| CN114595580A (en)* | 2022-03-09 | 2022-06-07 | 北京航空航天大学 | A Complex Workflow Engine Approach to Satisfy the Optimal Design of Large Flexible Blades |
| CN114625517A (en)* | 2022-04-13 | 2022-06-14 | 北京赛博云睿智能科技有限公司 | DAG graph computation distributed big data workflow task scheduling platform |
| WO2022135079A1 (en)* | 2020-12-25 | 2022-06-30 | 北京有竹居网络技术有限公司 | Data processing method for task flow engine, and task flow engine, device and medium |
| WO2023004805A1 (en)* | 2021-07-30 | 2023-02-02 | 西门子股份公司 | Workflow modeling implementation system and method, and storage medium |
| CN116069462A (en)* | 2022-12-07 | 2023-05-05 | 厦门美亚亿安信息科技有限公司 | Big data DAG task flow scheduling method, system and storage medium |
| CN116302381A (en)* | 2022-09-08 | 2023-06-23 | 上海数禾信息科技有限公司 | Parallel topology scheduling component and method, task scheduling method and task processing method |
| CN116627396A (en)* | 2023-06-28 | 2023-08-22 | 重庆大学 | Polyhedral model nested cyclic transformation dynamic solving acceleration method |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN103377035A (en)* | 2012-04-12 | 2013-10-30 | 浙江大学 | Pipeline parallelization method for coarse-grained streaming application |
| CN103617066A (en)* | 2013-12-16 | 2014-03-05 | 中国农业银行股份有限公司 | Workflow engine and implementation method thereof |
| CN106600238A (en)* | 2016-12-26 | 2017-04-26 | 上海轻维软件有限公司 | Network service fulfillment realization method based on Activiti flow engine and apparatus thereof |
| US20180276040A1 (en)* | 2017-03-23 | 2018-09-27 | Amazon Technologies, Inc. | Event-driven scheduling using directed acyclic graphs |
| CN107015856A (en)* | 2017-03-30 | 2017-08-04 | 青海大学 | Task scheduling approach generation method and device under cloud environment in scientific workflow |
| CN111597143A (en)* | 2020-03-24 | 2020-08-28 | 中电海康集团有限公司 | Method for converting DAG graph data into workflow engine scheduling file |
| CN112114960A (en)* | 2020-08-06 | 2020-12-22 | 河南大学 | Scheduling strategy for remote sensing image parallel cluster processing suitable for internet scene |
| CN112434061A (en)* | 2020-08-25 | 2021-03-02 | 上海幻电信息科技有限公司 | Task scheduling method and system supporting circular dependence |
| WO2022135079A1 (en)* | 2020-12-25 | 2022-06-30 | 北京有竹居网络技术有限公司 | Data processing method for task flow engine, and task flow engine, device and medium |
| CN113377348A (en)* | 2021-06-10 | 2021-09-10 | 平安科技(深圳)有限公司 | Task adjustment method applied to task engine, related device and storage medium |
| WO2023004805A1 (en)* | 2021-07-30 | 2023-02-02 | 西门子股份公司 | Workflow modeling implementation system and method, and storage medium |
| CN114548915A (en)* | 2022-01-26 | 2022-05-27 | 北京金和网络股份有限公司 | Method and system for realizing business cross-organization flow based on process engine |
| CN114595580A (en)* | 2022-03-09 | 2022-06-07 | 北京航空航天大学 | A Complex Workflow Engine Approach to Satisfy the Optimal Design of Large Flexible Blades |
| CN114625517A (en)* | 2022-04-13 | 2022-06-14 | 北京赛博云睿智能科技有限公司 | DAG graph computation distributed big data workflow task scheduling platform |
| CN116302381A (en)* | 2022-09-08 | 2023-06-23 | 上海数禾信息科技有限公司 | Parallel topology scheduling component and method, task scheduling method and task processing method |
| CN116069462A (en)* | 2022-12-07 | 2023-05-05 | 厦门美亚亿安信息科技有限公司 | Big data DAG task flow scheduling method, system and storage medium |
| CN116627396A (en)* | 2023-06-28 | 2023-08-22 | 重庆大学 | Polyhedral model nested cyclic transformation dynamic solving acceleration method |
| Title |
|---|
| CHUNEL: "纯序员给你介绍图化框架的简单实现——循环逻辑", pages 1 - 5, Retrieved from the Internet <URL:《https://zhuanlan.zhihu.com/p/582925879》>* |
| MICHEL KRÄMER 等: "Executing cyclic scientific workflows in the cloud", 《SPRINGER》, 6 April 2021 (2021-04-06), pages 1 - 26, XP021289089, DOI: 10.1186/s13677-021-00229-7* |
| 宋莉莉;聂冲;王维平;: "基于有向循环图的多学科设计优化模型调度方法", 系统仿真学报, no. 05, 20 May 2007 (2007-05-20), pages 1119 - 1123* |
| 戴晨;陈鹏;杨冬蕾;张为华;: "面向多核的并行编程和优化研究", 计算机应用与软件, no. 12, 15 December 2013 (2013-12-15), pages 198 - 203* |
| 李于锋;莫则尧;肖永浩;赵士操;段博文;: "超算环境科学工作流应用平台的引擎设计和资源调度", 计算机应用研究, no. 06, 9 July 2018 (2018-07-09), pages 1723 - 1726* |
| 杨明顺;韩周鹏;余婷;李言;邵利真;: "一种轻型工作流引擎的设计与实现", 西安理工大学学报, no. 01, 30 March 2013 (2013-03-30), pages 20 - 26* |
| 柴锐: "基于新型膜材料的计算组装工作流调度模型及成本优化研究", 《万方》, 27 September 2023 (2023-09-27), pages 1 - 78* |
| 王红霞;: "网格工作流引擎的设计与实现", 计算机工程与设计, no. 02, 16 February 2011 (2011-02-16), pages 430 - 433* |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN117785391A (en)* | 2024-02-28 | 2024-03-29 | 成都索贝视频云计算有限公司 | Service operation logic structuring device |
| CN117785391B (en)* | 2024-02-28 | 2024-05-10 | 成都索贝视频云计算有限公司 | Service operation logic structuring device |
| CN119292563A (en)* | 2024-08-16 | 2025-01-10 | 南威软件股份有限公司 | A method, device, equipment and medium for enhancing workflow |
| Publication number | Publication date |
|---|---|
| CN117610320B (en) | 2024-04-02 |
| Publication | Publication Date | Title |
|---|---|---|
| CN117610320B (en) | Directed acyclic graph workflow engine cyclic scheduling method, device and equipment | |
| JP6469084B2 (en) | Control of tasks performed by computing systems | |
| TWI442233B (en) | Parallelizing sequential frameworks using transactions, and computer storage medium for recording related instructions thereon | |
| CN104360903B (en) | The method that task data decoupling is realized in Spark job scheduling systems | |
| JP6763072B2 (en) | Compile data processing graph | |
| JP5813165B2 (en) | Parallelizing sequential frameworks using transactions | |
| US8661441B2 (en) | Transaction load reduction for process completion | |
| JP6467500B2 (en) | Managing the execution state of the components to control the associated tasks of the components in the graph-based program specification | |
| CN114595580B (en) | A complex workflow engine method for optimizing the design of large flexible blades | |
| CN111159268B (en) | Method and device for running ETL (extract-transform-load) process in Spark cluster | |
| CN110134506A (en) | Real-time dynamic critical path multi-core scheduling method based on processor core dynamics | |
| CN114721657A (en) | Multithreading program implementation method and device and related equipment | |
| WO2008041442A1 (en) | Parallelization program creating method, parallelization program creating device, and parallelization program creating program | |
| CN108932334A (en) | One kind is based on the extension of time series storage model and matching optimization method | |
| CN115586953A (en) | Hive-based task concurrent execution method and related device | |
| CN111596923A (en) | Haxe static link library construction method and device and electronic equipment | |
| CN119621072B (en) | Instruction scheduling optimization method, device and compiling method based on directed acyclic graph | |
| CN112558978A (en) | Accelerated programming and compiling method for supporting heterogeneous many-core full-chip view angle | |
| CN119356817B (en) | Multi-script execution method of virtual controller | |
| CN103164275B (en) | The method reducing maximum data storage in scheduling problem | |
| Hidders et al. | Towards a calculus for collection-oriented scientific workflows with side effects | |
| CN113868142A (en) | Multiprocessor system AADL model schedulability analysis method | |
| CN117093502A (en) | Method and device for detecting parallelism of program codes | |
| CN120386604A (en) | A deterministic concurrent execution method and system for nested contract transactions | |
| CN114924747A (en) | A method and device for improving the performance of a code construction pipeline |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |