CN112051993B - Method, device, medium and equipment for generating state machine template and processing task - Google Patents

Method, device, medium and equipment for generating state machine template and processing task Download PDF

Info

Publication number
CN112051993B
CN112051993B CN202010827095.XA CN202010827095A CN112051993B CN 112051993 B CN112051993 B CN 112051993B CN 202010827095 A CN202010827095 A CN 202010827095A CN 112051993 B CN112051993 B CN 112051993B
Authority
CN
China
Prior art keywords
node
state node
task
state
sub
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010827095.XA
Other languages
Chinese (zh)
Other versions
CN112051993A (en
Inventor
吴嘉林
黄文才
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010827095.XA priority Critical patent/CN112051993B/en
Publication of CN112051993A publication Critical patent/CN112051993A/en
Application granted granted Critical
Publication of CN112051993B publication Critical patent/CN112051993B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application provides a method, a device, a medium and equipment for generating a state machine template and processing tasks. The task processing method comprises the following steps: acquiring a state machine template corresponding to a task to be processed, wherein the task to be processed can come from a cloud server, and the state machine template is generated according to at least one functional component associated with the task to be processed; analyzing the state machine template to obtain at least one state node with an execution sequence; the at least one state node is executed sequentially from the initial node, wherein for the currently executed target state node, the function corresponding to the target state node is executed according to the input data of the target state node, and the output data of the target state node is sent to the downstream node of the target state node to serve as the input data of the downstream node; and when the target state node is an end node, determining that the task to be processed is processed. The technical scheme of the embodiment of the application realizes the effective control of each state of the task to be processed.

Description

Method, device, medium and equipment for generating state machine template and processing task
Technical Field
The present application relates to the field of computer and communication technologies, and in particular, to a method, an apparatus, a medium, and a device for generating a state machine template and processing a task.
Background
Currently, when a task or service needs to be issued, a developer is usually required to write task codes for the task or service to be issued, and the method has high requirements on professional ability of the developer and low development efficiency. Meanwhile, when a task is executed, effective control of each stage of the task in the execution process is difficult to realize.
Disclosure of Invention
The embodiment of the application provides a method, a device, a medium and equipment for generating a state machine template and processing tasks, which can further improve the arrangement generating efficiency of tasks or services at least to a certain extent and realize the effective control of each state of the tasks to be processed.
Other features and advantages of the application will be apparent from the following detailed description, or may be learned by the practice of the application.
According to an aspect of the embodiment of the present application, there is provided a task processing method based on a state machine, including: acquiring a state machine template corresponding to a task to be processed, wherein the state machine template is generated according to at least one functional component associated with the task to be processed; analyzing the state machine template to obtain at least one state node with an execution sequence, wherein the state node corresponds to the functional component one by one, and the at least one state node comprises a starting node; executing the at least one state node in sequence from the starting node, wherein for a currently executed target state node, executing a function corresponding to the target state node according to input data of the target state node, and sending output data of the target state node to a downstream node of the target state node as input data of the downstream node; and when the target state node is an end node, determining that the task to be processed is processed.
According to an aspect of an embodiment of the present application, there is provided a method for generating a state machine template, including: displaying an editing interface of a state machine template, wherein the editing interface comprises a functional component selection area, a template arrangement area and a state machine template code area; displaying, in the template arrangement area, at least one functional component selected from the functional component selection area and dragged into the template arrangement area, and a logical relationship set for the at least one functional component; displaying state machine template codes in the state machine template code region, wherein the state machine template codes are obtained by arranging codes corresponding to the at least one functional component respectively according to the logic relation among the at least one functional component; and generating a state machine template according to the state machine template code, wherein the state machine template is used for issuing a service which is a task to be processed or contains a calling interface.
According to an aspect of an embodiment of the present application, there is provided a task processing device based on a state machine, including: the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is configured to acquire a state machine template corresponding to a task to be processed, and the state machine template is generated according to at least one functional component associated with the task to be processed; the analyzing unit is configured to analyze the state machine template to obtain at least one state node with an execution sequence, the state nodes are in one-to-one correspondence with the functional components, and the at least one state node comprises a starting node; the processing unit is configured to execute the at least one state node in sequence from the starting node, wherein for a currently executed target state node, the function corresponding to the target state node is executed according to the input data of the target state node, and the output data of the target state node is sent to a downstream node of the target state node as the input data of the downstream node; and the determining unit is configured to determine that the task to be processed is processed when the target state node is an end node.
In some embodiments of the application, based on the foregoing, the at least one status node comprises a task-type status node; the processing unit is configured to: when executing the state node of the task type, converting the input data into data corresponding to the protocol type according to the protocol type supported by the component service indicated by the designated field in the state node of the task type to obtain converted data; transmitting the conversion data to the component service through a protocol supported by the component service, and acquiring a processing result of the component service on the conversion data; and generating output data of the state node of the task type based on the processing result.
In some embodiments of the application, based on the foregoing, the processing unit is configured to: and if the target state node is a state node of a transmission type or a state node of a task type, directly transmitting output data of the target state node to a downstream node of the target state node.
In some embodiments of the application, based on the foregoing, the at least one state node comprises a loop type state node; the processing unit is configured to: when executing a state node of a cycle type, acquiring a cycle start sub-state node, a cycle body sub-state node and a cycle end sub-state node which are obtained by analyzing the state node of the cycle type; if the circulation starting sub-state node determines that the circulation condition is met, the output data of the circulation starting sub-state node is sent to the circulation body sub-state node, and if the circulation condition is not met, the output data of the circulation starting sub-state node is sent to the circulation ending sub-state node; after executing the loop body sub-state node, sending output data of the loop body sub-state node to the loop end sub-state node for processing; and if the circulation ending sub-state node determines that the circulation is not ended, sending the output data of the circulation ending sub-state node to the circulation starting sub-state node, and if the circulation is ended, taking the output data of the circulation ending sub-state node as the output data of the circulation type state node.
In some embodiments of the application, based on the foregoing, the at least one state node comprises a state node of a selected type; the processing unit is configured to: when executing a state node of a selection type, acquiring a selection start sub-state node, a selection body sub-state node and a selection end sub-state node which are obtained by analyzing the state node of the selection type; if the selection starting sub-state node is executed, the output data of the selection starting sub-state node is sent to the selector sub-state node, and if the selection starting sub-state node is not executed, the output data of the selection starting sub-state node is sent to the selection ending sub-state node; after executing the selector sub-state node, sending output data of the selector sub-state node to the selector end sub-state node for processing; executing the selection ending sub-state node, and taking the output data of the selection ending sub-state node as the output data of the state node of the selection type.
In some embodiments of the application, based on the foregoing, the at least one state node comprises a parallel type of state node; the processing unit is configured to: when executing a state node of a parallel type, acquiring a parallel start sub-state node, a parallel processing sub-state node and a parallel end sub-state node which are obtained by analyzing the state node of the parallel type; executing the parallel start sub-state node, and sending output data of the parallel start sub-state node to the parallel processing sub-state node; after executing the parallel processing sub-state node, sending output data of the parallel processing sub-state node to the parallel ending sub-state node for processing; executing the parallel ending sub-state node to integrate the output data of the parallel processing sub-state node, and taking the integrated data as the output data of the state node of the parallel type.
In some embodiments of the present application, based on the foregoing scheme, if the target state node has no downstream node, or the target state node is a successful state node or a failed state node, the target state node is determined to be the end node.
In some embodiments of the application, based on the foregoing scheme, the obtaining unit is further configured to: before a state machine template corresponding to a task to be processed is acquired, a task scheduling instruction sent by a task scheduler is received, wherein the task scheduling instruction is used for scheduling a designated task stored in a task list, and the task to be processed is acquired according to the task scheduling instruction.
In some embodiments of the present application, based on the foregoing solution, the task processing device based on a state machine further includes: the sending unit is configured to send a registration request to the task scheduler before the acquisition unit receives a task scheduling instruction sent by the task scheduler, wherein the registration request comprises a network address of the task executor, and after successful registration to the task scheduler, a heartbeat message is periodically sent to the task scheduler, and the heartbeat message comprises at least one of the following information: load condition of the task executor and survival state of the task executor.
In some embodiments of the present application, based on the foregoing solution, the task list is stored in a database, where there are multiple task schedulers, the multiple task schedulers acquire the scheduling rights for the task list by means of a distributed lock; the task stored in the task list is provided with starting time information, and the task scheduler determines scheduling occasions for the task executor according to the starting time of each task in the task list when accessing the task list.
According to an aspect of an embodiment of the present application, there is provided a generating device of a state machine template, including: the first display unit is configured to display an editing interface of the state machine template, wherein the editing interface comprises a functional component selection area, a template arrangement area and a state machine template code area; a second display unit configured to display, in the template arrangement area, at least one functional component selected from the functional component selection area and dragged into the template arrangement area, and a logical relationship set for the at least one functional component; the third display unit is configured to display state machine template codes in the state machine template code area, wherein the state machine template codes are obtained by arranging codes corresponding to the at least one functional component respectively according to the logic relation among the at least one functional component; the generating unit is configured to generate a state machine template according to the state machine template code, wherein the state machine template is used for issuing a service which is a task to be processed or contains a calling interface.
In some embodiments of the present application, based on the foregoing solution, the generating device of the state machine template further includes: a receiving unit configured to receive a registration request of a functional component, the registration request being for registering a specified functional component; and a storage unit configured to store the specified functional component into a functional component list and display the specified functional component in the functional component selection area.
According to an aspect of the embodiments of the present application, there is provided a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a state machine based task processing method as described in the above embodiments, or implements a state machine template generation method as described in the above embodiments.
According to an aspect of an embodiment of the present application, there is provided an electronic apparatus including: one or more processors; and a storage device for storing one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the state machine based task processing method as described in the above embodiments, or to implement the state machine template generation method as described in the above embodiments.
According to an aspect of embodiments of the present application, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the state machine based task processing method provided in the above-described various alternative embodiments, or implements the state machine template generation method as described in the above-described embodiments.
In the technical schemes provided by some embodiments of the present application, by displaying an editing interface of a state machine template, displaying at least one functional component selected and dragged to a template editing area in a target editing area in the interface, and setting a logic relationship for the at least one functional component, then arranging codes corresponding to the at least one functional component according to the logic relationship between the selected at least one functional component to generate and display a state machine template code, and further generating the state machine template according to the state machine template code, the state machine template can be arranged in a visual dragging manner, and different services do not need to be called in a code writing manner to issue tasks or services, thereby improving the arranging and generating efficiency of the tasks or services.
In the technical solutions provided in some embodiments of the present application, after a state machine template corresponding to a task to be processed is obtained, the state machine template is parsed to obtain at least one state node having an execution sequence, and then the at least one state node is executed sequentially from a start node, for a currently executed target state node, a function corresponding to the target state node is executed according to input data of the target state node, and output data of the target state node is sent to a downstream node of the target state node as input data of the downstream node, and when the target state node is an end node, it is determined that the task to be processed is completed. Therefore, in the technical scheme of the embodiment of the application, the task to be processed can be represented by the state machine template, and the normal execution of the task according to the logic sequence can be ensured by analyzing the state machine template, so that the effective control of each state of the task to be processed is realized.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application. It is evident that the drawings in the following description are only some embodiments of the present application and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art. In the drawings:
FIG. 1 shows a flow diagram of a state machine for processing video;
FIG. 2 shows a schematic diagram of an exemplary system architecture to which the technical solution of an embodiment of the application may be applied;
FIG. 3 illustrates a flow chart of a method of generating a state machine template according to one embodiment of the application;
FIG. 4 illustrates a flow chart of a state machine based task processing method according to one embodiment of the present application;
FIG. 5 illustrates a schematic diagram of an editing interface of a state machine template, according to one embodiment of the application;
FIG. 6 illustrates an architecture diagram of a state machine based task processing system according to one embodiment of the present application;
FIG. 7 illustrates a flow chart of component registration, orchestration according to one embodiment of the present application;
FIG. 8A illustrates a code structure diagram corresponding to a concurrency component, according to one embodiment of the application;
FIG. 8B illustrates a code structure diagram corresponding to a task type component in accordance with one embodiment of the present application;
FIG. 8C illustrates a code structure diagram corresponding to a task type component in accordance with one embodiment of the application;
FIG. 8D illustrates a schematic diagram of an editing interface of a state machine template, according to one embodiment of the application;
FIG. 9 shows a schematic diagram of a task list according to one embodiment of the application;
FIG. 10 shows a schematic diagram of a scheduler and executor interaction process according to one embodiment of the application;
FIG. 11 shows a flow diagram of a scheduler scheduling an executor according to one embodiment of the application;
FIG. 12 shows a schematic of the process of an actuator according to one embodiment of the application;
FIG. 13 illustrates a flow chart of an actuator executing a status node according to one embodiment of the application;
FIG. 14 illustrates a process flow diagram of a loop type state node, according to one embodiment of the application;
FIG. 15 illustrates a process flow diagram of a select type of status node according to one embodiment of the application;
FIG. 16 illustrates a process flow diagram of a parallel type state node according to one embodiment of the application;
FIG. 17 illustrates a block diagram of a state machine based task processing device according to one embodiment of the present application;
FIG. 18 illustrates a block diagram of a state machine template generation apparatus according to one embodiment of the application;
fig. 19 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments may be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the application. One skilled in the relevant art will recognize, however, that the application may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the application.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations.
It should be noted that: references herein to "a plurality" means two or more. "and/or" describes an association relationship of an association object, meaning that there may be three relationships, e.g., a and/or B may represent: a exists alone, A and B exist together, and B exists alone. The character "/" generally indicates that the context-dependent object is an "or" relationship.
In an embodiment of the application, a state machine is a model that describes the behavior of a finite number of states and transitions and actions between these states. Each step of the state machine, also called a state, performs a corresponding operation based on the input and passes the output to the next state. For example, the types of states may include: task, pass, wait, choice, parallel, foreach, etc.; among them, task type is the most commonly used state to describe performing some work, such as executing local scripts, invoking various cloud services, etc.
A state machine template is a flow describing the entire state machine in a code language (e.g., json or YAML language).
In one example of a state machine, shown in FIG. 1, is a state machine that processes video, where the state machine may include several Task-type states: preprocessing, video capture, OCR (Optical Character Recognition ) recognition, audio-to-text, NLP (Natural Language Processing ), merge storage, and the like.
Wherein, the preprocessing may be to call a cloud function (Serverless Cloud Function, SCF for short) service to perform processing such as video shot segmentation, feature extraction, etc. on the video; the audio transcription may be the recognition of speech by invoking a speech recognition service, such as ASR (Automatic Speech Recognition, automatic speech recognition technology); the video capture may be by invoking a video processing service, such as MPS (Media Processing Service, video processing service for short), capturing video frames, etc.; OCR recognition is to recognize text content contained in a video frame; NLP can be a natural language processing service called to realize the processing of recognized text content (comprising text content obtained by voice recognition and text content obtained by OCR recognition); and the merging storage is to store the result obtained after NLP processing into a database.
In one embodiment of the present application, the Cloud function service, the voice recognition service, the video processing service, the natural language processing service, and the like shown in fig. 1 may be implemented by Cloud Computing (Cloud Computing), which distributes Computing tasks on a resource pool formed by a large number of computers, so that various application systems can acquire Computing power, storage space, and information service as required. The network that provides the resources is called a "cloud", where the resources appear to the user as infinitely expandable and available at any time, on demand, expandable at any time, pay-per-use.
As a basic capability provider of cloud computing, a cloud computing resource pool is established, where multiple types of virtual resources are deployed for external clients to select for use, where the cloud computing resource pool is called an IaaS (Infrastructure as a Service ) platform for short. The cloud computing resource pool mainly comprises: computing devices (which are virtualized machines, including operating systems), storage devices, network devices.
According to the logic function division, a PaaS (Platform as a Service ) layer can be deployed on the IaS layer, a SaaS (Software as a Service ) layer can be deployed on the PaaS layer, and the SaaS can also be directly deployed on the IaS. PaaS is a platform on which software runs, such as a database, web container, etc. SaaS is a wide variety of business software such as web portals, sms mass senders, etc.
The merging Storage shown in fig. 1 may be that a result obtained after NLP processing is stored in Cloud Storage (Cloud Storage), where Cloud Storage is a new concept that extends and develops in Cloud computing concept, and a distributed Cloud Storage system (hereinafter referred to as a Storage system for short) refers to a Storage system that integrates a large number of Storage devices (Storage devices are also referred to as Storage nodes) of various types in a network through application software or application interfaces to cooperatively provide data Storage and service access functions together.
At present, the storage method of the storage system is as follows: when creating logical volumes, each logical volume is allocated a physical storage space, which may be a disk composition of a certain storage device or of several storage devices. The client stores data on a certain logical volume, that is, the data is stored on a file system, the file system divides the data into a plurality of parts, each part is an object, the object not only contains the data but also contains additional information such as a data Identification (ID) and the like, the file system writes each object into a physical storage space of the logical volume, and the file system records storage position information of each object, so that when the client requests to access the data, the file system can enable the client to access the data according to the storage position information of each object.
The process of allocating physical storage space for the logical volume by the storage system specifically includes: physical storage space is divided into stripes in advance according to the group of capacity measurement of objects stored in a logical volume (the measurement often has a large margin with respect to the capacity of the objects to be actually stored) and redundant array of independent disks (Redundant Array of Independent Disk, simply referred to as RAID), and a logical volume can be understood as a stripe, so that physical storage space is allocated to the logical volume.
Fig. 2 shows a schematic diagram of an exemplary system architecture to which the technical solution of an embodiment of the present application may be applied.
As shown in fig. 2, the system architecture 200 may include a terminal device 201, a management server 202, a scheduler 203, and an executor 204. The management server 202 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or may be a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs (Content Delivery Network, content delivery networks), basic cloud computing services such as big data and artificial intelligence platforms, and the like. The terminal device 201 may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc. The terminal device 201 and the management server 202 may be directly or indirectly connected through wired or wireless communication, and the present application is not limited herein. The scheduler 203 is configured to obtain tasks to be executed from the management server 202 and schedule the executor 204 to process the tasks, where the number of schedulers 203 and executors 204 is merely illustrative, and any number of schedulers 203 and executors 204 may be provided according to implementation needs.
In one embodiment of the present application, the terminal device 201 may display an editing interface of the state machine template, where the editing interface includes a function component selection area, a template arrangement area, and a state machine template code area, and the user may drag the function component in the function component selection area to the template arrangement area through a drag operation, a selection operation, or the like, and set a logical relationship for the function component dragged to the template arrangement area, where the template arrangement area may display the function component dragged to the area and the logical relationship set by the user for the function component. And displaying state machine template codes in the state machine template code region, wherein the state machine template codes are obtained by encoding codes respectively corresponding to the functional components according to the logical relations set by the user aiming at the functional components dragged into the template arrangement region. The process of generating the state machine template code may be performed in the terminal device 201, or the terminal device 201 may send the functional components dragged by the user to the template arrangement area and the logical relationships set for the functional components to the management server 202, and the logical relationships are generated by the management server 202 and returned to the terminal device 201 for display.
After the user orchestration is finished, a state machine template may be generated according to the state machine template code, and then the terminal device 201 may issue the generated state machine template as a task to be processed or a service including a call interface, and send it to the management server 202.
In one embodiment of the present application, the scheduler 203 may acquire a state machine template corresponding to a task to be processed from the management server 202, then send the state machine template to the selected executor 204, after the executor 204 acquires the state machine template corresponding to the task to be processed, parse the state machine template to obtain at least one state node with an execution sequence, where the state node corresponds to a function component selected when the state machine template is generated, and then the executor 204 sequentially executes the state nodes from a start node, where when executing any one state node, the function corresponding to the state node is executed according to input data of the state node, and send output data of the state node to an downstream node of the state node as input data of the downstream node, until traversing to an end node, determining that the task to be processed is completed.
Therefore, the technical scheme of the embodiment shown in fig. 2 enables the state machine template to be arranged in a visual dragging mode, and different services do not need to be called in a code writing mode to release tasks or services, so that the arrangement generating efficiency of the tasks or services is improved. And the task to be processed can be represented by a state machine template, and the normal execution of the task according to the logic sequence can be ensured by analyzing the state machine template, so that the effective control of each state of the task to be processed is realized.
The implementation details of the technical scheme of the embodiment of the application are described in detail below:
fig. 3 shows a flow chart of a method of generating a state machine template according to an embodiment of the application, which may be performed by a device having a calculation processing function, such as the terminal device 201 shown in fig. 2. Referring to fig. 3, the method for generating the state machine template at least includes steps S310 to S340, which are described in detail as follows:
in step S310, an editing interface of the state machine template is displayed, where the editing interface includes a function component selection area, a template arrangement area, and a state machine template code area.
In one embodiment of the present application, the function component selection area is used to display a function component to be selected, and the function component may include a flow component, a service component, a script component, and the like. The flow component is used to control orchestration flow and may include, for example, a selection component, a loop component, a concurrency component, a success component, a failure component, and the like. The service component is used for executing background services of specific business functions, such as face recognition algorithm service, road traffic query service and the like. The script component is a body of script code (e.g., python script code) that is typically used to perform some simple function, such as processing request or response parameters of upstream and downstream nodes.
It should be noted that, the service provided by the components may be an atomic service, that is, each component provides only a single function, and may provide a callable interface to the outside.
In one embodiment of the present application, the user may also register the functional components, e.g., the user may initiate a registration request for a specified functional component, and if the registration is successful, the registered specified functional component may be stored in the functional component list and displayed in the functional component selection area.
In one embodiment of the present application, the template orchestration area is used to display the functional components selected by the user and the logical relationships set for the functional components, e.g., the user may drag the functional components from the functional component selection area to the template orchestration area, which in turn may display the functional components dragged in by the user and may display the logical relationships set by the user. The logical relationship may be a precedence order relationship between components, a nested relationship (e.g., loop, selection), etc.
In one embodiment of the application, the state machine template code region is used to display state machine template code generated from the user selected functional components and the logical relationships set for the functional components. Specifically, each functional component corresponds to a code, and then the codes corresponding to the functional components can be arranged according to the logical relationship set by the user for the functional components to obtain the state machine template codes.
In step S320, at least one functional component selected from the functional component selection area and dragged to the template arrangement area, and a logical relationship set for the at least one functional component are displayed in the template arrangement area.
In one embodiment of the application, after the user drags the functional components from the functional component selection area into the template arrangement area, an identification (such as a curve with an arrow, etc.) for representing a logical relationship (such as nesting, order of execution, etc.) between the functional components may be added to set the logical relationship between the functional components. Alternatively, the identifiers for representing the logical relationships between the functional components may be preset, each for characterizing one of the logical relationships, so that the user may conveniently characterize the corresponding logical relationship by selecting the identifier.
In step S330, state machine template codes obtained by arranging codes respectively corresponding to at least one functional component according to the logical relationship between the at least one functional component are displayed in the state machine template code region.
In one embodiment of the present application, the process of generating the state machine template code may be performed in the terminal device, for example, the terminal device stores codes corresponding to the respective functional components and has a code arrangement function, and then the terminal device may perform an arrangement process directly according to the selected functional components and the logical relationship between the functional components. Of course, the process of generating the template code of the state machine may also be that the terminal device transmits the functional components dragged by the user to the template arrangement area and the logical relationships set for the functional components to the server, and the functional components are generated by the server and returned to the terminal device for display.
In step S340, a state machine template is generated from the state machine template code, the state machine template being used for publishing services for the task to be processed or containing the call interface.
In one embodiment of the present application, for a state machine template that needs to execute a task at a certain point in time, it may be issued as a task to be processed, and then at a corresponding point in time, an executor may be scheduled to execute the task. For a state machine template that can be used as a certain service, for example, a state machine template that can be used as a face recognition service, a voice recognition service, an OCR recognition service, etc., it can be released as a service that includes a call interface so as to be called by other programs.
The technical scheme of the embodiment shown in fig. 3 enables the state machine template to be arranged in a visual dragging mode, and different services do not need to be called in a code writing mode to release tasks or services, so that the arrangement generating efficiency of the tasks or services is improved.
Fig. 4 shows a flow chart of a state machine based task processing method that may be performed by a device having computational processing functionality, such as the executor 204 shown in fig. 2, according to one embodiment of the application. Referring to fig. 4, the task processing method based on the state machine at least includes steps S410 to S440, and is described in detail as follows:
In step S410, a state machine template corresponding to the task to be processed is obtained, the state machine template being generated from at least one functional component associated with the task to be processed.
In one embodiment of the present application, the process of generating the state machine template refers to the technical solution of the foregoing embodiment. Briefly, the state machine templates are generated by orchestrating the code of at least one functional component associated with a task to be processed.
In one embodiment of the present application, the task executor may first receive a task scheduling instruction sent by the task scheduler, where the task scheduling instruction is used to schedule a specified task stored in the task list, and then the task executor obtains the task to be processed according to the task scheduling instruction and reads the corresponding state machine template.
In one embodiment of the present application, each task executor may send a registration request to the task scheduler at startup, where the registration request may include a network address of the task executor. After the task executor is successfully registered, the task executor may periodically send a heartbeat message to the task scheduler, where the heartbeat message includes at least one of the following information: load condition of the task executor and survival state of the task executor. The information can facilitate the task scheduler to select a corresponding task executor to process a task to be processed, for example, the task scheduler can preferentially schedule the task executor with smaller load to execute the task, and after determining that one executor is out of connection according to the survival state, the task processed by the executor can be scheduled to other executors for processing.
In one embodiment of the present application, the task list may be stored in a database, and if there are multiple task schedulers, in order to avoid that a task is repeatedly scheduled by the multiple task schedulers, the multiple task schedulers may acquire the scheduling rights for the task list by using a distributed lock, so as to ensure that only one task scheduler accesses the task list at the same time, and after the task scheduler that acquires the scheduling rights completes scheduling, the distributed lock may be released.
In one embodiment of the application, the task stored in the task list can also have starting time information, so that the task scheduler can determine the scheduling opportunity of the task executor according to the starting time of each task in the task list, thereby realizing the timing start execution of the task.
With continued reference to fig. 4, in step S420, the state machine template is parsed to obtain at least one state node having an execution order, the state node corresponding one-to-one to the aforementioned functional components, the at least one state node including a start node.
In one embodiment of the application, the status node may comprise: task node, pass node, wait node, choice node, parallel node, foreach node, success node, fail node, etc. The different nodes correspond to different functional components, for example, a state node corresponding to a selection component is a Choice node, a state node corresponding to a loop component is a force node, a state node corresponding to a concurrency component is a Parallel node, a state node corresponding to a Success component is a Success node, a state node corresponding to a failure component is a Fail node, a state node corresponding to a Task component (or called a service component) is a Task node, a state node corresponding to a transfer component is a Pass node, and the like. The starting node is the state node which needs to be executed first in at least one state node obtained by analyzing the state machine template.
In step S430, at least one state node is sequentially executed from the start node, where, for the currently executed target state node, a function corresponding to the target state node is executed according to input data of the target state node, and output data of the target state node is sent to a downstream node of the target state node as input data of the downstream node.
In one embodiment of the present application, if the status node is a task type status node, when executing the task type status node, the input data may be converted into data corresponding to the protocol type according to the protocol type supported by the component service indicated by the designated field in the task type status node, so as to obtain converted data, and further the converted data is transmitted to the component service through the protocol supported by the component service, and a processing result of the component service on the converted data is obtained, and then the output data of the task type status node is generated based on the processing result. Alternatively, the specified field in the status node of the task type may be a field for indicating the component service that needs to be invoked, such as the "resource" field. If the component service to be called supports the Json protocol of HTTP, the input data can be converted into Json data, and then the Json data is transmitted to the component service in a GET or POST mode of HTTP; if the component service to be called supports the pb protocol of HTTP (i.e. protobuf, a data transmission protocol), the input data can be converted into pb data, and then the pb data is transmitted to the component service through an HTTP request; if the component service to be invoked supports the pb protocol of the gRPC, then the input data may be converted to pb data, which is then transferred to the component service after being connected by the gRPC.
In one embodiment of the application, if it is a state node of the delivery type or a state node of the task type, these nodes, after obtaining the output data, send the output data directly to the downstream node.
In one embodiment of the present application, if the state node is a state node of a loop type, when the state node of the loop type is executed, a loop start sub-state node, a loop body sub-state node and a loop end sub-state node which are obtained by analysis of the state node of the loop type are acquired. And then executing the circulation start sub-state node, if the circulation start sub-state node is executed, sending the output data of the circulation start sub-state node to the circulation body sub-state node, and if the circulation condition is not met, sending the output data of the circulation start sub-state node to the circulation end sub-state node. And after the loop body sub-state node is executed, the output data of the loop body sub-state node is directly sent to the loop end sub-state node for processing. When the circulation ending sub-state node is executed, if the circulation is not ended, the output data of the circulation ending sub-state node is sent to the circulation starting sub-state node, and if the circulation is ended, the output data of the circulation ending sub-state node is used as the output data of the circulation type state node.
It should be noted that, the loop body sub-state node is a processing procedure in the loop process, and may be a Task node, a Pass node, a Wait node, a Choice node, a Parallel node, a Foreach node, etc. in essence.
In one embodiment of the present application, if the state node is a state node of a selection type, when the state node of the selection type is executed, a selection start sub-state node, a selection body sub-state node and a selection end sub-state node which are obtained by analyzing the state node of the selection type can be obtained. And then executing the selection start sub-state node, if the execution of the selection start sub-state node determines that the selection condition is met, sending the output data of the selection start sub-state node to the selection body sub-state node, and if the execution of the selection start sub-state node determines that the selection condition is not met, sending the output data of the selection start sub-state node to the selection end sub-state node. And after the selector sub-state node is executed, the output data of the selector sub-state node is directly sent to the selector end sub-state node for processing. When the selection ending sub-state node is executed, the output data of the selection ending sub-state node is used as the output data of the state node of the selection type.
It should be noted that, the selector sub-state node is a processing procedure executed after the condition is satisfied in the selection process, and may be a Task node, a Pass node, a Wait node, a Choice node, a Parallel node, a Foreach node, or the like.
In one embodiment of the present application, if the state node is a parallel type state node, when the parallel type state node is executed, a parallel start sub-state node, a parallel processing sub-state node and a parallel end sub-state node which are obtained by analyzing the parallel type state node can be obtained. And then executing the parallel start sub-state node, sending the output data of the parallel start sub-state node to the parallel processing sub-state node, and after executing the parallel processing sub-state node, sending the output data of the parallel processing sub-state node to the parallel end sub-state node for processing. When executing the parallel ending sub-state node, integrating the output data of the parallel processing sub-state node, and then taking the integrated data as the output data of the parallel type state node.
It should be noted that the Parallel processing sub-state node is several nodes of Parallel processing, and may be a Task node, a Pass node, a Wait node, a Choice node, a Parallel node, a Foreach node, or the like.
With continued reference to fig. 4, in step S440, when the target state node is an end node, it is determined that the processing of the task to be processed is completed.
In one embodiment of the present application, if the currently executing target state node has no downstream node, or the currently executing target state node is a successful state node or a failed state node, the target state node may be determined to be an end node.
The technical scheme of the embodiment shown in fig. 4 can characterize the task to be processed through a state machine template, and can ensure normal execution of the task according to a logic sequence through analyzing the state machine template, so that effective control of each state of the task to be processed is realized.
The implementation details of the technical solution of the embodiment of the present application are described in detail below with reference to fig. 5 to 5:
as shown in FIG. 5, in one embodiment of the present application, the editing interface of the state machine template includes a functional component selection area 501, a template layout area 502, and a state machine template code area 503. The function component selection area 501 displays a draggable component list, and after the function component is dragged into the template arrangement area 502, the refresh button 505 may be clicked, so that a state machine template code may be generated according to the flow chart arranged in the template arrangement area 502, and displayed in the state machine template code area 503. Of course, in other embodiments of the present application, the state machine template code may be generated automatically refreshed, such as by refreshing at predetermined periods, or automatically updating the code within the state machine template code region 503 whenever the flow chart in the template layout region 502 changes.
With continued reference to FIG. 5, the editing interface also includes a function options area 506 that includes component management options, template management options, service management options, and task management options. Wherein, the component management is used for integrating various callable functional components, enriching the capability of the orchestration engine, and the functional components can be regarded as a Web service interface, an algorithm service interface and the like. The component therefore manages the protocol, parameters, and call mode information of the primary storage component. In the state machine template, the Task node may invoke other components, in which case a resource field may be used in the code corresponding to the Task node to uniquely describe an execution Task. One example is as follows: "resource: sdk: json: qcloud: ocr: general AccurateOCR", this component can be entered by the interface, and the corresponding information is also filled in on the system page for importation.
The core function of template management is to program the state machine template, the front end supports dragging or directly programs state flow language, and after the template is established, the corresponding template creation task or service can be selected. The organized state machine templates are published or saved via buttons 504 on the interface, where the state machine templates can be published as tasks or services, thus having task management and service management.
Task management is used to manage published tasks (which may be distributed tasks) that can run for long periods of time and when an actor sends a failure, the task can be scheduled to other actors to continue running. Service management is used to manage published services, which can be regarded as a Web service and can be invoked directly via an API (Application Programming Interface, application program interface).
In one embodiment of the present application, the system architecture corresponding to the interface shown in fig. 5 is shown in fig. 6, and mainly includes: API gateway 601, orchestration system 602, peripheral system 603, storage system 604. The API gateway 601 is used to provide an API interface to interact with other applications. Orchestration system 602 is primarily used to enable generation of state machine templates, publication of tasks or services, and scheduling of executors by a scheduler to handle tasks or services. The peripheral system 603 may provide IoT (Internet of Things ) device information, algorithm services, data services, subscription services, etc. to orchestration system 602. The storage system 604 may implement various storage services such as TKE (Tencent Kubernetes Engine, tencel cloud container service), mySQL, redis, COS (Chip Operating System, on-chip operating system), ELK (elastomer search (a search server), logstar (application log, platform for event transmission, processing, management and search), kibana (an open source analysis and visualization platform), and the like.
Based on the system architecture, as shown in fig. 7, a flowchart of component registration and arrangement according to an embodiment of the present application includes the following steps:
in step S701, a user initiates a registration request to a component service. Wherein the component service may be a component management corresponding service. Specifically, the user may initiate a registration request for a certain component on the computer, where the registration request includes component information that the user needs to register.
In one embodiment of the application, the components may include flow components, service components, script components, and the like. The flow component is used to control orchestration flow and may include, for example, a selection component, a loop component, a concurrency component, a success component, a failure component, and the like. The script component is a body of script code (e.g., python script code) that is typically used to perform some simple function, such as processing request or response parameters of upstream and downstream nodes. The service component is used for executing background services of specific business functions, such as face recognition algorithm service, road traffic query service and the like. If the user registers a service component, the service component must provide an interface for http or grpc, and when registering, the service component needs to provide information such as a service name, an interface URI (Uniform Resource Identifier ), a request response parameter description, a call protocol (such as http, grpc, etc., if the protocol is grpc, the protocol content of protobuf needs to be provided), a request data format (such as json, pb, etc.), a call mode (such as GET, POST, etc.), a call address, etc.
In step S702, the component service returns a registration result to the user.
In one embodiment of the application, if the component service determines that the registration is successful, then returning the result of the successful registration to the user; if the registration fails, a result of the registration failure is returned to the user. It should be noted that step S702 is an optional step, and in other embodiments of the present application, the registration result may not be returned to the user.
In step S703, the component service acquires a component list from the Web console.
In one embodiment of the application, after the component service obtains the list of components from the Web console, it may be displayed on an interface for selection by the user. In particular, the background may provide a component list interface to the front-end user page.
In step S704, the user drags the orchestration component to generate template code.
In one embodiment of the application, the user may select a desired component in the component list and drag into the template orchestration area for orchestration, in which process the system generates the corresponding state machine template code.
In one embodiment of the present application, for a flow component, code may be generated directly according to grammar when dragged, such as a code correspondingly generated by a concurrency component (parallel) is shown in fig. 8A, where a code segment 801a in fig. 8A indicates that the component type is a "concurrency" type; code segment 802a represents the names of the branch nodes in the concurrency component; code segment 803a represents an listed branch node; code segment 804a represents performing a step in which a node of type "task" is performed, which is the 1 st node of branch node 1; code segment 805a represents performing a step in which a node of type "task" is performed, which is the 1 st node of branch node 2.
Other flow components, such as loops (for), choices (choice), success (success), and failure (fail), may also be generated directly from the contracted grammar.
In one embodiment of the present application, both the service component and the script component are intended to perform a specific task, so they can be described as task types, and generate a resource description node containing five segments through component interface call information returned by the component service. As shown in fig. 8B in particular, the code segment 801B in fig. 8B represents that the component type is "task" type; code segment 802b indicates that the task name is "face attribute identification service"; the code segment 803b uniquely describes an execution task through a "resource" field, and the content behind the "resource" field is interface information of the execution task to be called; code segment 804b represents mapping of input data by inputMappings, i.e., mapping source data (i.e., input data) to target data (i.e., target), and then passing to the execution task described in the "resource" field; code segment 805b represents the mapping of output data by the outputmaps, i.e., mapping source data (i.e., data output by the execution task described by the source field) to target data (i.e., target), and then passing to downstream nodes.
It should be noted that, the embodiment of the present application does not limit the description language and syntax of the state machine template, for example, the same task as described above may be represented in the form of Json syntax shown in fig. 8C, and the purpose of describing the state machine template may be achieved. As shown in fig. 8C, the code segment 801C represents a function defining a name "face-attribute"; the code segment 802c is a function body part, in which a Type (Type) is "task", a Comment (Comment) is "face attribute identification service", and one execution task is uniquely described by a "resource" field, and the content behind the "resource" field is interface information of the execution task to be called.
Thus, in particular implementations, the description language and syntax may be different depending on the scene requirements.
With continued reference to fig. 7:
in step S705, the Web console transmits an instruction to save the state machine template to the template service.
In one embodiment of the application, if the user orchestrates and selects to save or publish the state machine template, then the state machine template may be saved through a template service. Wherein the template service may be a template management corresponding service.
In step S706, the Web console returns the processing result to the user. Specifically, a result of success or failure of saving the state machine template can be returned to the user. It should be noted that step S706 is an optional step, and in other embodiments of the present application, the result may not be returned to the user.
Fig. 5 and 8D show examples of two state machine templates, respectively, as described below:
as shown in FIG. 5, the components in the template orchestration area 502 are service components and script components, and the execution order of the components is from top to bottom according to the arrow, so that the codes corresponding to the components are also displayed in the state machine template code area 503 in sequence. That is, the codes 5051 corresponding to the task "motor vehicle monitoring device", the codes 5052 corresponding to the "creation snapshot library 1", the codes 5053 corresponding to the "middle version person vehicle detection tracking service 1", the codes 5054 corresponding to the "vehicle attribute identification request group package", the codes 5055 corresponding to the "motor vehicle attribute identification service", the codes 5056 corresponding to the "vehicle attribute identification result processing", and the codes 5057 corresponding to the "vehicle alarm" are sequentially displayed. Wherein in FIG. 5, "version" in code section 5058 represents a version number; "timeout" means that it is desired to return a result within a given time; "vars" is used to define variables; "steps" means that the following steps are started. The description of the other individual code segments can be made with reference to the previous description of the parts of fig. 8A and 8B, wherein the code segment "desc" which has not been described before represents the description information.
As shown in fig. 8D, the template arrangement area includes not only task type components (i.e., script components and service components) but also flow components (i.e., loop) components, and the main body of the loop components includes task type components (i.e., face recognition and human body information recognition components). The codes displayed in the state machine template code area are obtained by arranging the codes corresponding to the components according to the logical relations of the components. Specifically, the code 801d corresponding to the task "graphics stream" is displayed first, then the code 802d corresponding to the foreach task is displayed, and finally the code 803d corresponding to the task "storage component" is displayed. The "desirability" in the code 802d corresponding to the foreach task defines that the result of each cycle is merged, and two task "face recognition" and "body information recognition" of the task type are also defined in the loop body in the code 802 d. The description of the other individual code segments may be referred to the previous description of fig. 5, 8A and 8B.
The code 5054 corresponding to the "vehicle attribute identification request package", the code 5055 corresponding to the "motor vehicle attribute identification service", the code 5056 corresponding to the "vehicle attribute identification result process", and the code 5057 corresponding to the "vehicle alarm". Wherein in FIG. 5, "version" in code section 5058 represents a version number; "timeout" means that it is desired to return a result within a given time; "vars" is used to define variables; "steps" means that the following steps are started. The description of the other individual code segments may be made with reference to the previous description of the portions of fig. 8A and 8B, wherein the code segments "desc" not previously described represent a descending order of ordering.
In one embodiment of the present application, after the state machine templates are arranged, the state machine templates may be published as tasks or services, and fig. 9 shows a published task list, where relevant information of the corresponding tasks, such as task descriptions, corresponding state machine templates, modifier, modification time, task status, operation information (such as suspending, deleting, starting tasks, and implementing effective control of tasks), etc. may be displayed.
In one embodiment of the present application, when a task in the task list needs to be started, the task is scheduled to an executor (i.e., an execution engine) by a scheduler for execution. As shown in fig. 10, in order to ensure that the scheduler effectively schedules the executor, the executor needs to register its own IP information to the scheduler at the time of startup, and the scheduler may not allocate task execution to the scheduler until the registration is successful. After registration is successful, the executor may send a heartbeat message to the scheduler periodically (e.g., 15 seconds is one period) to inform the scheduler of its survival and current load conditions. The scheduler may store the IP of the actuator, the current load value, the actuator registration time, the last heartbeat time of the actuator, the actuator survival status, etc., as shown in table 1 below, where a survival status of "0" may indicate disconnected and a survival status of "1" may indicate still connected. Of course, it is also possible to use a surviving state of "1" to indicate that the connection has been broken and a surviving state of "0" to indicate that the connection is still in place.
TABLE 1
In one embodiment of the present application, if a certain actuator fails to continuously perform 3 (the numerical value is only an example), the actuator and the scheduler are in a non-connection state, and the execution in the actuator is stopped; and if the scheduler does not receive the heartbeat of the executor, the task of the current executor is rescheduled and allocated to other executors for continuous execution, so that the timely processing of the task is ensured, and the task interruption is avoided. As shown in fig. 10, if the executors executing the task a and the task B are not connected, the scheduler schedules the task a and the task B to the other executors for processing.
In one embodiment of the application, to achieve high availability of schedulers, multiple schedulers may be started simultaneously. However, to prevent the same task from being repeatedly scheduled by multiple schedulers at the same time, redis may be introduced for distributed lock operation, as shown in FIG. 10. Specifically, when the scheduler needs to schedule, the scheduler needs to preempt the distributed lock, so that only one scheduler can acquire the scheduling authority at the moment, then the latest task list to be scheduled is loaded from MySQL to schedule, and the distributed lock is released after the scheduling is completed. The specific flow is shown in fig. 11, and comprises the following steps:
In step S1101, the daemon thread of the scheduler preempts the distributed lock to the Redis.
In one embodiment of the application, the scheduler can judge whether the task to be executed needs to be scheduled for execution immediately, if so, the task is scheduled, otherwise, the daemon thread waiting for the scheduler polls the task list to judge that the execution condition is met, and then the task is scheduled. Specifically, the daemon thread defaults to scan every 5 seconds (numerical values are merely examples). Except real-time scheduling, the judgment condition of timing scheduling is to judge whether the task starting time is greater than the current time; the judging condition of the periodic scheduling task is to judge whether the current moment is a time period for which the task needs to be executed.
In step S1102, the scheduler successfully acquires the distributed lock.
In step S1103, the scheduler obtains a task list from MySQL.
In step S1104, mySQL returns a task list to the scheduler.
In step S1105, the scheduler schedules the executor to execute the task.
In one embodiment of the application, the scheduler can know that there are several available actuators and their load conditions currently through heartbeat messages sent by the actuators, and then schedule tasks meeting the scheduling conditions to the actuators with lower load values for execution.
In step S1106, the executor returns the scheduling situation to the scheduler.
In step S1107, the scheduler updates the scheduling status of the task to MySQL.
In step S1108, the scheduler sends information to the Redis to release the distributed lock after completing the scheduling.
In step S1109, redis returns the release completed state to the scheduler. This step is an optional step, and in other embodiments of the present application, redis may not return the released state information to the scheduler.
It should be noted that, in addition to adopting the manner of dis distributed lock, the embodiment of the present application may also adopt other manners such as zookeeper (which is a distributed application coordination service of open source code) to ensure that only one scheduler obtains the access right at the same time. And the database storing the task list may be other types of databases as well.
In one embodiment of the present application, the execution process of the actuator is shown in fig. 12, and specifically includes the following steps:
in step S1201, the scheduler transmits a scheduling instruction to the executor.
In step S1202, the executor sends a heartbeat message to the scheduler to synchronize task status and load conditions, etc. It should be noted that this step may be performed all the time.
In step S1203, the executor obtains the state machine template of the task from the template service.
In step S1204, the template service returns the state machine template to the executor.
In step S1205, the executor parses the state machine template.
In one embodiment of the present application, the main task of the executor parsing is to parse each state Node to memory data structure of the state machine template, and the Node structure may be used to represent information of one state Node. The most critical of the parsing process is to find the starting node of the template state machine, and the downstream node array of each node in the data structure. It should be noted that the downstream node array may include only one downstream node, but may also include multiple downstream nodes (e.g., the downstream nodes are multiple parallel types of nodes).
In step S1206, the executor obtains a component interface description of the template dependency.
In step S1207, the component service returns to the scheduling case.
In step S1208, the executor executes the state machine to complete execution of the task.
In one embodiment of the application, the main workflow of the actuator is: and acquiring a state machine template and a current state node. The initial node is the initial step, and each node updates the task state after receiving the input data and executing the current state and sends the task state to the downstream node. The specific flow is shown in fig. 13, and mainly comprises the following steps:
Step S1301, input data is received.
Step S1302, check task status.
In step S1303, a map is input.
In one embodiment of the present application, the input map is used to process the logic of inputMappings, i.e., the Json data input is assembled into a target Json by the JsonPath description of inputMappings, and then passed to run () method of the current state.
Step S1304, run () is performed.
In one embodiment of the present application, only the task type node needs to perform the run () method. This method will obtain the protocol and call information of the component according to the component service described in the resource field of the task, and then assemble the request to make a call.
If the component service described in the resource field supports the Json protocol of HTTP, requesting the component service by using Json data assembled by inputMappings in a GET or POST mode of HTTP; if the component service described in the resource field supports the pb protocol of HTTP, the assembled Json data is required to be converted into pb data and then HTTP request is carried out; if the component service described in the resource field supports the pb protocol of the grpc, the assembled Json data needs to be converted into pb data, and then the pb data is connected through the grpc for data transmission.
Step S1305, the map is output.
In one embodiment of the present application, the output map is used to process the logic of the outputmaps, the Json returned by the run () method is assembled into the target Json through the Json path description of the outputmaps, and after the task state and step information are updated, the target Json is transferred to the downstream state node.
Step S1306, update step.
Step S1307, send to the downstream node, then the downstream node executes step S1301.
In one embodiment of the present application, there are different situations when data is sent to a downstream node, and for a task node or a pass node, the data is directly sent to a next node after being processed.
If the state node is of a loop type, a forward-start state node and a forward-end state node are constructed during parsing, and steps in the loop state can be placed between the forward-start state node and the forward-end state node, so that the start and end can be used for controlling the flow. As shown in fig. 14, the logic of the foreach-start state node is to determine whether a cycle condition is satisfied, send data to the state node inside foreach if the cycle condition is satisfied, and send data to the foreach-end state node if the cycle condition is not satisfied. After all the state nodes in the foreach are executed, data are sent to the foreach-end state node, logic of the foreach-end state node judges whether circulation is finished or not, if so, the data are sent to the downstream state node of the foreach, and if not, the data are sent to the foreach-start state node.
If the state node is of the selected type, a choice-start state node and a choice-end state node are constructed during parsing, and steps in the selected state can be placed between the choice-start state node and the choice-end state node, so that the start and end can be used for controlling the flow. As shown in fig. 15, the logic of the choice-start state node is to determine whether a selection condition is satisfied, and if so, send data to the state node in the choice; if not, the data is directly sent to the choice-end state node. After all the state nodes in the choice are executed, data are sent to the choice-end state nodes, the choice-end is simpler, and the data are directly transmitted to the downstream state nodes of the choice.
If the parallel state nodes are the parallel state nodes, a parallel-start state node and a parallel-end state node are constructed during parsing, and steps in the parallel state can be placed between the parallel state nodes, so that the start and end can be used for controlling the flow. As shown in fig. 16, the logic of the parallel-start state node distributes data to state nodes within multiple parallel. After all the state nodes in the parallel are executed, data are sent to the parallel-end state nodes, and logic of the parallel-end state nodes is combined into an array after waiting for completion of multiple paths of data and then sent to downstream state nodes of the parallel.
If the task is success state node or fail state node, the task is directly marked as successful or failed without being sent to a downstream state node.
If the last state node is reached, that is, the node without the downstream node is reached, the task is directly marked to be successfully completed without being sent to the downstream state node.
The technical scheme of the embodiment of the application ensures that the state machine templates of different business processes can be completed by dragging the atomic service components, and the process is completed without calling different services by writing codes, thereby improving the arrangement and generation efficiency of tasks or services. The issued tasks support timing start execution and periodic execution, and the tasks can be scheduled to different executors for execution, so that the distributed transverse expansibility is ensured. In addition, the normal execution of the tasks according to the logic sequence can be ensured by analyzing the state machine template, so that the effective control of each state of the task to be processed is realized.
The following describes an embodiment of an apparatus according to the present application, which may be used to perform the task processing method based on a state machine in the above embodiment of the present application. For details not disclosed in the embodiments of the apparatus of the present application, please refer to the embodiments of the task processing method based on a state machine described above.
Fig. 17 illustrates a block diagram of a state machine based task processing device that may be provided within a device having computational processing functionality, such as may be provided within the executor 204 illustrated in fig. 2, according to one embodiment of the present application.
Referring to fig. 17, a state machine based task processing device 1700 according to one embodiment of the present application includes: acquisition unit 1702, parsing unit 1704, processing unit 1706, and determination unit 1708.
The obtaining unit 1702 is configured to obtain a state machine template corresponding to a task to be processed, where the state machine template is generated according to at least one functional component associated with the task to be processed; the parsing unit 1704 is configured to parse the state machine template to obtain at least one state node with an execution sequence, where the state node corresponds to the functional component one by one, and the at least one state node includes a start node; the processing unit 1706 is configured to execute the at least one state node sequentially from the start node, wherein, for a currently executed target state node, a function corresponding to the target state node is executed according to input data of the target state node, and output data of the target state node is sent to a downstream node of the target state node as input data of the downstream node; the determining unit 1708 is configured to determine that the task to be processed is completed when the target state node is an end node.
In some embodiments of the application, based on the foregoing, the at least one status node comprises a task-type status node; the processing unit 1706 is configured to: when executing the state node of the task type, converting the input data into data corresponding to the protocol type according to the protocol type supported by the component service indicated by the designated field in the state node of the task type to obtain converted data; transmitting the conversion data to the component service through a protocol supported by the component service, and acquiring a processing result of the component service on the conversion data; and generating output data of the state node of the task type based on the processing result.
In some embodiments of the application, based on the foregoing scheme, the processing unit 1706 is configured to: and if the target state node is a state node of a transmission type or a state node of a task type, directly transmitting output data of the target state node to a downstream node of the target state node.
In some embodiments of the application, based on the foregoing, the at least one state node comprises a loop type state node; the processing unit 1706 is configured to: when executing a state node of a cycle type, acquiring a cycle start sub-state node, a cycle body sub-state node and a cycle end sub-state node which are obtained by analyzing the state node of the cycle type; if the circulation starting sub-state node determines that the circulation condition is met, the output data of the circulation starting sub-state node is sent to the circulation body sub-state node, and if the circulation condition is not met, the output data of the circulation starting sub-state node is sent to the circulation ending sub-state node; after executing the loop body sub-state node, sending output data of the loop body sub-state node to the loop end sub-state node for processing; and if the circulation ending sub-state node determines that the circulation is not ended, sending the output data of the circulation ending sub-state node to the circulation starting sub-state node, and if the circulation is ended, taking the output data of the circulation ending sub-state node as the output data of the circulation type state node.
In some embodiments of the application, based on the foregoing, the at least one state node comprises a state node of a selected type; the processing unit 1706 is configured to: when executing a state node of a selection type, acquiring a selection start sub-state node, a selection body sub-state node and a selection end sub-state node which are obtained by analyzing the state node of the selection type; if the selection starting sub-state node is executed, the output data of the selection starting sub-state node is sent to the selector sub-state node, and if the selection starting sub-state node is not executed, the output data of the selection starting sub-state node is sent to the selection ending sub-state node; after executing the selector sub-state node, sending output data of the selector sub-state node to the selector end sub-state node for processing; executing the selection ending sub-state node, and taking the output data of the selection ending sub-state node as the output data of the state node of the selection type.
In some embodiments of the application, based on the foregoing, the at least one state node comprises a parallel type of state node; the processing unit 1706 is configured to: when executing a state node of a parallel type, acquiring a parallel start sub-state node, a parallel processing sub-state node and a parallel end sub-state node which are obtained by analyzing the state node of the parallel type; executing the parallel start sub-state node, and sending output data of the parallel start sub-state node to the parallel processing sub-state node; after executing the parallel processing sub-state node, sending output data of the parallel processing sub-state node to the parallel ending sub-state node for processing; executing the parallel ending sub-state node to integrate the output data of the parallel processing sub-state node, and taking the integrated data as the output data of the state node of the parallel type.
In some embodiments of the present application, based on the foregoing scheme, if the target state node has no downstream node, or the target state node is a successful state node or a failed state node, the target state node is determined to be the end node.
In some embodiments of the present application, based on the foregoing scheme, the obtaining unit 1702 is further configured to: before a state machine template corresponding to a task to be processed is acquired, a task scheduling instruction sent by a task scheduler is received, wherein the task scheduling instruction is used for scheduling a designated task stored in a task list, and the task to be processed is acquired according to the task scheduling instruction.
In some embodiments of the present application, based on the foregoing solution, the task processing device 1700 based on a state machine further includes: the sending unit is configured to send a registration request to the task scheduler before the acquisition unit receives a task scheduling instruction sent by the task scheduler, wherein the registration request comprises a network address of the task executor, and after successful registration to the task scheduler, a heartbeat message is periodically sent to the task scheduler, and the heartbeat message comprises at least one of the following information: load condition of the task executor and survival state of the task executor.
In some embodiments of the present application, based on the foregoing solution, the task list is stored in a database, where there are multiple task schedulers, the multiple task schedulers acquire the scheduling rights for the task list by means of a distributed lock; the task stored in the task list is provided with starting time information, and the task scheduler determines scheduling occasions for the task executor according to the starting time of each task in the task list when accessing the task list.
Fig. 18 shows a block diagram of a state machine template generation apparatus according to an embodiment of the present application, which may be provided in a device having a calculation processing function, such as the terminal device 201 shown in fig. 2.
Referring to fig. 18, a state machine template generating apparatus 1800 according to an embodiment of the present application includes: a first display unit 1802, a second display unit 1804, a third display unit 1806, and a generation unit 1808.
The first display unit 1802 is configured to display an editing interface of a state machine template, where the editing interface includes a functional component selection area, a template arrangement area, and a state machine template code area; the second display unit 1804 is configured to display, in the template arrangement area, at least one functional component selected from the functional component selection area and dragged into the template arrangement area, and a logical relationship set for the at least one functional component; the third display unit 1806 is configured to display state machine template codes in the state machine template code area, where the state machine template codes are obtained by arranging codes corresponding to the at least one functional component respectively according to a logical relationship between the at least one functional component; the generating unit 1808 is configured to generate a state machine template according to the state machine template code, where the state machine template is used for publishing a service that is a task to be processed or contains a call interface.
In some embodiments of the present application, based on the foregoing solution, the generating device 1800 of the state machine template further includes: a receiving unit configured to receive a registration request of a functional component, the registration request being for registering a specified functional component; and a storage unit configured to store the specified functional component into a functional component list and display the specified functional component in the functional component selection area.
Fig. 19 shows a schematic diagram of a computer system suitable for use in implementing an embodiment of the application.
It should be noted that, the computer system 1900 of the electronic device shown in fig. 19 is only an example, and should not impose any limitation on the functions and the application scope of the embodiments of the present application.
As shown in fig. 19, the computer system 1900 includes a central processing unit (Central Processing Unit, CPU) 1901 that can perform various appropriate actions and processes, such as performing the methods described in the above embodiments, according to a program stored in a Read-Only Memory (ROM) 1902 or a program loaded from a storage section 1908 into a random access Memory (Random Access Memory, RAM) 1903. In the RAM 1903, various programs and data required for system operation are also stored. The CPU 1901, ROM 1902, and RAM 1903 are connected to each other via a bus 1904. An Input/Output (I/O) interface 1905 is also connected to bus 1904.
The following components are connected to I/O interface 1905: an input section 1906 including a keyboard, a mouse, and the like; an output portion 1907 including a Cathode Ray Tube (CRT), a liquid crystal display (Liquid Crystal Display, LCD), and a speaker; a storage section 1908 including a hard disk or the like; and a communication section 1909 including a network interface card such as a LAN (Local Area Network ) card, a modem, or the like. The communication section 1909 performs communication processing via a network such as the internet. The driver 1910 is also connected to the I/O interface 1905 as needed. A removable medium 1911 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed as needed on the drive 1910, so that a computer program read out therefrom is installed into the storage portion 1908 as needed.
In particular, according to embodiments of the present application, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising a computer program for performing the method shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from the network via the communication portion 1909, and/or installed from the removable media 1911. The computer programs, when executed by a Central Processing Unit (CPU) 1901, perform the various functions defined in the system of the present application.
It should be noted that, the computer readable medium shown in the embodiments of the present application may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-Only Memory (ROM), an erasable programmable read-Only Memory (Erasable Programmable Read Only Memory, EPROM), flash Memory, an optical fiber, a portable compact disc read-Only Memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present application, however, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with a computer-readable computer program embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. A computer program embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. Where each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present application may be implemented by software, or may be implemented by hardware, and the described units may also be provided in a processor. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
As another aspect, the present application also provides a computer-readable medium that may be contained in the electronic device described in the above embodiment; or may exist alone without being incorporated into the electronic device. The computer-readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to implement the methods described in the above embodiments.
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the application. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present application may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, a touch terminal, or a network device, etc.) to perform the method according to the embodiments of the present application.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (15)

1. A state machine based task processing method, comprising:
acquiring a state machine template corresponding to a task to be processed, wherein the state machine template is generated according to at least one functional component associated with the task to be processed; the functional components comprise a flow component, a service component and a script component; the process component is used for controlling the arranging process, the service component is used for executing background service of business functions, and the script component is used for executing specific tasks;
Analyzing the state machine template to obtain at least one state node with an execution sequence, wherein the state node corresponds to the functional component one by one, and the at least one state node comprises a starting node;
executing the at least one state node in sequence from the starting node, wherein for a currently executed target state node, executing a function corresponding to the target state node according to input data of the target state node, and sending output data of the target state node to a downstream node of the target state node as input data of the downstream node;
and when the target state node is an end node, determining that the task to be processed is processed.
2. The state machine based task processing method of claim 1, wherein the at least one state node comprises a state node of a task type;
for a currently executed target state node, executing a function corresponding to the target state node according to input data of the target state node, including:
when executing the state node of the task type, converting the input data into data corresponding to the protocol type according to the protocol type supported by the component service indicated by the designated field in the state node of the task type to obtain converted data;
Transmitting the conversion data to the component service through a protocol supported by the component service, and acquiring a processing result of the component service on the conversion data;
and generating output data of the state node of the task type based on the processing result.
3. The state machine based task processing method according to claim 1, wherein transmitting output data of the target state node to a downstream node of the target state node as input data of the downstream node, comprises:
and if the target state node is a state node of a transmission type or a state node of a task type, directly transmitting output data of the target state node to a downstream node of the target state node.
4. The state machine based task processing method of claim 1, wherein the at least one state node comprises a loop type state node;
for a currently executed target state node, executing a function corresponding to the target state node according to input data of the target state node, including:
when executing a state node of a cycle type, acquiring a cycle start sub-state node, a cycle body sub-state node and a cycle end sub-state node which are obtained by analyzing the state node of the cycle type;
If the circulation starting sub-state node determines that the circulation condition is met, the output data of the circulation starting sub-state node is sent to the circulation body sub-state node, and if the circulation condition is not met, the output data of the circulation starting sub-state node is sent to the circulation ending sub-state node;
after executing the loop body sub-state node, sending output data of the loop body sub-state node to the loop end sub-state node for processing;
and if the circulation ending sub-state node determines that the circulation is not ended, sending the output data of the circulation ending sub-state node to the circulation starting sub-state node, and if the circulation is ended, taking the output data of the circulation ending sub-state node as the output data of the circulation type state node.
5. The state machine based task processing method of claim 1, wherein the at least one state node comprises a selected type of state node;
for a currently executed target state node, executing a function corresponding to the target state node according to input data of the target state node, including:
When executing a state node of a selection type, acquiring a selection start sub-state node, a selection body sub-state node and a selection end sub-state node which are obtained by analyzing the state node of the selection type;
if the selection starting sub-state node is executed, the output data of the selection starting sub-state node is sent to the selector sub-state node, and if the selection starting sub-state node is not executed, the output data of the selection starting sub-state node is sent to the selection ending sub-state node;
after executing the selector sub-state node, sending output data of the selector sub-state node to the selector end sub-state node for processing;
executing the selection ending sub-state node, and taking the output data of the selection ending sub-state node as the output data of the state node of the selection type.
6. The state machine based task processing method of claim 1, wherein the at least one state node comprises a parallel type of state node;
for a currently executed target state node, executing a function corresponding to the target state node according to input data of the target state node, including:
When executing a state node of a parallel type, acquiring a parallel start sub-state node, a parallel processing sub-state node and a parallel end sub-state node which are obtained by analyzing the state node of the parallel type;
executing the parallel start sub-state node, and sending output data of the parallel start sub-state node to the parallel processing sub-state node;
after executing the parallel processing sub-state node, sending output data of the parallel processing sub-state node to the parallel ending sub-state node for processing;
executing the parallel ending sub-state node to integrate the output data of the parallel processing sub-state node, and taking the integrated data as the output data of the state node of the parallel type.
7. The state machine based task processing method according to claim 1, wherein if the target state node has no downstream node, or the target state node is a successful state node or a failed state node, the target state node is determined to be the end node.
8. The state machine based task processing method according to any one of claims 1 to 7, wherein before acquiring a state machine template corresponding to a task to be processed, the method further comprises:
Receiving a task scheduling instruction sent by a task scheduler, wherein the task scheduling instruction is used for scheduling a designated task stored in a task list;
and determining the task to be processed according to the task scheduling instruction.
9. The state machine based task processing method of claim 8, wherein prior to receiving a task scheduling instruction sent by a task scheduler, the method further comprises:
a registration request is sent to the task dispatcher, wherein the registration request comprises a network address of the task executor;
after successful registration to the task scheduler, periodically sending a heartbeat message to the task scheduler, wherein the heartbeat message contains at least one of the following information: load condition of the task executor and survival state of the task executor.
10. The state machine based task processing method according to claim 8, wherein the task list is stored in a database, and in the case of a plurality of task schedulers, the task schedulers acquire scheduling rights for the task list by means of a distributed lock;
the task stored in the task list is provided with starting time information, and the task scheduler determines scheduling occasions for the task executor according to the starting time of each task in the task list when accessing the task list.
11. A method for generating a state machine template, comprising:
displaying an editing interface of a state machine template, wherein the editing interface comprises a functional component selection area, a template arrangement area and a state machine template code area;
displaying, in the template arrangement area, at least one functional component selected from the functional component selection area and dragged into the template arrangement area, and a logical relationship set for the at least one functional component; the functional components comprise a flow component, a service component and a script component; the process component is used for controlling the arranging process, the service component is used for executing background service of business functions, and the script component is used for executing specific tasks;
displaying state machine template codes in the state machine template code region, wherein the state machine template codes are obtained by arranging codes corresponding to the at least one functional component respectively according to the logic relation among the at least one functional component;
and generating a state machine template according to the state machine template code, wherein the state machine template is used for issuing a service which is a task to be processed or contains a calling interface.
12. The method of generating a state machine template of claim 11, further comprising:
receiving a registration request of a functional component, wherein the registration request is used for registering a specified functional component;
and storing the specified functional components into a functional component list and displaying the specified functional components in the functional component selection area.
13. A state machine based task processing device, comprising:
the system comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is configured to acquire a state machine template corresponding to a task to be processed, and the state machine template is generated according to at least one functional component associated with the task to be processed; the functional components comprise a flow component, a service component and a script component; the process component is used for controlling the arranging process, the service component is used for executing background service of business functions, and the script component is used for executing specific tasks;
the analyzing unit is configured to analyze the state machine template to obtain at least one state node with an execution sequence, the state nodes are in one-to-one correspondence with the functional components, and the at least one state node comprises a starting node;
the processing unit is configured to execute the at least one state node in sequence from the starting node, wherein for a currently executed target state node, the function corresponding to the target state node is executed according to the input data of the target state node, and the output data of the target state node is sent to a downstream node of the target state node as the input data of the downstream node;
And the determining unit is configured to determine that the task to be processed is processed when the target state node is an end node.
14. A computer readable medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the state machine based task processing method according to any of claims 1 to 10 or the state machine template generation method according to any of claims 11 to 12.
15. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which when executed by the one or more processors cause the one or more processors to implement the state machine based task processing method of any of claims 1 to 10 or the state machine template generation method of any of claims 11 to 12.
CN202010827095.XA 2020-08-17 2020-08-17 Method, device, medium and equipment for generating state machine template and processing task Active CN112051993B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010827095.XA CN112051993B (en) 2020-08-17 2020-08-17 Method, device, medium and equipment for generating state machine template and processing task

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010827095.XA CN112051993B (en) 2020-08-17 2020-08-17 Method, device, medium and equipment for generating state machine template and processing task

Publications (2)

Publication Number Publication Date
CN112051993A CN112051993A (en) 2020-12-08
CN112051993B true CN112051993B (en) 2023-10-24

Family

ID=73600473

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010827095.XA Active CN112051993B (en) 2020-08-17 2020-08-17 Method, device, medium and equipment for generating state machine template and processing task

Country Status (1)

Country Link
CN (1) CN112051993B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112631696B (en) * 2020-12-29 2021-10-22 智慧神州(北京)科技有限公司 Service arranging method, arranging device, processor and service arranging system
CN112804334A (en) * 2021-01-15 2021-05-14 京东方科技集团股份有限公司 Method and device for distributing and acquiring tasks, storage medium and electronic equipment
CN112766750A (en) * 2021-01-25 2021-05-07 中国原子能科学研究院 Task model construction method and system
CN112800741A (en) * 2021-01-29 2021-05-14 远光软件股份有限公司 Task execution method, electronic device and storage medium
CN115220787A (en) * 2021-04-17 2022-10-21 华为技术有限公司 Driving control instruction generation method, heterogeneous calculation method, related device and system
CN113282355A (en) * 2021-05-18 2021-08-20 Oppo广东移动通信有限公司 Instruction execution method and device based on state machine, terminal and storage medium
CN113312202B (en) * 2021-07-29 2021-11-12 太平金融科技服务(上海)有限公司 Fault processing logic generation method, device, equipment and medium based on component
CN114518908B (en) * 2022-02-17 2024-03-22 杭州网易云音乐科技有限公司 Service orchestration method, medium, device and computing equipment
CN116450101B (en) * 2023-04-27 2024-04-09 睿珀智能科技有限公司 Software architecture design method, system and equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334545A (en) * 2017-12-27 2018-07-27 微梦创科网络科技(中国)有限公司 A kind of method and device for realizing asynchronous service
GB201821182D0 (en) * 2018-12-21 2019-02-06 Imagination Tech Ltd Scheduling tasks in a processor
CN110728519A (en) * 2019-09-27 2020-01-24 支付宝(杭州)信息技术有限公司 Processing method and device for refused payment task and server
CN110765099A (en) * 2019-09-06 2020-02-07 阿里巴巴集团控股有限公司 Business construction method and device and computer equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108334545A (en) * 2017-12-27 2018-07-27 微梦创科网络科技(中国)有限公司 A kind of method and device for realizing asynchronous service
GB201821182D0 (en) * 2018-12-21 2019-02-06 Imagination Tech Ltd Scheduling tasks in a processor
CN110765099A (en) * 2019-09-06 2020-02-07 阿里巴巴集团控股有限公司 Business construction method and device and computer equipment
CN110728519A (en) * 2019-09-27 2020-01-24 支付宝(杭州)信息技术有限公司 Processing method and device for refused payment task and server

Also Published As

Publication number Publication date
CN112051993A (en) 2020-12-08

Similar Documents

Publication Publication Date Title
CN112051993B (en) Method, device, medium and equipment for generating state machine template and processing task
US11907732B2 (en) Leveraging microservice containers to provide tenant isolation in a multi-tenant API gateway
CN110245008B (en) Timing task processing method, system and equipment
US9424481B2 (en) Screenshot database for application verification
CN110083455B (en) Graph calculation processing method, graph calculation processing device, graph calculation processing medium and electronic equipment
US10216491B2 (en) Controlled availability of objects in a visual design tool for integration development
US10135940B2 (en) Subscribing to event notifications using object instances
US20160011911A1 (en) Managing parallel processes for application-level partitions
CN110244942B (en) Page generation method, device and system
US11797273B2 (en) System and method for enhancing component based development models with auto-wiring
CN108171473A (en) A kind of Data Analysis Services system and data analysis processing method
WO2023093414A1 (en) Micro-application development method and apparatus, and device, storage medium and program product
CN109634599B (en) Page view display method, device, equipment and storage medium
CA2932897A1 (en) Visual effects system for "big data" analysis workflow editors, distribution platforms, execution engines, and management systems comprising same
US11836519B2 (en) Decoupled push-down execution generator
US20210224076A1 (en) Techniques for managing dependencies of an orchestration service
CN114265680A (en) Mass data processing method and device, electronic equipment and storage medium
CN111177237B (en) Data processing system, method and device
CN117076096A (en) Task flow execution method and device, computer readable medium and electronic equipment
WO2023124657A1 (en) Micro-application running method and apparatus, device, storage medium, and program product
US20160036911A1 (en) Power and network traffic optimization in communication synchronization
WO2021036987A1 (en) Method and device for achieving operation and maintenance monitoring
CN110262912B (en) Calling method and device for procedure call gRPC
CN112418796A (en) Sub-process node activation method and device, electronic equipment and storage medium
US11689473B2 (en) Pre-allocating resources with hierarchy-based constraints

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant