Task flow execution method, device, computer readable medium and electronic device
By starting and managing task processes in the business process engine, and combining the instructions of the distributed task scheduling platform for circulation and retry, the problems of low task circulation efficiency and lack of unifiedness are solved, and efficient and reliable task circulation and scheduling are achieved. , expanding applicable scenarios.
Patent Information
- Application Number
- CN202311341790.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-17
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2043-10-17
AI Technical Summary
When the task flow is abnormal or slow, the existing task flow technology is inefficient and easily leads to failure of the flow. It lacks a unified solution for task flow and scheduling, and has limited applicable scenarios.
By receiving task process creation requests in the predetermined business process engine, starting the target task process, and performing flow and retry operations based on the task scheduling instructions of the distributed task scheduling platform, using multi-threaded pool to retry concurrently, dynamically update the data table, and monitoring Process node, configure retry parameters and alarm mechanisms to achieve efficient and reliable flow of task processes.
It improves the efficiency and reliability of the task process, realizes the integration of task circulation and scheduling, expands applicable scenarios, and can be applied in different task circulation and scheduling scenarios, reducing the possibility of circulation failure.
Smart Images

Figure CN117076096B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of task flow, and in particular to a method, device, computer-readable medium and electronic device for executing a task flow. Background Art
[0002] At present, the solution to realize task flow is mainly to build a system based on a workflow engine or a process engine, and then transfer the task process through the system.
[0003] However, in this way, we can only hope that the task process can flow normally and quickly. Once the task process flows abnormally or slowly, the efficiency of the task process will be greatly reduced, which will often eventually lead to the failure of the task process flow. Summary of the invention
[0004] The embodiments of the present application provide a method, device, computer-readable medium and electronic device for executing a task flow, thereby enabling the task flow to flow normally and efficiently, at least to a certain extent.
[0005] Other features and advantages of the present application will become apparent from the following detailed description, or may be learned in part by the practice of the present application.
[0006] According to one aspect of an embodiment of the present application, a method for executing a task flow is provided, the method comprising: receiving a task flow creation request, and starting a target task flow in a predetermined business flow engine based on the task flow definition information carried in the task flow creation request; circulating the target task flow through the predetermined business flow engine to execute operations corresponding to each node of the target task flow; receiving a task scheduling instruction from a predetermined distributed task scheduling platform, the task scheduling instruction comprising task scheduling parameters configured for the predetermined distributed task scheduling platform, the task scheduling parameters comprising at least one of the following: a task retry object, a task retry mode; if it is determined according to the task scheduling parameters in the task scheduling instruction that a retry operation needs to be performed on a target node of the target task flow, then re-executing the operation corresponding to the target node of the target task flow in the predetermined business flow engine according to the task scheduling parameters, and continuing to circulate the target task flow starting from the target node.
[0007] According to one aspect of an embodiment of the present application, a task flow execution device is provided, the device comprising: a flow starting unit, for receiving a task flow creation request, and starting a target task flow in a predetermined business flow engine based on the task flow definition information carried in the task flow creation request; a circulation unit, for circulating the target task flow through the predetermined business flow engine to execute operations corresponding to each node of the target task flow; a receiving unit, for receiving a task scheduling instruction from a predetermined distributed task scheduling platform, the task scheduling instruction comprising task scheduling parameters configured for the predetermined distributed task scheduling platform, the task scheduling parameters comprising at least one of the following: a task retry object, a task retry mode; a task retry unit, for re-executing the operation corresponding to the target node of the target task flow in the predetermined business flow engine according to the task scheduling parameters if it is determined according to the task scheduling parameters in the task scheduling instruction that a retry operation needs to be performed on the target node of the target task flow, and continuing to circulate the target task flow starting from the target node.
[0008] In some embodiments of the present application, based on the aforementioned scheme, the task retry unit is configured to: determine a target thread from multiple threads in a pre-created thread pool, and the multiple threads are used to perform retry operations on multiple task processes concurrently; through the target thread, re-execute the operation corresponding to the target node of the target task process in the predetermined business process engine according to the task scheduling parameters.
[0009] In some embodiments of the present application, based on the aforementioned scheme, the device also includes an acquisition and update unit; after re-executing the operation corresponding to the target node of the target task process in the predetermined business process engine according to the task scheduling parameters through the target thread, the acquisition and update unit is used to: obtain the execution result corresponding to the first task process that completes the retry operation each time, and update the data table corresponding to the task process according to the execution result.
[0010] In some embodiments of the present application, based on the aforementioned scheme, the device also includes a monitoring unit; before receiving a task scheduling instruction from a predetermined distributed task scheduling platform, the monitoring unit is used to: monitor each task process flowing through the predetermined business process engine, and display the monitoring results, wherein the monitoring results include the number of task processes currently flowing to each node, and the task scheduling parameters are configured by the user for the predetermined distributed task scheduling platform based on the monitoring results.
[0011] In some embodiments of the present application, based on the aforementioned scheme, the task retry object includes at least one of the following: a specified task flow, a task flow in a specified state, a task flow flowing within a specified time range, a task flow associated with a specified data table, and a node of the task flow; the task retry method includes at least one of the following: the time interval for retries, the index used for data table query during retry, the number of task flows to be retried each time, and the maximum number of times the task flow is retried.
[0012] In some embodiments of the present application, based on the aforementioned scheme, the task retry method includes the maximum number of retries for the task process, and the device also includes an alarm unit; after re-executing the operation corresponding to the target node of the target task process according to the task scheduling parameters in the predetermined business process engine, the alarm unit is used to: if the number of retries for the target task process reaches the maximum number of retries for the target task process, then send an alarm message to at least one of the following persons: relevant personnel of the target task process and relevant personnel of the target node.
[0013] In some embodiments of the present application, based on the aforementioned scheme, the device also includes a data migration unit; the flow unit is configured to: flow the target task process through the predetermined business process engine, and record the data related to the target task process in the active data table corresponding to the target task process during the flow; after starting from the target node and continuing to flow the target task process, the data migration unit is used to: when the flow of the target task process is completed, migrate the data related to the target task process recorded in the active data table to the historical data table.
[0014] In some embodiments of the present application, based on the aforementioned scheme, the task retry unit is configured as follows: if it is determined according to the task scheduling parameters in the task scheduling instruction that a retry operation needs to be performed on the nodes of multiple task flows including the target task flow, the nodes of each task flow are added to the retry queue; the retry step is executed in a loop, and the retry step includes: taking out the tasks corresponding to the nodes of several task flows from the head of the retry queue in turn each time, and retrying the nodes of the several task flows in the predetermined business process engine according to the tasks corresponding to the nodes of the several task flows; if at least one of the nodes of the several task flows has not completed the retry operation, the task corresponding to the node of the at least one task flow is re-added to the tail of the retry queue.
[0015] In some embodiments of the present application, based on the aforementioned solution, the task process definition information is generated by a flowchart drawing platform according to a flowchart drawn by a user in the flowchart drawing platform.
[0016] According to one aspect of an embodiment of the present application, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for executing the task flow described in the above embodiment is implemented.
[0017] According to one aspect of an embodiment of the present application, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the execution method of the task flow as described in the above embodiments.
[0018] According to one aspect of an embodiment of the present application, a computer program product is provided, which includes computer instructions, and the computer instructions 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 task flow execution method described in the above embodiments.
[0019] In the technical solutions provided in some embodiments of the present application, upon receiving a task flow creation request, the target task flow is started in a predetermined business process engine based on the task flow definition information carried in the request, thereby automatically circulating the target task flow in the predetermined business process engine. After receiving a task scheduling instruction carrying task scheduling parameters sent by a predetermined distributed task scheduling platform, the task flow and its nodes that need to be retried can be determined according to the task scheduling parameters, and then the operations corresponding to the target nodes of the target task flow can be re-executed to achieve retry of the target task flow and its target nodes. Even if the target task flow encounters abnormal or slow flow when flowing to the target node, the possibility of task flow failure can be greatly reduced by retrying, so that the task flow can flow normally and efficiently.
[0020] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the specification are used to explain the principles of the present application. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0022] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiments of the present application can be applied is shown.
[0023] Figure 2 A schematic diagram of a data production flow chart according to an embodiment of the present application is shown.
[0024] Figure 3 A flowchart of a method for executing a task flow according to an embodiment of the present application is shown.
[0025] Figure 4 A block diagram showing a system architecture according to an embodiment of the present application is shown.
[0026] Figure 5 A schematic diagram of an overall process according to an embodiment of the present application is shown.
[0027] Figure 6 A schematic diagram of a Flowable flowchart according to an embodiment of the present application is shown.
[0028] Figure 7 An embodiment according to the present application is shown. Figure 3 Flowchart of steps before step 340 in an embodiment.
[0029] Figure 8 An embodiment according to the present application is shown. Figure 3 Flowchart of details of step 350 in an embodiment.
[0030] Fig. 9 An embodiment according to the present application is shown. Figure 8 Flowchart of steps after step 352 in an embodiment.
[0031] Fig.10 An embodiment according to the present application is shown. Figure 3 Details of step 320 and a flow chart of steps after step 350 in an embodiment.
[0032] Fig.11 A timing call diagram according to an embodiment of the present application is shown.
[0033] Fig.12 A block diagram of a device for executing a task flow according to an embodiment of the present application is shown.
[0034] Fig.13 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown. DETAILED DESCRIPTION
[0035] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this application will be more comprehensive and complete and fully convey the concept of the example embodiments to those skilled in the art.
[0036] In addition, described feature, structure or characteristic can be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present application. However, those skilled in the art will appreciate that the technical scheme of the present application can be put into practice without one or more of the specific details, or other methods, components, devices, steps, etc. can be adopted. In other cases, known methods, devices, realizations or operations are not shown or described in detail to avoid blurring the various aspects of the application.
[0037] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0038] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0039] In the related technology, a system is mainly developed based on a process engine such as Activiti, and the task process flows in the system.
[0040] However, this method cannot guarantee the reliability of task process flow, will reduce the efficiency of task process flow, and fails to achieve the unification of task process flow and task scheduling, resulting in relatively few applicable scenarios and difficulty in promoting and applying it to different task process flow scheduling scenarios.
[0041] To this end, the present application first provides a method for executing a task flow. The method for executing a task flow provided based on the embodiment of the present application can overcome the above-mentioned defects, not only can the task flow be efficiently and reliably transferred, but also the transfer of the task flow and the integration of the scheduling of the task flow can be realized, thereby greatly expanding the applicable scenarios, and can be easily promoted and applied to different task flow transfer scheduling scenarios.
[0042] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solution of the embodiment of the present application can be applied is shown. Figure 1 As shown, the system architecture 100 may include a user terminal 110 and a cloud 120. The cloud 120 specifically includes a task service background server 121, a database server 122, and an XXL-JOB background service cluster 123. The XXL-JOB background service cluster 123 specifically includes a scheduling center server 1231 and an executor server 1232. The user terminal 110 communicates with the cloud 120 through a communication link. The scheduling center server 1231 and the executor server 1232, the XXL-JOB background service cluster 123 and the task service background server 121, and the task service background server 121 and the database server 122 can all communicate. The task service background server 121 is deployed with a task service background based on the business process engine Flowable, and the database server 122 is deployed with a database. The scheduling center server 1231 includes a scheduling center in the XXL-JOB distributed task scheduling platform, and the executor server 1232 includes an executor in the XXL-JOB distributed task scheduling platform. The task service backend server 121 is the execution subject of the embodiment of the present application. When the execution method of a task flow provided by the embodiment of the present application is applied to Figure 1In the system architecture shown, a process may be as follows: first, the user draws a Flowable flowchart through a platform for drawing Flowable flowcharts according to business needs, and exports the Flowable flowchart as task process definition information in XML format; then, the user uses the user terminal 110 to access the cloud 120, enters the front-end page provided by the scheduling center on the scheduling center server 1231, creates a task corresponding to the target task process, and configures the parameters of the task, such as binding the task to the executor on the executor server 1232, and also configures the task scheduling parameters, such as setting the target task process as a task process that needs to be retried; then, the user uses the user terminal 110 to send a task process creation request to the task service backend of the task service backend server 121 of the cloud 120, and sends the task process definition information in XML format to the task service backend server 121 through the task process creation request. Service background server 121, task service background server 121 sends the task flow definition information to the database on database server 122 for storage, so that the task service background creates and starts the corresponding target task flow, and the target task flow begins to circulate; then, the scheduling center of the scheduling center server 1231 sends a scheduling request carrying task scheduling parameters to the executor on the executor server 1232 according to the task parameters; next, after the executor receives the scheduling request, the executor server 1232 sends the task scheduling parameters to the task service background server 121, and the corresponding JobHandler on the task service background server 121 performs a retry operation on the target node of the target task flow according to the task scheduling parameters, wherein the JobHandler inherits the IJobHandler class provided by XXL-JOB and is implemented by overriding the execute method of this class.
[0043] In some embodiments of the present application, a thread pool including multiple threads is created on the task service background server 121, and the task service background server 121 selects a thread from the thread pool to run the JobHandler to perform the retry operation.
[0044] In some embodiments of the present application, the task service backend server 121 queries the database on the database server 122 according to the task scheduling parameters to determine whether a retry operation needs to be performed on the target node of the target task flow.
[0045] In some embodiments of the present application, during the flow of the target task process, the task service background server 121 will dynamically update the data table corresponding to the target task process in the database of the database server 122 .
[0046] It should be understood that Figure 1The number of user terminals, task service backend servers and database servers included in the cloud, and the number of dispatch center servers and executor servers included in the XXL-JOB backend service cluster are only illustrative. According to the implementation needs, any number of user terminals can be set, the cloud can include any number of task service backend servers and database servers, and the XXL-JOB backend service cluster can include any number of dispatch center servers and executor servers. For example, the task service backend server and database server can be a server cluster composed of multiple servers, and the dispatch center and executor can also be deployed in a cluster.
[0047] It should be noted that Figure 1 The embodiment shown is only one embodiment of the present application. Figure 1 In the embodiment, the user terminal is a desktop computer, but in other embodiments of the present application, the user terminal may also be a smart phone, a tablet computer, a vehicle-mounted terminal, a portable wearable device, a workstation, a cloud server, and other types of devices; Figure 1 In the solution of the embodiment, Flowable, a business process engine, and XXL-JOB, a distributed task scheduling platform, are used. However, in other embodiments of the present application, various other types of business process engines and distributed task scheduling platforms may also be used. Figure 1 The solution of the embodiment is to draw the Flowable flowchart first and then export it as task flow definition information, but in other embodiments of the present application, the task flow definition information can also be directly created by the user, and even the task flow definition information can be generated by the large language model according to the user's instructions. The embodiment of the present application does not make any limitation to this, and the protection scope of the present application should not be limited in any way.
[0048] It is easy to understand that the execution method of the task flow provided in the embodiment of the present application is generally executed by the server, and accordingly, the execution device of the task flow is generally arranged in the server. However, in other embodiments of the present application, the terminal device may also have similar functions as the server, so as to execute the execution scheme of the task flow provided in the embodiment of the present application.
[0049] Therefore, the embodiments of the present application can be applied to a terminal or a server. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or 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 terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, and this application is not limited here.
[0050] The solution of the embodiment of the present application can be applied to the field of cloud computing. Cloud computing is a computing model that distributes computing tasks on a resource pool composed of a large number of computers, so that various application systems can obtain computing power, storage space and information services as needed. The network that provides resources is called a "cloud". The resources in the "cloud" are infinitely expandable in the eyes of users, and can be obtained at any time, used on demand, expanded at any time, and paid for by use.
[0051] As a cloud computing basic capability provider, a cloud computing resource pool (referred to as a cloud platform, generally referred to as IaaS (Infrastructure as a Service)) will be established, and various types of virtual resources will be deployed in the resource pool for external customers to choose to use. The cloud computing resource pool mainly includes: computing devices (virtualized machines, including operating systems), storage devices, and network devices.
[0052] According to the logical function division, the PaaS (Platform as a Service) layer can be deployed on the IaaS (Infrastructure as a Service) layer, and the SaaS (Software as a Service) layer can be deployed on the PaaS layer. SaaS can also be deployed directly on IaaS. PaaS is a platform for software operation, such as databases, web containers, etc. SaaS is a variety of business software, such as web portals, SMS mass senders, etc. Generally speaking, SaaS and PaaS are upper layers relative to IaaS.
[0053] The task flow execution method provided in the embodiment of the present application can be applied to various industry fields involving task flow, such as data production, process approval, project management, administrative services, etc., and is particularly suitable for high-concurrency task flows that require fast flow and retries.
[0054] Figure 2 A schematic diagram of a data production flow chart according to an embodiment of the present application is shown. Figure 2 As shown, the data production flow chart includes multiple nodes such as data collection, data operation, quality inspection, etc., which require a fast flow of task processes. Therefore, it is particularly suitable for using the task process execution method provided in the embodiment of the present application.
[0055] The implementation details of the technical solution of the embodiment of the present application are described in detail below:
[0056] Figure 3 The flowchart of the execution method of the task flow according to an embodiment of the present application is shown. The execution method of the task flow can be executed by various devices capable of computing and processing, such as user terminals or cloud servers. User terminals include but are not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle terminals, aircraft, smart watches, etc. Please refer to Figure 3 As shown, the execution method of the task flow may at least include the following steps:
[0057] In step 310, a task flow creation request is received, and a target task flow is started in a predetermined business process engine based on the task flow definition information carried in the task flow creation request.
[0058] The predetermined business process engine may be various business process engines such as Flowable. Flowable is a lightweight business process engine written in Java. The Flowable process engine can be used to deploy BPMN (Business Process Modeling Notation) 2.0 process definitions (an industry XML standard for defining processes), create process instances of these process definitions, perform queries, and access running or historical process instances and related data.
[0059] In the embodiment of the present application, it is first necessary to build the application project, that is, to build the entire system.
[0060] Figure 4 FIG. 1 is a block diagram showing a system architecture according to an embodiment of the present application. Figure 4 As shown, the system architecture shown is the system architecture of the system that needs to be constructed in the embodiment of the present application, and the entire system is a service.
[0061] Figure 5 Schematic diagram of the overall process according to an embodiment of the present application is shown. Figure 5 As shown, it includes the following processes:
[0062] Step 510, build the system front end, system back end and Flowable database by integrating SpringBoot, XXL-JOB and Flowable.
[0063] Spring Boot is a Java-based open source framework for quickly creating independent and runnable Spring applications. It is designed based on Spring 4.0, which not only inherits the original excellent features of the Spring framework, but also further simplifies the entire construction and development process of Spring applications and provides many out-of-the-box functions and features.
[0064] XXL-JOB is a lightweight distributed task scheduling platform, whose core design goal is to develop quickly, learn easily, be lightweight and easy to expand. It is now open source and connected to the online product lines of many companies, ready to use out of the box.
[0065] See also Figure 4As shown, the system front end includes the task management front end and the XXL-JOB front end, and the system back end includes the task service back end and the XXL-JOB back end. The task management front end can be used to interact with the task service back end, and the XXL-JOB front end can be used to interact with the XXL-JOB back end. The steps of the method provided in the embodiment of the present application can be executed by the task service back end, and the task service back end can be developed based on the predetermined business process engine Flowable. Specifically, the task service back end includes modules such as data access, public dependencies, configuration center, request components, service scheduling, task management, scheduled tasks, and log services. Among them, the data access module is a component for accessing the database; the common dependency module is some common dependent lib libraries and middleware of various modules of the system; the configuration center module is used to configure the system, such as the URL address of the configuration request, the configuration information during the program running process, etc.; the request component module is used to encapsulate the request method, and can support the HTTP protocol and Kafka protocol; the service scheduling module includes a multi-threaded and high-concurrency scheduling strategy based on the thread pool; the task management module is used to perform task query, collection, editing, submission and other operations; the scheduled task module is used to initiate tasks or retry certain links of the task according to demand; the log service module is used to collect logs generated by the application, and some log information can be used for alarm management. The XXL-JOB backend includes multiple modules such as the registration center, the scheduling center, the routing strategy and the executor. The registration center module is used to register the executor, and the executor registers the task. The scheduling center module adopts a centralized design, supports cluster deployment, and ensures high availability. It is used to send scheduling requests to the executor to schedule tasks. The routing strategy module is a variety of routing strategies provided when the executor is deployed in a cluster, such as the first, polling, random, LRU, LFU, etc., where "first" refers to the fixed selection of the first machine in the cluster, "polling" refers to the selection of machines in the cluster in turn, and "random" refers to the random selection of online machines in the cluster. LRU (LEAST_RECENTLY_USED) refers to the priority selection of the machine that has not been used in the cluster for the longest time, and LFU (LEAST_FREQUENTLY_USED) refers to the priority selection of the machine with the lowest frequency of use in the cluster. The executor module is the executor used to execute tasks, which can distribute and execute tasks. One executor can set multiple tasks, and one executor can be deployed in a cluster.
[0066] In actual application, XXL-JOB and Flowable can be completely decoupled, and XXL-JOB can be used as a service center to provide unified services to multiple task service backends built on Flowable.
[0067] Figure 4The components used in the system shown include Redis, Mysql, Kafka, and Zookeeper. Redis is used to cache user data, which can be used for permission verification; Mysql is used to store task data, scheduling data, configuration data, etc. The aforementioned Flowable database can be Mysql; Kafka is used to interact with other services, such as sending requests and receiving return data; Zookeeper is used to achieve coordinated synchronization of applications. Figure 4 The system shown also includes infrastructure, including image repositories, deployment pipelines, containers, and service discovery. The image repository is used to store, manage, and distribute service images; the deployment pipeline is used to automate code submission, building, and deployment, and to release programs with one click; the container is a container platform based on native Kubernetes, including release management, log monitoring, and other functions; service discovery is used to register system services.
[0068] The following is a detailed introduction on how to start the target task process.
[0069] In one embodiment of the present application, the task process definition information is generated by a flowchart drawing platform according to a flowchart drawn by a user in the flowchart drawing platform.
[0070] Please continue to see Figure 5 As shown, after step 510, the following process may be included:
[0071] Step 520, draw a Flowable flowchart according to the business process, and configure process node parameters, process variables, task monitors, etc.
[0072] The flowchart drawing platform can be a platform for users to draw Flowable flowcharts. Such a platform can be built in advance, and users can draw Flowable flowcharts on the platform according to business needs or business processes. The Flowable flowchart is a BPMN flowchart. Then, an XML file based on the BPMN standard can be exported from the platform. The XML file is the task process definition information.
[0073] Figure 6 FIG. 1 is a schematic diagram showing a Flowable flow chart according to an embodiment of the present application. Figure 6As shown in the figure, each rounded rectangular element in the Flowable flowchart is a node of the task flow, that is, a link of the task flow; the top circle is an empty start event, which is the entry point of the task flow, and the bottom circle is an empty end event, which is the end point of the task flow. The upper right corner of the operation 1 node contains a user icon, indicating that the node is a user task, which may require related services or related tasks to process. User tasks are used to model tasks that require manual execution. When the process execution reaches the user task, a new task is created for the task list of the user or group assigned to the task. The upper right corner of other nodes such as operation 2 contains a V-shaped icon, which means that these nodes are HTTP tasks, indicating that these links can automatically call a certain HTTP interface to implement related logical processing. This type of node is also compatible with the Kafka protocol and can send Kafka messages to the service provider in the corresponding link, making this solution more flexible.
[0074] Process node parameters can include the node task ID, name, description information, etc., where the node task ID is the unique ID set for the node. Process variables are data in the process instance and can be used in many places in the process (for example, exclusive gateways often use process variables to determine the next path to take in the process). In addition, it is also necessary to configure information such as sequence flow in the Flowable flowchart.
[0075] It is also necessary to set up a task listener for each node. The task monitor is used to execute custom Java logic or expressions when a specific task-related event occurs. The task monitor can include properties such as the task event type that triggers the task monitor and the delegate class that needs to be called. The delegate class that needs to be called must implement the TaskListener interface of the Flowable framework, that is, rewrite the Notify method of the TaskListener interface to implement the business logic required by itself. When the task process flows to a certain node, the task monitor will detect the event corresponding to the task event type of the task monitor, and automatically call the Notify method of the TaskListener interface of the Flowable framework to implement the corresponding business logic.
[0076] Step 530, perform service-related configuration, including XXL-JOB scheduling parameters, task links, retry parameters and other configurations.
[0077] A task link is a node in the task process.
[0078] Specifically, the Flowable framework needs to be configured as follows: implement and override the Notify method of the TaskListener interface provided by Flowable, and use this method to obtain the identifier of the node task, the node to which the current task process flows, the current status of the task process, the creation time and update time of the task process, etc.; use an enumeration for each node of the task process, and configure a corresponding Service in the enumeration. When the task process flows to this link, call the Process method corresponding to this Service in the Notify method, execute the corresponding code logic, and realize the flow and scheduling of the task process.
[0079] pass Figure 4 The XXL-JOB front end shown can configure the parameters of the task and the task scheduling parameters, so as to achieve the scheduled initiation of the task process or retry of the task process. Specifically, after completing the construction of XXL-JOB, first add a new executor through the executor management page provided by the XXL-JOB front end, and then configure the parameters of the task and the task scheduling parameters through the new task page provided by the XXL-JOB front end. Among them, the parameters of the task may include configuring the executor, configuring the task, routing strategy, operation mode, blocking processing strategy, task timeout, JobHandler, etc. JobHandler refers to the component used to execute tasks in the XXL-JOB distributed task scheduling platform. The blocking processing strategy is the processing strategy when the executor is too late to process due to too intensive scheduling. Specifically, it may include: single-machine serial, discarding subsequent scheduling, overwriting previous scheduling, etc.; the task scheduling parameters can be customized by extending XXL-JOB according to business needs. The task scheduling parameters will be described in detail below.
[0080] Combine the following Figure 5 Step 540 introduces step 310.
[0081] Step 540, upload the flowchart to the service database, initiate the task process according to business characteristics or certain rules, and the task begins to flow automatically.
[0082] The service database is the aforementioned Flowable database.
[0083] The process can be initiated by calling the StartProcessInstanceByKey method of the RuntimeService class of Flowable. This overloaded method can pass in different parameters as needed, such as the unique ID of the flowchart (String), the task ID (String), the process variables (Map) that need to be brought into the process, etc.
[0084] The flowchart here is the task process definition information in XML format. When the task process definition information is recorded in the Flowable database, the target task process will be started. The target task process is a process instance corresponding to the task process definition information.
[0085] Please continue to see Figure 3 In step 320, the target task process is transferred through a predetermined business process engine to execute operations corresponding to each node of the target task process.
[0086] After the target task flow is initiated, whenever the flow is transferred to a node of the target task flow, the relevant operations will be automatically executed according to the configuration information in the task flow definition information. For example, when the flow is transferred to the HTTP task node, the service call will be made according to the URL configured for the node, and the relevant logic processing will be performed after the callee returns the call result.
[0087] Please continue to see Figure 5 As shown, after step 540, the following steps may also be included:
[0088] Step 550, automatically retry the task link, monitor the entire task process, adjust the task scheduling parameters, and handle task abnormality alarms.
[0089] Combine the following Figure 3 The illustrated embodiment is described in detail.
[0090] In step 340, a task scheduling instruction is received from a predetermined distributed task scheduling platform, the task scheduling instruction includes task scheduling parameters configured for the predetermined distributed task scheduling platform, and the task scheduling parameters include at least one of the following: a task retry object and a task retry mode.
[0091] The predetermined distributed task scheduling platform may be the XXL-JOB distributed task scheduling platform.
[0092] Figure 7 An embodiment according to the present application is shown. Figure 3 Flowchart of the steps before step 340 in the embodiment. Before introducing step 340, step 330 is introduced first. Figure 7 As shown, before receiving the task scheduling instruction from the predetermined distributed task scheduling platform, the method may include the following steps:
[0093] In step 330, each task process flowing through the predetermined business process engine is monitored, and the monitoring result is displayed, wherein the monitoring result includes the number of task processes currently flowing to each node.
[0094] Specifically, multiple task processes initiated based on the same task process definition information can be circulated through a predetermined business process engine, and different task processes can be circulated to the same node at the same time, so that they can be monitored. Specifically, assuming that three task processes numbered 1, 2, and 3 are circulated through a predetermined business process engine, and these three task processes all include the three nodes A, B, and C, then, if at a certain moment, the task processes numbered 1 and 2 flow to node A, and the task process numbered 3 flows to node B, then the monitoring result can be that the number of task processes currently flowing to node A is 2, and the number of task processes currently flowing to node B is 1. In this way, full-process monitoring of task processes can be achieved.
[0095] In one embodiment of the present application, the task scheduling parameters are configured by the user on a predetermined distributed task scheduling platform according to monitoring results.
[0096] Specifically, since the task scheduling parameters have been configured in advance for the predetermined distributed task scheduling platform, the task scheduling parameters configured in the embodiment of the present application can be obtained by the user by adjusting and updating the configured task scheduling parameters.
[0097] In the embodiment of the present application, the user can adjust the task scheduling parameters in real time according to the monitoring results so that the task process can flow efficiently.
[0098] In step 350, if it is determined according to the task scheduling parameters in the task scheduling instruction that the target node of the target task process needs to be retried, the operation corresponding to the target node of the target task process is re-executed in the predetermined business process engine according to the task scheduling parameters, and the target task process continues to flow starting from the target node.
[0099] In one embodiment of the present application, the target node is a node where an abnormality occurs in a service called by the target task flow during the flow process.
[0100] Specifically, when an exception occurs in a certain link in the target task process, such as an exception in the called service, causing the process to be stuck, it will be retried according to the configuration of the task scheduling parameters.
[0101] In one embodiment of the present application, the task retry object includes at least one of the following: a specified task flow, a task flow in a specified state, a task flow flowing within a specified time range, a task flow associated with a specified data table, and a node of a task flow. The task retry method includes at least one of the following: a time interval for retrying, an index used for querying a data table during retrying, the number of task flows to be retried each time, and the maximum number of times a task flow can be retried.
[0102] If the task scheduling parameters include the nodes of the task flow, then the target node is the node of the task flow; if the task scheduling parameters do not include the nodes of the task flow, then the target node is the first node of the target task flow, that is, restarting the target task flow.
[0103] For each task flow, there can be a corresponding data table in the Flowable database. During the flow process, changes in information such as the node to which the task flow is currently transferred and the status of the task flow will be recorded in the corresponding data table; the data tables corresponding to different task flows can be different; the data tables corresponding to multiple task flows can also be the same, for example, the data tables corresponding to the same category of task flows can be the same. The task flow associated with a specified data table is one or more task flows corresponding to the specified data table. By configuring the index used for data table queries during retries, the query speed can be accelerated.
[0104] Periodic retry can be achieved by setting the time interval for retrying. The embodiment of the present application can also customize the state of the task flow, and the specified state can be some task flows in a customized state, such as an uncollected state, that is, a task flow that has not been received by the user.
[0105] In addition, the task retry object may also include a task flow that does not participate in the retry, such as a task flow that is in an abnormal state.
[0106] When the target node is retried successfully, the target task process will continue to flow.
[0107] In one embodiment of the present application, if it is determined according to the task scheduling parameters in the task scheduling instruction that a retry operation needs to be performed on a target node of a target task flow, then in a predetermined business process engine, an operation corresponding to the target node of the target task flow is re-executed according to the task scheduling parameters, including: if it is determined according to the task scheduling parameters in the task scheduling instruction that a retry operation needs to be performed on nodes of multiple task flows including the target task flow, then the nodes of each task flow are added to a retry queue;
[0108] The retry step is executed in a loop, and the retry step includes: taking out tasks corresponding to nodes of several task flows from the head of the retry queue in turn each time, and retrying the nodes of the several task flows in a predetermined business process engine according to the tasks corresponding to the nodes of the several task flows; when at least one task flow node among the nodes of the several task flows fails to complete the retry operation, re-adding the tasks corresponding to the nodes of at least one task flow to the tail of the retry queue.
[0109] When the number of times the retry step is executed on a node of a task flow reaches the maximum number of times the task flow can be retried, the corresponding task may no longer be added to the tail of the retry queue, and the retry step may no longer be executed.
[0110] In order to prevent the retry process from being stuck due to slow single-thread scheduling, the embodiment of the present application also proposes a multi-thread concurrent scheduling strategy.
[0111] Figure 8 An embodiment according to the present application is shown. Figure 3 Flow chart of details of step 350 in the embodiment. Figure 8 As shown, re-executing the operation corresponding to the target node of the target task flow in the predetermined business process engine according to the task scheduling parameters may specifically include the following steps:
[0112] In step 351, a target thread is determined from a plurality of threads in a pre-created thread pool, and the plurality of threads are used to concurrently perform retry operations on a plurality of task flows.
[0113] Specifically, you can use the ThreadPoolExecutor class that implements the ExecutorService interface to create a thread pool. Set the number of core threads to 20, the maximum number of threads to 100, the blocking queue length to 3000, and the rejection policy to use CallerRunsPolicy. The number of core threads is the number of threads that always exist in the thread pool and will not be recycled; the maximum number of threads is the maximum number of threads that can exist in the thread pool. CallerRunsPolicy is a thread pool execution policy in Java, which means that executing tasks in the caller thread can avoid tasks being abandoned or throwing exceptions, and improve the reliability and performance of the program.
[0114] In step 352, the operation corresponding to the target node of the target task flow is re-executed in the predetermined business process engine according to the task scheduling parameters through the target thread.
[0115] Multithreading allows retry operations on different task processes in a concurrent manner.
[0116] Fig. 9 An embodiment according to the present application is shown. Figure 8 Flow chart of the steps after step 352 in the embodiment. Fig. 9 As shown, after the target thread re-executes the operation corresponding to the target node of the target task flow in the predetermined business process engine according to the task scheduling parameters, the method may further include the following steps:
[0117] In step 360, the execution result corresponding to the first task flow that completes the retry operation is obtained each time, and the data table corresponding to the task flow is updated according to the execution result.
[0118] Specifically, after the thread pool starts working, it will automatically process business logic. In scenarios where it takes a long time or is highly concurrent, CompletionService can be used to solve the blocking problem of multiple threads. You can submit a batch of tasks corresponding to the task flow to CompletionService, and then, while generating tasks, you can get the return value of the task through the take method, so that the two things can be executed separately, and the tasks will not block each other. The result can be obtained first, and it is no longer dependent on the order of tasks, thus solving the problem of one task being blocked by another task.
[0119] In one embodiment of the present application, the task retry mode includes a maximum number of retries for the task flow, and after re-executing the operation corresponding to the target node of the target task flow in the predetermined business process engine according to the task scheduling parameters, the method may further include the following steps:
[0120] If the number of retries for the target task flow reaches the maximum number of retries for the target task flow, an alarm message is sent to at least one of the following persons: a person related to the target task flow, a person related to the target node.
[0121] Alarm information can be sent to relevant personnel through group chat, email, SMS, etc. The relevant personnel can be the person in charge of the target task process or target node, or the operator of the system.
[0122] In the embodiment of the present application, by sending alarm information to relevant personnel, it can be ensured that relevant personnel can receive the alarm information in time, handle the problem in time, and ensure that the service can run normally and smoothly.
[0123] Fig.10 An embodiment according to the present application is shown. Figure 3 Details of step 320 and a flowchart of steps after step 350 in the embodiment. Fig.10 As shown, the target task process is transferred through a predetermined business process engine, which may specifically include:
[0124] In step 320', the target task process is circulated through a predetermined business process engine, and during the circulation process, data related to the target task process is recorded in an active data table corresponding to the target task process.
[0125] After continuing to transfer the target task process from the target node, the method further includes:
[0126] In step 370 , when the target task process is completed, the data related to the target task process recorded in the active data table is migrated to the historical data table.
[0127] Active data tables can be stored in storage media with higher read and write rates.
[0128] A historical data table can correspond to one or more active data tables. The data in the active data table needs to be migrated to the corresponding historical data table.
[0129] The historical data table can be stored in a storage medium with a high read and write rate.
[0130] By storing the data generated during the task flow in a storage medium with a higher read and write rate, the data retrieval efficiency can be improved.
[0131] See also Figure 5 As shown, it also includes:
[0132] Step 560: After the task is completed, it will be automatically archived.
[0133] After the task process is completed, the relevant data will be automatically archived into the historical data table.
[0134] Fig.11 FIG. 1 shows a timing call diagram according to an embodiment of the present application. Fig.11 As shown in the figure, the timing call diagram includes objects such as users, service front-end, service back-end, database, XXL-JOB, service A, and service B. The service front-end is Figure 4 The system front end shown in the figure and the service back end are Figure 4 The task service background shown, the database is Figure 4The Mysql shown in the figure, XXL-JOB is the XXL-JOB background, and service A and service B are two external services. The timing flow of the timing call diagram is as follows: First, the user initiates a request to create a task by interacting with the service front end. Of course, you can also initiate a request to create a task in the form of a scheduled task. The request is transmitted from the service front end to the service back end. The service back end performs relevant checks on the parameters of the request, such as parameter validity checks, idempotence checks, etc. If the check passes, the task is created and the task data is recorded in the database. The service back end returns the result of the task creation to the service front end based on the return result of the database, and the service front end returns the result of the task creation to the user; then, after the task is successfully created, relying on the Flowable framework, the task will be automatically scheduled and transferred. During this process, changes will occur in information such as task links and status. These changes will be recorded in the database, and the database will return the operation results to the service back end; when the task process flows to a certain node, the service back end will call other services, and other services will process the task data and call back the service back end after the processing is completed. For example, the service background will call service A, and service A will return the processing result to the service background after processing; then, the service background will retry through interaction with XXL-JOB. Specifically, it will retry the links in the task process by looping the following steps until the task is in a completed state: XXL-JOB sends the task configuration parameters to the service background to request the scheduling of the task. The service background queries the database according to the conditions specified by the task configuration parameters, and obtains the query results returned by the database, that is, the query obtains the task process and nodes that need to be retried. The service background performs task scheduling logic processing according to the query results, that is, performs retries through JobHandler, and the task process continues to flow. The service background will call service B. Service B returns the processing result to the service background after processing. The service background will request the database to modify the task status according to the received processing result and obtain the return result of the database; finally, the service background interacts with the database to complete the task archiving.
[0135] In summary, the task flow execution method provided in the embodiment of the present application provides a highly available, fast and efficient task scheduling solution, which can at least achieve the following beneficial effects:
[0136] 1. This solution can realize process customization, automatic task flow, full-process task monitoring, archiving after task completion, and hot and cold data separation.
[0137] 2. This solution can achieve the scheduling and circulation of tasks of various specifications and types through real-time adjustment of task scheduling parameters. When a task link in the process is stuck, the link can be automatically retried. When the maximum number of retries is reached, an abnormal alarm can be issued to ensure the normal circulation of tasks.
[0138] 3. This solution uses a timed polling method to trigger task scheduling and uses Java multi-threading technology to perform asynchronous retries of task links, which will not occupy the threads of the thread pool for a long time.
[0139] The following describes an embodiment of the device of the present application, which can be used to execute the execution method of the task flow in the above embodiment of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the execution method of the task flow in the above embodiment of the present application.
[0140] Fig.12 A block diagram of a device for executing a task flow according to an embodiment of the present application is shown.
[0141] Reference Fig.12 As shown, a task flow execution device 1200 according to an embodiment of the present application includes: a flow starting unit 1210, a flow unit 1220, a receiving unit 1230 and a task retry unit 1240. Among them, the process starting unit 1210 is used to receive a task process creation request, and start the target task process in a predetermined business process engine based on the task process definition information carried in the task process creation request; the circulation unit 1220 is used to circulate the target task process through the predetermined business process engine to execute operations corresponding to each node of the target task process; the receiving unit 1230 is used to receive a task scheduling instruction from a predetermined distributed task scheduling platform, and the task scheduling instruction includes task scheduling parameters configured for the predetermined distributed task scheduling platform, and the task scheduling parameters include at least one of the following: task retry object, task retry method; the task retry unit 1240 is used to re-execute the operation corresponding to the target node of the target task process in the predetermined business process engine according to the task scheduling parameters if it is determined according to the task scheduling parameters in the task scheduling instruction that a retry operation needs to be performed on the target node of the target task process, and continue to circulate the target task process starting from the target node.
[0142] In some embodiments of the present application, based on the aforementioned scheme, the task retry unit 1240 is configured to: determine a target thread from multiple threads in a pre-created thread pool, and the multiple threads are used to perform retry operations on multiple task processes concurrently; through the target thread, re-execute the operation corresponding to the target node of the target task process in the predetermined business process engine according to the task scheduling parameters.
[0143] In some embodiments of the present application, based on the aforementioned scheme, the device also includes an acquisition and update unit; after re-executing the operation corresponding to the target node of the target task process in the predetermined business process engine according to the task scheduling parameters through the target thread, the acquisition and update unit is used to: obtain the execution result corresponding to the first task process that completes the retry operation each time, and update the data table corresponding to the task process according to the execution result.
[0144] In some embodiments of the present application, based on the aforementioned scheme, the device also includes a monitoring unit; before receiving a task scheduling instruction from a predetermined distributed task scheduling platform, the monitoring unit is used to: monitor each task process flowing through the predetermined business process engine, and display the monitoring results, wherein the monitoring results include the number of task processes currently flowing to each node, and the task scheduling parameters are configured by the user for the predetermined distributed task scheduling platform based on the monitoring results.
[0145] In some embodiments of the present application, based on the aforementioned scheme, the task retry object includes at least one of the following: a specified task flow, a task flow in a specified state, a task flow flowing within a specified time range, a task flow associated with a specified data table, and a node of the task flow; the task retry method includes at least one of the following: the time interval for retries, the index used for data table query during retry, the number of task flows to be retried each time, and the maximum number of times the task flow is retried.
[0146] In some embodiments of the present application, based on the aforementioned scheme, the task retry method includes the maximum number of retries for the task process, and the device also includes an alarm unit; after re-executing the operation corresponding to the target node of the target task process according to the task scheduling parameters in the predetermined business process engine, the alarm unit is used to: if the number of retries for the target task process reaches the maximum number of retries for the target task process, then send an alarm message to at least one of the following persons: relevant personnel of the target task process and relevant personnel of the target node.
[0147] In some embodiments of the present application, based on the aforementioned scheme, the device also includes a data migration unit; the flow unit 1220 is configured to: flow the target task process through the predetermined business process engine, and record the data related to the target task process in the active data table corresponding to the target task process during the flow; after starting from the target node and continuing to flow the target task process, the data migration unit is used to: when the flow of the target task process is completed, migrate the data related to the target task process recorded in the active data table to the historical data table.
[0148] In some embodiments of the present application, based on the aforementioned scheme, the task retry unit 1240 is configured as follows: if it is determined according to the task scheduling parameters in the task scheduling instruction that a retry operation needs to be performed on the nodes of multiple task flows including the target task flow, the nodes of each task flow are added to the retry queue; the retry step is executed in a loop, and the retry step includes: taking out the tasks corresponding to the nodes of several task flows from the head of the retry queue in turn each time, and retrying the nodes of the several task flows in the predetermined business process engine according to the tasks corresponding to the nodes of the several task flows; if at least one of the nodes of the several task flows has not completed the retry operation, the task corresponding to the node of the at least one task flow is re-added to the tail of the retry queue.
[0149] In some embodiments of the present application, based on the aforementioned solution, the task process definition information is generated by a flowchart drawing platform according to a flowchart drawn by a user in the flowchart drawing platform.
[0150] Fig.13 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present application is shown.
[0151] It should be noted that Fig.13 The computer system 1300 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0152] like Fig.13As shown, the computer system 1300 includes a central processing unit (CPU) 1301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 1302 or the program loaded from the storage part 1308 to the random access memory (RAM) 1303, such as executing the method described in the above embodiment. Various programs and data required for system operation are also stored in the RAM 1303. The CPU 1301, the ROM 1302 and the RAM 1303 are connected to each other through the bus 1304. The input / output (I / O) interface 1305 is also connected to the bus 1304.
[0153] The following components are connected to the I / O interface 1305: an input section 1306 including a keyboard, a mouse, etc.; an output section 1307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1308 including a hard disk, etc.; and a communication section 1309 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 1309 performs communication processing via a network such as the Internet. A drive 1310 is also connected to the I / O interface 1305 as needed. A removable medium 1311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1310 as needed so that a computer program read therefrom is installed into the storage section 1308 as needed.
[0154] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 1309, and / or installed from a removable medium 1311. When the computer program is executed by the central processing unit (CPU) 1301, various functions defined in the system of the present application are executed.
[0155] It should be noted that the computer-readable medium shown in the embodiment of the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate, or transmit programs for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0156] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program product according to various embodiments of the present application. Wherein, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0157] The units involved in the embodiments described in this application may be implemented by software or hardware, and the units described may also be set in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0158] As one aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being assembled into the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the above embodiment.
[0159] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0160] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software, or by combining software with necessary hardware. Therefore, the technical solution according to the implementation method of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a touch terminal, or a network device, etc.) to execute the method according to the implementation method of the present application.
[0161] It is understandable that in the specific implementation of this application, data related to the task process is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.
[0162] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the embodiments disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application.
[0163] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A method for executing a task flow, characterized in that: The method comprises: Receive a task flow creation request, and start a target task flow in a predetermined business process engine based on the task flow definition information carried in the task flow creation request; The target task process is circulated through the predetermined business process engine, and during the circulation process, data related to the target task process is recorded in an active data table corresponding to the target task process, so as to perform operations corresponding to each node of the target task process; Receive a task scheduling instruction from a predetermined distributed task scheduling platform, the task scheduling instruction includes task scheduling parameters configured for the predetermined distributed task scheduling platform by a user by adjusting the configured task scheduling parameters according to the monitoring results of the task flow, the task scheduling parameters include at least one of the following: a task retry object, a task retry mode; the task retry object includes at least one of the following: a specified task flow, a task flow in a specified state, a task flow flowing within a specified time range, a task flow associated with a specified data table; the task scheduling parameters include or do not include nodes of the task flow; the task retry mode includes at least one of the following: a time interval for retrying, an index used for querying the data table during retrying, the number of task flows to be retried each time, and a maximum number of times the task flow is retried; wherein the task retry mode includes the maximum number of times the task flow is retried; If it is determined according to the task scheduling parameters in the task scheduling instruction that a retry operation needs to be performed on the target node of the target task flow, the operation corresponding to the target node of the target task flow is re-executed in the predetermined business process engine according to the task scheduling parameters, and the target task flow is continued to flow from the target node; If the number of retries for the target task flow reaches the maximum number of retries for the target task flow, an alarm message is sent to at least one of the following persons: a person related to the target task flow, a person related to the target node; When the target task flow is completed, the data related to the target task flow recorded in the active data table is migrated to the historical data table.
2. The task flow execution method according to claim 1, characterized in that: The re-executing the operation corresponding to the target node of the target task flow in the predetermined business process engine according to the task scheduling parameter includes: Determine a target thread from a plurality of threads in a pre-created thread pool, wherein the plurality of threads are used to concurrently retry operations on a plurality of task flows; The operation corresponding to the target node of the target task flow is re-executed in the predetermined business process engine according to the task scheduling parameters through the target thread.
3. The task flow execution method according to claim 2, characterized in that: After re-executing the operation corresponding to the target node of the target task process in the predetermined business process engine according to the task scheduling parameters through the target thread, the method further includes: Each time, the execution result corresponding to the first task flow that completes the retry operation is obtained, and the data table corresponding to the task flow is updated according to the execution result.
4. The task flow execution method according to claim 1, characterized in that: Before receiving the task scheduling instruction from the predetermined distributed task scheduling platform, the method further includes: Each task process flowing through the predetermined business process engine is monitored, and the monitoring result is displayed, wherein the monitoring result includes the number of task processes currently flowing to each node.
5. The task flow execution method according to claim 1, characterized in that: If it is determined according to the task scheduling parameters in the task scheduling instruction that a retry operation needs to be performed on the target node of the target task flow, then re-execute the operation corresponding to the target node of the target task flow in the predetermined business process engine according to the task scheduling parameters, including: If it is determined according to the task scheduling parameters in the task scheduling instruction that a retry operation needs to be performed on the nodes of multiple task flows including the target task flow, then the nodes of each task flow are added to the retry queue; The retry step is executed cyclically, and the retry step includes: Taking out tasks corresponding to nodes of several task flows from the head of the retry queue in turn each time, and retrying the nodes of the several task flows in the predetermined business process engine according to the tasks corresponding to the nodes of the several task flows; When at least one of the nodes of the plurality of task flows has not completed the retry operation, the task corresponding to the node of the at least one task flow is re-added to the tail of the retry queue.
6. The method for executing a task flow according to any one of claims 1 to 5, characterized in that: The task process definition information is generated by a flowchart drawing platform according to a flowchart drawn by a user in the flowchart drawing platform.
7. A task flow execution device, characterized in that: The device comprises: A process starting unit, used to receive a task process creation request, and start a target task process in a predetermined business process engine based on the task process definition information carried in the task process creation request; A transfer unit, used to transfer the target task process through the predetermined business process engine, and record the data related to the target task process in an active data table corresponding to the target task process during the transfer process, so as to perform operations corresponding to each node of the target task process; A receiving unit, for receiving a task scheduling instruction from a predetermined distributed task scheduling platform, wherein the task scheduling instruction includes task scheduling parameters configured for the predetermined distributed task scheduling platform by a user by adjusting the configured task scheduling parameters according to a monitoring result of a task flow, wherein the task scheduling parameters include at least one of the following: a task retry object, a task retry mode; the task retry object includes at least one of the following: a specified task flow, a task flow in a specified state, a task flow flowing within a specified time range, and a task flow associated with a specified data table; the task scheduling parameters include or do not include nodes of the task flow; the task retry mode includes at least one of the following: a time interval for retrying, an index used for querying a data table during a retry, the number of task flows to be retried each time, and a maximum number of times a task flow is retried; wherein the task retry mode includes the maximum number of times a task flow is retried; A task retry unit, for re-executing the operation corresponding to the target node of the target task flow in the predetermined business process engine according to the task scheduling parameters if it is determined according to the task scheduling parameters in the task scheduling instruction that a retry operation needs to be performed on the target node of the target task flow, and continuing to circulate the target task flow starting from the target node; A data migration unit, configured to migrate the data related to the target task process recorded in the active data table to the historical data table when the target task process is completed; The device further comprises an alarm unit; after the operation corresponding to the target node of the target task flow is re-executed in the predetermined business process engine according to the task scheduling parameter, the alarm unit is used to: If the number of retries for the target task flow reaches the maximum number of retries for the target task flow, an alarm message is sent to at least one of the following persons: a person related to the target task flow and a person related to the target node.
8. A computer readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for executing the task flow according to any one of claims 1 to 6 is implemented.
9. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the execution method of the task flow as described in any one of claims 1 to 6.
10. A computer program product, characterized in that The computer program product 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 task flow execution method as described in any one of claims 1 to 6.