Control method and electronic device

CN115328554BActive Publication Date: 2026-10-27LENOVO (BEIJING) LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211055178.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-30
Publication Date
2026-10-27
Estimated Expiration
2042-08-30

AI Technical Summary

Technical Problem

[0003]但是,在边端执行工作流的情况下,云端无法查看到边端工作流中各执行步骤的执行情况

Benefits of technology

[0169]可见,本申请的技术方案具有如下优势:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115328554B_ABST
    Figure CN115328554B_ABST
Patent Text Reader

Abstract

The application discloses a control method and an electronic device. The method is applied to a cloud device, and the method comprises the following steps: obtaining a first workflow of the cloud device, the first workflow corresponding to a second workflow, the second workflow being a workflow corresponding to an edge event listened to on an edge device; a template of the first workflow comprising at least one first step, a template of the second workflow comprising at least one second step, the first step and the second step corresponding to each other; and updating execution state information of the first workflow according to execution state information of the second workflow.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of workflow technology, and more particularly to a control method and electronic device. Background Technology

[0002] A workflow is a process-oriented abstraction of a business logic. It contains multiple execution steps (tasks) and is defined and implemented by a workflow engine. Workflows can be executed on the edge or in the cloud.

[0003] However, when executing workflows at the edge, the cloud cannot view the execution status of each step in the edge workflow. Summary of the Invention

[0004] In view of the above, this application provides a control method and an electronic device, as follows:

[0005] A control method applied to a cloud device, the method comprising:

[0006] A first workflow for cloud devices is obtained, which corresponds to a second workflow. The second workflow is the workflow corresponding to the edge events listened to on the edge device. The template of the first workflow contains at least one first step, and the template of the second workflow contains at least one second step. The first step and the second step correspond one-to-one.

[0007] Update the execution status information of the first workflow based on the execution status information of the second workflow.

[0008] The above method, preferably, involves obtaining the first workflow for cloud devices, including:

[0009] The device receives a template of a first workflow sent by the edge device; the template of the first workflow is obtained by the edge device based on the template of a second workflow corresponding to an edge event it has been listening to.

[0010] The first workflow is obtained based on the template of the first workflow.

[0011] In the above method, preferably, the template of the first workflow sent by the receiving edge device includes:

[0012] The template of the first workflow is obtained in the messaging system through the first channel; the first channel is a transmission channel between the cloud device and the messaging system for transmitting the template, and the template of the first workflow is sent to the messaging system by the edge device through the second channel, which is also a transmission channel between the edge device and the messaging system for transmitting the template.

[0013] The above method, preferably, involves updating the execution status information of the first workflow based on the execution status information of the second workflow, including:

[0014] Create a corresponding first object for the first step of the first workflow;

[0015] The execution status information corresponding to the second object sent by the edge device is obtained. The second object is the object created by the edge device for the second step corresponding to the second workflow. The execution status information includes at least the running data output after the container corresponding to the second object is started. The second object corresponds one-to-one with the first object.

[0016] Update the execution status information of the first object based on the execution status information of the second object.

[0017] In the above method, preferably, obtaining the execution status information corresponding to the second object sent by the edge device includes:

[0018] The execution status information corresponding to the second object is obtained in the message system through the third channel; the third channel is a transmission channel between the cloud device and the message system for transmitting execution status information; the execution status information corresponding to the second object is sent by the edge device to the message system through the fourth channel; the fourth channel is a transmission channel between the edge device and the message system for transmitting execution status information.

[0019] Preferably, after obtaining the execution status information corresponding to the second object sent by the edge device, the method further includes:

[0020] If there is no unupdated target object before the first object corresponding to the execution status information, then the following is executed: update the execution status information corresponding to the first object according to the execution status information corresponding to the second object;

[0021] If there is an unupdated target object before the first object corresponding to the execution status information, determine that the waiting time for the target object to be updated meets the first condition, and execute the following: update the execution status information corresponding to the first object according to the execution status information corresponding to the second object, and send a data upload request to the edge device. The data upload request contains at least the object identifier of the target object, so that the edge device sends the execution status information corresponding to the second object to which the object identifier belongs to the cloud device according to the object identifier.

[0022] If there is an unupdated target object before the first object corresponding to the execution status information, determine that the waiting time for the target object to be updated meets the second condition, and then execute: update the execution status information corresponding to the first object according to the execution status information corresponding to the second object.

[0023] Preferably, after updating the execution status information corresponding to the first object based on the execution status information corresponding to the second object, the method further includes:

[0024] If there is no unupdated target object before the first object corresponding to the execution status information, the execution status information corresponding to the first object is output in the display area corresponding to the first object;

[0025] If there is an unupdated target object before the first object corresponding to the execution status information, monitor whether the target object has been updated;

[0026] If the target object is updated, the execution status information corresponding to the target object is output in the display area corresponding to the target object, and the execution status information corresponding to the first object is output in the display area corresponding to the first object.

[0027] If the target object has not been updated, return to the step of monitoring whether the target object has been updated.

[0028] In the above method, preferably, the execution status information includes at least: the object identifier of the second object, the input parameters corresponding to the second object, the output result corresponding to the second object, the execution status corresponding to the second object, and the loop identifier corresponding to the second object, wherein the loop identifier represents the workflow loop order in which the second object to which the execution status information belongs;

[0029] The step of updating the execution status information corresponding to the first object based on the execution status information corresponding to the second object includes:

[0030] In the multiple cyclic workflows within the first workflow, the target workflow is determined according to the cycle identifier;

[0031] In the first object corresponding to the target workflow, determine the first object to be updated according to the object identifier;

[0032] Write the input parameters from the execution status information into the input variables of the first object to be updated;

[0033] Write the output result from the execution status information into the output variable of the first object to be updated;

[0034] Write the execution status from the execution status information into the status variable of the first object to be updated.

[0035] Preferably, in the above method, the execution status information further includes: an edge identifier, which represents the edge device to which the second workflow to which the second object belongs is run; the first workflow is the workflow corresponding to the edge identifier among multiple workflows in the cloud device;

[0036] The first workflow includes a monitoring identifier, which indicates that the first workflow is a workflow that monitors the execution status of the second workflow. The monitoring identifier is used to instruct the cloud device to update the execution status information of the first workflow based on the execution status information of the second workflow.

[0037] An electronic device, which is a cloud device, includes:

[0038] A memory for storing computer programs and the data generated by the execution of said computer programs;

[0039] A processor is configured to execute the computer program to: obtain a first workflow of the cloud device, the first workflow corresponding to a second workflow, the second workflow being a workflow corresponding to an edge event listened to on the edge device; the template of the first workflow contains at least one first step, the template of the second workflow contains at least one second step, the first step and the second step are in one-to-one correspondence; and update the execution status information of the first workflow according to the execution status information of the second workflow. Attached Figure Description

[0040] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0041] Figure 1 A flowchart of a control method provided in Embodiment 1 of this application;

[0042] Figures 2-5 These are partial flowcharts of a control method provided in Embodiment 1 of this application;

[0043] Figure 6 This is a schematic diagram of the structure of a control device provided in Embodiment 2 of this application;

[0044] Figure 7This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of this application;

[0045] Figure 8 This is a schematic diagram illustrating how the edge workflow can be viewed through a shadow workflow in edge computing scenarios, as described in this application. Detailed Implementation

[0046] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0047] refer to Figure 1 The diagram shown is a flowchart illustrating the implementation of a control method according to Embodiment 1 of this application. This method can be applied to electronic devices capable of executing workflows, where the electronic device can be a cloud device. The technical solution in this embodiment is used to view the execution status information of the workflow on the edge in the cloud.

[0048] Specifically, the method in this embodiment may include the following steps:

[0049] Step 101: Obtain the first workflow for cloud devices.

[0050] The first workflow corresponds to the second workflow, where the second workflow is the workflow corresponding to the edge event listened to on the edge device. The template of the first workflow contains at least one first step, and the template of the second workflow contains at least one second step, with a one-to-one correspondence between the first and second steps.

[0051] In other words, when an edge device detects an edge event, it creates a corresponding second workflow. The second workflow contains one or more second steps. Based on this, in this embodiment, a first workflow of the cloud device is created on the cloud device according to the second steps in the second workflow. The first step in the created first workflow is created based on the second step in the second workflow.

[0052] Step 102: Update the execution status information of the first workflow based on the execution status information of the second workflow.

[0053] Specifically, the cloud device acquires the execution status information of the second workflow on the edge device, and then updates the execution status information of the first workflow on the cloud device based on the execution status information of the second workflow.

[0054] As can be seen from the above technical solutions, in the control method provided in Embodiment 1 of this application, a first workflow of the cloud device is obtained on the cloud device. This first workflow corresponds to a second workflow corresponding to the edge time reached on the edge device. Therefore, the execution status information of the first workflow on the cloud device is updated according to the execution status information of the second workflow on the edge device. It is evident that in this embodiment, a workflow corresponding to the workflow on the edge is established in the cloud and the execution status information of the workflow on the cloud is updated according to the execution status information of the workflow on the edge. Thus, when a workflow is executed on the edge, the execution status information of the workflow on the edge can also be viewed on the cloud through the workflow on the cloud.

[0055] In one implementation, step 101, upon obtaining the first workflow from the cloud device, can be achieved in the following way: Figure 2 As shown:

[0056] Step 201: Receive the template of the first workflow sent by the edge device.

[0057] The template for the first workflow is obtained by the edge device based on the template for the second workflow corresponding to the edge events it monitors. The template for the second workflow includes one or more second steps. The edge device has an event source monitoring component, a workflow triggering component, and a workflow engine component. The event source monitoring component monitors whether a corresponding event source generates a corresponding trigger event and sends the trigger event to the workflow triggering component via the messaging system. The workflow triggering component triggers the corresponding workflow engine component based on the trigger event sent by the event source monitoring component. For example, the event source monitoring component on the edge device sets a data transmission identifier (such as a device identifier) ​​for the trigger event to establish a transmission channel between the event source monitoring component and the messaging system, and then sends the trigger event to the messaging system. The workflow triggering component on the edge device uses the data transmission identifier of the edge device to establish a transmission channel with the messaging system and reads the trigger event from the messaging system accordingly. Based on this, the workflow engine component searches for the corresponding template for the second workflow according to the trigger event and executes the corresponding second workflow.

[0058] For example, the workflow engine component creates step objects corresponding to each second step in the second workflow, and containers corresponding to each step object, to obtain the execution status information output by the containers. Based on this, before creating the step objects, the edge device generates a template for the first workflow according to the template of the second workflow, and sends the template of the first workflow to the cloud device. For example, the edge device copies the template of the second workflow to obtain a template of the first workflow that matches the template of the second workflow, and sends it to the cloud device.

[0059] Step 202: Obtain the first workflow based on the template of the first workflow.

[0060] In this process, after receiving the template of the first workflow, the cloud device creates the first workflow according to the template. The first workflow contains each first step that corresponds to each second step.

[0061] In specific implementation, step 201, when receiving the template of the first workflow sent by the edge device, can be achieved in the following way:

[0062] The template of the first workflow is obtained in the messaging system through the first channel; the first channel is a transmission channel between the cloud device and the messaging system for transmitting the template. The template of the first workflow is sent to the messaging system by the edge device through the second channel, which is also a transmission channel between the edge device and the messaging system for transmitting the template.

[0063] In this system, cloud devices are configured with data transmission identifiers for both cloud devices and edge devices. As a result, cloud devices and edge devices can obtain data sent by other devices according to their own data transmission identifiers, and can also transmit data to other devices according to the data transmission identifiers of the other device (cloud device or edge device).

[0064] Based on this, in step 201, the cloud device can use the data transmission identifier of the edge device to establish a first channel with the messaging system, and obtain the template of the first workflow sent by the edge device to the messaging system through the first channel. The edge device can use its own data transmission identifier to establish a second channel with the messaging system, and send the template of the first workflow to the messaging system through the second channel, thereby realizing asynchronous transmission of the workflow template.

[0065] In one implementation, when updating the execution status information of the first workflow based on the execution status information of the second workflow in step 102, it can be specifically implemented in the following way, such as... Figure 3 As shown:

[0066] Step 301: Create the corresponding first object for the first step of the first workflow.

[0067] For example, a corresponding first pod object is created on the cloud device for each first step in the first workflow.

[0068] Step 302: Obtain the execution status information corresponding to the second object sent by the edge device.

[0069] The second object is the object created by the edge device for the second step corresponding to the second workflow, such as the second pod object corresponding to the second step. The execution status information includes at least the running data output by the container corresponding to the second object after it is started, such as input parameters, output results and execution status. The second object corresponds one-to-one with the first object.

[0070] Specifically, the cloud device can obtain the execution status information corresponding to the second object in the message system through the third channel; the third channel is the transmission channel between the cloud device and the message system for transmitting execution status information, and the execution status information corresponding to the second object is sent by the edge device to the message system through the fourth channel, which is the transmission channel between the edge device and the message system for transmitting execution status information.

[0071] For example, a cloud device can use the data transmission identifier of the edge device to establish a third channel with the messaging system, and obtain the execution status information of the second object sent by the edge device to the messaging system through this third channel. Meanwhile, the edge device can use its own data transmission identifier to establish a fourth channel with the messaging system, and send the execution status information of the second object to the messaging system through this fourth channel, thereby achieving asynchronous transmission of execution status information.

[0072] Step 303: Update the execution status information of the first object based on the execution status information of the second object.

[0073] The execution status information may include: the object identifier of the second object, the input parameters corresponding to the second object, the output result corresponding to the second object, and the execution status corresponding to the second object. For example, the execution status can be execution completed, execution successful, or execution failed. The object identifier is used to uniquely identify the second object; for example, a UUID is used to represent the corresponding step object. Accordingly, in step 303, the first object to be updated can be determined in the first object corresponding to the target workflow according to the object identifier. Then, the input parameters (inputs) in the execution status information are written into the input variables of the first object to be updated, and the output results (outputs) in the execution status information are written into the output variables of the first object to be updated. At the same time, the execution status (status) in the execution status information is written into the status variables of the first object to be updated.

[0074] It should be noted that the first object is created on the cloud device, but the container corresponding to the first object will not be started. It only receives the execution status information output by the container corresponding to the second object uploaded by the edge device, and then updates the execution status information corresponding to the first object.

[0075] Furthermore, when the first workflow and the second workflow are cyclical workflows, i.e., contain multiple cyclical workflows, the execution status information may also include: a cycle identifier corresponding to the second object, which indicates the cyclical order of the workflow in which the status information belongs.

[0076] Based on this, in step 303, when updating the execution status information corresponding to the first object according to the execution status information corresponding to the second object, it can be implemented in the following way:

[0077] First, in the multiple cyclic workflows in the first workflow, the target workflow is determined according to the cycle identifier. Based on this, in the first object corresponding to the target workflow, the first object to be updated is determined according to the object identifier. Then, the input parameters in the execution status information are written into the input variables of the first object to be updated, and the output results in the execution status information are written into the output variables of the first object to be updated. At the same time, the execution status in the execution status information is written into the status variables of the first object to be updated.

[0078] Furthermore, the execution status information may also include: an edge identifier, which represents the edge device to which the second workflow to which the second object belongs runs, that is, the edge device from which the execution status information received by the cloud device comes; and the first workflow is the workflow corresponding to the edge identifier among multiple workflows in the cloud device. Based on this, when the cloud device receives the execution status information, it determines the first workflow corresponding to the edge identifier from multiple workflows in the cloud according to the edge identifier in the execution status information. Then, it can update the execution status information of the corresponding first object in the first workflow according to the input parameters, output results and execution status in the execution status information.

[0079] For example, the edge identifier can be represented by clusterid, which records the unique identifier of the edge cluster executing the second workflow, so that the execution status information of the workflow on the corresponding edge device can be updated using the execution status information on the cloud device.

[0080] In addition, the first workflow has a monitoring identifier, which indicates that the first workflow is a workflow that monitors the execution status of the second workflow. The monitoring identifier is used to instruct the cloud device to perform the following: update the execution status information of the first workflow according to the execution status information of the second workflow.

[0081] In other words, a monitoring identifier is used to characterize the first workflow as a shadow workflow of the second workflow, so that the execution status information of the second workflow on the edge device can be viewed through the first workflow on the cloud device. For example, the monitoring identifier "shadow.argo.io" = true indicates that the first workflow with this monitoring identifier on the cloud device corresponds to the second workflow on the monitoring edge device.

[0082] In one implementation, after obtaining the execution status information corresponding to the second object sent by the edge device in step 302, the method in this embodiment may further include the following steps, such as... Figure 4 As shown:

[0083] Step 304: Determine whether there is an unupdated target object before the first object corresponding to the execution status information. If there is no unupdated target object before the first object corresponding to the execution status information, execute step 303 to update the execution status information corresponding to the first object according to the execution status information corresponding to the second object. If there is an unupdated target object before the first object corresponding to the execution status information, execute step 305.

[0084] Step 305: Determine whether the waiting time for the target object meets the first condition. If the waiting time for the target object meets the first condition, such as the waiting time being greater than or equal to the time threshold, then execute step 303 and step 306. If the waiting time for the target object meets the second condition, such as the waiting time being less than the time threshold, then only execute step 303.

[0085] Step 306: Send a data upload request to the edge device.

[0086] The data upload request includes at least the object identifier of the target object, so that the edge device can send the execution status information of the second object to which the object identifier belongs to the cloud device according to the object identifier. Thus, after the cloud device obtains the execution status information corresponding to the target object, it updates the corresponding execution status information of the target object accordingly.

[0087] Furthermore, if in step 304 it is determined that there is no unupdated target object before the first object corresponding to the execution status information, the method in this embodiment may further include the following steps after step 303, such as... Figure 5 As shown:

[0088] Step 307: Output the execution status information corresponding to the first object in the display area corresponding to the first object.

[0089] If, in step 304, it is determined that there is a target object that has not been updated before the first object corresponding to the execution status information, the method in this embodiment may further include the following steps:

[0090] Step 308: Monitor whether the target object has been updated. If the target object has been updated, proceed to step 309. If the target object has not been updated, return to step 308 to continue monitoring whether the target object has been updated.

[0091] Step 309: Output the execution status information of the target object in the display area corresponding to the target object. Execute step 307 to output the execution status information of the first object in the display area corresponding to the first object.

[0092] In other words, on the cloud device, for the first object whose execution status information has been updated, the execution status information corresponding to the first object is output in the corresponding display area. If the execution status information of other target objects has not been updated before this, only the execution status information corresponding to the first object is updated, and it is not output. Furthermore, if the duration for which the execution status information of a target object has not been updated meets the first condition, such as being greater than or equal to a duration threshold, a data upload request is simultaneously sent to the edge device, which then re-uploads the execution status information corresponding to the object identifier. Thus, after receiving the execution status information corresponding to the target object on the cloud device, it can update the execution status information of the corresponding target object and output the corresponding execution status information in the display area corresponding to the target object, and also output the execution status information of the first object whose execution status information has not been output. Therefore, the execution status information of the corresponding objects is output on the cloud device according to the order of the first steps in the first workflow.

[0093] refer to Figure 6 This is a schematic diagram of a control device provided in Embodiment 2 of this application. This device can be configured on an electronic device capable of executing workflows, where the electronic device can be a cloud device. The technical solution in this embodiment is used to view the execution status information of the workflow on the edge in the cloud.

[0094] Specifically, the device in this embodiment may include the following units:

[0095] Workflow acquisition unit 601 is used to acquire a first workflow of a cloud device, the first workflow corresponding to a second workflow, the second workflow being the workflow corresponding to an edge event listened to on the edge device; the template of the first workflow contains at least one first step, the template of the second workflow contains at least one second step, and the first step and the second step correspond one-to-one;

[0096] The status update unit 602 is used to update the execution status information of the first workflow according to the execution status information of the second workflow.

[0097] As can be seen from the above technical solution, in the control device provided in Embodiment 2 of this application, a first workflow of the cloud device is obtained on the cloud device. This first workflow corresponds to a second workflow corresponding to the edge time reached on the edge device. Therefore, the execution status information of the first workflow on the cloud device is updated according to the execution status information of the second workflow on the edge device. It is evident that in this embodiment, a workflow corresponding to the workflow on the edge is established in the cloud and the execution status information of the workflow on the cloud is updated according to the execution status information of the workflow on the edge. Thus, when a workflow is executed on the edge, the execution status information of the workflow on the edge can also be viewed on the cloud through the workflow on the cloud.

[0098] In one implementation, the workflow acquisition unit 601 is specifically used to: receive a template of a first workflow sent by the edge device; the template of the first workflow is obtained by the edge device based on a template of a second workflow corresponding to an edge event it has been listening to; and obtain the first workflow according to the template of the first workflow.

[0099] In one implementation, when the workflow acquisition unit 601 receives the template of the first workflow sent by the edge device, it is specifically used to: obtain the template of the first workflow in the message system through a first channel; the first channel is a transmission channel between the cloud device and the message system for transmitting templates, and the template of the first workflow is sent by the edge device to the message system through a second channel, the second channel being a transmission channel between the edge device and the message system for transmitting templates.

[0100] In one implementation, the state update unit 602 is specifically used for: creating a corresponding first object for the first step corresponding to the first workflow; obtaining execution state information corresponding to the second object sent by the edge device, wherein the second object is an object created by the edge device for the second step corresponding to the second workflow, and the execution state information at least includes running data output after the container corresponding to the second object is started; the second object corresponds one-to-one with the first object; and updating the execution state information corresponding to the first object according to the execution state information corresponding to the second object.

[0101] In one implementation, when the state update unit 602 obtains the execution status information corresponding to the second object sent by the edge device, it is specifically used to: obtain the execution status information corresponding to the second object in the message system through a third channel; the third channel is a transmission channel between the cloud device and the message system for transmitting execution status information, and the execution status information corresponding to the second object is sent by the edge device to the message system through a fourth channel, the fourth channel being a transmission channel between the edge device and the message system for transmitting execution status information.

[0102] In one implementation, after obtaining the execution status information corresponding to the second object sent by the edge device, the state update unit 602 is further configured to: if there is no unupdated target object before the first object corresponding to the execution status information, perform the following steps: update the execution status information corresponding to the first object based on the execution status information corresponding to the second object; if there is an unupdated target object before the first object corresponding to the execution status information, determine that the waiting time for update corresponding to the target object meets a first condition, and perform the following steps: update the execution status information corresponding to the first object based on the execution status information corresponding to the second object, and send a data upload request to the edge device, wherein the data upload request at least includes the object identifier of the target object, so that the edge device sends the execution status information corresponding to the second object to which the object identifier belongs to the cloud device according to the object identifier; if there is an unupdated target object before the first object corresponding to the execution status information, determine that the waiting time for update corresponding to the target object meets a second condition, and perform the following steps: update the execution status information corresponding to the first object based on the execution status information corresponding to the second object.

[0103] In one implementation, after updating the execution status information corresponding to the first object based on the execution status information corresponding to the second object, the state update unit 602 is further configured to: if there is no unupdated target object before the first object corresponding to the execution status information, output the execution status information corresponding to the first object in the display area corresponding to the first object; if there is an unupdated target object before the first object corresponding to the execution status information, monitor whether the target object has been updated; if the target object has been updated, output the execution status information corresponding to the target object in the display area corresponding to the target object, and output the execution status information corresponding to the first object in the display area corresponding to the first object; if the target object has not been updated, return to the step of monitoring whether the target object has been updated.

[0104] In one implementation, the execution status information includes at least: the object identifier of the second object, the input parameters corresponding to the second object, the output result corresponding to the second object, the execution status corresponding to the second object, and the loop identifier corresponding to the second object, wherein the loop identifier represents the workflow loop order in which the second object to which the execution status information belongs;

[0105] Specifically, the state update unit 602 is used to: determine a target workflow in the multiple cyclic workflows in the first workflow according to the cycle identifier; determine a first object to be updated in the first object corresponding to the target workflow according to the object identifier; write the input parameters in the execution state information into the input variables of the first object to be updated; write the output results in the execution state information into the output variables of the first object to be updated; and write the execution state in the execution state information into the state variables of the first object to be updated.

[0106] In one implementation, the execution status information further includes: an edge identifier, which represents the edge device to which the second workflow to which the second object belongs is run; the first workflow is a workflow among multiple workflows in the cloud device that corresponds to the edge identifier; wherein, the first workflow has a monitoring identifier, which represents that the first workflow is a workflow that monitors the execution status of the second workflow, and the monitoring identifier is used to instruct the cloud device to update the execution status information of the first workflow according to the execution status information of the second workflow.

[0107] It should be noted that the specific implementation of each unit in this embodiment can be referred to the corresponding content above, and will not be described in detail here.

[0108] refer to Figure 7 This is a schematic diagram of an electronic device provided in Embodiment 3 of this application. This electronic device can be a cloud device. The technical solution in this embodiment is used to view the execution status information of the workflow on the edge in the cloud.

[0109] Specifically, the electronic device in this embodiment may include the following structure:

[0110] Memory 701 is used to store computer programs and data generated by the execution of said computer programs;

[0111] The processor 702 is configured to execute the computer program to: obtain a first workflow of the cloud device, the first workflow corresponding to a second workflow, the second workflow being a workflow corresponding to an edge event listened to on the edge device; the template of the first workflow contains at least one first step, the template of the second workflow contains at least one second step, the first step and the second step are in one-to-one correspondence; and update the execution status information of the first workflow according to the execution status information of the second workflow.

[0112] As can be seen from the above technical solutions, in the electronic device provided in Embodiment 3 of this application, a first workflow of the cloud device is obtained on the cloud device. This first workflow corresponds to a second workflow corresponding to the edge time reached on the edge device. Therefore, the execution status information of the first workflow on the cloud device is updated according to the execution status information of the second workflow on the edge device. It is evident that in this embodiment, a workflow corresponding to the workflow on the edge is established in the cloud and the execution status information of the workflow on the cloud is updated according to the execution status information of the workflow on the edge. Thus, when a workflow is executed on the edge, the execution status information of the workflow on the edge can also be viewed on the cloud through the workflow on the cloud.

[0113] Taking edge computing scenarios as an example, most workflows lack cloud-edge collaboration to complete complex workflows, and edge-executed workflows cannot be reported to the cloud. To address this, this application defines a shadow workflow template. It has the same topology as the actual edge workflow, but it executes in the cloud, and its steps only create Pod objects without actually starting containers. Through the collaboration of cloud and edge components, the shadow workflow is uploaded to the cloud when the edge workflow begins execution, triggering the execution of the cloud shadow workflow. This ensures synchronization between each step in the edge and cloud workflows.

[0114] The core technical solution of this application lies in:

[0115] 1. Before executing the workflow (second workflow), the edge device first uploads a shadow workflow (the template of the first workflow) to the cloud. This shadow workflow is basically the same as the workflow to be executed on the edge device. The only difference is that the shadow workflow adds an annotation "shadow.argo.io" = true to indicate that it is a shadow workflow to be executed in the cloud.

[0116] 2. The edge controls the execution order of its own workflow and shadow workflow, and ensures the synchronization of its own workflow and shadow workflow. First, the edge sends the shadow workflow to the cloud. If the edge is blocked, it waits for the cloud to start the shadow workflow. Once the cloud starts the shadow workflow, it sends a message to the edge. After receiving the message, the edge knows that the shadow workflow has started successfully, and then starts its own workflow.

[0117] 3. When the edge device uploads a shadow workflow, it identifies the shadow workflow (edge ​​device identifier). This ensures that the cloud can distinguish between shadow workflows with the same name when multiple edge devices upload them at the same time.

[0118] 4. Multiple endpoints may simultaneously upload the execution results of a step to the shadow workflow. The shadow workflow receives the execution results asynchronously, receiving the result first and without blocking the step.

[0119] 5. Running a shadow workflow in the cloud does not actually start the business instance, that is, it does not start the container, but only creates the step object.

[0120] 6. The execution results of the edge workflow are synchronized to the step Pod objects of the cloud shadow workflow to complete the state synchronization of the shadow workflow. This is then made available for use by the cloud server and UI.

[0121] 7. Check the execution results in the cloud for packet loss. If packet loss is found, trigger the edge to re-upload the execution results.

[0122] 8. The cloud shadow workflow displays the execution results according to the execution order of the edge workflow.

[0123] The specific plan is as follows:

[0124] like Figure 8 As shown, the following two components have been added to the cloud-edge system:

[0125] 1. Cloud Hub: Responsible for receiving shadow workflows uploaded from the Heavy Edge and triggering their execution in the cloud, as well as triggering the edge to re-upload the execution results when packets are lost.

[0126] 2. Edge Agent component: responsible for publishing shadow workflow templates, monitoring the execution results of edge step Pods and uploading them to the cloud, and re-uploading the execution results in the event of packet loss.

[0127] In addition, this embodiment modifies two components in the cloud-edge system:

[0128] 1. Edge Workflow component: Defines shadow workflows and triggers the upload of shadow workflows.

[0129] 2. In Nats, define a dedicated topic4 for communication between the Event Source and the Sensor components, and a dedicated topic5 for communication between the cloud-edge shadow workflow.

[0130] The shadow workflow template is similar to the normal edge workflow template, except that:

[0131] 1. Add an annotation "shadow.argo.io" = true to it to indicate that it is a shadow workflow template.

[0132] 2. A prefix has been added to the name of the Workflow object in the shadow workflow template. For example, the original genericName=hello- is now set to genericName=hello-${edge cluster ID}-. This makes it easier to distinguish which edge the shadow workflow object is uploaded to when different edges upload it.

[0133] The specific execution process is as follows:

[0134] 1. Edge Event Source component listens to edge event sources.

[0135] 2. When an edge event occurs, the Edge Event Source publishes the edge event to topic4 of Event BuswithNats.

[0136] 3. The Edge Sensor component, which triggers the edge workflow, subscribes to edge events from topic 4 of the Event Bus.

[0137] 4. Edge Sensor triggers the execution of the Edge Workflow component of the edge workflow engine.

[0138] 5. Edge Workflow defines shadow workflow templates in the cloud.

[0139] Add the annotation "shadow.argo.io" = true to the Workflow definition to indicate that it is a shadow workflow template. Add a prefix to the name of the Workflow object in the shadow workflow template, for example: genericName = hello-${edge cluster ID}-. Here, ${edge cluster ID} is used later to check which shadow workflow the step of uploading the execution result belongs to.

[0140] For a loop workflow, assuming it loops 10 times, then create 10 UUIDs sequentially and set them to the Workflow loop template annotation ["loop.uuid"] = []string{"xxx", "yyy", ...}.

[0141] 6. The Edge Agent publishes the shadow workflow template to topic 5 of Event Bus.

[0142] 7. Cloud Hub subscribes to the shadow workflow template from topic 5 of Event Bus.

[0143] 8. Cloud Hub triggers the Cloud Workflow component of the cloud workflow engine based on the shadow workflow template.

[0144] 9. Cloud Workflow checks if there is an annotation "shadow.argo.io" = true in the shadow workflow template. If so, it indicates that it is a shadow workflow and triggers the execution of the shadow workflow. Each step of the shadow workflow only creates a Pod object and does not start a container, which will save a lot of system resources.

[0145] Cloud Workflow checks the annotation ["loop.uuid"] of the shadow workflow loop template. In the loop processing flow, when a Pod for each shadow step is created, it selects one UUID from the list and sets it to the Pod's annotation ["uuid"].

[0146] Before executing step 10, the edge will receive a "Shadow Workflow Startup Complete" message from the cloud, and then execute step 10 to perform the steps of the edge workflow.

[0147] 10. Edge Workflow executes workflow steps based on the definition of the edge workflow template. For example, first, a Pod object is created in the edge cluster, then the edge cluster scheduler allocates a suitable edge node to the Pod, and then the kubelet of the edge node starts the container according to the Pod definition.

[0148] 11. Edge Agent monitors the execution result (i.e., output result) and status (i.e., execution status) of Pod objects.

[0149] 12. When the Pod object is complete, i.e., its status is succeeded, the Pod object is encapsulated as JSON and published to topic5 of NATS.

[0150] The JSON definition is as follows:

[0151]

[0152]

[0153] 13. Cloud Hub subscribes to the execution results of Pod objects from topic 5 of EventBus.

[0154] 14. Cloud Hub checks if any steps before the latest step have not received execution results.

[0155] If all steps before the latest step have received execution results, it means there was no packet loss, then proceed to steps 15-16.

[0156] 15. Cloud Hub updates Pod objects created by cloud shadow workflows.

[0157] Cloud Hub determines which workflow a step belongs to based on the clusterid in the JSON message.

[0158] For recurring workflows, the execution result of the edge step is compared with the annotation ["uuid"] of the shadow Pod to determine which step in the loop the execution result belongs to.

[0159] Set the inputs in the Pod annotations["inputs.argo.io"].

[0160] Set the outputs in the Pod annotations["outputs.argo.io"].

[0161] Update the status to Pod.status.

[0162] 16. The server and UI obtain the input parameters, output results and execution status of each step from the annotations and status of the Pod, so that users can view them or other programs can use them.

[0163] Specifically, the cloud shadow workflow displays the execution results of each step in the order they are executed to reflect the execution order of the edge workflow. If a previous execution result is lost, it will not be displayed after the first lost result until it is re-uploaded.

[0164] If no execution result is received for the steps before the latest step, and the timeout threshold is exceeded, it indicates that there may be packet loss. In this case, the edge needs to re-upload the execution result, and then steps 17-19 will be executed.

[0165] 17. Cloud Hub sends an "Upload Execution Result" message (containing the object identifier that lacks execution status information).

[0166] 18. The Edge Agent subscribes to the "Upload Execution Results" message.

[0167] 19. The Edge Agent retrieves the Pod execution result again.

[0168] The reporting of execution status information for other steps is as described above.

[0169] It is evident that the technical solution of this application has the following advantages:

[0170] (1) The shadow workflow in the cloud does not require starting a container, saving system resources and response time. Assuming that one container occupies 10MB of memory, and 1000 workflows are executed per day, with each workflow executing 1000 steps, then the daily memory consumption reaches 10TB. Based on this, the technical solution of this application will save this 10TB of memory consumption per day.

[0171] (2) Decoupling cloud-edge information synchronization improves processing speed and unifies the processing flow. The execution results and status of each step of the workflow are uploaded to the cloud, the step Pod object is updated, and the cloud asynchronously collects the execution results of the workflow from the Pod object.

[0172] (3) Each step is processed separately. The cloud shadow workflow retains the topology of the edge workflow, simplifies the processing flow, and is more universal.

[0173] (4) Check whether the execution result (execution status information) is lost in the cloud. If the result is lost, the edge will be triggered to re-upload the execution result to ensure the synchronization of the edge workflow and the cloud shadow workflow.

[0174] (5) The cloud shadow workflow displays the execution results of the steps in the execution order. If the previous execution results are lost, they will not be displayed after the first lost result until they are re-uploaded. In this way, the cloud shadow workflow can display the execution order of the edge workflow.

[0175] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.

[0176] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0177] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0178] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A control method applied to a cloud device, the method comprising: Obtain the first workflow of the cloud device, which corresponds to the second workflow, where the second workflow is the workflow corresponding to the edge event listened to on the edge device; The template of the first workflow contains at least one first step, and the template of the second workflow contains at least one second step, with the first step and the second step corresponding one-to-one; Create a corresponding first object for the first step of the first workflow; Obtain the execution status information corresponding to the second object sent by the edge device, wherein the second object is the object created by the edge device for the second step corresponding to the second workflow; the second object corresponds one-to-one with the first object. Update the execution status information of the first object based on the execution status information of the second object.

2. The method according to claim 1, wherein obtaining a first workflow for a cloud device comprises: Receive the template of the first workflow sent by the edge device; The template for the first workflow is obtained by the edge device based on the template for the second workflow corresponding to the edge events it has been monitoring; The first workflow is obtained based on the template of the first workflow.

3. The method according to claim 2, wherein receiving the template of the first workflow sent by the edge device includes: The template for the first workflow is obtained from the messaging system through the first channel; The first channel is a transmission channel between the cloud device and the messaging system for transmitting templates. The template of the first workflow is sent by the edge device to the messaging system through the second channel, which is also a transmission channel between the edge device and the messaging system for transmitting templates.

4. The method according to claim 1 or 2, wherein the execution status information includes at least the running data output after the container corresponding to the second object is started.

5. The method according to claim 4, wherein obtaining the execution status information corresponding to the second object sent by the edge device includes: The execution status information corresponding to the second object is obtained from the message system through the third channel; The third channel is a transmission channel between the cloud device and the message system for transmitting execution status information. The execution status information corresponding to the second object is sent by the edge device to the message system through the fourth channel, which is also a transmission channel between the edge device and the message system for transmitting execution status information.

6. The method according to claim 4, after obtaining the execution status information corresponding to the second object sent by the edge device, the method further includes: If there is no unupdated target object before the first object corresponding to the execution status information, then the following is executed: update the execution status information corresponding to the first object according to the execution status information corresponding to the second object; If there is an unupdated target object before the first object corresponding to the execution status information, determine that the waiting time for the target object to be updated meets the first condition, and execute the following: update the execution status information corresponding to the first object according to the execution status information corresponding to the second object, and send a data upload request to the edge device. The data upload request contains at least the object identifier of the target object, so that the edge device sends the execution status information corresponding to the second object to which the object identifier belongs to the cloud device according to the object identifier. If there is an unupdated target object before the first object corresponding to the execution status information, determine that the waiting time for the target object to be updated meets the second condition, and then execute: update the execution status information corresponding to the first object according to the execution status information corresponding to the second object.

7. The method according to claim 6, after updating the execution status information corresponding to the first object based on the execution status information corresponding to the second object, the method further includes: If there is no unupdated target object before the first object corresponding to the execution status information, the execution status information corresponding to the first object is output in the display area corresponding to the first object; If there is an unupdated target object before the first object corresponding to the execution status information, monitor whether the target object has been updated; If the target object is updated, the execution status information corresponding to the target object is output in the display area corresponding to the target object, and the execution status information corresponding to the first object is output in the display area corresponding to the first object. If the target object has not been updated, return to the step of monitoring whether the target object has been updated.

8. The method according to claim 4, wherein the execution status information includes at least: the object identifier of the second object, the input parameters corresponding to the second object, the output result corresponding to the second object, the execution status corresponding to the second object, and the loop identifier corresponding to the second object, wherein the loop identifier represents the workflow loop order in which the second object to which the execution status information belongs; in, The step of updating the execution status information corresponding to the first object based on the execution status information corresponding to the second object includes: In the multiple cyclic workflows within the first workflow, the target workflow is determined according to the cycle identifier; In the first object corresponding to the target workflow, determine the first object to be updated according to the object identifier; Write the input parameters from the execution status information into the input variables of the first object to be updated; Write the output result from the execution status information into the output variable of the first object to be updated; Write the execution status from the execution status information into the status variable of the first object to be updated.

9. The method according to claim 8, wherein the execution status information further includes: an edge identifier, the edge identifier representing the edge device to which the second workflow to which the second object belongs is run; the first workflow is the workflow corresponding to the edge identifier among multiple workflows in the cloud device; in, The first workflow has a monitoring identifier, which indicates that the first workflow is a workflow that monitors the execution status of the second workflow. The monitoring identifier is used to instruct the cloud device to update the execution status information of the first workflow based on the execution status information of the second workflow.

10. An electronic device, a cloud device, comprising: A memory for storing computer programs and the data generated by the execution of said computer programs; A processor is configured to execute the computer program to: obtain a first workflow of the cloud device, the first workflow corresponding to a second workflow, the second workflow being a workflow corresponding to an edge event listened to on the edge device; the template of the first workflow contains at least one first step, the template of the second workflow contains at least one second step, the first step and the second step correspond one-to-one; create a corresponding first object for the first step corresponding to the first workflow; obtain execution status information corresponding to a second object sent by the edge device, the second object being an object created by the edge device for the second step corresponding to the second workflow; the second object corresponds one-to-one with the first object; and update the execution status information corresponding to the first object according to the execution status information corresponding to the second object.

Citation Information

Patent Citations

  • Data synchronization method and device for edge equipment and cloud

    CN112532729A

  • Edge cloud collaborative management and control system and method

    CN113114716A