Data processing method, apparatus and device, and readable storage medium
By introducing loop start and end function code blocks on the workflow editing page, users can implement loop traversal operations, which solves the problem of insufficient loop traversal functionality and ease of use of existing workflow engines, and improves the ease of use of the workflow engine. Usability and functionality.
Patent Information
- Application Number
- PCT/CN2023/098214
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2022-08-22
- Filing Date
- 2023-06-05
- Publication Date
- 2024-09-12
AI Technical Summary
Existing workflow engines have poor functionality and ease of use when processing loop traversal operations, and cannot effectively support arrays or lists to perform loop traversal operations.
By introducing the loop start function code block and the loop end function code block in the workflow editing page, users can visually drag and connect these code blocks and set loop parameters, thereby realizing multiple executions of the loop function code block.
It lowers the threshold for using the workflow engine, improves the ease of use and functionality of the workflow engine, and enables users to implement loop traversal operations without having programming experience.
Smart Images

Figure CN2023098214_12092024_PF_FP_ABST
Abstract
Description
Data processing method, device, equipment and readable storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on August 22, 2022, with application number 2022110078327 and application name “Data processing method, device, equipment and readable storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of computer technology, and in particular to data processing technology. Background Art
[0003] A workflow engine is a low-code technology that uses visual methods like graphical drag-and-drop and parameterized configuration to design processes or develop applications. This technology lowers the barrier to entry for programming and improves efficiency. This low-code technology enables various code features, such as conditional judgment and concurrency. This approach reduces development costs and allows those without programming experience to implement various code features through visual programming.
[0004] However, most current workflow engines only support simple serial execution tasks, meaning each application module (App) can only be executed once. They are unable to support scenarios that require looping through arrays or lists, resulting in poor usability and functionality.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide a data processing method, apparatus, device, and readable storage medium, which can improve the usability and functionality of a workflow engine.
[0007] In one aspect, an embodiment of the present application provides a data processing method, which is executed by a computer device and includes:
[0008] Creating an execution instance corresponding to the target workflow; the execution instance includes a pointing relationship between at least two function code blocks included in the target workflow; the at least two function code blocks include a loop start function code block and a loop end function code block;
[0009] Get the loop parameters corresponding to the loop start function code block;
[0010] According to the pointing relationship, a function code block between the loop start function code block and the loop end function code block is determined as a loop function code block;
[0011] According to the loop parameters and the pointing relationship, the loop function code block is executed cyclically.
[0012] In one aspect, an embodiment of the present application provides a data processing method, which is executed by a computer device and includes:
[0013] In response to a creation operation on a target workflow, a workflow editing page is displayed;
[0014] In response to a selection and connection operation on at least two function block controls, a workflow control tree consisting of at least two function block controls is displayed on a workflow editing page; the at least two function block controls include a loop start function block control and a loop end function block control;
[0015] In response to a triggering operation on a loop start function block control in a workflow control tree, setting loop parameters for the loop start function block control;
[0016] In response to a creation operation on a workflow control tree, a target workflow is created and sent to a workflow engine; the target workflow includes function code blocks corresponding to at least two function block controls; the pointing relationship between the at least two function code blocks is determined based on a connection relationship between the at least two function block controls; the at least two function code blocks include a loop start function code block corresponding to a loop start function block control and a loop end function code block corresponding to a loop end function block control;
[0017] In response to the trigger operation for the target workflow, a trigger request for the target workflow is sent to the workflow engine.
[0018] In one aspect, an embodiment of the present application provides a data processing device, including:
[0019] A trigger module is used to create an execution instance corresponding to the target workflow; the execution instance includes a pointing relationship between at least two function code blocks included in the target workflow; the at least two function code blocks include a loop start function code block and a loop end function code block;
[0020] A loop start module is used to obtain loop parameters corresponding to the loop start function code block;
[0021] A loop confirmation module is used to determine, based on the pointing relationship, a function code block between the loop start function code block and the loop end function code block as a loop function code block;
[0022] The loop execution module is used to loop execute the loop function code block according to the loop parameters and the pointing relationship.
[0023] An embodiment of the present application provides a data processing device, including:
[0024] A first response module is used to respond to a creation operation on a target workflow and display a workflow editing page;
[0025] A second response module is configured to respond to a selection and connection operation on at least two function block controls and display a workflow control tree consisting of at least two function block controls on a workflow editing page; the at least two function block controls include a loop start function block control and a loop end function block control;
[0026] A third response module is used to respond to the trigger operation of the loop start function block control in the workflow control tree and set loop parameters for the loop start function block control;
[0027] A fourth response module is configured to respond to a creation operation on a workflow control tree, create a target workflow, and send the target workflow to a workflow engine; the target workflow includes function code blocks corresponding to at least two function block controls; the pointing relationship between the at least two function code blocks is determined based on a connection relationship between the at least two function block controls; the at least two function code blocks include a loop start function code block corresponding to a loop start function block control and a loop end function code block corresponding to a loop end function block control;
[0028] The fifth response module is configured to respond to the trigger operation on the target workflow and send the trigger request on the target workflow to the workflow engine.
[0029] On one hand, an embodiment of the present application provides a computer device, including: a processor, a memory, and a network interface;
[0030] The above-mentioned processor is connected to the above-mentioned memory and the above-mentioned network interface, wherein the above-mentioned network interface is used to provide a data communication network element, the above-mentioned memory is used to store a computer program, and the above-mentioned processor is used to call the above-mentioned computer program to execute the method in the embodiment of the present application.
[0031] On one hand, an embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored. The computer program is suitable for being loaded by a processor and executing the method in the embodiment of the present application.
[0032] On the one hand, an embodiment of the present application provides a computer program product or a computer program, which includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method in the embodiment of the present application.
[0033] In an embodiment of the present application, an execution instance corresponding to a target workflow is created, and the execution instance includes a pointing relationship between at least two function code blocks included in the target workflow, wherein the at least two function code blocks include a loop start function code block and a loop end function code block; then, the loop parameter corresponding to the loop start function code block is obtained, and based on the pointing relationship, the function code block between the loop start function code block and the loop end function code block is determined as the loop function code block; finally, based on the loop parameter and the pointing relationship, the loop function code block is executed cyclically. Thus, when an object creates a workflow through a workflow engine, for the function code block that it wants to execute multiple times, it only needs to place it between the loop start function code block and the loop end function code block. The object does not need to have other programming experience, which lowers the threshold for using the workflow engine and improves the ease of use and functionality of the workflow engine. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] FIG1 is a schematic diagram of a network architecture provided by an embodiment of the present application;
[0035] FIG2a is a schematic diagram of a scenario of creating a target workflow provided by an embodiment of the present application;
[0036] FIG2 b is a schematic diagram of a scenario of target workflow execution provided by an embodiment of the present application;
[0037] FIG3 is a flow chart of a data processing method provided in an embodiment of the present application;
[0038] FIG4 is a flowchart of a web page callback trigger request processing according to an embodiment of the present application;
[0039] FIG5 is a schematic diagram of a flow chart of target application instruction execution according to an embodiment of the present application;
[0040] FIG6 is a schematic diagram of a workflow pointing relationship provided in an embodiment of the present application;
[0041] FIG7 is a flow chart of a data processing method provided in an embodiment of the present application;
[0042] FIG8 is a schematic diagram of an execution instance message queue provided in an embodiment of the present application;
[0043] FIG9 is a schematic diagram of a function block instance queue provided in an embodiment of the present application;
[0044] FIG10 is a schematic diagram of a global variable data structure in memory during workflow execution provided by an embodiment of the present application;
[0045] FIG11 is a schematic diagram of a scenario of index determination provided by an embodiment of the present application;
[0046] FIG12 is a schematic diagram of a scenario of index determination provided by an embodiment of the present application;
[0047] FIG13 is a flow chart of a data processing method provided in an embodiment of the present application;
[0048] FIG14a is a schematic diagram of the overall process of implementing a workflow execution supporting looping provided by an embodiment of the present application;
[0049] FIG14a is a schematic diagram of the overall process of another workflow execution implementation supporting looping provided by an embodiment of the present application;
[0050] FIG15 is a schematic structural diagram of a data processing device provided in an embodiment of the present application;
[0051] FIG16 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application;
[0052] FIG17 is a schematic structural diagram of another data processing device provided in an embodiment of the present application;
[0053] FIG18 is a schematic structural diagram of another computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0055] For ease of understanding, the following describes the relevant concepts of this application:
[0056] App: An application module that encapsulates certain commonly used functions or interface services. It can also be called a functional code block. An app can be thought of as an atomic task, the most basic execution unit in a workflow.
[0057] App instance: An app can be executed multiple times, and each execution (with different parameters) generates an instance. This instance is called an app instance, or a function block instance. An app instance is a specific instantiation of an app. The difference between the two is that an app is a template with default parameters, while an app instance uses a specific app template with specific parameters. The relationship between the two is similar to that between classes and objects in object-oriented programming.
[0058] For loop body: Similar to the For loop code snippet in the code, the App in the loop body will be traversed and executed N times in sequence.
[0059] For loop start App: It can be called a loop start function code block. This App indicates that the process starts to enter a For loop body. This App can set the number of loops.
[0060] For loop end App: This can be called a loop end function code block. This App indicates the end position of the loop body. That is, the range of the For loop body is from the For loop start App to the For loop end App. After entering the For loop end App, the loop body will end when the number of loops is met.
[0061] Trigger: It is the starting app that triggers the workflow to run, including timers, WebHooks (web page callbacks), etc.
[0062] Credentials: Mainly refers to some important parameter information, including account password, token, key and other information. Different apps may correspond to different credential parameters.
[0063] Workflow: A flowchart is used to represent the actual business model and complete specific work scenarios in an automated manner.
[0064] Workflow Engine: The workflow engine is the routing controller for processes. Each process corresponds to a specific business flow, and the execution path of the process is controlled by the current app instance data. The flow rules for the process are specified during process definition. Generally, these flow rules are determined by variable expressions in the current app instance data. The workflow engine's task is to parse these variable expressions based on the context of the process execution and determine the next execution direction for the process.
[0065] Workflow definition language: refers to the syntax specification used when designing workflows. This article defines workflows in a simple and universal way using Json (a language).
[0066] Path syntax expression: You can use a path like {{AppInstId.data.0.name}} to index the input or output data of each App instance in the workflow, thereby achieving dynamic resolution and reference of data at runtime.
[0067] Execution task: refers to a specific workflow instance, also known as an execution instance. When a workflow is triggered to execute, a specific execution task will be generated. The workflow will obtain execution tasks with different results based on different input parameters.
[0068] Message queue: a data structure where data is first in, first out.
[0069] Please refer to Figure 1, which is a schematic diagram of a network architecture provided by an embodiment of the present application. As shown in Figure 1, the network architecture may include a business server 100 and a terminal device cluster, wherein the terminal device cluster may include multiple terminal devices, as shown in Figure 1, specifically including terminal device 10a, terminal device 10b, terminal device 10c, ..., terminal device 10n. As shown in Figure 1, terminal device 10a, terminal device 10b, terminal device 10c, ..., terminal device 10n can respectively communicate with the business server 100 through the network, so that each terminal device can exchange data with the business server 100 through the network, so that each terminal device can receive business data from the business server 100.
[0070] It should be understood that each terminal device in the terminal cluster shown in FIG1 can be installed with an application client. When the application client runs in each terminal device, data can be exchanged with the business server 100 shown in FIG1 . The application client can be an application client for an application such as a programming application, a game application, a video editing application, a social application, an instant messaging application, a live broadcast application, a short video application, a video application, a music application, a shopping application, a novel application, a payment application, a browser, etc., which has the function of displaying data information such as text, images, audio, and video. The application client can be an independent client or an embedded sub-client integrated in a client (such as a social client, a game client, etc.), which is not limited here.
[0071] As shown in Figure 1, any terminal device in the terminal device cluster can display the workflow editing page by running the application client. Taking terminal device 10a as an example, the application client running on terminal device 10a can select and connect the function block controls displayed on the workflow editing page through the workflow editing page displayed by terminal device 10a, thereby building a workflow control tree. Among them, one function block control corresponds to one function code block. Based on the connection relationship between the function block controls in the workflow control tree, the terminal device 10a determines the pointing relationship between the corresponding function code blocks, thereby generating a target workflow. The terminal device 10a will send the target workflow to the business server 100, and the business server 100 will store the target workflow and execute the target workflow when a trigger request for the target workflow is received.
[0072] As shown in Figure 1, after receiving a trigger request for a target workflow, the business server 100 creates an execution instance corresponding to the target workflow. This execution instance includes a pointing relationship between at least two function code blocks contained in the target workflow, where the at least two function code blocks may include a loop-start function code block and a loop-end function code block. After the business server 100 creates a loop-start function block instance corresponding to the loop-start function code block, it pushes the loop-start function block instance to a function block instance queue. When the loop-start function block instance in the function block instance queue successfully executes, the business server 100 retrieves the loop parameters corresponding to the loop-start function code block. It should be noted that the function block instances in the function block instance queue are executed sequentially. Based on the pointing relationship, the business server 100 determines the function code block between the loop-start function code block and the loop-end function code block as the loop function code block. The loop function code block is then executed in a loop based on the loop parameters, the function block instance queue, and the pointing relationship. In short, the loop start function code block and the loop end function code block jointly provide a loop function for the target workflow. The function code block that needs to be executed multiple times only needs to be located between the loop start function code block and the loop end function code block. For the user object (such as the user), it is only necessary to drag the function block control corresponding to the function code block that needs to be executed multiple times to the loop start function block control corresponding to the loop start function code block and the loop end function block control corresponding to the loop end function code block to connect them. The user object does not need to have additional programming experience to create a workflow with a loop function.
[0073] Among them, it can be understood that the network connection between the above-mentioned business server 100 and each terminal device in the terminal device cluster is not limited to the connection method. It can be directly or indirectly connected through wired communication, directly or indirectly connected through wireless communication, or through other connection methods. This application does not limit this.
[0074] It is understandable that the data processing method provided in the embodiments of the present application can be executed by a computer device, including but not limited to the above-mentioned business server 100 and terminal device. The above-mentioned server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The above-mentioned terminal can be a smart phone, tablet computer, laptop computer, desktop computer, intelligent voice interaction device, smart home appliance, car terminal, etc., but is not limited to this.
[0075] The embodiments of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc.
[0076] It is understandable that when the embodiments of the present application are applied to specific products or technologies, the workflow and other related data involved need to obtain user permission or consent, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0077] To facilitate understanding of the above process, please refer to Figures 2a-2b, where the terminal device 20 shown in Figures 2a-2b can be any terminal device in the terminal device cluster shown in Figure 1 above, such as, the terminal device 20a can be the terminal device 10a; the business server 200 shown in Figures 2a-2b can be the business server 100 shown in Figure 1 above.
[0078] Please refer to Figure 2a first. Figure 2a is a schematic diagram of a scenario for creating a target workflow provided by an embodiment of the present application. As shown in Figure 2a, an application client 21 is integrated and installed in the terminal device 20. The application client 21 can be used to provide a workflow design function for the user object (such as a user). Assuming that the user object of the terminal device 20 is object A, object A has no programming experience, but wants to design a business model with the business functions it needs, it can use the workflow design function provided by the application client 21 to design the target workflow using a visual drag-and-drop programming method, and then trigger the target workflow to achieve the corresponding business function. As shown in Figure 2a, when the application client 21 is running in the terminal device 20, object A can perform a creation operation for the target workflow through the application client 21, and the terminal device 20 can respond to the creation operation for the target workflow and display a workflow editing page 22. The workflow editing page 22 may include a control selection area 221 and a canvas area 222. Function block controls are displayed in the control selection area 221. A function block control corresponds to a function code block, which can implement a specific function. The control selection area 221 may display the default function block controls built into the system, or may display the function block controls custom-designed by the object.
[0079] It should be noted that the types of function block controls can be mainly divided into three categories. The first is the trigger function block control, which corresponds to the trigger function code block. The trigger function code block is mainly the starting function code block of the workflow. Different trigger function code blocks can realize different triggering methods of the workflow; the second is the business function block control, which corresponds to the business function code block. The business function code block is a function code block that encapsulates more commonly used business operations; the third is the logic function block control, which corresponds to the logic function code block. The logic function code block mainly involves the process relationship of the workflow. For example, the function code blocks between the loop start function code block corresponding to the loop start function block control and the loop end function code block corresponding to the loop end function block control need to be executed cyclically.
[0080] The canvas area 222 is an area used to support object A in designing a workflow control tree. Object A can select a function block control from the control selection area 221, then drag the selected function block control into the canvas area 222, connect it with other function block controls, and then obtain a workflow control tree 223. As shown in Figure 2a, the workflow control tree 223 designed by object A can sequentially include a trigger function block control A, a loop start function block control, a business function block control B, a business function block control A, and a loop end function block control according to the connection relationship. It should be noted that, by default, the execution count of the function code block corresponding to the function block control is 1, but the function code block corresponding to the function block control located between the loop start function block control and the loop end function block control needs to be executed cyclically, and the number of loops is determined by the loop parameters corresponding to the loop start function block control.
[0081] It can be understood that, for the parameters required for the execution of the function code block, object A can perform a trigger operation on the function code block control in the canvas area 222, and then enter the edit text box corresponding to the function code block control for editing. For example, when object A performs a trigger operation on the loop start function block control, the terminal device 20 can display the loop edit text box 224, and then object A can set the loop parameters in the loop edit text box 224. The terminal device 20 responds to the input parameters of object A for the loop edit text box 225, and determines that the loop parameters of the loop start function block control are 5.
[0082] When object A has set the required parameters for each functional block control, a trigger operation can be performed on the creation control 225 displayed in the canvas area 222 to implement a creation operation on the workflow control tree 223. The terminal device can respond to the creation operation on the workflow control tree 223, create a target workflow 23, and then send the target workflow 23 to the workflow engine, where the workflow engine refers to an engine system for executing workflows, which can be deployed in the business server 200. That is, the terminal device 20 will send the generated target workflow 23 to the business server 200, and the business server 200 will store the target workflow 23 accordingly.
[0083] In addition, it should be noted that during the operation of the functional code block, credential information (i.e., account password and other information) may also be required. For example, the database operation functional code block needs to use credential information such as account password related to the database. In order to facilitate management, the application client 21 also has a credential management function, that is, creating and saving credential information that can be used by the object. In short, when object A needs to use credential information, before performing the creation operation for the target workflow, a credential management operation needs to be performed first. The terminal device will display a credential creation page in response to the credential management operation. Object A can create the credential information required through the credential creation page, and the terminal device will save the credential information created by object A. The specific creation process can be determined according to the actual situation, and this application does not limit it here.
[0084] Further, please refer to Figure 2b, which is a schematic diagram of a scenario of target workflow execution provided by an embodiment of the present application. As shown in Figure 2b, object A performs a trigger operation on the target workflow through the trigger method corresponding to the trigger function code block A. The terminal device 20 responds to the trigger operation and generates a trigger request 24. After the terminal device 20 sends the trigger request 24 to the business server 200, the business server 200 will create an execution instance 25 corresponding to the target workflow 23 according to the trigger request 24. Among them, the target workflow 23 can sequentially include a trigger function code block A, a loop start function code block, a business function code block B, a business function code block A, and a loop end function code block. It can be understood that the function code blocks included in the target workflow 23 correspond one-to-one to the function block controls shown in Figure 2a above. Among them, the execution instance 25 is a specific implementation task of the target workflow 23. Different execution instances of the target workflow 23 correspond to different parameters, and the execution results obtained may be different.
[0085] The business server 200 will determine the pointing relationship between the function code blocks based on the execution instance 25, and then start from the first function code block, that is, the trigger function code block A, to create and execute the trigger function block instance corresponding to the trigger function code block A. The process of creating and executing the trigger function block instance can be that the business server 200 first creates the trigger function block instance corresponding to the trigger function code block A, and then pushes it into the function block instance queue to wait for execution. The function block instances in the function block instance queue will be taken out sequentially and then executed. After the business server 200 takes out the trigger function block instance from the function block instance queue, it will execute the trigger function block instance. After the execution is completed, the business server 200 will determine the next function code block pointed to by the trigger function code block A (that is, the loop starting function code block) based on the pointing relationship, and then continue to create and execute the function block instance corresponding to the next function code block. When the business server 200 creates and executes the loop-starting function block instance corresponding to the loop-starting function block, it obtains the loop parameters corresponding to the loop-starting function block instance. Specifically, in the embodiment shown in FIG2a , the loop parameters are entered by object A through the loop edit text box corresponding to the loop-starting function block control. The business server 200 then treats the function code blocks between the loop-starting function block and the loop-ending function code block, namely, business function code block B and business function code block A, as looping function code blocks and executes them in a loop. As shown in FIG2a , assuming the loop parameter is 5, the business server 200 creates and executes business function block instance B and business function block instance A for the first time, then needs to loop again. It then creates and executes business function block instance B a second time, creates and executes business function block instance A, and continues the loop until it creates and executes business function block instance B for the fifth time, creates and executes business function block instance A, and then executes the loop-ending function block instance.
[0086] It should be noted that the loop-end function block instance is created after the business function block instance A is executed for the first time, that is, after the business server 200 executes the business function block instance A, it creates the function block instance corresponding to the next function code block pointed to by the business function code block A according to the pointing relationship. If it is detected that the function block instance corresponding to the next function code block pointed to by the business function code block A is the loop-end function block instance, the business server 200 will temporarily cache the loop-end function block instance to perform the above-mentioned loop process.
[0087] As shown in Figure 2b, the business server 200 will create an execution instance table 26 corresponding to the execution instance 25. The execution instance table 26 is used to record the execution status of the execution instance 25. After the execution instance 25 is completed, the business server 200 can send the execution instance table 26 to the terminal device 20, and the object A can query the execution results corresponding to each function code block based on the execution instance table 26.
[0088] It should be understood that the execution process of the above workflow can also be directly executed in the terminal device, and this application does not limit this.
[0089] It can be seen that by adopting the method described in the embodiment of the present application, the cyclic execution of the function code block can be achieved by relying on the loop start function code block and the loop end function code block. The object does not need to have additional programming experience, which improves the usability and feasibility of the workflow engine.
[0090] Further, please refer to Figure 3, which is a flow chart of a data processing method provided by an embodiment of the present application. The method can be executed by a computer device, which can be the business server 100 shown in Figure 1 above, or any terminal device in the terminal device cluster shown in Figure 1 above, such as terminal device 10c. The following description will take the execution of the method by a computer device as an example, wherein the data processing method can include at least the following steps S101-S104:
[0091] Step S101: creating an execution instance corresponding to a target workflow; the execution instance includes a pointing relationship between at least two function code blocks included in the target workflow; the at least two function code blocks include a loop start function code block and a loop end function code block.
[0092] Specifically, a workflow refers to a business model that includes at least two functional code blocks, and can be understood as a process with business functions. A functional code block can be called a node in the workflow, and at least two functional code blocks have a pointing relationship. For example, a workflow can be represented as Node A → Node B → Node C, where Node A, Node B, and Node C each represent a functional code block, Node A points to Node B, and Node B points to Node C. When a computer device executes the workflow, it will first execute Node A, then Node B, and finally Node C.
[0093] Specifically, the starting function code block in the workflow is usually the trigger function code block, also known as the trigger APP. Different trigger APPs can trigger the workflow in different ways. There are three specific triggers, as shown in Table 1 below:
[0094] Table 1
[0095] Specifically, a computer device can receive a trigger request for a target workflow and, in response to the trigger request, create an execution instance corresponding to the target workflow. Due to different triggering methods, the types of trigger requests received by the computer device vary. When the trigger request is a web page callback trigger request, a specific implementation process for receiving the trigger request for the target workflow and creating an execution instance corresponding to the target workflow can be as follows: receiving a web page callback trigger request for the target workflow, obtaining a target token from the web page callback trigger request; obtaining the target workflow from a workflow repository based on the target token; and creating an execution instance corresponding to the target workflow based on request parameters contained in the web page callback trigger request.
[0096] Among them, the web page callback trigger request can be an HTTP (HyperText Transfer Protocol) request. When the starting node of the target workflow is a WebHook trigger, the computer device can create and assign a unique Token for the target workflow to form a unique WebHook URL request address. Each WebHook URL corresponds to a workflow. When a POST (a request method) request is initiated to this URL, the workflow engine API (Application Programming Interface) service installed in the computer device will receive the HTTP (HyperText Transfer Protocol) request and obtain the corresponding workflow execution.
[0097] For ease of understanding, please refer to Figure 4, which is a flow chart of a web page callback trigger request processing according to an embodiment of the present application. As shown in Figure 4, the process of the web page callback trigger request processing mainly includes the following steps:
[0098] Step S41: The computer device receives a web page callback trigger request.
[0099] Specifically, the computer device receives a web page callback trigger request for the target workflow. The web page callback trigger request is the HTTP request sent to the computer device when a POST request is made to the URL address corresponding to the workflow.
[0100] Step S42, obtaining a token.
[0101] Specifically, the computer device obtains the target token from the web page callback trigger request. The web page callback trigger request carries the token, and the computer device parses the web page callback trigger request to obtain the token.
[0102] Step S43: Find the corresponding workflow.
[0103] Specifically, the computer device can retrieve the target workflow from the workflow repository based on the target token. The workflow repository is used to store workflows. Each token is bound to a unique workflow, so only the workflow bound to the token needs to be retrieved.
[0104] Step S44: Determine whether to enable the workflow.
[0105] Specifically, if the workflow is enabled successfully, step S45 is executed; if the workflow is enabled unsuccessfully, step S49 is executed.
[0106] Step S45: Obtain request parameters.
[0107] Specifically, obtain the POST request parameters.
[0108] Step S46: construct an execution record.
[0109] Specifically, an execution record table is created, which can record information such as workflow process relationships and execution time.
[0110] Step S47: The computer device asynchronously initiates the execution of the workflow.
[0111] Specifically, the computer device may create an execution instance corresponding to the target workflow according to the request parameters included in the webpage callback trigger request, and then execute the execution instance.
[0112] Step S48: The computer device generates an execution identifier and ends the process.
[0113] Specifically, an execution instance can be identified by a unique execution identifier, and the computer device can first return the execution identifier to the terminal device. Later, the terminal device can query the execution result of the execution instance through the execution identifier. At this point, the process of triggering the workflow by the webpage callback trigger request ends.
[0114] Step S49: Report an error and end the process.
[0115] Specifically, the computer device will return the error message to the terminal device.
[0116] Optionally, when the trigger request is an instruction request, the above-mentioned specific implementation process of receiving the trigger request for the target workflow and creating an execution instance corresponding to the target workflow can be: obtaining the instruction request sent by the first object through the callback address, decrypting the instruction request, and obtaining the trigger instruction and trigger parameters; obtaining the target workflow according to the trigger instruction, and verifying the trigger permission of the first object according to the trigger parameters; if the trigger permission of the first object is a qualified permission, creating an execution instance corresponding to the target workflow.
[0117] Among them, the instruction request may refer to a request generated by sending a trigger instruction to the target account. When the starting node of the target workflow is an instruction trigger, you can apply for and register a target account on the target application, and point the callback address of this target account to the callback API (interface) of the workflow engine installed in the computer device. All subsequent messages sent to the target account will be forwarded to the following callback API interface through the target application. Among them, the target application can be an application with instant conversation function. Among them, the trigger instruction can be created by the object itself, and the triggering of a workflow corresponds to a unique trigger instruction.
[0118] For ease of understanding, please refer to Figure 5, which is a schematic diagram of a target application instruction execution process provided by an embodiment of the present application. As shown in Figure 5, the target application is an application with an instant conversation function that can be integrated and installed in a terminal device. The target application instruction execution process mainly includes the following steps:
[0119] Step S51: The computer device configures the target account and callback address.
[0120] Specifically, the computer device may be integrated with a workflow engine and may also provide an API service corresponding to the workflow engine. The computer device can configure a target account and callback address through the workflow engine's API service. The target account is used to receive instructions sent by the terminal device, and the callback address points to the workflow engine's callback API, which can be used to call the workflow engine's API service.
[0121] Step S52: The computer device registers the configured target account and callback address in the target application.
[0122] Specifically, after the target account is successfully registered in the target application, any target account that has logged into the target application in the subsequent terminal device can send messages to the target account. The messages received by the target account will be forwarded to the callback API through the callback address in the target application.
[0123] Step S53: The terminal device creates an instruction.
[0124] Specifically, the terminal device can create trigger instructions. Each trigger instruction has a unique name and corresponds to the current workflow. At the same time, the terminal device can authorize the instruction to the object account of a specific object. Only the object account with permission can view and execute the instruction.
[0125] Optionally, the target account that has logged into the target application in the terminal device can send a system query instruction to the target account to query whether it has permission to use the instruction.
[0126] In step S54, the terminal device sends the instruction to the computer device, and the computer device records the instruction and associates it with the corresponding workflow.
[0127] Specifically, the computer device will record the trigger instruction created by the terminal device and associate it with the corresponding workflow.
[0128] Step S55: The terminal device sends a message carrying instructions to the target account.
[0129] Specifically, after the first object logs in to the object account through the target application running on the terminal device, the first object can send a message carrying instructions to the target account.
[0130] Step S56: After receiving the message through the target account, the target application encrypts and signs the message to obtain an encrypted message, and sends the encrypted message to the computer device.
[0131] Step S57: The computer device receives the encrypted message sent by the target application through the callback address.
[0132] In step S58, the computer device decrypts the encrypted message to obtain instructions and parameters.
[0133] Specifically, after the computer device obtains the instruction request carrying the encrypted message sent by the first object through the callback address, it decrypts the encrypted message in the instruction request to obtain the instruction (i.e., trigger instruction) and parameters (i.e., trigger parameters). Among them, the first object is the object of the logged-in object account.
[0134] Step S59: The computer device obtains the workflow associated with the instruction.
[0135] Specifically, the computer device may obtain the target workflow according to the instruction (ie, the trigger instruction), ie, the workflow associated with the trigger instruction.
[0136] Step S510: The computer device determines whether the first object has instruction permission.
[0137] Specifically, the computer device can verify the triggering permission of the first object based on the triggering parameters, that is, determine whether the object account sending the message has instruction permission. If the triggering permission is qualified, it means that the first object has instruction permission and can trigger the target workflow, so step S512 is executed; if not, step S511 is executed.
[0138] Step S511: The computer device sends an unauthorized prompt to the terminal device.
[0139] Step S512: The computer device creates an execution instance corresponding to the workflow.
[0140] Step S513: The computer device executes the execution instance to obtain an execution result.
[0141] Step S514: The computer device returns the execution result to the terminal device.
[0142] Optionally, when the trigger request is a timer trigger request, a specific implementation process of receiving the trigger request for the target workflow and creating an execution instance corresponding to the target workflow can be: receiving the timer trigger request for the target workflow, obtaining the specified execution time from the timer trigger request; when the system time is the same as the specified execution time, creating the execution instance corresponding to the target workflow.
[0143] A timer trigger request can be a request generated by a Cron periodic task trigger. Cron triggers use the syntax of Linux crontab (a programming language). When the specified time arrives, an execution instance corresponding to the target workflow is created and executed.
[0144] Step S102: Obtain loop parameters corresponding to the loop start function code block.
[0145] Specifically, for at least two function code blocks in the execution instance, the computer device will first obtain the first function code block (usually the trigger function code block mentioned above), create a starting function block instance corresponding to the first function code block, and push the starting function block instance to the function block instance queue; it should be understood that the first function code block is usually not a loop starting function code block. Among them, the function block instance queue is used to store function block instances waiting to be executed, and the computer device will sequentially execute the function block instances in the function block instance queue, and the execution order usually adopts the first-in-first-out principle. When the computer device takes out the starting function block instance from the function block instance queue and executes it, the computer device can determine the function code block list pointed to by the first function code block based on the pointing relationship. The function code block list contains one or more function code blocks pointed to by the first function code block. At this time, the computer device will sequentially create function block instances corresponding to one or more function code blocks, and then push them all to the function block instance queue to wait for execution.
[0146] It should be noted that after each function block instance associated with the execution instance is successfully executed from the function block instance queue, the computer device will determine whether the function code block corresponding to the function block instance is a loop-starting function code block. If the function code block corresponding to the function block instance is not a loop-starting function code block, the computer device will continue to query the function code block list pointed to by the function code block corresponding to the function block instance based on the pointing relationship. If the function code block list it points to is queried, it will continue to create a function block instance corresponding to the function code block contained in the function code block list, and then continue to push the created function block example to the function block instance queue for execution. For example, assuming that the target workflow is node A→node B→node C→…, where node A corresponds to the first function code block in the workflow. After the function block instance corresponding to node A is taken out from the function block instance queue and executed, the computer device will create the function block instance corresponding to node B. Assuming that node B corresponds to a business function code block, the computer device will push the function block instance corresponding to node B to the function block instance queue and wait for execution. After waiting for the function block instance corresponding to node B to be taken out from the function block instance queue and executed, the computer device will continue to create the function block instance corresponding to node C, and so on.
[0147] Specifically, when the computer device creates a loop start function block instance corresponding to the loop start function code block, the computer device will first push the loop start function block instance to the function block instance queue. When the loop start function block instance in the function block instance queue is executed successfully, the computer device will first obtain the loop parameters corresponding to the loop start function code block, where the loop parameters are the number of For loop traversals, which are used to represent the number of times the following loop function code block needs to be executed in a loop.
[0148] Step S103 : determining, according to the pointing relationship, a function code block between the loop start function code block and the loop end function code block as a loop function code block.
[0149] Specifically, the number of loop function code blocks can be one or more. Assume that node S corresponds to the loop start function code block, node E corresponds to the loop end function code block, node D and node F correspond to a business function code block respectively. In the target workflow, node S→node D→node F→node E, then the business function code blocks corresponding to node D and node F are loop function code blocks and need to be executed in a loop.
[0150] Step S104: cyclically executing the loop function code block according to the loop parameter and the pointing relationship.
[0151] That is, the computer device may execute the above-mentioned loop function code block in a loop according to the loop parameter, the function block instances included in the function block instance queue, and the pointing relationship.
[0152] Specifically, assuming a loop parameter of N, where N is a positive integer greater than or equal to 1, the computer device will iteratively execute the loop function code block N times based on the function block instance queue and the pointer relationship. During the kth round of iterative execution of the loop function code block, the computer device may first determine the list of pending function code blocks pointed to by the loop start function code block based on the pointer relationship. k is a positive integer less than or equal to N.
[0153] For ease of understanding, please refer to Figure 6, which is a schematic diagram of a workflow pointing relationship provided by an embodiment of the present application. Assume that node s corresponds to a loop start function code block, node e corresponds to a loop end function code block, and node a, node b, node c, and node d correspond to a business function code block respectively. Because node a, node b, node c, and node d are located between node s and node e, the business function code blocks corresponding to node a, node b, node c, and node d are loop function code blocks. As shown in Figure 6, node s points to node a and node b, that is, the list of function code blocks to be executed that node s points to includes node a and node b. At this point, the loop function code block forms two branches, i.e., [node a, node c] and [node b, node d]. It can be understood that the execution processes of node a and node b do not affect each other, and correspondingly, the execution processes of the two branches do not affect each other, so in each round of iterative execution, the execution of the two branches can be carried out simultaneously. In other words, the computer device can directly create the to-be-executed function block instances corresponding to the function code blocks included in the above-mentioned to-be-executed function code block list, that is, create the to-be-executed function block instances corresponding to node a and node b respectively, and then push them sequentially to the function block instance queue.
[0154] The computer device then executes the target to-be-executed function block instance corresponding to the target to-be-executed function code block in the function block instance queue, where the target to-be-executed function code block is a function code block in the to-be-executed function code block list. If the to-be-executed function code block list does not contain the loop-ending function code block at this time, then when the target to-be-executed function block instance in the function block instance queue is successfully executed, the computer device will continue to determine a new to-be-executed function code block list pointed to by the target to-be-executed function code block based on the pointing relationship until it is determined that the kth round of iterative execution of the loop function code block is complete. If k is less than N, the computer device will continue to perform the k+1th round of iterative execution of the loop function code block.
[0155] To facilitate understanding of the above process, please refer to Figure 6 again. Assume that during the kth round of iterative execution, the computer device creates function block instances corresponding to nodes a and b, respectively, pointed to by the loop's starting function code block. The computer device then pushes the function block instances corresponding to nodes a and b together into the function block instance queue. After the computer device retrieves and executes the function block instance corresponding to node a from the function block instance queue, the computer device determines the function code block list pointed to by node a based on the pointing relationship. At this point, the next batch of function code block lists only contains node c. The computer device creates a function block instance corresponding to node c and pushes it into the function block instance queue. After the computer device retrieves and executes the function block instance corresponding to node c from the function block instance queue, the computer device again determines the function code block list pointed to by node c based on the pointing relationship, and so on. In this way, all nodes contained in the branch starting with node a will be executed. Similarly, the nodes contained in the branch starting with node b will also be executed. Therefore, during the kth round of iterative execution, all loop function code blocks will be executed based on the pointing relationship until the kth round of iterative execution is completed.
[0156] Optionally, if the new list of function code blocks to be executed includes a loop-end function code block, the loop-end function block instance queue is queried; if the loop-end function block instance queue is an empty queue, a loop-end function block instance corresponding to the loop-end function code block is created, and the loop-end function block instance is pushed to the loop-end function block instance queue; if the loop-end function block instance queue is not an empty queue, the computer device may no longer create a loop-end function block instance corresponding to the loop-end function code block.
[0157] It is understandable that because a loop function code block may contain multiple branches, and the end nodes of these branches ultimately point to the loop end function code block. When the computer device determines that a loop end function code block is included in the list of function code blocks to be executed, it can only be said that the current branch of the loop function code block has been completed in this round of iterative execution. In addition, for the loop end function code block, because it does not need to be executed in a loop, the computer device only needs to create its corresponding loop end function code block instance once. However, the loop end function code block instance should be executed after the loop function code block is completed in the loop. Therefore, when the computer device determines that a list of function code blocks to be executed contains a loop-end function code block, the computer device will query the loop-end function block instance queue, where the loop-end function block instance queue is used to temporarily store the loop-end function code block instances created during the loop execution process. If the computer device queries that the loop-end function block instance queue is an empty queue, it means that the computer device has not yet created the loop-end function code block instance corresponding to the loop-end function code block. At this time, the computer device will create the loop-end function code block instance and push it to the loop-end function block instance queue; if the computer device queries that the loop-end function block instance queue is not an empty queue, it means that the computer device has already created the loop-end function code block instance corresponding to the loop-end function code block.
[0158] For ease of understanding, please refer to Figure 6. As shown in Figure 6, for the branch [node a, node c], when node c is executed, the computer device will determine that the next node it points to is node e. Because node e corresponds to the loop end function code block, the computer device will query the loop end function block instance queue. Assuming that the loop end function block instance queue is an empty queue, the computer device will create a loop end function block instance corresponding to node e and push the loop end function block instance to the loop end function block instance queue for temporary storage; if the loop end function block instance queue already stores a loop end function block instance, the computer device does not need to create a loop end function block instance corresponding to node e. At this point, the computer device can determine that the branch [node a, node c] has completed execution in this round of iterative execution. In other words, after the computer device executes a certain node, if it determines that the next node pointed to by the node is the loop end function code block, it can be determined that in this round of iterative execution, the branch with the node as the end node has completed execution, but it cannot directly determine that the loop function code block has completed this round of iterative execution.
[0159] Optionally, the computer device may determine whether the kth round of iterative execution is completed by detecting the execution data of the execution instance. The execution data may include the number of queue instances and the number of instance executions, as shown in Table 2 below:
[0160] Table 2
[0161] Optionally, when creating an execution instance, the computer device may first initialize the number of queue instances to a first default parameter and the number of instance executions to a second default parameter. The first default parameter and the second default parameter may be the same or different. Typically, the first default parameter and the second default parameter may both be set to 0. The computer device will accumulate or decrement the number of queue instances and the number of instance executions based on the execution status of the function block instance associated with the execution instance; if the computer device detects that the number of queue instances is equal to the first default parameter and the number of instance executions is equal to the second default parameter, it determines that the execution data of the execution instance meets the execution termination condition.
[0162] For example, please refer to Figure 6 again. When node c and node d are executed, because the node e they point to is a loop-ending function code block, when the computer device obtains the loop-ending function code block, it will only create its corresponding loop-ending function block instance the first time. When it obtains the loop-ending function code block again, it will not create its corresponding loop-ending function block instance. Moreover, the created loop-ending function block instance is not pushed to the function block instance queue, but is pushed to the loop-ending function block instance queue for temporary storage. Therefore, when node c and node d are executed, the number of queue instances will decrease to 0, and the number of instance executions will decrease to 0. Therefore, when it is detected that the execution data of the execution instance meets the execution end condition, it can be determined that the current round of iteration execution is completed.
[0163] Assuming that the function block instances associated with the execution instance include the target function block instance, a feasible implementation process of accumulating or decrementing the number of queue instances and accumulating or decrementing the number of instance executions according to the execution status of the function block instance associated with the execution instance can be: when the target function block instance is pushed to the function block instance queue, the queue instance data is accumulated by default; when the target function block instance in the function block instance queue is executed, the instance execution number is accumulated by default, and the queue instance number is decremented by default. Then, when the execution of the target function block instance is completed, the computer device can determine the creation status of the new target function block instance; if the new target function block instance is created successfully, and the function code block corresponding to the new target function block instance is a loop-ending function code block, the number of instance executions is decremented by default; if the new target function block instance is created successfully, and the function code block corresponding to the new target function block instance is not a loop-ending function code block, then after the new target function block instance is pushed to the function block instance queue, the number of queue instances is accumulated according to the number of new target function block instances, and the number of instance executions is decremented by default; if the creation of the new target function block instance fails, the number of instance executions is decremented by default.
[0164] Among them, the new target function block instance refers to the function block instance corresponding to the function code block pointed to by the target function code block corresponding to the target function block instance. Among them, the default accumulation processing refers to adding one to the target data. For example, the default accumulation processing of the number of queue instances refers to adding one to the number of queue instances to obtain the new number of queue instances; the default accumulation processing of the number of instance executions refers to adding one to the number of instance executions to obtain the new number of instance executions; similarly, the default decrement processing refers to subtracting one from the target data. Among them, the accumulation processing of the number of queue instances according to the number of new target function block instances refers to adding the number of queue instances to the number of new target function block instances to obtain the new number of queue instances.
[0165] As can be seen from the above, the number of instance executions and the number of queue instances are initialized to 0 at the beginning. Then, after the computer device starts to execute the instance, the number of instance executions and the number of queue instances will be accumulated or decremented according to the execution status of the target function block instance. As long as a new target function block instance is created when the target function block instance is executed and the new target function block instance is not a loop-ending function block instance, the computer device will accumulate the number of queue instances according to the new target function block instance. The number of instance executions and the number of queue instances will not be decremented to 0 at the same time. At this time, the execution data of the execution instance will not meet the execution end condition. Only when the target function block instance is executed, the computer device does not create a new target function block instance or the new target function block instance it creates is a loop-ending function block instance, the computer device will only perform a default decrement on the number of instance executions. At this time, if the number of queue instances is 0, the number of instance executions will also be decremented to 0, and the execution data of the execution instance will meet the execution end condition. Therefore, when the computer device performs k rounds of iterative execution on the loop function code block, although the loop function code block may contain multiple branches, since the function code block pointed to by the end node of each branch is the loop end function code block, when the end nodes of all branches are executed, the number of queue instances and the number of instance executions will both decrease to 0. Therefore, the computer device can determine whether the kth round of iterative execution of the loop function code block is completed based on whether the execution data meets the execution end condition.
[0166] Optionally, when the computer device determines that the Nth round of iterative execution of the loop function code block is complete, the computer device has terminated the loop execution of the loop function code block, but the execution of at least two function code blocks has not yet terminated. The computer device needs to push the loop-end function block instance in the loop-end function block instance queue to the function block instance queue and continue to detect new execution data of the execution instance; if the new execution data is detected to meet the execution termination condition and the loop-end function block instance queue is an empty queue, it is determined that the execution of at least two function code blocks is complete.
[0167] It can be understood that after the loop end function block instance is pushed into the function block instance queue, as the computer device takes out the loop end function block instance from the function block instance queue and executes it, the function code blocks located after the loop end function code block in at least two function code blocks will be executed sequentially according to the pointing relationship. In the process of sequentially executing the function code blocks located after the loop end function code block in at least two function code blocks, the computer device will also continue to perform cumulative or decremental processing on the execution data. When the computer device detects again that new execution data meets the execution end condition, there are two possibilities. One is that a new loop function code block appears, and the loop execution of the new loop function code block is the same as the loop execution of the above-mentioned loop function code block, which will not be repeated here; the other is that all the function code blocks located after the loop end function code block in at least two function code blocks are executed, and no new function block instances are established, and the new execution data will also meet the execution end condition. It can be understood that in the two cases, in the first case, the loop end function block instance queue will inevitably temporarily store a new loop end function block instance. Therefore, as long as the computer determines that the loop end function block instance queue is an empty queue, it can be determined that all the function code blocks located after the loop end function code block in at least two function code blocks have been executed, and the function code block located before the loop end function code block in at least two function code blocks has also been executed. Therefore, the computer device can determine that at least two function code blocks have been executed.
[0168] By adopting the method provided in the embodiment of the present application, when an object creates a workflow through a workflow engine, it only needs to place the functional code block that it wants to execute multiple times between the loop start functional code block and the loop end functional code block. The object does not need to have other programming experience, which lowers the usage threshold of the workflow engine and improves the usability and functionality of the workflow engine.
[0169] Further, please refer to Figure 7, which is a flow chart of a data processing method provided by an embodiment of the present application. The method can be executed by a computer device, which can be the business server 100 shown in Figure 1 above, or any terminal device in the terminal device cluster shown in Figure 1 above, such as terminal device 10c. The following description will take the execution of the method by a computer device as an example, wherein the data processing method can include at least the following steps S201-S205:
[0170] Step S201: receiving a trigger request for a target workflow and creating an execution instance corresponding to the target workflow.
[0171] Specifically, the execution process of step S201 can refer to the description of step S101 above, which will not be repeated here.
[0172] Step S202: while creating the execution instance corresponding to the target workflow, create an execution instance table corresponding to the execution instance; the execution instance table is used to record the execution status of the execution instance.
[0173] Specifically, an execution instance can be represented as an execution. The execution instance table is the execution table. The execution table is used to record information such as the process relationship and execution time of the target workflow. Its table structure is shown in Table 3 below:
[0174] Table 3
[0175] The most important field is the apps field, which records the target workflow's process structure. This process structure includes the pointing relationship between at least two functional code blocks corresponding to the target workflow. The computer device traverses and executes the at least two functional code blocks based on the pointing relationship contained in its process structure.
[0176] A process data structure of the target workflow stored in apps recorded in Table 3 can be referred to in Table 4 below:
[0177] Table 4
[0178] As you can understand, each app has a unique InstId, which the computer can use to locate and identify the app in the process. After creating the execution table, the computer stores it in the database. Simultaneously, the computer pushes the execution instance ID to the execution message queue, where it awaits consumption and execution by the distributed workflow engine cluster.
[0179] For ease of understanding, please refer to Figure 8, which is a schematic diagram of an execution instance message queue provided by an embodiment of the present application. As shown in Figure 8, for the newly generated execution instance 81, the computer device will first push it to the execution instance message queue 800, and the execution instance 81 will be located at the end of the execution instance message queue 800. The computer device can consume the execution instance in the execution instance message queue 800 through the workflow engine cluster 801, wherein the workflow engine cluster 801 can contain multiple containers, and the containers are independent of each other, that is, the processes of different containers executing different execution instances will not affect each other. Whenever the computer device detects that the workflow engine cluster meets the instance execution condition, the computer device will obtain the execution instance from the head of the execution instance message queue and then transfer it to the target container for execution. Among them, the workflow engine cluster meeting the instance execution condition can mean that the workflow engine cluster has an idle container. For example, as shown in Figure 8, assuming that the computer device detects that container 1 is idle, the computer device will obtain the execution instance 82 from the head of the execution instance message queue 800 and then transfer it to container 1 for execution.
[0180] Step S203, sequentially obtain the first function block instance associated with the execution instance in the function block instance queue as the function block instance to be processed; the function block instance to be processed corresponds to the function block instance identifier to be processed and the function block instance index to be processed; the function block instance identifier to be processed and the function block instance index to be processed are generated when the function block instance to be processed is created according to the function code block to be processed; the target function block instance index is used to represent the number of executions of the function code block to be processed; the function code block to be processed belongs to the at least two function code blocks.
[0181] Specifically, after the computer device obtains the execution instance corresponding to the target workflow through the workflow execution engine cluster, it initializes the status of each function code block in the execution instance to pending. Then, based on the pointing relationship, it obtains the starting node in the target workflow, namely the trigger app (trigger function code block), creates a trigger app instance, and pushes the trigger app instance to the app instance queue (i.e., the function block instance queue) for execution. During the subsequent execution of the execution instance, the app instance corresponding to each app created by the computer device is pushed to the app instance queue.
[0182] For ease of understanding, please refer to Figure 9, which is a schematic diagram of a function block instance queue provided in an embodiment of the present application. As shown in Figure 9, the App instance queue 900 has the same structure as the above-mentioned execution message queue 800. The newly created App instance, for example, App instance 91 will be pushed to the end of the App instance queue 900. When the computer device consumes the App instance through the workflow engine cluster 901, it will obtain the App instance at the head of the App instance queue, that is, App instance 92. In addition, an optional element format of the App instance queue can be: appInst#executionId#appInstId#index, that is, app instance / execution record id / app instance id / index. Based on this optional element format, after the computer device consumes the App instance, it can locate the specific execution instance and the execution data of a certain App at a certain time.
[0183] In the data structure shown in Table 4 above, the App instance has a Parameters array (input parameter) structured as <parameter key, parameter value, parameter type, parameter description>. Parameter types include string, boolean, and number. The value parameter can be a constant (number or string) or a path syntax expression referencing the output of any previous app instance.
[0184] Step S204: execute the function block instance to be processed to obtain a target execution result.
[0185] Specifically, the function block instance to be processed may include a demand data acquisition path. A feasible implementation process for a computer device to execute the function block instance to be processed and obtain a target execution result may be: querying the computing resource idleness of the execution engine container, determining the execution engine container with the most computing resources idleness as the target execution engine container; transferring the function block instance to be processed from the function block instance queue to the target execution engine container, obtaining the demand data in the target execution engine container according to the demand data acquisition path, executing the function block instance to be processed according to the demand data, and obtaining the target execution result.
[0186] The required data acquisition path refers to the path syntax expression used in the Parameters array corresponding to the App instance. Because the runtime data of each App instance is stored in a database, after creating an execution instance, the computer device first loads the execution data of all App instances under the current execution instance into memory, forming a global variable structure mapping the App instance ID to a map.
[0187] For easier understanding, please also refer to Figure 10, which is a schematic diagram of a global variable data structure in memory during workflow execution, provided in an embodiment of the present application. Using the structure shown in Figure 10, a computer device can locate the function block instance ID of an App instance and globally obtain the input and output data of any App instance in the workflow, thereby parsing and replacing the path syntax expressions used in the App instance parameters with the corresponding data.
[0188] Step S205 : Recording the target execution result in the execution instance table according to the to-be-processed function block instance identifier and the to-be-processed function block instance index.
[0189] Specifically, because an App in the process can be executed multiple times, it will correspond to multiple execution results. When the computer device records the pending function code block corresponding to the target execution result through the pending function block instance identifier in the execution instance table, it is also necessary to use the pending function block instance index to record which execution result the target execution result corresponds to the pending function code block.
[0190] Optionally, when the computer device obtains a function block instance to be processed, it updates the status of the function block instance table corresponding to the function block instance to "processing" and sets the start time of execution. The function block instance table can be represented as an App instance table, which is used to record the execution status of a function code block. An available structure of the function block instance table can be seen in Table 5 below:
[0191] Table 5
[0192] Optionally, because an app can be executed multiple times in a process, multiple entries can be created in the app instance table corresponding to that app. For example, multiple execution results of an app instance can be represented as: [{app_inst_id=x,index=0},{app_inst_id=x,index=1},…,{app_inst_id=x,index=n}], and the app_inst_id and index fields can be used to uniquely identify a particular execution result of an app.
[0193] The apps field in Table 5 stores data in a JSON structure, which is used to record the execution results of the current App instance, the preceding and succeeding Apps, input parameters, and runtime data information. An available format for the Apps field can be found in Table 6 below:
[0194] Table 6
[0195] For a description of the App instance members Index and MaxIndexCount in apps, see Table 7 below:
[0196] Table 7
[0197] It should be noted that when you want to obtain the execution result of an app in an execution instance, since the app may be executed multiple times in the For loop body, you first need to obtain the number of times it is executed, that is, MaxIndexCount, and then obtain all the execution results of the app in sequence according to the InstId and Index index of the app.
[0198] Optionally, when creating a pending function block instance corresponding to a pending function code block, an identifier for uniquely identifying the pending function code block is obtained as the pending function block instance identifier corresponding to the pending function block instance; if the pending function block instance identifier is not found in the execution instance table, the pending function block instance index is determined to be the default index; if the pending function block instance identifier is found in the execution instance table, the historical index with the latest record time associated with the pending function block instance identifier is obtained, and the historical indexes are accumulated to obtain the pending function block instance index.
[0199] In short, the computer device can obtain the historical index of the most recent execution of the pending function code block, add one to the historical index, and obtain the pending function block instance identifier corresponding to the pending function block instance; however, if the pending function code block has not been executed before, the pending function block instance identifier is set to the default index, that is, 0.
[0200] Optionally, when creating an instance of a pending function block, the computer device also needs to update the MaxIndexCount in the pending function block instance table corresponding to the pending function code block. Similarly, the computer device can directly obtain the MaxIndexCount of the pending function code block at the time of the most recent execution from the pending function block instance table, and then add one to the MaxIndexCount of the most recent execution to obtain the MaxIndexCount corresponding to this execution, and then update the MaxIndexCount corresponding to this execution and write it into the pending function block instance table.
[0201] Optionally, different parameter adjustment methods can be used to determine index and MaxIndexCount for different workflow structures. Assume that a computer device has completed executing the current App and needs to create a nextAppInst (next App instance) corresponding to the nextApp (next App) pointed to by the current App. First, the computer device can obtain the InstId corresponding to nextApp, use this InstId to query the App instance table corresponding to nextApp, obtain the data of nextAppInst (including template type, parameters, location, etc.), and then construct the instance data corresponding to nextAppInst. Furthermore, the computer device can obtain the Index value of the most recent execution of nextApp: lastIndex based on the executionId and appInstId corresponding to nextApp, and initialize the variable idx = lastIndex + 1. It should be noted that if nextApp is being executed for the first time, there is no execution record in its corresponding App instance table at this time, and the default lastIndex is -1. The computer device can then determine the index and MaxIndexCount corresponding to nextAppInst based on the logical structure between the current App and nextApp.
[0202] To facilitate understanding of the process of determining the index corresponding to nextAppInst based on the current App by the computer device, please refer to Figure 11, which is a schematic diagram of a scenario for determining an index provided by an embodiment of the present application. The computer device determines the index corresponding to nextAppInst in four main cases: (1) In workflow 1 as shown in Figure 11, the current App is the loop start function code block 1 (i.e., the For loop start App), and the nextApp it points to is the function code block X1, then the computer device will determine that nextAppInst.Index = idx; (2) In workflow 2 as shown in Figure 11, assuming that the current App is the function code block X2, and the nextApp it points to is the function code block Y2, then the current App is not the For loop start App, and the current App is not in the loop, but the nextApp is in the loop, then the computer device can determine that nextAppInst.Index = idx. Among them, a loop means that the pointing relationship between function code blocks can form a loop when the conditions are met. Function code block Y2 and function code block N2 in workflow 2 form a loop. (3) In workflow 3 shown in FIG11 , assuming that the current App is function code block X3 and the nextApp it points to is function code block Y3, and the current App is not the start App of a For loop and the current App is in the loop, the computer device can determine that nextAppInst.Index = idx. (4) In workflow 4 shown in FIG11 , assuming that the current App is function code block X4 and the nextApp it points to is function code block Y4, and the current App is not the start App of a For loop and the current App is not in the loop, the computer device can determine that nextAppInst.Index = todoApp.Index, where todoApp.Index refers to the index of the current App.
[0203] To facilitate understanding of the process of the computer device determining the MaxIndexCount corresponding to nextAppInst based on the current App, please refer to Figure 12, which is a schematic diagram of an index determination scenario provided by an embodiment of the present application. The computer device determines the MaxIndexCount corresponding to nextAppInst mainly in four cases: (1) In workflow 1 as shown in Figure 12, the current App is the function code block X1, and the nextApp it points to is the function code block Y1. At this time, the current App is not in the ring, but the nextApp is in the ring, then the computer device will determine that nextAppInst.MaxIndexCount=idx+1; (2) In workflow 2 as shown in Figure 12, the current App is the function code block Y2, and the nextApp it points to is the function code block N2. At this time, the current App is in the ring, but the nextApp is not in the ring, then the computer device will determine that nextAppInst.MaxIndexCount=idx+1; (3) As shown in Figure 12 In workflow 3, the current App is function code block Y3, and the nextApp it points to is function code block N3. At this time, the current App is not in the loop, and the nextApp is also not in the loop. The computer device will determine that nextAppInst.MaxIndexCount = todoApp.MaxIndexCount, where todoApp.MaxIndexCount refers to the MaxIndexCount of the current App; (4) In workflow 4 as shown in Figure 12, the current App is loop start function code block 4, and the nextApp it points to is function code block X4. At this time, the computer device will determine that nextAppInst.MaxIndexCount = the maximum number of loops, where the maximum number of loops is the loop parameter mentioned above.
[0204] It should be noted that, in the above process of determining the index and MaxIndexCount corresponding to nextAppInst, if nextAppInst is a loop-ending function block instance, the computer device needs to reset its Index to 0 and MaxIndexCount to 1.
[0205] Using the above method to determine the index and MaxIndexCount corresponding to the nextAppInst based on the current app makes it easier to assemble data from the subsequent app execution results. This is because in the absence of a loop, the index and MaxIndexCount are inherited upwards. That is, the execution results of apps in the same round of execution have the same index and MaxIndexCount.
[0206] Further, please refer to Figure 13, which is a flow chart of a data processing method provided by an embodiment of the present application. The method can be executed by a computer device, which can be the business server 100 shown in Figure 1 above, or any terminal device in the terminal device cluster shown in Figure 1 above, such as terminal device 10c. The following description will take the execution of the method by a computer device as an example, wherein the data processing method can include at least the following steps S301-S305:
[0207] Step S301: In response to a creation operation on a target workflow, a workflow editing page is displayed.
[0208] Step S302 : In response to a selection and connection operation on at least two function block controls, a workflow control tree consisting of the at least two function block controls is displayed on the workflow editing page; the at least two function block controls include a loop start function block control and a loop end function block control.
[0209] Step S303: In response to the triggering operation on the loop start function block control in the workflow control tree, loop parameters are set for the loop start function block control.
[0210] In a specific implementation, the computer device may respond to a trigger operation on the loop start function block control in the workflow control tree, display a loop edit text box, and respond to an input operation on the loop edit text box to set loop parameters for the loop start function block control.
[0211] Step S304: In response to the creation operation for the workflow control tree, a target workflow is created and the target workflow is sent to the workflow engine; the target workflow includes the function code blocks corresponding to the at least two function block controls; the pointing relationship between the at least two function code blocks is determined according to the connection relationship between the at least two function block controls; the at least two function code blocks include a loop start function code block corresponding to the loop start function block control and a loop end function code block corresponding to the loop end function block control.
[0212] Step S305: In response to the trigger operation for the target workflow, a trigger request for the target workflow is sent to the workflow engine.
[0213] Sending a trigger request for the target workflow to the workflow request can enable the workflow engine to create an execution instance corresponding to the target workflow; then, based on the loop parameters indicated by the loop start function code block in the execution instance and the pointing relationship in the execution instance, the loop function code block between the loop start function code block and the loop end function code block is instructed to be executed in a loop.
[0214] Specifically, the implementation process of steps S301 to S305 can be referred to the scenario diagram shown in FIG2 a above, and this application will not elaborate on it here.
[0215] By adopting the method provided in the embodiment of the present application, when an object creates a workflow through a workflow engine, it only needs to place the functional code block that it wants to execute multiple times between the loop start functional code block and the loop end functional code block. The object does not need to have other programming experience, which lowers the usage threshold of the workflow engine and improves the usability and functionality of the workflow engine.
[0216] Further, please refer to Figures 14a-14b, which are schematic diagrams of the overall process of implementing a workflow execution supporting loops provided by an embodiment of the present application. As can be seen from Figures 14a and 14b, the overall process can be executed by a computer device and mainly includes the following steps:
[0217] Step S601: triggering the workflow.
[0218] Specifically, workflows can be triggered in many ways, including web page callbacks (e.g., webhook calls); command requests (e.g., command triggers); and periodic tasks (e.g., Cron triggers). A computer device can determine the triggering of a workflow based on different triggering requests. The specific implementation process can be found in the description of step S101 in the embodiment corresponding to FIG3 , and will not be further elaborated here.
[0219] Step S602: Create an execution instance of the workflow.
[0220] Specifically, the computer device will create an execution instance and an execution instance table. After the creation is completed, the computer device will push the execution instance to the execution instance message queue to wait for execution as shown in FIG8 .
[0221] Step S603: Obtain an execution instance.
[0222] Specifically, the computer device will obtain the execution instances from the execution instance message queue in sequence.
[0223] Step S604: parse the execution instance.
[0224] Specifically, after the computer device obtains the execution instance from the execution instance message queue, it will first parse the execution instance.
[0225] Specifically, the implementation of steps S602 to S604 may refer to step S202 in the embodiment corresponding to FIG. 7 , and will not be described in detail here.
[0226] Step S605 , initializing the initial state of each function code block and initializing the execution data of the execution instance (the number of queue instances and the number of instance executions).
[0227] Specifically, after the computer device parses the execution instance, it changes the initial state of each function code block in the execution instance table to a pending state, and then initializes the number of queue instances = 0 and the number of instance executions = 0.
[0228] Step S606: Obtain the starting function block instance and push it into the function block instance queue.
[0229] Step S607: Accumulate the number of queue instances.
[0230] Specifically, the computer device will increase the number of queue instances by 1.
[0231] Step S608: Obtain the function block instance from the function block instance queue.
[0232] Step S609: Set the status of the function block instance to being executed.
[0233] Step S610: Accumulate the number of instance executions and decrement the number of queue instances.
[0234] Specifically, the computer device will increase the number of instance executions by 1 and the number of queue instances by 1.
[0235] Specifically, the implementation process of steps S605 to S610 can refer to the process described in the above step S104, which includes accumulating or decrementing the number of queue instances and accumulating or decrementing the number of instance executions according to the execution status of the function block instance associated with the execution instance. No further details will be given here.
[0236] Step S611: parse the path syntax expression in the function block instance to obtain the data to be executed.
[0237] Specifically, the computer device may obtain data required for executing the function block instance according to the path syntax expression corresponding to the function block instance.
[0238] Step S612: Execute the function block instance according to the data to be executed to obtain an execution result.
[0239] Step S613: Storing the execution results.
[0240] Specifically, the computer device may write the execution result into the database according to the index corresponding to the function block instance and the function block instance identifier.
[0241] Specifically, steps S611 to S613 may refer to the description of steps S203 and S204 in the embodiment corresponding to FIG7 , and will not be described in detail here.
[0242] Step S614: determine whether the current function code block is a loop start function code block.
[0243] Specifically, the current function code block is the function code block corresponding to the function block instance just executed. If yes, then execute step S615; if not, then execute step S616.
[0244] Step S615, set the number of loops: N = loop parameter.
[0245] Step S616, set the number of cycles: N=1.
[0246] Step S617: Obtain the next batch of function code block lists pointed to by the current function code block.
[0247] Step S618, perform N cycles according to the number of cycles.
[0248] Specifically, the process of one cycle starts from step S619 corresponding to node ② and continues to step S629, and it can be determined whether one cycle is completed.
[0249] Step S619: Create the next function block instance.
[0250] Specifically, the computer device will perform an internal loop according to the next batch of function code block lists, and establish function block instances corresponding to the function code blocks included in the next batch of function code block lists.
[0251] Step S620: Determine the index and maximum number of loops corresponding to the next function block instance.
[0252] Specifically, the index is the above index; the maximum number of loops is the above MaxIndexCount.
[0253] Specifically, the determination method may refer to the parameter adjustment method shown in FIG. 11 and FIG. 12 .
[0254] Step S621: Determine whether the next function code block is a loop-ending function code block.
[0255] Specifically, the computer device may first determine whether the next function code block is a loop-ending function code block, and then determine whether to create a function block instance corresponding to the next function code block. This application is not limited to this. If the next function code block is a loop-ending function code block, step S622 is executed; otherwise, step S627 is executed.
[0256] Step S622, reset index = 0, maximum number of loops = 1.
[0257] Step S623: Determine whether the next function code block is created for the first time.
[0258] Specifically, because the next function code block is the loop-ending function code block, it only needs to be created once. If the computer device determines that the next function code block is created for the first time, step S624 is executed; otherwise, step S625 is executed.
[0259] Step S624: Push the next function block instance to the loop-end function block instance queue and execute step S626.
[0260] Step S625: discard the next function block instance and execute step S626.
[0261] Step S626, decrement the instance execution quantity, and execute step S629.
[0262] Specifically, the number of instances is executed -1.
[0263] Step S627: Push the next function block instance into the function block instance queue.
[0264] Step S628: accumulate the number of queue instances and decrement the number of instance executions.
[0265] Specifically, the number of queue instances is increased by 1, and the number of instance executions is reduced by 1.
[0266] Step S629: Determine whether the execution data meets the execution end condition.
[0267] Specifically, it is determined whether the number of queue instances and the number of instance executions are both 0. If not, the computer device is expected to execute step S608 corresponding to node ①; if so, it indicates that this loop is complete, and step S630 is executed.
[0268] Step S630: Determine whether the outer loop is finished.
[0269] Specifically, if the outer loop has not yet completed, indicating that the number of loops has not reached N, the computer device needs to start the next loop from step S619 corresponding to node ②. At this time, the next function block instance created in step S619 is determined by the next batch of function blocks pointed to by the loop start function code block. If the outer loop has completed, step S631 is executed.
[0270] Step S631: Determine whether there is a loop-end function block instance in the loop-end function block instance queue.
[0271] Specifically, if yes, execute step S632; if not, execute step S634.
[0272] Step S632: Accumulate the number of queue instances.
[0273] Specifically, the number of queue instances is increased by 1.
[0274] Step S633: Push the loop-ending function block instance to the function block instance queue, and wait for the computer device to execute step S608 corresponding to node ①.
[0275] Step S634: clear the function block instance cache.
[0276] Specifically, cache refers to data temporarily stored during the execution of an instance.
[0277] Step S635: Update the execution instance status and update the database.
[0278] Specifically, the implementation process of steps S614 to S635 can refer to the description of step S104 in the embodiment corresponding to FIG3 and the optional description of step S205 in the embodiment corresponding to FIG4 , which will not be repeated here.
[0279] Through the method provided in the embodiments of this application, based on the fine-grained execution mechanism of the App and combined with the For loop index adjustment algorithm, the process engine uses the For loop traversal function in a visual way, making some array or list traversal execution scenarios possible. The system designed and implemented based on this solution supports the use of a visual low-code method to implement For loop traversal, greatly reducing the threshold for using the system, eliminating the need for specialized programming experience, and greatly improving efficiency.
[0280] Please refer to Figure 15, which is a schematic diagram of the structure of a data processing device provided in an embodiment of the present application. The data processing device can be a computer program (including program code) running on a computer device, for example, the data processing device is an application software; the device can be used to execute the corresponding steps of the data processing method provided in an embodiment of the present application. As shown in Figure 15, the data processing device 1 may include: a trigger module 101, a loop start module 102, a loop confirmation module 103, and a loop execution module 104.
[0281] The trigger module 101 is used to create an execution instance corresponding to the target workflow; the execution instance includes a pointing relationship between at least two function code blocks included in the target workflow; the at least two function code blocks include a loop start function code block and a loop end function code block;
[0282] A loop start module 102 is used to obtain loop parameters corresponding to the loop start function code block;
[0283] A loop confirmation module 103 is used to determine, based on the pointing relationship, a function code block between the loop start function code block and the loop end function code block as a loop function code block;
[0284] The loop execution module 104 is used to loop execute the loop function code block according to the loop parameters and the pointing relationship.
[0285] The specific implementation of the trigger module 101, the loop start module 102, the loop confirmation module 103 and the loop execution module 104 can refer to the specific description of steps S101 to S104 in the embodiment corresponding to FIG3 above, which will not be repeated here.
[0286] The cycle initiation module 102 is specifically configured to:
[0287] Creating a loop-starting function block instance corresponding to the loop-starting function code block, pushing the loop-starting function block instance to a function block instance queue, and when the loop-starting function block instance in the function block instance queue is successfully executed, obtaining loop parameters corresponding to the loop-starting function code block;
[0288] The loop execution module 104 is specifically used to:
[0289] The loop function code block is executed cyclically according to the loop parameter, the function block instance queue and the pointing relationship.
[0290] Wherein, the loop parameter is N, and N is a positive integer greater than or equal to 1;
[0291] The loop execution module 104 includes a first iteration unit 1041 and a second iteration unit 1042 .
[0292] The first iteration unit 1041 is configured to determine, during the kth round of iterative execution of the loop function code block, a list of to-be-executed function code blocks pointed to by the loop start function code block according to the pointing relationship; k is a positive integer less than or equal to N;
[0293] The first iteration unit 1041 is further configured to, if the list of function code blocks to be executed does not include a loop-ending function code block and the target function code block instance to be executed corresponding to the target function code block to be executed in the function block instance queue is successfully executed, determine a new list of function code blocks to be executed that the target function code block to be executed points to based on the pointing relationship, until it is determined that the kth round of iterative execution for the loop function code block is completed; the target function code block to be executed is a function code block in the list of function code blocks to be executed;
[0294] The second iterative unit 1042 is configured to continue executing the k+1th round of iterative execution on the loop function code block if k is less than N.
[0295] The specific implementation of the first iteration unit 1041 and the second iteration unit 1042 can refer to the specific description of step S104 in the embodiment corresponding to FIG3 , which will not be repeated here.
[0296] The data processing device 1 further includes: a third iteration module 105 , a push module 106 and a first detection module 107 .
[0297] The third iterative module 105 is configured to query the loop-end function block instance queue if the new list of to-be-executed function code blocks includes a loop-end function code block, and if the loop-end function block instance queue is empty, push the loop-end function block instance corresponding to the loop-end function code block into the loop-end function block instance queue;
[0298] The third iteration module 105 is further configured to determine that the kth iteration execution of the loop function code block is completed if it is detected that the execution data of the execution instance meets the execution end condition;
[0299] The push module 106 is configured to push the loop-end function block instance in the loop-end function block instance queue to the function block instance queue when determining that the Nth round of iterative execution of the loop function code block is completed, and detect new execution data of the execution instance;
[0300] The first detection module 107 is configured to determine that the execution of at least two function code blocks is completed if it is detected that the new execution data meets the execution end condition and the loop end function block instance queue is an empty queue.
[0301] The specific implementation of the third iteration module 105 , the push module 106 and the first detection module 107 can refer to the optional description of step S104 in the embodiment corresponding to FIG. 3 , which will not be described again here.
[0302] The execution data includes the number of queue instances and the number of instance executions;
[0303] The data processing device 1 further includes: a data initialization module 108 , a first data updating module 109 and a second detection module 110 .
[0304] The data initialization module 108 is used to initialize the number of queue instances to a first default parameter and the number of instance executions to a second default parameter when creating an execution instance;
[0305] A first data updating module 109 is configured to perform a cumulative processing or a decrement processing on the number of queue instances and a cumulative processing or a decrement processing on the number of instance executions according to the execution status of the function block instance associated with the execution instance;
[0306] The second detection module 110 is configured to determine that the execution data of the execution instance meets the execution end condition if it is detected that the number of queue instances is equal to the first default parameter and the number of instance executions is equal to the second default parameter.
[0307] The specific implementation of the data initialization module 108 , the first data update module 109 and the second detection module 110 can refer to the optional description of step S104 in the embodiment corresponding to FIG. 3 , which will not be repeated here.
[0308] wherein the function block instance associated with the execution instance includes a target function block instance;
[0309] The first data updating module 109 includes a first updating unit 1091 and a second updating unit 1092 .
[0310] The first updating unit 1091 is configured to perform accumulation processing on queue instance data when a target function block instance is pushed into the function block instance queue;
[0311] The second updating unit 1092 is configured to perform a default accumulation process on the number of instance executions and a default decrement process on the number of queue instances when executing a target function block instance in the function block instance queue.
[0312] The specific implementation of the first updating unit 1091 and the second updating unit 1092 can refer to the specific description of step S104 in the embodiment corresponding to FIG3 , which will not be repeated here.
[0313] The data processing device further includes a second data updating module 111 .
[0314] The second data updating module 111 is used to determine the creation status of a new target function block instance when the execution of the target function block instance is completed;
[0315] The second data updating module 111 is further configured to perform a default decrement process on the instance execution quantity if the new target function block instance is successfully created and the function code block corresponding to the new target function block instance is a loop-ending function code block;
[0316] The second data updating module 111 is further configured to, if the new target function block instance is successfully created and the function code block corresponding to the new target function block instance is not a loop-ending function code block, then after pushing the new target function block instance to the function block instance queue, accumulate the number of queue instances according to the number of the new target function block instances and perform a default decrement process on the number of instance executions;
[0317] The second data updating module 111 is further configured to perform a default decrement process on the instance execution quantity if the creation of the new target function block instance fails.
[0318] The specific implementation of the second data updating module 111 can refer to the specific description of step S104 in the embodiment corresponding to FIG. 3 , which will not be described in detail here.
[0319] The data processing device 1 further includes: a table creation module 112 , an instance acquisition module 113 , an instance execution module 114 and a table recording module 115 .
[0320] The table creation module 112 is used to create an execution instance table corresponding to the execution instance while creating the execution instance corresponding to the target workflow; the execution instance table is used to record the execution status of the execution instance;
[0321] The instance acquisition module 113 is configured to sequentially acquire the first function block instance associated with the execution instance in the function block instance queue as the function block instance to be processed; the function block instance to be processed corresponds to a function block instance identifier to be processed and a function block instance index to be processed; the function block instance identifier to be processed and the function block instance index to be processed are generated when the function block instance to be processed is created based on the function code block to be processed; the target function block instance index is used to represent the number of times the function code block to be processed has been executed; the function code block to be processed belongs to at least two function code blocks;
[0322] The instance execution module 114 is used to execute the function block instance to be processed and obtain the target execution result;
[0323] The table recording module 115 is configured to record the target execution result in the execution instance table according to the identifier of the function block instance to be processed and the index of the function block instance to be processed.
[0324] The specific implementation of the table creation module 112 , the instance acquisition module 113 , the instance execution module 114 and the table recording module 115 can refer to the specific description of steps S201 to S205 in the embodiment corresponding to FIG. 7 , which will not be repeated here.
[0325] The function block instance to be processed includes a required data acquisition path;
[0326] The instance execution module 114 includes a container determination unit 1141 and a container execution unit 1142 .
[0327] The container determination unit 1141 is configured to query the idle computing resources of the execution engine containers and determine the execution engine container with the most idle computing resources as the target execution engine container;
[0328] The container execution unit 1142 is used to transfer the function block instance to be processed from the function block instance queue to the target execution engine container, obtain the required data according to the required data acquisition path in the target execution engine container, execute the function block instance to be processed according to the required data, and obtain the target execution result.
[0329] The specific implementation of the container determination unit 1141 and the container execution unit 1142 can refer to the specific description of step S204 in the embodiment corresponding to FIG. 7 , which will not be repeated here.
[0330] The data processing device 1 further includes an identification determination module 116 and an index determination module 117 .
[0331] The identifier determining module 116 is configured to obtain an identifier for uniquely identifying the function code block to be processed as the function block instance identifier to be processed corresponding to the function block instance to be processed when creating the function block instance to be processed corresponding to the function code block to be processed;
[0332] The index determination module 117 is configured to determine the instance index of the function block to be processed as a default index if the instance identifier of the function block to be processed is not found in the execution instance table;
[0333] The index determination module 117 is further configured to obtain the latest historical index associated with the pending function block instance identifier if the pending function block instance identifier is found in the execution instance table, and accumulate the historical indexes to obtain the pending function block instance index.
[0334] The specific implementation of the identification determination module 116 and the index determination module 117 can refer to the optional description of step S205 in the embodiment corresponding to FIG. 7 , which will not be described in detail here.
[0335] Optionally, the trigger module 101 is specifically configured to:
[0336] A trigger request for the target workflow is received, and an execution instance corresponding to the target workflow is created.
[0337] The trigger request includes a web page callback trigger request;
[0338] The trigger module 101 includes: a first trigger unit 1011 .
[0339] The first triggering unit 1011 is configured to receive a webpage callback triggering request for a target workflow and obtain a target token from the webpage callback triggering request;
[0340] The first triggering unit 1011 is further configured to obtain a target workflow from the workflow repository according to the target token;
[0341] The first triggering unit 1011 is further configured to create an execution instance corresponding to the target workflow according to the request parameters included in the webpage callback triggering request.
[0342] The specific implementation of the first trigger unit 1011 can refer to the specific description of step S101 in the embodiment corresponding to FIG3 , which will not be repeated here.
[0343] Wherein, the trigger request includes an instruction request;
[0344] The trigger module 101 includes: a second trigger unit 1012 .
[0345] The second triggering unit 1012 is configured to obtain the instruction request sent by the first object through the callback address, decrypt the instruction request, and obtain the trigger instruction and trigger parameters;
[0346] The second triggering unit 1012 is further configured to obtain a target workflow according to the trigger instruction and verify the triggering authority of the first object according to the triggering parameter;
[0347] The second triggering unit 1012 is further configured to create an execution instance corresponding to the target workflow if the triggering permission of the first object is a qualified permission.
[0348] The specific implementation of the second trigger unit 1012 can refer to the specific description of step S101 in the embodiment corresponding to FIG3 , and will not be repeated here.
[0349] Wherein, the trigger request includes a timer trigger request;
[0350] The trigger module 101 includes: a third trigger unit 1013 .
[0351] The third triggering unit 1013 is configured to receive a timer triggering request for a target workflow and obtain a specified execution time from the timer triggering request;
[0352] The third triggering unit 1013 is further configured to create an execution instance corresponding to the target workflow when the system time is the same as the specified execution time.
[0353] The specific implementation of the third trigger unit 1013 can refer to the specific description of step S101 in the embodiment corresponding to FIG3 , which will not be repeated here.
[0354] Please refer to Figure 16, which is a structural diagram of a computer device provided in an embodiment of the present application. As shown in Figure 16, the data processing device 1 in the embodiment corresponding to Figure 15 above can be applied to a computer device 1000, which may include: a processor 1001, a network interface 1004 and a memory 1005. In addition, the computer device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. Among them, the user interface 1003 may include a display screen (Display), a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or it may be a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 1005 may also be at least one storage device located away from the aforementioned processor 1001. As shown in FIG. 16 , the memory 1005 , which is a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and a device control application program.
[0355] In the computer device 1000 shown in FIG16 , the network interface 1004 provides a network communication element; the user interface 1003 is primarily used to provide an interface for user input; and the processor 1001 can be used to call the device control application stored in the memory 1005 to implement the data processing method described in the embodiments corresponding to either FIG3 or FIG7 above, which will not be repeated here. Furthermore, the beneficial effects of using the same method will not be repeated here.
[0356] In addition, it should be pointed out here that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the data processing device 1 mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, it can execute the description of the data processing method in any of the embodiments corresponding to Figures 3 and 7 above. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application.
[0357] Further, please refer to Figure 17, which is a schematic diagram of the structure of another data processing device provided in an embodiment of the present application. The above-mentioned data processing device can be a computer program (including program code) running on a computer device, for example, the data processing device is an application software; the device can be used to execute the corresponding steps of the method provided in an embodiment of the present application. As shown in Figure 17, the data processing device 2 may include: a first response module 201, a second response module 202, a third response module 203, a fourth response module 204, and a fifth response module 205.
[0358] The first response module 201 is used to respond to the creation operation of the target workflow and display the workflow editing page;
[0359] The second response module 202 is configured to respond to a selection and connection operation on at least two function block controls and display a workflow control tree consisting of at least two function block controls on a workflow editing page; the at least two function block controls include a loop start function block control and a loop end function block control;
[0360] The third response module 203 is configured to respond to a trigger operation on a loop start function block control in the workflow control tree and set loop parameters for the loop start function block control;
[0361] The fourth response module 204 is configured to respond to a creation operation on a workflow control tree, create a target workflow, and send the target workflow to the workflow engine; the target workflow includes function code blocks corresponding to at least two function block controls; the pointing relationship between the at least two function code blocks is determined based on the connection relationship between the at least two function block controls; the at least two function code blocks include a loop start function code block corresponding to the loop start function block control and a loop end function code block corresponding to the loop end function block control;
[0362] The fifth response module 205 is configured to respond to the trigger operation for the target workflow and send a trigger request for the target workflow to the workflow engine.
[0363] Among them, the specific implementation methods of the first response module 201, the second response module 202, the third response module 203, the fourth response module 204 and the fifth response module 205 can be found in the specific description of steps S301 to S305 in the embodiment corresponding to Figure 13 above, and will not be repeated here.
[0364] Optionally, the third response module 203 is specifically configured to:
[0365] In response to a trigger operation on a loop start function block control in a workflow control tree, a loop edit text box is displayed, and in response to an input operation on the loop edit text box, loop parameters are set for the loop start function block control.
[0366] Further, please refer to Figure 18, which is a structural diagram of another computer device provided in an embodiment of the present application. As shown in Figure 18, the data processing device 2 in the embodiment corresponding to Figure 17 above can be applied to a computer device 2000, which may include: a processor 2001, a network interface 2004 and a memory 2005. In addition, the computer device 2000 further includes: a user interface 2003, and at least one communication bus 2002. Among them, the communication bus 2002 is used to realize the connection and communication between these components. Among them, the user interface 2003 may include a display screen (Display), a keyboard (Keyboard), and the optional user interface 2003 may also include a standard wired interface and a wireless interface. The network interface 2004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 2005 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 2005 may also be at least one storage device located away from the aforementioned processor 2001. As shown in FIG. 18 , the memory 2005 , which is a computer-readable storage medium, may include an operating system, a network communication module, a user interface module, and a device control application program.
[0367] In the computer device 2000 shown in FIG18 , the network interface 2004 provides network communication functionality; the user interface 2003 primarily serves as an interface for user input; and the processor 2001 can be used to invoke the device control application stored in the memory 2005 to implement the access control method described in the various embodiments above. It can also execute the data processing device 2 described in the embodiment corresponding to FIG13 above, which will not be repeated here. Furthermore, the beneficial effects of employing the same method will not be repeated here.
[0368] In addition, it should be noted that the embodiments of the present application also provide a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the aforementioned data processing device 2. When the processor loads and executes the computer program, it can perform the description of the access control method described in any of the above embodiments. Therefore, it will not be repeated here. In addition, the description of the beneficial effects of using the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiments involved in this application, please refer to the description of the method embodiments of this application.
[0369] The computer-readable storage medium may be the data processing device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Furthermore, the computer-readable storage medium may also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0370] In addition, it should be noted that embodiments of the present application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method provided in any of the corresponding embodiments described above.
[0371] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device comprising a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.
[0372] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example in terms of network elements. Whether these network elements are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel may use different methods to implement the described network elements for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0373] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A data processing method, executed by a computer device, comprising: Creating an execution instance corresponding to the target workflow; the execution instance includes a pointing relationship between at least two function code blocks included in the target workflow; The at least two function code blocks include a loop start function code block and a loop end function code block; Obtain loop parameters corresponding to the loop start function code block; According to the pointing relationship, determining a function code block between the loop start function code block and the loop end function code block as a loop function code block; The loop function code block is executed cyclically according to the loop parameter and the pointing relationship.
2. The method according to claim 1, characterized in that: The step of obtaining the loop parameters corresponding to the loop start function code block includes: Creating a loop start function block instance corresponding to the loop start function code block, pushing the loop start function block instance to a function block instance queue, and when the loop start function block instance in the function block instance queue is successfully executed, obtaining loop parameters corresponding to the loop start function code block; The loop function code block is executed cyclically according to the loop parameter and the pointing relationship, including: The loop function code block is executed cyclically according to the loop parameter, the function block instance queue and the pointing relationship.
3. The method according to claim 2, wherein the loop parameter is N, and N is a positive integer greater than or equal to 1; and the loop function code block is executed cyclically according to the loop parameter, the function block instance queue, and the pointing relationship, comprising: During the kth round of iterative execution of the loop function code block, a list of function code blocks to be executed pointed to by the loop start function code block is determined according to the pointing relationship; k is a positive integer less than or equal to N; If the list of function code blocks to be executed does not contain the loop-ending function code block, and the target function code block instance to be executed corresponding to the target function code block to be executed in the function block instance queue is executed successfully, then a new list of function code blocks to be executed pointed to by the target function code block to be executed is determined according to the pointing relationship until it is determined that the kth round of iterative execution for the loop function code block is completed; the target function code block to be executed is a function code block in the list of function code blocks to be executed; If k is less than N, the k+1th round of iteration execution is continued for the loop function code block.
4. The method according to claim 3, further comprising: If the new list of function code blocks to be executed includes the loop-ending function code block, query the loop-ending function block instance queue; if the loop-ending function block instance queue is an empty queue, push the loop-ending function block instance corresponding to the loop-ending function code block to the loop-ending function block instance queue; If it is detected that the execution data of the execution instance meets the execution end condition, it is determined that the kth round of iteration execution for the loop function code block is completed; When it is determined that the Nth round of iterative execution for the loop function code block is completed, pushing the loop end function block instance in the loop end function block instance queue to the function block instance queue, and detecting new execution data of the execution instance; If it is detected that the new execution data meets the execution end condition and the loop end function block instance queue is an empty queue, it is determined that the execution of the at least two function code blocks is completed.
5. The method according to any one of claims 1 to 4, characterized in that: The execution data of the execution instance includes the number of queue instances and the number of instance executions; The method further comprises: While creating the execution instance, initializing the number of queue instances to a first default parameter, and initializing the number of instance executions to a second default parameter; According to the execution status of the function block instance associated with the execution instance, the number of the queue instances is accumulated or decreased, and the number of instance executions is accumulated or decreased; If it is detected that the number of queue instances is equal to the first default parameter and the number of instance executions is equal to the second default parameter, it is determined that the execution data of the execution instance is detected to meet the execution end condition.
6. The method of claim 5, wherein the function block instance associated with the execution instance comprises a target function block instance; The step of adding or subtracting the number of queue instances and adding or subtracting the number of instance executions according to the execution state of the function block instance associated with the execution instance includes: When the target function block instance is pushed into the function block instance queue, accumulating the queue instance data; When the target function block instance in the function block instance queue is executed, the instance execution quantity is accumulated by default, and the queue instance quantity is decremented by default.
7. The method according to claim 6, further comprising: When the target function block instance is executed, determining the creation status of a new target function block instance; If the new target function block instance is created successfully, and the function code block corresponding to the new target function block instance is the loop end function code block, the execution quantity of the instance is decremented by default; If the new target function block instance is created successfully, and the function code block corresponding to the new target function block instance is not the loop end function code block, then after the new target function block instance is pushed to the function block instance queue, the number of queue instances is accumulated according to the number of the new target function block instances, and the number of instance executions is decremented by default; If the creation of the new target function block instance fails, the instance execution quantity is decremented by default.
8. The method according to any one of claims 2 to 7, further comprising: While creating the execution instance corresponding to the target workflow, creating an execution instance table corresponding to the execution instance; The execution instance table is used to record the execution status of the execution instance; Sequentially obtain the first function block instance associated with the execution instance in the function block instance queue as the function block instance to be processed; the function block instance to be processed corresponds to the function block instance identifier to be processed and the function block instance index to be processed; the function block instance identifier to be processed and the function block instance index to be processed are generated when the function block instance to be processed is created according to the function code block to be processed; The target function block instance index is used to represent the number of executions of the to-be-processed function code block; the to-be-processed function code block belongs to the at least two function code blocks; Execute the function block instance to be processed to obtain a target execution result; The target execution result is recorded in the execution instance table according to the to-be-processed function block instance identifier and the to-be-processed function block instance index.
9. The method according to claim 8, wherein the function block instance to be processed comprises a required data acquisition path; The executing the function block instance to be processed to obtain a target execution result includes: Query the idle computing resources of the execution engine container, and determine the execution engine container with the most idle computing resources as the target execution engine container; The function block instance to be processed is transferred from the function block instance queue to the target execution engine container, the demand data is obtained in the target execution engine container according to the demand data acquisition path, the function block instance to be processed is executed according to the demand data, and the target execution result is obtained.
10. The method according to claim 8 or 9, further comprising: When creating the to-be-processed function block instance corresponding to the to-be-processed function code block, obtaining an identifier for uniquely identifying the to-be-processed function code block as the to-be-processed function block instance identifier corresponding to the to-be-processed function block instance; If the to-be-processed function block instance identifier is not found in the execution instance table, determining that the to-be-processed function block instance index is a default index; If the function block instance identifier to be processed is found in the execution instance table, the historical index with the latest record time associated with the function block instance identifier to be processed is obtained, and the historical index is accumulated to obtain the function block instance index to be processed.
11. The method according to any one of claims 1 to 10, wherein the step of creating an execution instance corresponding to the target workflow comprises: A trigger request for the target workflow is received, and an execution instance corresponding to the target workflow is created.
12. The method according to claim 11, wherein the trigger request comprises a web page callback trigger request; The receiving a trigger request for the target workflow and creating an execution instance corresponding to the target workflow includes: Receiving the webpage callback trigger request for the target workflow, and obtaining a target token from the webpage callback trigger request; Acquire the target workflow in a workflow repository according to the target token; An execution instance corresponding to the target workflow is created according to the request parameters included in the webpage callback trigger request.
13. The method according to claim 11, wherein the trigger request comprises an instruction request; The receiving a trigger request for the target workflow and creating an execution instance corresponding to the target workflow includes: Obtain the instruction request sent by the first object through the callback address, decrypt the instruction request, and obtain the trigger instruction and trigger parameters; Acquire the target workflow according to the trigger instruction, and verify the trigger permission of the first object according to the trigger parameter; If the triggering permission of the first object is a qualified permission, an execution instance corresponding to the target workflow is created.
14. The method according to claim 11, wherein the trigger request comprises a timer trigger request; The receiving a trigger request for the target workflow and creating an execution instance corresponding to the target workflow includes: receiving the timer trigger request for the target workflow, and obtaining a specified execution time from the timer trigger request; When the system time is the same as the specified execution time, an execution instance corresponding to the target workflow is created.
15. A data processing method, executed by a computer device, comprising: In response to a creation operation on a target workflow, a workflow editing page is displayed; In response to a selection and connection operation for at least two function block controls, a workflow control tree consisting of the at least two function block controls is displayed on the workflow editing page; the at least two function block controls include a loop start function block control and a loop end function block control; In response to a triggering operation on the loop start function block control in the workflow control tree, setting loop parameters for the loop start function block control; In response to the creation operation on the workflow control tree, a target workflow is created, and the target workflow is sent to the workflow engine; The target workflow includes function code blocks corresponding to the at least two function block controls respectively; the pointing relationship between the at least two function code blocks is determined according to the connection relationship between the at least two function block controls; the at least two function code blocks include a loop start function code block corresponding to the loop start function block control and a loop end function code block corresponding to the loop end function block control; In response to the trigger operation for the target workflow, a trigger request for the target workflow is sent to the workflow engine.
16. A data processing device, comprising: A trigger module, used to create an execution instance corresponding to the target workflow; the execution instance includes a pointing relationship between at least two function code blocks included in the target workflow; The at least two function code blocks include a loop start function code block and a loop end function code block; A loop start module, used for obtaining loop parameters corresponding to the loop start function code block; A loop confirmation module, used for determining, according to the pointing relationship, a function code block between the loop start function code block and the loop end function code block as a loop function code block; The loop execution module is used to loop execute the loop function code block according to the loop parameter and the pointing relationship.
17. A data processing device, comprising: A first response module is used to respond to the creation operation for the target workflow and display the workflow editing page; A second response module is used to respond to the selection and connection operation of at least two function block controls, and display a workflow control tree consisting of at least two function block controls on the workflow editing page; the at least two function block controls include a loop start function block control and a loop end function block control; A third response module is used to respond to the trigger operation of the loop start function block control in the workflow control tree and set loop parameters for the loop start function block control; A fourth response module, used to respond to the creation operation on the workflow control tree, create a target workflow, and send the target workflow to the workflow engine; The target workflow includes function code blocks corresponding to at least two function block controls; the pointing relationship between the at least two function code blocks is determined according to the connection relationship between the at least two function block controls; the at least two function code blocks include a loop start function code block corresponding to the loop start function block control and a loop end function code block corresponding to the loop end function block control; The fifth response module is used to respond to the trigger operation for the target workflow and send the trigger request for the target workflow to the workflow engine.
18. A computer device comprising: Processor, memory, and network interface; The processor is connected to the memory and the network interface, wherein the network interface is used to provide a data communication function, the memory is used to store program code, and the processor is used to call the program code to execute the method described in any one of claims 1-15.
19. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, wherein the computer program is suitable for being loaded by a processor and executing the method according to any one of claims 1 to 15.
20. A computer program product, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the method according to any one of claims 1 to 15 can be executed.
