Method for carrying out thermal reloading on workflow
The method for hot reloading workflows addresses the inefficiencies of traditional update methods by parsing and comparing workflows to identify changes, ensuring accurate and consistent updates without stopping, enhancing system robustness and flexibility.
Patent Information
- Application Number
- CN202411180662.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-27
- Publication Date
- 2024-12-31
AI Technical Summary
Existing workflow systems require stopping and restarting to update, leading to inefficiencies and inflexibility, especially in complex environments where immediate adaptation to changing conditions is necessary.
A method for hot reloading workflows that involves parsing new and old workflows to identify differences, processing dynamic and static data, and ensuring consistency through detailed parameter comparison and cursor management, allowing updates without stopping the current version.
Ensures accurate and consistent workflow updates, improving system robustness, flexibility, and performance by avoiding errors and omissions during the hot reload process.
Smart Images

Figure CN119225757A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic digital data processing, and in particular to a computer system with thermal overload. Background Art
[0002] In the current production process of enterprises, operators are required to perform various complex and high-risk operations on a daily basis to meet the basic activities of factory operation. However, operators usually perform operations in complex and harsh environments and lack corresponding standardized guidance. Once a failure occurs, it may cause system shutdown, production interruption, product quality failure, and even vicious production accidents, endangering the safety of life and property of personnel. The direct economic losses caused are very huge, and the indirect losses and social impacts are even more difficult to estimate. In order to reduce the operating costs of the factory and maximize profits, the electronic operating procedures / electronic SOPs use intuitive operating procedure workflow diagrams to standardize, template and automate manual operation steps. On the premise of ensuring safety, the labor intensity of operators can be effectively reduced; the operating process can also be continuously optimized and improved in combination with actual process conditions and operating experience, so as to achieve a benign process benefit improvement cycle. However, during the modification and debugging of the workflow, the workflow cannot take effect immediately. Common technical solutions will perform version control on the workflow. The currently running workflow version is determined by the workflow runtime. If you want to update the workflow, you need to complete, stop, and invalidate the current workflow first, and then restart the workflow with the new version.
[0003] For example, a Chinese patent with publication number CN117813586A discloses hot reloading of a running application with unsaved source code changes, and provides the following technical solution for hot reloading a running application with unsaved source code changes. Identify code changes in the source code of a running software application associated with a project type. The code changes are stored in an editor cache in a memory and are not submitted to any source code file. Determine that the code changes can be applied to the running software application using hot reload. Identify (multiple) hot reload agents associated with the project type. Using (multiple) hot reload agents, pass the code changes to an application runtime associated with the running software application. At least one process of the running software application calls a new compiled code entity corresponding to the code changes. However, the above-mentioned hot reloading of a running application with unsaved source code changes focuses mainly on the software code direction, and it is difficult to modify, debug, and update the workflow through it to improve the debugging and configuration workflow efficiency, enhance the workflow flexibility, and adapt to the needs of changing field needs. Summary of the invention
[0004] The present invention solves the problems in the prior art of needing to stop running for updating, low workflow efficiency and poor flexibility, and proposes a method for hot reloading workflows, achieving the goals of high flexibility, adaptability to changing on-site needs and high workflow efficiency.
[0005] To achieve the above object, the present invention adopts the following technical solution: A method for hot reloading a workflow comprises the following steps: S1: Receive the instruction to call the new version of the workflow hot reload, parse and obtain the workflow data that needs to be updated; S2: Step processing for deleting dynamic data and step cursor; S3: additional steps for processing static data and dynamic data; S4: step processing for modifying static data, dynamic data and step cursor; S5: Determine and ensure whether the updated workflow data is consistent with the requirements of the new version.
[0006] The advantage of this design is that it ensures that all data can be correctly updated and processed when the workflow is hot-reloaded, ensuring the correctness and consistency of the new version of the workflow.
[0007] Preferably, the step S1 comprises: S1.1: Receive the instruction to call the new version of workflow hot reload; S1.2: Parse the old workflow and establish the dictionary relationship between step ID, step object, upstream step and downstream step; S1.3: Parse the new workflow and establish the dictionary relationship between step ID, step object, upstream step and downstream step; S1.4: Determine whether there is a difference between the old workflow step ID and the new workflow step ID. If so, proceed to step S1.5; if not, proceed to step S1.6; S1.5: Identify the step sets to be deleted and the step sets to be added; S1.6: Determine whether the data structures of the steps with the same step ID in the new and old workflows are different. If so, identify the step set that modifies the static data. If not, go directly to step S2.
[0008] The advantage of this design is that by analyzing the differences between the new and old workflows in detail, you can accurately identify the steps that need to be deleted, added, and modified, ensuring that there are no omissions or errors in the workflow during the hot reload process.
[0009] Preferably, in step S2, the specific processing of deleting the dynamic data is that, since the step has been deleted, the original dynamic data of the deleted step can be deleted or not processed; the specific processing of deleting the step cursor is that if the current step cursor does not point to the deleted step, it is not processed. If the current step cursor points to a deleted step, the current step cursor disappears and execution will not continue until the current step is manually specified and the start step command is issued.
[0010] The advantage of this design is that the dynamic data and step cursor status of the deleted steps can be flexibly processed, further improving the robustness and flexibility of the system.
[0011] Preferably, in step S3, step cursor processing is not involved; in the newly added step processing of dynamic data, historical data processing is not involved.
[0012] The advantage of this design is that it can reduce unnecessary data processing, simplify the processing flow of new steps, and improve the performance and response speed of the system.
[0013] Preferably, the step S4 comprises: S4.1: Apply the static data of the modified step to overwrite the original step, and the executor applies the updated static data; S4.2: modify the parameters in the dynamic data; S4.3: The step cursor processing remains consistent with the original step cursor.
[0014] The advantage of this design is that it ensures that when a step is modified, both static and dynamic data are correctly updated and the step cursor state remains consistent, thus ensuring the coherence and consistency of the workflow.
[0015] Preferably, the step S4.2 comprises: S4.21: Compare parameter configuration and parameter operation data, compare parameter names, types and descriptions; S4.22: Determine whether the parameter names are the same, if yes, proceed to step S4.23, if no, proceed to step S4.24; S4.23: Determine whether the data type is the same, if so, the data is kept consistent with the original data, if not, it is initialized to the default value; S4.24: Determine whether the parameter name exists in the configuration, if so, go to step S4.25, if not, the original data is deleted or not processed; S4.25: Determine whether the parameter name exists during operation. If so, perform the corresponding modification step. If not, initialize it to the default value.
[0016] The advantage of this design is that by comparing the parameter names, types, and descriptions in detail, you can accurately locate the parameters that need to be modified and ensure the consistency and correctness of the parameter data.
[0017] Preferably, the step S5 includes: determining whether the updated workflow data is consistent with the requirements of the new version, if so, the workflow runs normally, if not, returning to step S1.2.
[0018] The advantage of this design is that it can verify the updated workflow data to ensure that it meets the requirements of the new version, thereby ensuring the normal operation and stability of the workflow.
[0019] Preferably, in step S3, the newly added step processing for static data specifically includes adding static data of the newly added step; the newly added step processing for dynamic data specifically includes initializing the step state to the default value and initializing the parameter to the default value.
[0020] The advantage of this design is that when adding a new step, the static data and dynamic data can be initialized correctly, ensuring that the status and parameters of the new step are at the default values, and preventing inconsistent data status.
[0021] Preferably, in step S4.2, historical data processing is not involved, the step state is kept consistent with the original step state, and the parameter description is based on the new data.
[0022] The advantage of this design is that it can reduce unnecessary historical data processing, ensure that the step status is consistent with the original step, and at the same time, the parameter description is based on the new data, thereby improving the efficiency and accuracy of data updates.
[0023] Preferably, in step S2, if there are multiple cursors, the steps are executed one by one according to the situation of the step cursors; static data is not involved.
[0024] The advantage of this design is that it can effectively handle the situation of multiple step cursors, ensuring that each cursor can be processed correctly while the static data is not affected, thus simplifying the data processing process.
[0025] Compared with the prior art, the present invention has the following beneficial effects: 1. The present invention analyzes the differences between the old and new workflows in detail, accurately identifies the steps that need to be deleted, added, and modified, and ensures that no omissions or errors occur during the hot reload process, thereby ensuring the correctness and consistency of the workflow. This design can effectively avoid system problems caused by inaccurate step identification and improve the stability of the entire system.
[0026] 2. The present invention can further improve the robustness and flexibility of the system by flexibly processing the dynamic data and step cursor status of the deleted step. For the newly added step, the processing flow of the newly added step is simplified, and the step cursor and historical data processing are not involved, which reduces unnecessary data processing, improves the performance and response speed of the system, and ensures that the status and parameters of the newly added step are at the default values to prevent inconsistent data status.
[0027] 3. The present invention ensures the consistency and correctness of data by modifying static and dynamic data. Step S4 compares the name, type and description of the parameters in detail, accurately locates the parameters that need to be modified, and ensures that the parameter data is correctly updated. At the same time, the consistency of the updated workflow data with the requirements of the new version is verified to ensure the normal operation and stability of the workflow, greatly improving the efficiency and accuracy of data updates. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 The present invention is a flowchart of an embodiment of a method for hot reloading a workflow.
[0029] Figure 2 The present invention is a detailed flow chart of step S4 (step processing for modifying static data, dynamic data and step cursor) in an embodiment of a method for hot reloading a workflow of the present invention. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical scheme and advantages of the present disclosure clearer, the following will further describe the embodiments of the present disclosure in detail with reference to the accompanying drawings. The proportions of the components are not drawn according to the actual proportions, and the proportions and sizes shown in the accompanying drawings should not limit the substantial technical scheme of the present invention. These embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described.
[0031] Example 1: See Figure 1-2 As shown, a method for hot reloading a workflow includes the following steps: S1: Receive the instruction to call the new version of the workflow hot reload, parse and obtain the workflow data that needs to be updated; S2: Step processing for deleting dynamic data and step cursor; S3: additional steps for processing static data and dynamic data; S4: step processing for modifying static data, dynamic data and step cursor; S5: Determine and ensure whether the updated workflow data is consistent with the requirements of the new version.
[0032] like Figure 1 In one embodiment shown, Figure 1The present invention is a flowchart of an embodiment of a method for hot reloading a workflow. First, the system receives an instruction to call a new version of the workflow for hot reloading, parses the instruction and obtains the workflow data that needs to be updated. Next, the system parses the old workflow and establishes a dictionary relationship between the step ID and the step object and its upstream and downstream steps. Then, the system performs the same analysis on the new workflow and establishes a dictionary relationship between the step ID of the new workflow and the step object and its upstream and downstream steps. By comparing the step IDs of the new and old workflows, the system determines whether there are differences. If there are differences, the system identifies the step set that needs to be deleted and the step set that needs to be added; if there are no differences, the system determines whether the data structures of the steps with the same step ID in the new and old workflows are different. If they are different, the step set that needs to modify the static data is identified, otherwise it goes directly to the next step.
[0033] When processing the steps that need to be deleted, the system processes the dynamic data of these steps. Specifically, the dynamic data of the deleted steps can be selectively deleted or not processed. For the step cursor, if the current step cursor does not point to the deleted step, no operation is required; if the cursor points to the deleted step, the current step cursor disappears and the system stops executing until a new current step is manually specified and started. When there are multiple step cursors, the system processes them one by one according to the status of the step cursor, and does not involve the processing of static data.
[0034] In the processing phase of adding new steps, the system mainly initializes the static and dynamic data of the new steps, without involving the processing of step cursors and historical data. This design simplifies the processing flow of new steps and improves the performance and response speed of the system.
[0035] In the process of modifying a step, the system first overwrites the original step with the modified static data, and the executor applies the updated static data. Then, the system modifies the parameters in the dynamic data to ensure the correctness and consistency of these parameters. For the step cursor, the system keeps it consistent with the original step cursor to ensure the continuity of the workflow.
[0036] Finally, the system verifies the updated workflow data to ensure that it is consistent with the requirements of the new version. If the verification passes, the workflow can run normally; if it is inconsistent, the system returns to the steps of re-parsing the old workflow until the data is consistent.
[0037] This design approach has several significant advantages. First, by analyzing the differences between the old and new workflows in detail, the system can accurately identify the steps that need to be deleted, added, and modified, ensuring that no omissions or errors occur during the hot reload process, thereby ensuring the correctness and consistency of the workflow. Second, the system is very flexible in handling the dynamic data and step cursors of deleted steps, further improving the robustness and flexibility of the system. The simplified processing flow for added steps reduces unnecessary data processing and improves the performance and response speed of the system. The modification of static and dynamic data ensures the consistency and correctness of the data. By comparing the names, types, and descriptions of the parameters in detail, the system can accurately locate the parameters that need to be modified and ensure that the parameter data is updated correctly. At the same time, it verifies that the updated workflow data is consistent with the requirements of the new version to ensure the normal operation and stability of the workflow. In general, this approach effectively avoids system problems caused by inaccurate step identification through detailed analysis and processing, and improves the stability and processing efficiency of the system.
[0038] The method for hot reloading a workflow designed by the present invention first starts with receiving an instruction that needs to be called for hot reloading of a new version of the workflow, parsing and obtaining the workflow data that needs to be updated. During the parsing process, the old workflow must first be parsed to establish a dictionary relationship between the step ID and the step object and the upstream step and the downstream step. Then, the new workflow is parsed in the same way to establish a dictionary relationship between the step ID and the step object of the new workflow and the upstream step and the downstream step. By comparing the difference between the step IDs of the new and old workflows, the step set that needs to be deleted and the step set that needs to be added can be identified, thereby laying a solid foundation for subsequent data processing.
[0039] When deleting steps that need to be processed, the processing of dynamic data and step cursors is particularly critical. For the dynamic data of the deleted step, you can choose to delete or not process it. This design has a high degree of flexibility. For the step cursor, if the current step cursor does not point to the deleted step, it does not need to be processed; if it points to the deleted step, the current step cursor disappears, and you need to manually specify the current step and initiate the start step command. In the case of multiple step cursors, process them one by one according to the status of the step cursor to ensure that all step cursors are processed correctly, thereby avoiding omissions and errors.
[0040] The newly added step processing is also simplified and efficient. For the newly added step processing of step S3, it mainly initializes static data and dynamic data, and does not involve the processing of step cursors and historical data. This design can reduce unnecessary data processing and improve system performance and response speed.
[0041] In the process of modifying a step, both static and dynamic data need to be updated. By comparing the parameter name, type, and description in detail, you can pinpoint the parameters that need to be modified and ensure that the updated parameter data is correctly applied. In this process, the step cursor processing remains consistent with the original step cursor, ensuring the coherence and consistency of the workflow.
[0042] Finally, by judging whether the updated workflow data is consistent with the requirements of the new version, the workflow can be ensured to run normally. If the data is inconsistent, return to step S1.2 and reparse the workflow until the data is consistent. This design can ensure that each data update meets the requirements of the new version, thereby ensuring the normal operation and stability of the workflow.
[0043] The benefit of this design is that it can analyze the differences between the old and new workflows in detail, accurately identify the steps that need to be deleted, added, and modified, and ensure that there are no omissions or errors during the hot reload process, thereby ensuring the correctness and consistency of the workflow. By flexibly handling the dynamic data and step cursor status of deleted steps, the robustness and flexibility of the system can be further improved. For new steps, the processing flow of new steps is simplified, and step cursors and historical data processing are not involved, which reduces unnecessary data processing and improves system performance and response speed.
[0044] The modification of static and dynamic data ensures the consistency and correctness of the data. Step S4 compares the name, type and description of the parameters in detail, accurately locates the parameters that need to be modified, and ensures that the parameter data is updated correctly. At the same time, the consistency of the updated workflow data with the requirements of the new version is verified to ensure the normal operation and stability of the workflow. Through detailed analysis and processing, system problems caused by inaccurate step identification can be effectively avoided, and the stability of the entire system can be improved.
[0045] In addition, segmented processing of different types of data and cursors can ensure that each step can be processed effectively, ensuring the correctness of all data and status in the system. For the case of multiple step cursors, processing them one by one not only improves the accuracy of processing, but also ensures the flexibility and robustness of the system. For the dynamic data processing of the newly added steps, historical data is not involved. Such a design can reduce unnecessary historical data processing and improve data processing efficiency.
[0046] The addition and modification of static and dynamic data can ensure the consistency and correctness of the data. In particular, for parameter processing in dynamic data, the consistency and correctness of parameter data can be ensured by comparing the parameter names, types, and descriptions in detail. By comparing the parameter names, types, and descriptions, you can accurately locate the parameters that need to be modified and ensure that the parameter data is applied correctly. At the same time, verify that the updated workflow data is consistent with the requirements of the new version to ensure the normal operation and stability of the workflow.
[0047] In general, this method of hot reloading workflows accurately identifies the steps that need to be deleted, added, and modified by analyzing the differences between the old and new workflows in detail, ensuring that no omissions or errors occur during the hot reload process, thereby ensuring the correctness and consistency of the workflow. The robustness and flexibility of the system are further improved by flexibly handling the dynamic data and step cursor status of deleted steps. For new steps, the processing flow of new steps is simplified, and step cursors and historical data processing are not involved, which reduces unnecessary data processing and improves the performance and response speed of the system. The modification of static and dynamic data ensures the consistency and correctness of the data, verifies that the updated workflow data is consistent with the requirements of the new version, and ensures the normal operation and stability of the workflow. Through detailed analysis and processing, system problems caused by inaccurate step identification can be effectively avoided, and the stability of the entire system can be improved.
[0048] like Figure 1 In one embodiment shown, Figure 2 This is a detailed flow chart of step S4 (step processing for modifying static data, dynamic data and step cursor) in an embodiment of a method for hot reloading a workflow of the present invention. Step S4 specifically includes the following contents: First, the system applies the static data of the modified step to the original step and makes the actuator adopt the updated static data. This is to ensure that the basic configuration and fixed information of the step are updated and applied in time.
[0049] Next, the system modifies the parameters in the dynamic data. First, the system compares the configuration data and operation data of the parameters, including the parameter name, type, and description. The system determines whether the parameter names are the same. If the parameter names are the same, the system further determines whether the data types are consistent. If the data types of the two are consistent, the original data is kept unchanged; if the data types are different, the data is initialized to the default value.
[0050] If the parameter name is different, the system will then determine whether the parameter name exists in the configuration data. If so, the system will further determine whether the parameter name exists in the running data. If the parameter name exists in the running data, the system will modify it accordingly; if not, the data will be initialized to the default value. If the parameter name does not exist in the configuration data, the system will choose to delete or not process the original data.
[0051] Finally, the system processes the step cursor and keeps it consistent with the original step cursor. This is to ensure that the workflow can maintain the original execution order and status after hot reload.
[0052] In this way, the system can ensure the correct update of static and dynamic data during the step modification process, ensuring the consistency and correctness of the data. At the same time, the continuity of the step cursor is retained to ensure the stable operation of the workflow.
[0053] In one embodiment, the technical solution of the present invention is explained by taking the central control InPlant Direct software as an example.
[0054] Workflow data mainly includes: 1. Workflow structure: structural data that describes which steps a workflow consists of and how the steps are connected, generally stored through structural data.
[0055] 2. Step static data: step attributes, such as step ID, step name, step description, step type, etc.
[0056] 3. Step dynamic data: step status, parameters: current status information when the workflow is running.
[0057] 4. Step historical data: historical data of dynamic data can also be treated as special dynamic data.
[0058] 5. Current step cursor, pointing to the current step ID.
[0059] The main steps of hot reload: 1. The old version of the workflow is running and receives a hot reload call from the new version of the workflow.
[0060] 2. Analyze and compare what changes have occurred in the workflow: (1) Parse the old workflow and establish a dictionary relationship between step ID and step object, upstream step, and downstream step.
[0061] (2) Parse the new workflow and establish a dictionary relationship between step ID and step object, upstream step, and downstream step.
[0062] (3) Compare the differences between the old workflow step ID and the new workflow step ID to identify the deleted step set and the newly added step set.
[0063] (4) Compare the data structures of the steps with the same step ID in the new and old workflows, such as step name, step description, step attributes, upstream step, and downstream step data, and identify the step set that modifies the static data.
[0064] 3. Delete the step processing.
[0065] (1) Static data: The step has been deleted and is not involved.
[0066] (2) Dynamic data: The step has been deleted. The original dynamic data of the deleted step can be deleted or not processed.
[0067] (3) Current step cursor processing: ① The current step cursor does not point to the deleted step and is not involved.
[0068] ②The current step cursor points to the deleted step. a. The current step cursor disappears and the program no longer continues to execute b. Until the current step is manually specified and the start step command is issued.
[0069] ③When there are multiple cursors, execute the above solution one by one.
[0070] 4. Added step processing.
[0071] (1) Static data: Use the static data of the newly added step.
[0072] (2) Dynamic data: ① Step state, initialized.
[0073] ②Parameters, initialized to default values.
[0074] ③Historical data, new steps are not involved.
[0075] (3) Current step cursor processing: Newly added steps are not involved.
[0076] 5. Modified step processing.
[0077] (1) Static data: The static data of the modified step is applied to overwrite the original step, and the executor applies the updated static data.
[0078] (2) Dynamic data: ① Step status, keep consistent with the original step status.
[0079] ②Parameters: Apply the modified parameter configuration.
[0080] a. Compare parameter configuration and parameter operation data, and compare parameter names, types, and descriptions.
[0081] b. The parameter name is the same, the data type is the same, and the data is consistent with the original data.
[0082] c. The parameter names are the same, but the data types are different (modified), and initialized to the default values.
[0083] d. The parameter name does not exist in the configuration (has been deleted), and the original data is deleted or not processed.
[0084] e. The parameter name does not exist during operation (newly added) and is initialized to the default value.
[0085] f.Parameter description is subject to the new data.
[0086] ③Historical data, new steps are not involved.
[0087] (3) Current step cursor processing: Keep it consistent with the original step cursor.
[0088] Among them, the relevant code of the simple workflow example corresponding to the workflow structure is as follows: <bpmn2:process id="Process_1" isExecutable="true"> <flow:start id="Event_163recu"> <bpmn2:outgoing> Flow_0wjvjll< / bpmn2:outgoing> <flow:end id="Event_0b6nypw"> <bpmn2:incoming> Flow_0mzqe1a< / bpmn2:incoming> <timer:wait id="Activity_1w9u56o" name="Wait"> <ext:data> <! [CDATA[{"subTitle":"","version":1,"showDetail":true,"type":"specifiedTime","integer Time":10,"specifiedTime":"00:01:00"}]]>< / ext:data> <bpmn2:incoming> Flow_0wjvjll< / bpmn2:incoming> <bpmn2:outgoing> Flow_0mzqe1a< / bpmn2:outgoing> <bpmn2:sequenceFlow id="Flow_0wjvjll" sourceRef="Event_163recu" targetRef="Activity_1w9u56o" / > <bpmn2:sequenceFlow id="Flow_0mzqe1a" sourceRef="Activity_1w9u56o" targetRef="Event_0b6nypw" / > <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"> <bpmndi:BPMNEdge id="Flow_0wjvjll_di" bpmnElement="Flow_0wjvjll"> <di:waypoint x="490" y="207" / > <di:waypoint x="490" y="250" / > <bpmndi:BPMNEdge id="Flow_0mzqe1a_di" bpmnElement="Flow_0mzqe1a"> <di:waypoint x="490" y="310" / > <di:waypoint x="490" y="363" / > <bpmndi:BPMNShape id="Event_163recu_di" bpmnElement="Event_163recu"> <dc:Bounds x="463" y="153" width="54" height="54" / > <bpmndi:BPMNShape id="Activity_1w9u56o_di" bpmnElement="Activity_1w9u56o"> <dc:Bounds x="390" y="250" width="200" height="60" / > <bpmndi:BPMNShape id="Event_0b6nypw_di" bpmnElement="Event_0b6nypw"> <dc:Bounds x="463" y="363" width="54" height="54" / > 。
[0089] The relevant code for step attribute data is as follows: <timer:wait id="Activity_1w9u56o" name="Wait"> <ext:data><![CDATA[{"subTitle":"Description", "version":1, "showDetail":true, "type":"specifiedTime", "integerTime":10, "specifiedTime":"00:01:00"} >< / ext:data> <bpmn2:incoming> Flow_0wjvjll< / bpmn2:incoming> <bpmn2:outgoing> Flow_0mzqe1a< / bpmn2:outgoing> 。
[0090] The existing mainstream technologies for updating workflows are all based on version control. When a certain version of a workflow is running, if the workflow changes (version upgrade), the current version of the workflow must be completed, stopped, and invalidated before the new version of the workflow is started. The existing technical solutions do not support the completion of workflow updates without stopping or restarting the current version of the workflow. The present invention supports hot reloading of the workflow locally during the operation of the workflow, and can complete the workflow update without stopping or restarting the current version of the workflow. Compared with the workflow update technology based on version control, the workflow hot reload technology designed by the present invention can update the workflow during the operation of the same workflow without waiting for the previous workflow to be completed or restarted, thereby improving the efficiency of debugging and configuring workflows. The present invention supports temporary updating of part of the workflow during the operation of the workflow without stopping the currently running workflow, thereby improving the flexibility of the workflow, adapting to sudden on-site conditions, and meeting changing on-site needs.
[0091] In summary, the method for hot reloading a workflow designed by the present invention aims to solve the problem in the prior art that the workflow cannot be updated without stopping or restarting the workflow. The method includes the following steps: receiving and parsing new version instructions to obtain data to be updated; processing the dynamic data and step cursor of the step to be deleted; initializing the static and dynamic data of the newly added step to simplify the processing flow; modifying the static and dynamic data of the existing step, ensuring data consistency by comparing the parameter configuration and operation data in detail, and keeping the step cursor consistent. Finally, verify whether the updated workflow data meets the requirements of the new version. If not, re-parse the old workflow. The method of the present invention analyzes the differences between the new and old workflows in detail, accurately identifies the steps that need to be deleted, added and modified, ensures that there are no omissions or errors in the hot reload process, improves the performance, stability and flexibility of the system, and adapts to changing on-site needs.
[0092] Embodiment 2: A method for hot reloading a workflow, further refining the method flow based on Embodiment 1: Step 1: Receive instructions and parse workflow data.
[0093] The process of receiving instructions includes: the system continuously listens to instructions from users, other systems or scheduled tasks. When receiving an instruction to call a new version of the workflow hot reload, the legality of the instruction is first verified, including checking the instruction format, permission verification, etc. If the instruction verification passes, the system confirms that the instruction has been received and is ready to perform subsequent operations.
[0094] Parse the received instructions: extract key information, such as workflow version, operation type (hot reload), possible target environment, etc. Based on the information in the instructions, locate the workflow data file or database record that needs to be updated. This may include workflow definition files (such as XML, JSON format), workflow tables in the database, etc. Extract the complete workflow data from the located workflow data source. This usually includes the various steps of the workflow (step ID, step object), the dependencies between steps (upstream and downstream steps), and the static data of the steps (such as step name, step description, step attributes, etc.).
[0095] Parse the old workflow: Similarly, read the data from the new workflow data source. Parse the data of the new workflow and extract the steps and related information. Build the dictionary of the new workflow in the same way to ensure that the new and old workflows are consistent in data structure for easy comparison. Ensure that the data of the new and old workflows have been fully parsed and stored in the corresponding data structure (such as a dictionary). Perform some pre-check operations, such as verifying the integrity of the data and checking for obvious logical errors. If necessary, set up an appropriate comparison environment or tool to facilitate efficient and accurate data comparison later.
[0096] Step 2: Perform the deletion step.
[0097] Process the dynamic data associated with the step to be deleted to ensure the integrity and consistency of the data. First, identify all dynamic data associated with the step to be deleted. This data may include temporary files, database records, messages in the message queue, etc. generated when executing the step. Evaluate the importance of this data and determine whether it needs to be retained or deleted. Some data may still be valuable for auditing, logging, or subsequent processes.
[0098] Data operation: For data that is no longer needed, delete it to ensure that the data no longer occupies system resources. For data that needs to be retained, mark it as obsolete or move it to a dedicated archive area so that it can be retrieved when needed in the future. After completing data operations, clean up the data to ensure that there is no invalid data left or references to deleted steps.
[0099] Processing step cursors: Traverse all step cursors in the system and check whether they point to the step to be deleted. For a single step cursor: If the step cursor does not point to the deleted step, no operation is required and the cursor maintains its current state; If the step cursor points to the deleted step, the following operations are performed: Clear the step cursor from the system, indicating that there is no active execution point at present; The system suspends the execution of the current workflow until the user or system administrator manually specifies a new current step and starts execution; Record the reason why the step cursor was cleared and the status of the current workflow for subsequent tracking and auditing.
[0100] For multiple step cursors: When there are multiple step cursors, the system checks and processes the status of each step cursor one by one, and operates according to the above single step cursor processing flow.
[0101] In addition, provide notifications about the step deletion operation to users or system administrators, and record detailed log information for auditing and troubleshooting. Send notifications about the step deletion operation to relevant users or administrators through system notifications, emails, or text messages, including information such as the deleted step ID, dynamic data processing results, and step cursor status changes. Record detailed information about the step deletion operation in the system's log file, including the operation time, executor, deleted step ID, dynamic data processing results, and step cursor status changes. This log information is crucial for subsequent auditing and troubleshooting.
[0102] Step 3: Process the newly added step.
[0103] First, initialize the static data: assign a unique identifier (step ID) to the newly added step and set its basic properties so that it can be uniquely identified and referenced in the system. Assign a unique identifier (step ID) to the new step to ensure that it will not be repeated with existing step IDs throughout the workflow. Provide an easy-to-understand name for the newly added step to identify the step in the workflow. Write a detailed step description to explain the function and effect of the step and the precautions when executing it. Set related properties such as execution conditions, priority, timeout, retry strategy, etc. according to the type and needs of the step. Define the upstream and downstream steps of the newly added step and establish dependencies between the steps.
[0104] Initialize dynamic data: Set the initial state and related parameters of the newly added step to ensure that the step has the necessary preparation conditions before execution. Initialize the state of the newly added step to "Not Started" or "To be Executed", indicating that the step has not yet been executed. Set default values for parameters that may be required in the newly added step. These default values can be preset by the system or dynamically calculated based on the context. As needed, allocate temporary storage space for the newly added step to store intermediate results or temporary files generated during execution.
[0105] For step cursors: Step cursors are usually used to identify the step currently being executed or waiting to be executed. Since the newly added step is just added to the workflow, it will not automatically become the currently executed step, so there is no need to perform special processing on the step cursor. The adjustment of the step cursor usually occurs during the workflow execution process, and is determined by the current execution status and process control logic.
[0106] For historical data: Historical data records the status and results of the workflow in the past. As a newly added part, the execution results of the new step will be recorded as new historical data instead of modifying or deleting the historical data. Therefore, when processing the new step, there is no need to consider the processing of historical data.
[0107] Verify and test: Ensure that the configuration of the new step is correct and can be executed as expected. Verify the static and dynamic data of the new step to ensure that there are no omissions or incorrect configurations. Perform unit tests on the new step, simulate different inputs and scenarios, and verify whether its execution logic and results meet expectations. Integrate the new step into the entire workflow and perform integration testing to ensure that the interaction and dependency between the new step and other steps are correct.
[0108] Step 4: Modify step processing.
[0109] During the workflow hot reload process, the handling of modified steps is a key step to ensure that the workflow can flexibly adapt to changes and continue to execute correctly. First update the static data: Update the static data of the steps that need to be modified and ensure that these updates can be correctly applied by the executor. In this process, it is clear which static data of which steps need to be modified, such as step name, step description, step attributes, etc. Modify these static data directly in the database or configuration file. Ensure that the modified data conforms to the data format and constraints. Notify the workflow executor to apply the updated static data through event triggering, API call or configuration file reload. After applying the update, the executor verifies whether the static data is updated correctly and checks whether there are any incompatibilities or errors.
[0110] Modify parameters in dynamic data: Ensure the correctness and consistency of parameters in dynamic data to accommodate the step modification. Keep the original data unchanged, as these parameters remain consistent before and after the modification. Initialize the parameters to default values or perform appropriate conversions based on the new data type. Note that this may require additional validation to ensure the safety and correctness of the conversion. If parameters exist in the running data but not in the new configuration data, decide whether to delete these parameters or keep the original data unchanged based on business needs. For newly added parameters in the new configuration data, if they do not exist in the running data, initialize them to default values. Update the parameter description information in the running data based on the new parameter description to ensure the accuracy and consistency of the information.
[0111] Processing step cursors: Ensure that the step cursor can still correctly point to and execute the corresponding step after the step is modified. If the modification of the step does not affect the pointing of the step cursor (for example, only the step name or step description is modified), keep the step ID pointed to by the step cursor unchanged. If the step pointed to by the step cursor is modified (for example, the execution logic or dependency of the step is modified), re-evaluate the validity of the step cursor according to the modified step definition. If the step cursor still points to a valid step, keep the step cursor unchanged; if the step pointed to by the step cursor no longer exists or is no longer valid, the user or system administrator may need to manually specify a new current step. After processing the step modification, verify that the status of the step cursor is still as expected to ensure that the system can continue to execute correctly.
[0112] Verify and test: Ensure that the modified step can be executed correctly according to the new definition, and that the interaction and dependency with other steps are not affected. Unit test the modified step to verify whether the update of its static and dynamic data is successfully applied, and check whether the execution logic is as expected. Integrate the modified step into the entire workflow and perform integration testing to ensure that the interaction and dependency with other steps are still correct. If the scope of the modification is large or the impact is wide, system testing may also be required to verify whether the stability and performance of the entire workflow system are affected.
[0113] Step 5: Verify the updated workflow data.
[0114] Ensure that the updated workflow data (including static data and dynamic data) is completely consistent with the requirements of the new version to avoid errors or exceptions caused by inconsistent data. First, clarify the specific requirements of the new version of the workflow, including the format and constraints of static data, as well as the expected state of dynamic data, parameter configuration, etc. Compare these requirements with the updated workflow data to check whether the static data of each step (such as step name, step description, step attributes, etc.) has been updated according to the requirements of the new version. Verify that the dependencies and constraints between static data are still valid. Check whether the initial state of dynamic data, parameter default values, etc. meet the requirements of the new version. Verify whether the dynamic data works as expected during simulation or actual execution. Ensure that all necessary steps and data in the workflow have been completely updated without missing or repeated parts.
[0115] If the verification results show that the updated workflow data is consistent with the new version requirements, the workflow is confirmed to run normally. Record the checkpoints, test results, and conclusions during the verification process in detail for subsequent tracking and auditing. Send a notification to the administrator, developer, or relevant user of the workflow to inform them that the workflow has been updated and verified and can be used normally. After ensuring that all preparations are in place, start the workflow for actual operation and monitor its running status and output results.
[0116] If data inconsistencies or other problems are found during the verification process, the workflow needs to be re-parsed until the data is consistent and meets the requirements of the new version. Based on the verification results and log information, locate the specific cause of the data inconsistency or problem. Depending on the nature of the problem, decide which specific parsing step to return to for reprocessing (possibly S1.2 or other related steps). During the re-parsing process, correct and adjust the static and dynamic data according to the requirements of the new version. After completing the data correction, re-execute the verification process to ensure that all problems have been resolved and the data is consistent with the requirements of the new version. If there are still problems after re-parsing and verification, repeat the above steps until the data is consistent and passes the verification.
[0117] To improve verification efficiency and accuracy, consider using automated verification tools to assist in the comparison and verification of static and dynamic data. Use a version control system to record every modification and update of workflow data so that you can go back to the previous version when needed. As workflow data is updated, update related documents and instructions in a timely manner to ensure that developers and users can accurately understand and use the new version of the workflow.
[0118] The code is combined with the hot reload process and described below.
[0119] The original workflow contains the following main components: Start event: Event_163recu, which is the starting point of the workflow. Timer wait activity: Activity_1w9u56o, which continues the process after a certain time. End event: Event_0b6nypw, which marks the end of the workflow. Sequence flow: Flow_0wjvjll and Flow_0mzqe1a, which define the flow between steps.
[0120] The system receives a hot reload instruction to update the current workflow to adapt to new business requirements or fix errors. When parsing the old workflow, the system first establishes a dictionary relationship or similar data structure to map the various components in the workflow: Event_163recu is mapped to the start event. Activity_1w9u56o is mapped to the timer wait activity. Event_0b6nypw is mapped to the end event. Flow_0wjvjll and Flow_0mzqe1a are mapped to the sequence flow that defines the flow between steps.
[0121] The main change between the new workflow and the old workflow is that Activity_1w9u56o (timer waiting activity) is modified, and its waiting time is updated from the original setting to 1 minute (00:01:00). After parsing the new workflow and comparing it with the old workflow, the system identifies the set of steps that need to be modified as Activity_1w9u56o.
[0122] For the step Activity_1w9u56o that needs to be modified, the system updates the waiting time in its static data to 1 minute. This usually involves modifying the corresponding fields in the XML configuration file or database. Since this update does not involve changes to dynamic data, the original dynamic data remains unchanged. The step cursor is a pointer used by the system to track which step is currently executed. Since this update does not change the execution order or logical structure of the workflow, the step cursor remains consistent with the original step cursor, that is, it continues to point to the next step to be executed.
[0123] Finally, the system performs a series of verification operations to ensure that the updated workflow data is consistent with the new version requirements: verify that all updated static data has been applied correctly; check that the sequence flow and dependencies in the workflow are still valid; simulate or actually run part or all of the workflow to verify that it works as expected.
[0124] The present invention is not limited to the above-mentioned embodiments. No matter any changes are made in the shape or material composition, any structural design provided by the present invention is a variation of the present invention and should be considered to be within the protection scope of the present invention.
Claims
1. A method for hot reloading a workflow, characterized in that: The following steps are involved: S1: Receive the instruction to call the new version of the workflow hot reload, parse and obtain the workflow data that needs to be updated; S2: Step processing for deleting dynamic data and step cursor; S3: additional steps for processing static data and dynamic data; S4: step processing for modifying static data, dynamic data and step cursor; S5: Determine and ensure whether the updated workflow data is consistent with the requirements of the new version.
2. A method for hot reloading a workflow according to claim 1, characterized in that: The step S1 comprises: S1.1: receiving an instruction to be called for hot reloading of a new version of the workflow; S1.2: Parse the old workflow and establish the dictionary relationship between step ID, step object, upstream step and downstream step; S1.3: Parse the new workflow and establish the dictionary relationship between step ID, step object, upstream step and downstream step; S1.4: Determine whether there is a difference between the old workflow step ID and the new workflow step ID. If so, proceed to step S1.5; if not, proceed to step S1.6; S1.5: Identify the step sets to be deleted and the step sets to be added; S1.6: Determine whether the data structures of the steps with the same step ID in the new and old workflows are different. If so, identify the step set that modifies the static data. If not, go directly to step S2.
3. A method for hot reloading a workflow according to claim 1 or 2, characterized in that: In step S2, the specific processing of deleting the dynamic data is that, since the step has been deleted, the original dynamic data of the deleted step can be deleted or not processed; the specific processing of deleting the step cursor is, If the current step cursor does not point to the deleted step, no processing will be done. If the current step cursor points to a deleted step, the current step cursor disappears and execution will not continue until the current step is manually specified and the start step command is issued.
4. A method for hot reloading a workflow according to claim 3, characterized in that: In the step S3, the step cursor processing is not involved; in the newly added step processing of dynamic data, the historical data processing is not involved.
5. A method for hot reloading a workflow according to claim 1 or 3, characterized in that: The step S4 comprises: S4.1: Apply the static data of the modified step to overwrite the original step, and the executor applies the updated static data; S4.2: modify the parameters in the dynamic data; S4.3: The step cursor processing remains consistent with the original step cursor.
6. A method for hot reloading a workflow according to claim 5, characterized in that: The step S4.2 comprises: S4.21: comparing the parameter configuration and the parameter operation data, and comparing the name, type and description of the parameters; S4.22: Determine whether the parameter names are the same, if yes, proceed to step S4.23, if no, proceed to step S4.24; S4.23: Determine whether the data type is the same, if so, the data is kept consistent with the original data, if not, it is initialized to the default value; S4.24: Determine whether the parameter name exists in the configuration, if so, go to step S4.25, if not, the original data is deleted or not processed; S4.25: Determine whether the parameter name exists during operation. If so, perform the corresponding modification step. If not, initialize it to the default value.
7. A method for hot reloading a workflow according to claim 2, characterized in that: The step S5 includes: determining whether the updated workflow data is consistent with the requirements of the new version, if so, the workflow runs normally, if not, returning to step S1.
2.
8. A method for hot reloading a workflow according to claim 1 or 2, characterized in that: In the step S3, the newly added step processing for static data specifically includes adding static data of the newly added step; the newly added step processing for dynamic data specifically includes initializing the step state to the default value and initializing the parameter to the default value.
9. A method for hot reloading a workflow according to claim 5, characterized in that: In step S4.2, historical data processing is not involved, the step state is kept consistent with the original step state, and the parameter description is based on the new data.
10. A method for hot reloading a workflow according to claim 3, characterized in that: In the step S2, if there are multiple cursors, the scheme is executed one by one according to the situation of the step cursors; static data is not involved.
