A method, apparatus, electronic device, and storage medium for running a workflow instance
By determining the workflow template for the target task identification in the workflow and generating instances, and running task instances based on multiple execution conditions, the problem of workflow non-university is solved, and the effect of adapting to multiple business needs and improving operational efficiency is achieved.
Patent Information
- Application Number
- CN202210617061.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-01
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2042-06-01
AI Technical Summary
In the prior art, workflow functions are limited and not universal, making it difficult to apply to a variety of business needs.
By determining the target workflow template corresponding to the target task identification from multiple pre-created workflow templates, a target workflow instance is generated, and the target task instance is run according to the target execution conditions, the pre-execution conditions of multiple task nodes are supported, including all pre-execution instances succeeding, any pre-execution instances succeeding, all pre-execution instances completed, and any pre-execution instances completed.
It improves the versatility of workflows, can adapt to a variety of business needs, saves workflow design time, improves operational efficiency, and adapts to IDP systems.
Smart Images

Figure CN114862368B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of workflow, and more particularly, to a method, apparatus, electronic device, and storage medium for running a workflow instance. Background Art
[0002] A workflow refers to the process of automating a partial or entire business process in a computer application environment. Briefly speaking, a workflow is an abstract and generalized description of a work process and the business rules between its various operation steps. In a computer, a workflow is part of computer-supported collaborative work; the main problem it solves is: in order to achieve a certain business goal, use a computer to automatically transfer documents, information, or tasks among multiple participants according to a certain predetermined rule.
[0003] In the existing product design process, it is necessary to make multiple task nodes in the workflow execute in a certain logical running order, and sometimes the pre-execution conditions for each task node to run are different. However, in the general process, it is default that the pre-execution conditions when the task nodes run are unified, which easily leads to limited workflow functions, lack of generality, and difficulty in applying to various business requirements. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a method, apparatus, electronic device, and storage medium for running a workflow instance, which solves the problems of limited workflow functions, lack of generality, and difficulty in applying to various business requirements in the prior art.
[0005] In a first aspect, an embodiment of this application provides a method for running a workflow instance, and the running method includes:
[0006] In response to a running request for a target task, determine a target workflow template corresponding to the target task identifier carried in the running request from a plurality of pre-created workflow templates;
[0007] In response to a configuration parameter selection operation for the target workflow template, generate a target workflow instance; wherein, the configuration parameter has an association relationship with the target task identifier, and the target workflow instance includes a plurality of target task instances connected in sequence according to the logical running order of the target workflow template;
[0008] For each target task instance in the target workflow instance, if it is detected that the pre-task instance corresponding to the target task instance meets the target execution condition, then run the target task instance;
[0009] Among them, the pre-task instance is located above the target task instance and connected to the target task instance; the target execution condition includes any one of the following items: all pre-task instances of the target task instance are in the successfully run state, any pre-task instance of the target task instance is in the successfully run state, all pre-task instances of the target task instance are in the completed run state, and any pre-task instance of the target task instance is in the completed run state.
[0010] In an alternative embodiment of the present application, a workflow template is created through the following steps:
[0011] Obtain a task creation request for the workflow; among them, a module selection identifier and a connection order identifier are carried in the task creation request;
[0012] Select a plurality of target task modules from a preset task module library according to the module selection identifier carried in the task creation request;
[0013] In response to a creation operation for the workflow, obtain the workflow and save the workflow to obtain a workflow template; among them, the workflow includes the plurality of target task modules connected in sequence according to the logical running order, and the logical running order is determined according to the connection order identifier carried in the task creation request.
[0014] In an alternative embodiment of the present application, a workflow is created in the following manner:
[0015] Determine the parallel task identifier carried in the task creation request for the workflow;
[0016] Classify the plurality of target task modules according to a preset hierarchical type to obtain a plurality of target task levels and a task module set corresponding to each target task level; among them, when the task module set includes a plurality of target task modules, the plurality of target task modules are determined according to the parallel task identifier carried in the task creation request;
[0017] Determine the hierarchical priority of each target task level according to the connection order identifier carried in the task creation request to obtain a target sub-logical order for representing the connection order between a plurality of task module sets;
[0018] Connect a plurality of task module sets in sequence according to the target sub-logical order, and connect the plurality of target task modules within the task module set in parallel to obtain a workflow.
[0019] In an alternative embodiment of the present application, the running method further includes:
[0020] In response to a workflow parameter selection operation for the workflow, update the workflow and save the updated workflow to obtain an updated workflow template; wherein, the workflow parameters include the task parallelism and the number of retries, and the task parallelism is used to characterize the number of times of simultaneously running the node tasks corresponding to the target task module.
[0021] In an alternative embodiment of the present application, the running method further includes:
[0022] During the process of running the target task instance, detect the node response time corresponding to the target task instance;
[0023] If the node response time exceeds a preset response time threshold, end the running of the target task instance.
[0024] In an alternative embodiment of the present application, the target task is a timed task;
[0025] The step of determining a target workflow template corresponding to the target task identifier carried in the running request from a plurality of pre-created workflow templates in response to a running request for the target task includes:
[0026] In response to a running request for a timed task, detect whether there is a timed workflow template corresponding to the target task identifier carried in the running request among a plurality of pre-created workflow templates;
[0027] If not, periodically search for a timed workflow template corresponding to the target task identifier carried in the running request from a plurality of pre-created workflow templates;
[0028] If so, determine the found timed workflow template as the target workflow template.
[0029] In an alternative embodiment of the present application, the successfully run state means that the task completion rate of the pre-task instance is not less than a preset threshold; the completed run state means that the task completion rate of the pre-task instance is less than the preset threshold.
[0030] In a second aspect, an embodiment of the present application further provides a running device for a workflow instance, and the running device includes:
[0031] A template determination module, configured to determine a target workflow template corresponding to the target task identifier carried in the running request from a plurality of pre-created workflow templates in response to a running request for the target task;
[0032] An instance generation module, configured to generate a target workflow instance in response to a configuration parameter selection operation for the target workflow template; wherein, the configuration parameter has an association relationship with the target task identifier, and the target workflow instance includes a plurality of target task instances connected in sequence according to the logical running order of the target workflow template;
[0033] An instance running module, configured to, for each target task instance in the target workflow instance, if it is detected that the preceding task instance corresponding to the target task instance meets the target execution condition, run the target task instance;
[0034] Wherein, the preceding task instance is located before the target task instance and is connected to the target task instance; the target execution condition includes any one of the following items: all preceding task instances of the target task instance are in a successfully run state, any preceding task instance of the target task instance is in a successfully run state, all preceding task instances of the target task instance are in a completed run state, and any preceding task instance of the target task instance is in a completed run state.
[0035] In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor, a memory, and a bus, where the memory stores machine-readable instructions executable by the processor. When the electronic device runs, the processor communicates with the memory through the bus, and the processor executes the machine-readable instructions to perform the steps of the method for running a workflow instance as described above.
[0036] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is run by a processor, it performs the steps of the method for running a workflow instance as described above.
[0037] The method, apparatus, electronic device, and storage medium for running a workflow instance provided by an embodiment of the present application include: in response to a running request for a target task, determining a target workflow template corresponding to the target task identifier carried in the running request from a plurality of pre-created workflow templates; in response to a configuration parameter selection operation for the target workflow template, generating a target workflow instance; wherein, the configuration parameter has an association relationship with the target task identifier, and the target workflow instance includes a plurality of target task instances connected in sequence according to the logical running order of the target workflow template; for each target task instance in the target workflow instance, if it is detected that the pre-task instance corresponding to the target task instance meets the target execution condition, then run the target task instance; wherein, the pre-task instance is located one position above the target task instance and is connected to the target task instance; the target execution condition includes any one of the following items: all pre-task instances of the target task instance are in a successfully run state, any pre-task instance of the target task instance is in a successfully run state, all pre-task instances of the target task instance are in a completed run state, any pre-task instance of the target task instance is in a completed run state.
[0038] Compared with the method in the general process of the prior art where the preconditions for running task nodes are defaulted to be unified, the embodiments of the present application design multiple target execution conditions for running task instances, meeting the task node running schemes under various complex conditions, solving the problems in the prior art that the workflow function is limited, not general, and difficult to apply to various business requirements, and improving the generality of the workflow. In this way, for users with the same or similar task requirements, they can use a workflow with higher generality to save the design time of the workflow. For users with diverse and complex task requirements, they only need to change the target execution condition without having to recreate the workflow, which can improve the running efficiency of the workflow. In addition, the method for running a workflow instance provided by the embodiments of the present application can be better adapted to the IDP (Intelligent Development Platform) system, meet the workflow requirements of the IDP system, and can be directly applied to the IDP system.
[0039] To make the above objects, features, and advantages of the present application more obvious and understandable, the following specific preferred embodiments are given and described in detail in conjunction with the accompanying drawings. Description of the Drawings
[0040] To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present application and should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0041] Figure 1 It is a flowchart of a method for running a workflow instance provided by an embodiment of the present application;
[0042] Figure 2 It is a schematic structural diagram of a target workflow instance provided by an embodiment of the present application;
[0043] Figure 3 It is a flowchart of running a workflow instance provided by an embodiment of the present application;
[0044] Figure 4 It is a schematic structural diagram of a workflow system provided by an embodiment of the present application;
[0045] Figure 5 It is a schematic structural diagram of a device for running a workflow instance provided by an embodiment of the present application;
[0046] Figure 6 It is a schematic structural diagram of another device for running a workflow instance provided by an embodiment of the present application;
[0047] Figure 7 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0048] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part rather than all of the embodiments of the present application. Usually, the components of the embodiments of the present application described and illustrated in the accompanying drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application claimed, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, every other embodiment obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present application.
[0049] First, the applicable application scenarios of this application are introduced. This application can be applied to workflows. A workflow refers to the process of automating part or the whole business process in a computer application environment. Simply put, a workflow is an abstract and generalized description of a work process and the business rules between its operation steps. In a computer, a workflow is part of computer-supported collaborative work; the main problem it solves is: in order to achieve a certain business goal, use a computer to automatically transfer documents, information, or tasks among multiple participants according to a certain predetermined rule. Taking an AI workflow as an example, an algorithm scientist constructs a data science workflow through its visual interface, configures parameters, environments, jobs, and scheduling plans, so that training and inference can be executed regularly. Each task node has a superior-subordinate dependency relationship, and a task node can determine whether to start running based on the running status of the previous task node.
[0050] In the existing product design process, it is necessary to make multiple task nodes in a workflow execute in a certain logical running order, and sometimes the pre-execution conditions for each task node to run are different. However, in the general process, it is default that the pre-execution conditions when a task node runs are unified, which easily leads to limited workflow functions, lack of generality, and difficulty in applying to various business requirements.
[0051] Based on this, the embodiments of this application provide a method, device, electronic device, and storage medium for running a workflow instance, which solves the problems of limited workflow functions, lack of generality, and difficulty in applying to various business requirements in the prior art.
[0052] Please refer to Figure 1 , Figure 1 which is a flowchart of a method for running a workflow instance provided by an embodiment of this application. As shown in Figure 1 , the method for running a workflow instance provided by the embodiments of this application includes:
[0053] S101. In response to a running request for a target task, determine a target workflow template corresponding to the target task identifier carried in the running request from multiple pre-created workflow templates;
[0054] S102. In response to a configuration parameter selection operation for the target workflow template, generate a target workflow instance; wherein, the configuration parameter has an association relationship with the target task identifier, and the target workflow instance includes multiple target task instances connected in sequence according to the logical running order of the target workflow template;
[0055] S103. For each target task instance in the target workflow instance, if it is detected that the pre-task instance corresponding to the target task instance meets the target execution condition, then run the target task instance; wherein, the pre-task instance is located one position above the target task instance and is connected to the target task instance; the target execution condition includes any one of the following items: all pre-task instances of the target task instance are in the successfully run state, any pre-task instance of the target task instance is in the successfully run state, all pre-task instances of the target task instance are in the completed run state, any pre-task instance of the target task instance is in the completed run state.
[0056] The following is a specific description of the above exemplary steps:
[0057] In step S101, in response to a run request for a target task, determine a target workflow template corresponding to the target task identifier carried in the run request from multiple pre-created workflow templates.
[0058] Here, the target task is a task that meets the user's requirements. The run request for the target task is a request initiated by the user to the workflow system for running the target task. The run request carries a target task identifier, and the target task identifier is used to distinguish different tasks and has the unique attribute characteristics of the target task, so that the workflow system can retrieve the target workflow template corresponding to the target task identifier from multiple pre-created workflow templates.
[0059] In the embodiment of the present application, by saving the historically created workflows, workflow templates can be obtained. As the user's task requirements increase, more and more workflows are created. In this way, the workflow templates can be continuously enriched, so that when running other tasks, the workflow templates can be directly retrieved, saving the creation time of the workflows and being convenient and fast.
[0060] In an optional embodiment, a workflow template is created through the following steps:
[0061] Step 1011. Obtain a task creation request for the workflow; wherein, the task creation request carries a module selection identifier and a connection sequence identifier;
[0062] Step 1012. Select multiple target task modules from a preset task module library according to the module selection identifier carried in the task creation request;
[0063] Step 1013. In response to a creation operation for the workflow, obtain the workflow and save the workflow to obtain a workflow template; wherein, the workflow includes multiple target task modules connected in sequence according to the logical running order, and the logical running order is determined according to the connection sequence identifier carried in the task creation request.
[0064] In step 1011, the task creation request refers to a request initiated by a user to a workflow system for creating a workflow. The task creation request carries a module selection identifier and a connection order identifier. The module selection identifier is used to indicate extracting target task modules for creating a workflow from a preset task module library; the connection order identifier is used to indicate that the extracted target task modules are connected in the connection order corresponding to the connection order identifier to construct a workflow.
[0065] In step 1012, the preset task module library has a large number of task modules and a module identifier corresponding to each task module. Each task module corresponds to a task instance and can complete a specific task, such as downloading, screening, comparing, inputting, and outputting, etc. Specifically, the similarity value between the module selection identifier and the module identifiers of each task module in the task module library can also be calculated, and the task module corresponding to the module identifier with a similarity value greater than the first similarity threshold is determined as the target task module. Among them, a module selection identifier can include multiple sub-identifiers, and each sub-identifier can correspond to selecting a target task module, so that multiple target task modules can be selected based on one module selection identifier.
[0066] In step 1013, the logical running order is determined according to the connection order identifier carried in the task creation request, and multiple target task modules are connected in sequence according to the logical running order to obtain a workflow. Here, in response to the creation operation for the workflow, it can be that the target user manually selects to create, or the target user clicks the create button, and the workflow system automatically creates the workflow.
[0067] Here, the logical running order is determined through the following steps: a database for representing the connection order between each task module is preset. This database includes multiple connection orders and preset connection order identifiers corresponding to each connection order. The connection order identifier carried in the task creation request is compared with the preset connection order identifiers in the database, the similarity value between the connection order identifier carried in the task creation request and the preset connection order identifiers in the database is calculated, and the connection order corresponding to the preset connection order identifier with a similarity value greater than the second similarity threshold is determined as the logical running order corresponding to the connection order identifier carried in the task creation request.
[0068] It should be noted that the above-mentioned first similarity threshold and second similarity threshold can be set according to the actual situation and the actual task creation request, and these similarity thresholds can be continuously adjusted.
[0069] Optionally, in step 1013, the workflow is created in the following manner:
[0070] Step 10131: Determine the co - task identifiers carried in the task creation request of the workflow;
[0071] Step 10132: Classify multiple target task modules according to a preset hierarchical type to obtain multiple target task levels and a set of task modules corresponding to each target task level; among them, when the set of task modules includes multiple target task modules, the multiple target task modules are determined according to the co - task identifiers carried in the task creation request;
[0072] Step 10133: Determine the hierarchical priority of each target task level according to the connection order identifier carried in the task creation request to obtain a target sub - logical order representing the connection order between multiple sets of task modules;
[0073] Step 10134: Connect multiple sets of task modules in sequence according to the target sub - logical order, and connect the multiple target task modules within the set of task modules in parallel to obtain a workflow.
[0074] In step 10131, the co - task identifier includes at least two task identifiers representing the same task, which are used to distinguish task modules that perform the same running task but have different task running methods. For example, both the A task model and the B task module are used to download data, but the A task model downloads data from platform C, and the B task model downloads data from platform D.
[0075] In step 10132, the preset hierarchical type refers to dividing the workflow into a multi - level hierarchical structure according to the tasks that the task modules can complete, and the hierarchical type corresponding to each level of the hierarchical structure; among them, the ways in which the task modules included in each hierarchical structure complete tasks can be more than one, and task modules that perform the same running task but have different task running methods can be classified into one hierarchical structure. Furthermore, according to the preset hierarchical type, multiple target task modules can be classified to obtain multiple target task levels.
[0076] Since each target task level corresponds to a set of task modules, a set of task modules can include one target task module or multiple target task modules. When the set of task modules includes multiple target task modules, the multiple target task modules are determined according to the co - task identifiers carried in the task creation request. Among them, multiple target task modules under a set of task modules can complete the same task in parallel, only the ways of completing the task are different. Since the tasks implemented are the same, there is no connection order between multiple target task modules under a set of task modules.
[0077] It should be noted that the task module sets corresponding to different target task levels may be displayed with different markings, which are color markings and / or symbol markings. From this, it can be known that when classifying multiple target task modules into levels according to a preset level type to obtain multiple target task levels, color markings and / or symbol markings can be added to each target task level.
[0078] Specifically, each target task level in the workflow is displayed with a marking, which can be a color marking, a symbol marking, or both a color marking and a symbol marking at the same time. Among them, the color marking means that different target task levels are displayed by different colors. For example, red represents the first target task level, yellow represents the second target task level, and blue represents the third target task level. The symbol marking means that different target task levels are displayed by different symbols. For example, serial number 1 represents the first target task level, serial number 2 represents the second target task level, serial number 3 represents the third target task level, and so on.
[0079] In this way, by setting different markings for different task levels and displaying them on the graphical user interface, it is convenient for target users to observe and clearly show the connection relationship between each target task module at the same time. If the workflow is created by the target user selecting task modules one by one, the set markings can assist the target user to quickly and standardly complete the creation of the workflow. If the workflow is automatically generated by the workflow system, the displayed markings can facilitate the target user to proofread the generated workflow, thereby improving work efficiency, saving time, and enhancing the user experience.
[0080] In steps 10133 and 10134, according to the connection sequence identifier carried in the task creation request, determine the level priority of each target task level, and determine the order from high to low of the level priority as the target sub-logical order. Furthermore, connect multiple task module sets in sequence according to the target sub-logical order, and connect multiple target task modules within the task module set in parallel to obtain a workflow.
[0081] Optionally, after creating the workflow, the embodiments of the present application further include: in response to a workflow parameter selection operation for the workflow, update the workflow and save the updated workflow to obtain an updated workflow template; where the workflow parameters include task parallelism and retry times, and the task parallelism is used to characterize the number of times of simultaneously running the node tasks corresponding to the target task modules.
[0082] Here, the task parallelism is used to characterize the number of times of running the node tasks corresponding to the target task module simultaneously. Among them, one node task corresponds to one task instance, that is, one target task module corresponds to one task instance. Among them, the number of node tasks corresponding to the task parallelism can be selected according to the number of target task modules included in a task module set. For example, if a task module set corresponding to a target task hierarchy includes 5 target task modules and the task parallelism is selected as 2, then randomly 2 of these 5 target task modules are run at a time.
[0083] Specifically, after selecting the workflow parameters, the workflow with the workflow parameters is saved to obtain a workflow template.
[0084] For example, please refer to Figure 2 , Figure 2 is a schematic structural diagram of a target workflow instance provided by an embodiment of the present application. As Figure 2 shown, the target workflow instance includes 3 target task hierarchies. The first target task hierarchy includes a task module set, and a task module set includes three target task modules. The second target task hierarchy includes a task module set, and a task module set includes two target task modules. Among them, all three target task modules in the task module set corresponding to the first target task hierarchy are connected to one of the target task modules in the task module set corresponding to the second target task hierarchy. The third target task hierarchy includes a task module set, and the task module set includes one target task module. Furthermore, through the connection between different target task hierarchies, the target workflow instance can be obtained.
[0085] In step S102, in response to an operation of selecting configuration parameters for the target workflow template, a target workflow instance is generated; among them, the configuration parameters have an association relationship with the target task identifier, and the target workflow instance includes multiple target task instances connected in sequence according to the logical running order of the target workflow template.
[0086] Among them, the target workflow instance is a directed acyclic graph. That is to say, the target task instance with a later logical running order cannot run towards the target task instance with an earlier logical running order and can only continue to run backward.
[0087] In this step, a target workflow instance includes multiple target task instances. A workflow instance refers to an actual run according to the workflow pattern. The configuration parameters include task name, script content, resource configuration, execution conditions, etc.; the configuration parameters can be determined according to the target task identifier. The logical running order of the target workflow instance is the same as the logical running order of the target workflow template.
[0088] In step S103, for each target task instance in the target workflow instance, if it is detected that the pre-task instance corresponding to the target task instance meets the target execution condition, then the target task instance is run. Since the target task instances corresponding to the first target task level in the target workflow instance have no pre-task instances, only the target task instances corresponding to the second target task level in the target workflow instance are detected, and starting from the target task instances corresponding to the second target task level, it is sequentially detected whether the pre-task instances corresponding to the target task instances meet the target execution condition.
[0089] Among them, the pre-task instance is located at the previous position of the target task instance and is connected to the target task instance; the target execution condition includes any one of the following items: all pre-task instances of the target task instance are in the successfully run state, any pre-task instance of the target task instance is in the successfully run state, all pre-task instances of the target task instance are in the completed run state, and any pre-task instance of the target task instance is in the completed run state.
[0090] Specifically, the successfully run state means that the task completion rate of the pre-task instance is not less than the preset threshold; the completed run state means that the task completion rate of the pre-task instance is less than the preset threshold. Exemplarily, the preset threshold is 100%, that is to say, the successfully run state means that the task completion rate of the pre-task instance is 100%, and the completed run state means that the task completion rate of the pre-task instance is less than 100%.
[0091] Illustrate with examples, the target execution condition includes the following four forms:
[0092] (1) The target task instance is run only when all pre-task instances of the target task instance are completed;
[0093] (2) The target task instance is run only when all pre-task instances of the target task instance are successful to ensure the correct operation of the algorithm;
[0094] (3) When any one of all pre-task instances of the target task instance is completed, the target task instance is run, which can greatly save the running time of the entire workflow;
[0095] (4) When any one of all pre-task instances of the target task instance is successful, the target task instance is run, which can greatly save the running time of the entire workflow.
[0096] Among them, the target task instance corresponds to the node to be run, and the pre-task instance of the target task instance corresponds to the pre-node. When there are multiple target task instances in the target workflow instance (when a workflow has multiple nodes), the target execution condition is as shown in list a:
[0097]
[0098] List a
[0099] In an alternative embodiment, the running method provided by the embodiments of the present application further includes: during the running of the target task instance, detecting the node response time corresponding to the target task instance; if the node response time exceeds a preset response time threshold, ending the running of the target task instance.
[0100] Here, if the node response time exceeds the preset response time threshold, regardless of the execution progress of the current target task instance, end the running of the target task instance.
[0101] In this way, it is possible to avoid the node response time being too long and occupying a large amount of computing resources, thereby achieving the purpose of saving computing resources.
[0102] In an alternative embodiment, the target task is a timed task, and step S101 further includes:
[0103] In response to a running request for the timed task, detecting whether there is a timed workflow template corresponding to the target task identifier carried in the running request among a plurality of pre-created workflow templates;
[0104] If not, periodically search for a timed workflow template corresponding to the target task identifier carried in the running request from among the plurality of pre-created workflow templates;
[0105] If so, determining the found timed workflow template as the target workflow template.
[0106] In the above manner, when creating a workflow corresponding to the target task, first search for a timed workflow template corresponding to the target task identifier carried in the running request from among the plurality of pre-created workflow templates. If not found, continue to search after an interval of time until a timed workflow template is found. During the process of searching for the template, a timed workflow template corresponding to the target task identifier carried in the running request can be created based on steps 1011 to 1013. If found, directly determine the found timed workflow template as the target workflow template.
[0107] Through the above manner, task timed running can be achieved. Exemplarily, the running of the timed task can be controlled and scheduled according to the Java Spring @Scheduled timed task crontab expression setting.
[0108] For example, please refer to Figure 3 , Figure 3 is a running flowchart of a workflow instance provided by the embodiments of the present application. AsFigure 3 As shown in the figure, first, a workflow template is created. It is determined whether there is a timed workflow template in the workflow system. If not, the workflow template is queried at regular intervals. If so, the configuration management of the workflow template is read, and a workflow instance is generated. Then, a task instance is generated, and finally, a DAG sequence diagram is generated. It is determined whether the preconditions for running are met (the pre-task instances corresponding to the target task instance meet the target execution conditions). If so, the task instance is executed until the task is completed.
[0109] In addition, after all the target task instances corresponding to the target tasks are completely run, message push can be performed, such as sending an email to the user for notification.
[0110] Compared with the method in the general process of the prior art where the preconditions during the running of task nodes are defaulted to be unified, the method for running a workflow instance provided in the embodiments of the present application designs various target execution conditions for running task instances, meets the task node running solutions under various complex conditions, solves the problems in the prior art that the workflow function is limited, not universal, and difficult to be applicable to various business requirements, and improves the universality of the workflow. In this way, for users with the same or similar task requirements, a workflow with a relatively high universality can be used to save the design time of the workflow. For users with diverse and complex task requirements, only the target execution conditions need to be changed without re-creating the workflow, which can improve the running efficiency of the workflow. In addition, the method for running a workflow instance provided in the embodiments of the present application can be well adapted to the IDP (Intelligent Development Platform) system, meet the workflow requirements of the IDP system, and can be directly applied to the IDP system.
[0111] The embodiments of the present application also provide a workflow system. Please refer to Figure 4 , Figure 4 which is a schematic diagram of the architecture of a workflow system provided by the embodiments of the present application. The architecture of the workflow system is based on configuration management and workflow templates, with the scheduling system as the center, and can perform a series of system services such as workflow generation, running, warehousing, and message push. As Figure 4 shown, the architecture of the workflow system includes a scheduling system, a workflow template, a workflow instance, a task instance, a data source management, a configuration management, a monitoring and alarm notification service, a file system, a database (DB), and a LOG (a color mode of a video).
[0112] The workflow system in the embodiments of this application can run each task instance according to the above-mentioned running method of the workflow instance. It can support visual creation of workflows, has built-in general templates, and also supports custom templates; it can formulate execution plans, support real-time and offline tasks, can view the status of workflow tasks in real time, and supports convenient management of multiple workflows. Specifically, the task module in the workflow simplifies the connection order between tasks and supports the logical execution of multiple inputs and multiple conditions of task nodes, meeting the sub-node running schemes under various complex conditions. The specific logic includes: not limited to running only when all upper-level nodes are successful, running when a single node is successful, running only when all upper-level nodes are completed (regardless of success or failure), running when a single node is completed, etc. It also supports periodic and one-time runs. Among them, the periodic run can support rule runs in the form of complex Crontab expressions; the one-time run means that the user clicks manually and it is executed only once.
[0113] In addition, the workflows in the above-mentioned workflow system have the following characteristics: (1) Workflows can be executed regularly and manually; (2) Definition of workflow node dependency relationships (supporting all successful, all completed, one successful, one completed); (3) Multiple nodes can run concurrently; (4) The number of node retries can be configured separately; (4) The node timeout time can be configured separately; (5) The workflow and node task status can be updated in real time; (5) Node monitoring and alarm can be performed; (6) Workflows can be managed visually.
[0114] Based on the same inventive concept, an operating device for a workflow instance corresponding to the running method of the workflow instance is also provided in the embodiments of this application. Since the principle of problem-solving of the device in the embodiments of this application is similar to the above-mentioned running method of the workflow instance in the embodiments of this application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be elaborated.
[0115] Please refer to Figure 5 、 Figure 6 , Figure 5 which is a schematic structural diagram of an operating device for a workflow instance provided by an embodiment of this application, Figure 6 and is a schematic structural diagram of another operating device for a workflow instance provided by an embodiment of this application. As shown in Figure 5 , the operating device 500 includes:
[0116] A template determination module 501, configured to determine a target workflow template corresponding to the target task identifier carried in the running request from multiple pre-created workflow templates in response to a running request for a target task;
[0117] An instance generation module 502, configured to generate a target workflow instance in response to a configuration parameter selection operation for the target workflow template; wherein, the configuration parameter has an association relationship with the target task identifier, and the target workflow instance includes a plurality of target task instances connected in sequence according to the logical running order of the target workflow template;
[0118] An instance running module 503, configured to, for each target task instance in the target workflow instance, run the target task instance if it is detected that the pre-task instance corresponding to the target task instance meets the target execution condition;
[0119] Wherein, the pre-task instance is located before the target task instance and is connected to the target task instance; the target execution condition includes any one of the following items: all pre-task instances of the target task instance are in a successfully run state, any pre-task instance of the target task instance is in a successfully run state, all pre-task instances of the target task instance are in a completed run state, and any pre-task instance of the target task instance is in a completed run state.
[0120] Further, as Figure 6 shown, the running device 500 further includes a template creation module 504, and the template creation module 504 is configured to create a workflow template through the following steps:
[0121] Obtain a task creation request for the workflow; wherein, the task creation request carries a module selection identifier and a connection order identifier;
[0122] Select a plurality of target task modules from a preset task module library according to the module selection identifier carried in the task creation request;
[0123] In response to a creation operation for the workflow, obtain a workflow and save the workflow to obtain a workflow template; wherein, the workflow includes the plurality of target task modules connected in sequence according to the logical running order, and the logical running order is determined according to the connection order identifier carried in the task creation request.
[0124] In an optional embodiment of the present application, the template creation module 504 is further configured to create a workflow in the following manner:
[0125] Determine the parallel task identifier carried in the task creation request for the workflow;
[0126] Classify the multiple target task modules according to a preset hierarchical type to obtain multiple target task hierarchies and a task module set corresponding to each target task hierarchy; wherein, when the task module set includes multiple target task modules, the multiple target task modules are determined according to the parallel task identifiers carried in the task creation request;
[0127] Determine the hierarchical priority of each target task hierarchy according to the connection order identifier carried in the task creation request to obtain a target sub-logical order for characterizing the connection order between multiple task module sets;
[0128] Connect the multiple task module sets in sequence according to the target sub-logical order, and connect the multiple target task modules within the task module set in parallel to obtain a workflow.
[0129] In an alternative embodiment of the present application, the template creation module 504 is further specifically configured to:
[0130] In response to a workflow parameter selection operation for the workflow, update the workflow and save the updated workflow to obtain an updated workflow template; wherein the workflow parameters include a task parallelism degree and a retry count, and the task parallelism degree is used to characterize the number of times of simultaneously running the node tasks corresponding to the target task modules.
[0131] In an alternative embodiment of the present application, the running device further includes a time response module (not shown in the figure), and the time response module is used to:
[0132] During the process of running the target task instance, detect the node response time corresponding to the target task instance;
[0133] If the node response time exceeds a preset response time threshold, end the running of the target task instance.
[0134] In an alternative embodiment of the present application, the target task is a timed task; the template determination module 501 is further specifically configured to:
[0135] In response to a running request for the timed task, detect whether there is a timed workflow template corresponding to the target task identifier carried in the running request among the multiple pre-created workflow templates;
[0136] If not, periodically search for a timed workflow template corresponding to the target task identifier carried in the running request among the multiple pre-created workflow templates;
[0137] If so, determine the found timed workflow template as the target workflow template.
[0138] In an alternative embodiment of the present application, the successfully executed state means that the task completion rate of the pre-task instance is not less than the preset threshold; the completed execution state means that the task completion rate of the pre-task instance is less than the preset threshold.
[0139] Compared with the method in the prior art where the preconditions for the operation of task nodes are unified by default in the general process, the operation device of the workflow instance provided in the embodiments of the present application designs various target execution conditions for the operation of task instances, meeting the task node operation solutions under various complex conditions, solving the problems in the prior art that the workflow function is limited, not universal, and difficult to apply to various business requirements, and improving the universality of the workflow. In this way, for users with the same or similar task requirements, they can use a workflow with higher universality to save the design time of the workflow. For users with diverse and complex task requirements, they only need to change the target execution conditions without having to recreate the workflow, which can improve the operation efficiency of the workflow. In addition, the operation method of the workflow instance provided in the embodiments of the present application can be well adapted to the IDP (Intelligent Development Platform) system, meet the workflow requirements of the IDP system, and can be directly applied to the IDP system.
[0140] Please refer to Figure 7 , Figure 7 which is a schematic structural diagram of an electronic device provided in the embodiments of the present application. As Figure 7 shown in
[0141] the electronic device 700 includes a processor 701, a memory 702, and a bus 703. Figure 1 The memory 702 stores machine-readable instructions executable by the processor 701. When the electronic device 500 runs, the processor 701 communicates with the memory 702 through the bus 703. When the machine-readable instructions are executed by the processor 701, the steps of the operation method of the workflow instance in the method embodiment as shown above can be executed. The specific implementation manner can be referred to the method embodiment and will not be elaborated here.
[0142] The embodiments of the present application further provide a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is run by a processor, the steps of the operation method of the workflow instance in the method embodiment as shown above can be executed. The specific implementation manner can be referred to the method embodiment and will not be elaborated here. Figure 1
[0143] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.
[0144] In several embodiments provided in the present application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division, and there may be other division methods in actual implementation. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some communication interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.
[0145] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0146] In addition, in each embodiment of the present application, the functional units can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit.
[0147] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in each embodiment of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0148] Finally, it should be noted that the above-described embodiments are only specific embodiments of the present application, which are used to illustrate the technical solutions of the present application, rather than limiting it. The protection scope of the present application is not limited thereto. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that any person skilled in the art within the technical scope disclosed by the present application can still modify the technical solutions described in the foregoing embodiments or can easily think of changes, or make equivalent replacements for some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be covered within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A method for running a workflow instance, characterized in that The running method includes: In response to a running request for a target task, determining a target workflow template corresponding to the target task identifier carried in the running request from a plurality of pre-created workflow templates; In response to a configuration parameter selection operation for the target workflow template, generating a target workflow instance; wherein, the configuration parameter has an association relationship with the target task identifier, and the target workflow instance includes a plurality of target task instances connected in sequence according to the logical running order of the target workflow template; For each target task instance in the target workflow instance, if it is detected that the preceding task instance corresponding to the target task instance meets the target execution condition, running the target task instance; Wherein, the preceding task instance is located before the target task instance and is connected to the target task instance; the target execution condition includes any one of the following items: all preceding task instances of the target task instance are in a successfully run state, any preceding task instance of the target task instance is in a successfully run state, all preceding task instances of the target task instance are in a completed run state, any preceding task instance of the target task instance is in a completed run state; Create a workflow template through the following steps: Obtaining a task creation request for a workflow; wherein, a module selection identifier and a connection order identifier are carried in the task creation request; Selecting a plurality of target task modules from a preset task module library according to the module selection identifier carried in the task creation request; In response to a creation operation for a workflow, obtaining a workflow and saving the workflow to obtain a workflow template; wherein, the workflow includes the plurality of target task modules connected in sequence according to the logical running order, and the logical running order is determined according to the connection order identifier carried in the task creation request; Create a workflow in the following manner: Determining the concurrent task identifier carried in the task creation request for the workflow; Classifying the plurality of target task modules according to a preset hierarchy type to obtain a plurality of target task hierarchies and a task module set corresponding to each target task hierarchy; wherein, when the task module set includes a plurality of target task modules, the plurality of target task modules are determined according to the concurrent task identifier carried in the task creation request; Determining the hierarchy priority of each target task hierarchy according to the connection order identifier carried in the task creation request to obtain a target sub-logical order for characterizing the connection order between a plurality of task module sets; Connecting a plurality of task module sets in sequence according to the target sub-logical order, and connecting the plurality of target task modules within the task module set in parallel to obtain a workflow.
2. The operating method according to claim 1, characterized in that, The running method further includes: In response to a workflow parameter selection operation for the workflow, updating the workflow and saving the updated workflow to obtain an updated workflow template; wherein, the workflow parameters include a task parallelism degree and a retry count, and the task parallelism degree is used to characterize the number of times of simultaneously running the node tasks corresponding to the target task module.
3. The operating method according to claim 1, characterized in that, The running method further includes: During the process of running the target task instance, detect the node response time corresponding to the target task instance; If the node response time exceeds the preset response time threshold, end the running of the target task instance.
4. The operating method according to claim 1, characterized in that, The target task is a timed task; The step of determining a target workflow template corresponding to the target task identifier carried in the running request from multiple pre-created workflow templates in response to a running request for a target task includes: In response to a running request for a timed task, detect whether there is a timed workflow template corresponding to the target task identifier carried in the running request among multiple pre-created workflow templates; If not, periodically search for a timed workflow template corresponding to the target task identifier carried in the running request from multiple pre-created workflow templates; If so, determine the found timed workflow template as the target workflow template.
5. The operating method according to claim 1, characterized in that, The successfully run state refers to that the task completion rate of the previous task instance is not less than the preset threshold; the completed running state refers to that the task completion rate of the previous task instance is less than the preset threshold.
6. An operating device for a workflow instance, characterized in that, The running device includes: A template determination module, configured to determine a target workflow template corresponding to the target task identifier carried in the running request from multiple pre-created workflow templates in response to a running request for a target task; An instance generation module, configured to generate a target workflow instance in response to a configuration parameter selection operation for the target workflow template; wherein, the configuration parameters are associated with the target task identifier, and the target workflow instance includes multiple target task instances connected in sequence according to the logical running order of the target workflow template; An instance running module, configured to, for each target task instance in the target workflow instance, if it is detected that the previous task instance corresponding to the target task instance meets the target execution condition, run the target task instance; Wherein, the previous task instance is located before the target task instance and is connected to the target task instance; the target execution condition includes any one of the following items: all previous task instances of the target task instance are in the successfully run state, any previous task instance of the target task instance is in the successfully run state, all previous task instances of the target task instance are in the completed running state, any previous task instance of the target task instance is in the completed running state; A template creation module, configured to create a workflow template through the following steps: obtain a task creation request for a workflow; wherein, the task creation request carries a module selection identifier and a connection order identifier; select multiple target task modules from a preset task module library according to the module selection identifier carried in the task creation request; in response to a creation operation for the workflow, obtain a workflow and save the workflow to obtain a workflow template; wherein, the workflow includes the multiple target task modules connected in sequence according to the logical running order, and the logical running order is determined according to the connection order identifier carried in the task creation request; The template creation module is further configured to create a workflow in the following manner: determine the co-existing task identifiers carried in the task creation request of the workflow; classify the multiple target task modules according to a preset hierarchical type to obtain multiple target task hierarchies and a task module set corresponding to each target task hierarchy; wherein, when the task module set includes multiple target task modules, the multiple target task modules are determined according to the co-existing task identifiers carried in the task creation request; determine the hierarchical priority of each target task hierarchy according to the connection sequence identifier carried in the task creation request to obtain a target sub-logical order for characterizing the connection sequence between multiple task module sets; connect the multiple task module sets in sequence according to the target sub-logical order, and connect the multiple target task modules within the task module set in parallel to obtain a workflow.
7. An electronic device, characterized in that, Comprising: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device runs, the processor communicates with the memory through the bus, and the processor executes the machine-readable instructions to perform the steps of the running method of the workflow instance according to any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is run by a processor, it performs the steps of the running method of the workflow instance according to any one of claims 1 to 5.
Citation Information
Patent Citations
Azkaban-based project operation method and device and terminal equipment
CN111459629A