CN113176931B - Task stream processing method and device, storage medium and electronic equipment - Google Patents

Task stream processing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN113176931B
CN113176931B CN202110343053.3A CN202110343053A CN113176931B CN 113176931 B CN113176931 B CN 113176931B CN 202110343053 A CN202110343053 A CN 202110343053A CN 113176931 B CN113176931 B CN 113176931B
Authority
CN
China
Prior art keywords
task
identifier
package
execution sequence
execution
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
CN202110343053.3A
Other languages
Chinese (zh)
Other versions
CN113176931A (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.)
Neusoft Cloud Technology Co ltd
Neusoft Corp
Original Assignee
Neusoft Cloud Technology Co ltd
Neusoft Corp
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 Neusoft Cloud Technology Co ltd, Neusoft Corp filed Critical Neusoft Cloud Technology Co ltd
Priority to CN202110343053.3A priority Critical patent/CN113176931B/en
Publication of CN113176931A publication Critical patent/CN113176931A/en
Application granted granted Critical
Publication of CN113176931B publication Critical patent/CN113176931B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The method comprises the steps of executing packing functions according to the sequence of packing functions in packing codes, wherein the calling parameter of each packing function is a task identifier of at least one task in a task stream, the packing function is used for packing the task identifier serving as the calling parameter into a task packet, the task packet comprises an execution sequence number and a task identifier, and the execution sequence number is determined according to the execution sequence of the packing functions; according to the execution sequence number of the task package, tasks corresponding to task identifiers included in each task package are sequentially executed, execution codes with sequential or parallel execution relation among the tasks do not need to be manually written, and complexity of code writing is reduced.

Description

Task stream processing method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to electronic information technology, and in particular, to a task flow processing method, device, storage medium, and electronic apparatus.
Background
The business is usually composed of a plurality of independent tasks, the tasks have execution sequence or parallel relation, and a task group formed by arranging the tasks is a task stream. Before the background executes the service, the execution relationship between the tasks of the task flow is required to be manually encoded to obtain the execution codes with the execution relationship, and the execution codes written manually are operated in the background to finish the execution of each task in the task flow.
Because the execution relationship of the different task flows is different in succession or in parallel. Therefore, for different task flows, the execution codes with sequential or parallel execution relation among the tasks included in the task flows need to be manually written, so that the encoding complexity is high.
Disclosure of Invention
The purpose of the present disclosure is to provide a task stream processing method, apparatus, storage medium and electronic device, which do not need to manually write execution codes between tasks, and reduce coding complexity.
To achieve the above object, in a first aspect, the present disclosure provides a task flow processing method, the method including:
executing packing functions according to the sequence of each packing function in packing codes, wherein the calling parameter of each packing function is the task identifier of at least one task in a task stream, the packing function is used for packing the task identifier serving as the calling parameter into a task packet, the task packet comprises an execution sequence number and a task identifier, and the execution sequence number is determined according to the execution sequence of the packing function;
and sequentially executing tasks corresponding to the task identifiers included in each task package according to the execution sequence numbers of the task packages.
Optionally, for each packing function, the packing function packs the task identifier as a call parameter of the packing function into a task package by:
creating a task package;
under the condition that the task cache is empty, taking the initial execution sequence number as the execution sequence number of the task package created at this time;
under the condition that the task cache is not empty, taking the sum of the execution sequence number of the task packet corresponding to the task stored in the last time in the task cache and a preset value as the execution sequence number of the task packet created at the time;
the packing function is also to: storing a task corresponding to a task identifier serving as a calling function into the task cache;
the task corresponding to the task identifier included in each task package is sequentially executed according to the execution sequence number of the task package, and the method comprises the following steps: and taking out tasks from the task caches according to the execution sequence numbers of the task packages and the task identifications in each task package in turn for execution.
Optionally, the task flow includes parallel branches, task identifiers corresponding to a plurality of tasks on the parallel branches are used for calling the packing function as the same calling parameter;
the packing function is also to: setting a front task identifier corresponding to each task identifier after a first task identifier in each branch under the condition that the calling parameter of the packing function comprises task identifiers of a plurality of tasks; and is combined with the other components of the water treatment device,
and setting a post task identifier corresponding to the task identifier for each task identifier before the last task identifier in each branch.
Optionally, the extracting the task from the task cache according to the task identifier in each task packet in turn according to the execution sequence number of the task packet, and executing the task includes:
when executing a task package comprising a plurality of task identifications, determining task execution sequences among tasks corresponding to the task identifications according to the front task identification and the rear task identification, and sequentially taking out the tasks from the task cache according to the task execution sequences for execution.
Optionally, the sequentially executing the tasks corresponding to the task identifiers included in each task includes:
the task information processor corresponding to the task flow is used for placing a task corresponding to a task identifier in the task package into an operation task pool of a task manager according to an execution sequence number of the task package, wherein the task manager is used for executing the task in the operation task pool, monitoring the execution state of the task in the operation task pool and notifying the task information processor after the task in the operation task pool is monitored to be operated;
and the task message processor adds the task corresponding to the task identifier in the next task package into the running task pool after receiving the notification of the task manager.
In a second aspect, the present disclosure provides a task flow processing device, the device comprising:
the packaging module is used for executing the packaging functions according to the sequence of each packaging function in the packaging code, wherein the calling parameter of each packaging function is the task identifier of at least one task in the task stream, the packaging function is used for packaging the task identifier serving as the calling parameter into a task packet, the task packet comprises an execution sequence number and a task identifier, and the execution sequence number is determined according to the execution sequence of the packaging function;
and the execution module is used for sequentially executing tasks corresponding to the task identifiers included in each task package according to the execution sequence number of the task package.
Optionally, for each packing function, the packing function packs the task identifier as a call parameter of the packing function into a task package by:
creating a task package;
under the condition that the task cache is empty, taking the initial execution sequence number as the execution sequence number of the task package created at this time;
under the condition that the task cache is not empty, taking the sum of the execution sequence number of the task packet corresponding to the task stored in the last time in the task cache and a preset value as the execution sequence number of the task packet created at the time;
the packing function is also to: storing a task corresponding to a task identifier serving as a calling function into the task cache;
the execution module is specifically configured to take out tasks from the task cache according to the execution sequence number of the task package and the task identifier in each task package in turn for execution.
Optionally, the task flow includes parallel branches, task identifiers corresponding to a plurality of tasks on the parallel branches are used for calling the packing function as the same calling parameter;
the packing function is also to: setting a front task identifier corresponding to each task identifier after a first task identifier in each branch under the condition that the calling parameter of the packing function comprises task identifiers of a plurality of tasks; and is combined with the other components of the water treatment device,
and setting a post task identifier corresponding to the task identifier for each task identifier before the last task identifier in each branch.
In a third aspect, the present disclosure provides a computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the method of any of the first aspects above.
In a fourth aspect, the present disclosure provides an electronic device comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of any of the above first aspects.
According to the technical scheme, each packing function in the packing codes is utilized, the packing functions are used for packing task identifiers serving as calling parameters into task packages, the task packages comprise execution serial numbers and task identifiers, the execution serial numbers are determined according to the execution sequence of the packing functions, so that for different task flows, the execution serial numbers of each task package can be automatically packed and set by utilizing the task identifiers corresponding to the tasks in the task flows by utilizing each packing function only by changing packing codes, when the tasks are executed, the tasks corresponding to the task identifiers included in each task package are executed according to the execution serial numbers of the task packages, the execution codes with sequential or parallel execution relations among the tasks are not required to be manually written for different task flows, and the complexity of code writing is reduced.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings are included to provide a further understanding of the disclosure, and are incorporated in and constitute a part of this specification, illustrate the disclosure and together with the description serve to explain, but do not limit the disclosure. In the drawings:
fig. 1 is a flow chart illustrating a task flow processing method according to an exemplary embodiment of the present disclosure.
FIG. 2 is a task flow diagram illustrating an exemplary embodiment of the present disclosure.
FIG. 3 is another task flow diagram illustrating an example embodiment of the present disclosure.
FIG. 4 is a flow chart illustrating an implementation of a packing function according to an exemplary embodiment of the present disclosure.
Fig. 5 is another schematic diagram illustrating a task flow processing method according to an exemplary embodiment of the present disclosure.
Fig. 6 is a block diagram illustrating a task flow processing device according to an example embodiment.
Fig. 7 is a block diagram of an electronic device, according to an example embodiment.
Detailed Description
Specific embodiments of the present disclosure are described in detail below with reference to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating and illustrating the disclosure, are not intended to limit the disclosure.
When processing a service, when the service logic processing is complex, it can be divided into a plurality of independent and usually reusable logic processing units, which we refer to as tasks. The task group formed by arranging a plurality of tasks is a task flow, and execution sequence or parallel relation exists among the plurality of tasks. Before processing the service, coding the sequence or parallel relation between the tasks of the task flow to obtain an execution code with the sequence or parallel execution relation, and running the written execution code in the background to finish the execution of each task in the task flow. However, in the related art, the sequence or parallel relation between the tasks included in each task stream is usually encoded manually, which results in higher encoding complexity, especially including parallel branches and other task streams with more complex execution relation.
In view of this, the present disclosure provides a task flow processing method, apparatus, storage medium, and electronic device, which can implement automatic packing of task identifiers corresponding to tasks in a task flow by using each packing function in a packing code for different task flows, and set an execution sequence number of each task packet, and when executing a task, execute tasks corresponding to task identifiers included in each task packet according to the execution sequence number of the task packet, without manually writing execution codes having a sequential or parallel execution relationship between each task for different task flows, thereby reducing complexity of code writing.
Fig. 1 is a flow chart illustrating a task flow processing method according to an exemplary embodiment of the present disclosure. Referring to fig. 1, the task flow processing method may include the steps of:
step 101, executing the packing functions according to the sequence of each packing function in the packing code, wherein the calling parameter of each packing function is the task identifier of at least one task in the task stream, the packing function is used for packing the task identifier serving as the calling parameter into a task packet, and the task packet comprises an execution sequence number and the task identifier, and the execution sequence number is determined according to the execution sequence of the packing function.
Step 102, executing tasks corresponding to task identifiers included in each task package in sequence according to the execution sequence numbers of the task packages.
By way of example, the task flow processing method provided by the embodiment of the disclosure can be used in the business processing of the automation monitoring operation and maintenance field.
Illustratively, FIG. 2 is a task flow diagram illustrating one example embodiment of the present disclosure. In fig. 2, each task is performed in the direction of the arrow shown in fig. 2. The task of the task1 is identified as task1, the task of the task2 is identified as task2, the task of the task3 is identified as task3, the task of the task4 is identified as task4, the task of the task5 is identified as task5, the task of the task6 is identified as task6, the task of the task7 is identified as task7, and the task flow shown in fig. 2 is taken as task flow example 1 to further explain the present embodiment.
For example, for the task stream shown in fig. 2, the packing encoding may be:
task flow = new task flow ("task flow instance 1")
Task 1=new task ("task 1")
Task task2=new task ("task 2")
Task 3=new task ("task 3")
Task 4=new task ("task 4")
Task 5=new task ("task 5")
Task 6=new task ("task 6")
List = new list ()
list.add(task3).add(task4).add(task5).add(task6)
Task7 = new task ("task 7")
flow.add(task1)
flow.add(task2)
flow.addParallelTasks(list)
flow.add(task7)
In the above packing coding, both the flow.add () and the flow.add paralleltask () are packing functions, where the flow.add () is a packing function including only one task identifier for a call parameter, and the flow.add paralleltask () is a packing function including a plurality of task identifiers for a call parameter. Specifically, task1 is a call parameter of flow.add (task 1); task2 is a call parameter of flow. Add (task 2); list is a call parameter of flow. AddParallelTasks (list); task7 is a call parameter of flow.add (task 7).
It should be understood that the execution of each packing function in the packing code is performed in the order in which each packing function is written in the packing code. Therefore, in the above-described packing encoding, the execution order of each packing function is flow.add (task 1), flow.add (task 2), flow.add paralleltask (list), flow.add (task 7) in this order.
The task packages obtained by the above flow.add (task 1), flow.add (task 2), flow.add ParallelTask (list), flow.add (task 7) packing functions are task package 1, task package 2, task package 3 and task package 4, task package 1 comprises task1, task package 2 comprises task2, task package 3 comprises task3, task4, task5 and task6, and task package 4 comprises task7. Since the execution sequence number of the task package is determined according to the execution sequence of the packing function. Therefore, the execution sequence of the task packet 1 is before the execution sequence of the task packet 2, the execution sequence of the task packet 2 is before the execution sequence of the task packet 3, and the execution sequence of the task packet 3 is before the execution sequence of the task packet 4, which are available according to the execution sequence of the packing functions. That is, the order of executing the task packages is as follows: task package 1, task package 2, task package 3, and task package 4.
It should be noted that the packing code is edited manually, and only the packing code needs to be changed manually for different task streams.
Illustratively, FIG. 3 is another task flow diagram that is shown in accordance with an exemplary embodiment of the present disclosure. The task flow shown in fig. 3 is task flow embodiment 2, and for fig. 3, only the packing code shown in fig. 2 needs to be simply modified manually, so that task packets corresponding to the task flow shown in fig. 3 and each having a sequential execution order can be obtained. Illustratively, the packetization code corresponding to the task stream shown in fig. 3 may be:
task flow = new task flow ("task flow instance 2")
Task 1=new task ("task 1")
List = new list ()
list.add(task2).add(task3).add(task4)
Task 5=new task ("task 5")
flow.add(task1)
flow.addParallelTasks(list)
flow.add(task5)
According to the method, the device and the system, the plurality of tasks can be executed according to the sequence or parallel relation among the plurality of tasks only by simply transforming the packing codes, so that the complexity and difficulty of the codes are effectively reduced, and the method and the system are particularly aimed at the business with complex task logic.
By adopting the mode, only the packing codes are manually edited, the calling parameters of each packing function are set, the packing function can be utilized to automatically generate the task package with the sequential execution sequence, the tasks corresponding to the task identifiers included in each task package can be executed according to the execution sequence of each task package, the business processing can be realized, the manual writing of the execution codes with the sequential or parallel execution relationship among the tasks is not needed, and the complexity of code writing is reduced.
In a possible way, the packing function is also used to: and storing the task corresponding to the task identifier serving as the calling function into the task cache. Accordingly, for each packing function, the packing function packs the task identification as a call parameter of the packing function into a task package by:
a task package is created.
And under the condition that the task cache is empty, taking the initial execution sequence number as the execution sequence number of the task package created at this time.
And under the condition that the task cache is not empty, taking the sum of the execution sequence number of the task packet corresponding to the task stored in the last time in the task cache and a preset value as the execution sequence number of the task packet created at the time.
Illustratively, FIG. 4 is a flow chart illustrating an implementation of a packing function according to an exemplary embodiment of the present disclosure. Referring to fig. 4, the method comprises the steps of:
in step 401, a task package is created.
Step 402, determining whether the task cache is empty.
And step 403, taking the initial execution sequence number as the execution sequence number of the task package created at this time.
And step 404, taking the sum of the execution sequence number of the task packet corresponding to the task stored in the last time in the task cache and the preset value as the execution sequence number of the task packet created at the time.
Step 405, storing the task corresponding to the task identifier as the calling function in the task cache.
Step 406, storing the task identifier as the calling function in the task package created at this time
In the present disclosure, task caches are used to store tasks corresponding to task identifications.
For example, the initial execution sequence number may be a preset sequence number, e.g., 0. And the preset numerical value is a natural number greater than 0, so that the execution sequence number of the task packet obtained by packing the next packing function is ensured to be greater than the execution sequence number of the task packet obtained by packing the previous packing function.
In the case of storing the task corresponding to the task identifier as the calling function in the task cache, step 102 shown in fig. 1 may include: and taking out the tasks from the task caches to execute according to the execution sequence numbers of the task packages and the task identifiers in each task package.
In a possible manner, the task flow includes parallel branches, and task identifiers corresponding to a plurality of tasks on the parallel branches are used to call the packing function as the same call parameter. The packing function is also used to: setting a front task identifier corresponding to each task identifier after a first task identifier in the calling parameters under the condition that the calling parameters of the packing function comprise task identifiers of a plurality of tasks; and setting a post task identifier corresponding to the task identifier for each task identifier before the last task identifier in the calling parameters.
By way of example, taking the task flow shown in fig. 2 as an example, task3 and task4 and task5 and task6 are parallel task branches, and task identifications of task3, task4, task5 and task6 call packing functions as the same call parameters.
Aiming at the task branching situation shown in fig. 2, the task3 and the task4 are the same branch, in the branch, the task identifier of the task3 is used as the first task identifier in the branch, so that a front task identifier needs to be set for the task identifier of the task4, and the front task identifier corresponding to the task identifier of the task4 should be the task identifier of the task 3; the task identifier of the task4 is used as the last task identifier in the branch, so that a post-task identifier needs to be set for the task identifier of the task3, and the post-task identifier corresponding to the task identifier of the task3 should be the task identifier of the task 4.
Task5 and task6 are the same branch, in the branch, the task identifier of task5 is used as the first task identifier in the branch, so that a front task identifier needs to be set for the task identifier of task6, and the front task identifier corresponding to the task identifier of task6 should be the task identifier of task 5; the task identifier of the task6 is used as the last task identifier in the branch, so that a post-task identifier needs to be set for the task identifier of the task5, and the post-task identifier corresponding to the task identifier of the task5 should be the task identifier of the task 6.
Under the condition that the front task identifier and the rear task identifier are set, the step of sequentially taking out the tasks from the task cache according to the task identifiers in each task packet and executing the tasks according to the execution sequence number of the task packet can comprise the following steps: when executing a task package comprising a plurality of task identifications, determining task execution sequences among tasks corresponding to the task identifications according to the front task identifications and the rear task identifications, and sequentially taking out the tasks from the task cache according to the task execution sequences for execution. The task packages for executing the plurality of task identifications will be further explained below by taking the tasks 3 and 4 and the tasks 5 and 6 shown in fig. 2 as examples.
If the task identifier is not provided with the post-task identifier, the task corresponding to the task identifier is characterized as being in the first execution sequence in the branch. Therefore, when executing the task package, first, task3 and task5 corresponding to task3 and task4 without the pre-task identifier may be taken out from the task cache, and task3 and task5 may be executed in parallel.
Then, after the task3 or the task5 is executed, a post task identification of the task executed in the task package is acquired. Taking the execution of the task3 as an example, at this time, acquiring a task4 corresponding to a post task identifier task4 of the task identifier of the task3, and executing the task 4.
By adopting the mode, the execution sequence among the tasks corresponding to the task identifications included in the same task package is characterized by utilizing the post-task identifications and the post-task identifications, so that the tasks corresponding to the task packages including the task identifications can be conveniently processed.
In a possible manner, executing the task corresponding to the task identifier included in each task in turn may include: and placing the task corresponding to the task identifier in the task package into an operation task pool of a task manager according to the execution sequence number of the task package by a task message processor corresponding to the task flow, wherein the task manager is used for executing the task in the operation task pool, monitoring the execution state of the task in the operation task pool, and notifying the task message processor after the task in the operation task pool is monitored to be operated. The execution process of the task corresponding to the task identifier included in each task package in this embodiment is further explained below with reference to fig. 2 and fig. 5.
According to the above packing condition of the task stream shown in fig. 2 by the packing coding, four task packages are obtained by packing, including a task package 1, a task package 2, a task package 3 and a task package 4, and the execution sequence is as follows: task package 1, task package 2, task package 3, and task package 4. The task execution process for the task flow is as follows:
the task message processor firstly puts the task1 corresponding to the task identification task1 in the task package 1 into an operation task pool of the task manager, and enables the task manager to execute the task1 in the operation task pool, monitors the execution state of the task1, notifies the task message processor when the task1 is monitored to be completed, and adds the task2 corresponding to the task identification task2 in the next task package (task package 2) into the operation task pool after receiving the notification until the tasks corresponding to the task identifications of all the task packages are executed.
In addition, it is considered that in the case where a plurality of task flows need to be simultaneously executed, a large number of task packages of the task flows cannot be simultaneously stored due to the limited storage space of the execution task pool. When a task package comprises a plurality of task identifiers, if tasks corresponding to the task package comprising the plurality of task identifiers are stored in an operation task pool, the tasks corresponding to the plurality of task identifiers cannot be executed simultaneously due to the sequence of the tasks, so that the mode of storing the tasks which cannot be executed by the horses in the operation task pool in advance occupies the storage space of the operation task pool, so that the tasks which can be executed by the horses in other task streams cannot be stored, and further the execution efficiency of other task streams is reduced. Thus, in a possible manner, in a case that there are multiple task identifiers in the task package, the task corresponding to the multiple task identifiers may also be put into the running task pool in the following manner.
Specifically, the task message processor firstly puts the task corresponding to the task identifier in the first execution sequence in the task package into an operation task pool, monitors the execution state of the task in the operation task pool, notifies the task message processor after the task in the operation task pool is monitored to be completed, and deletes the task from the operation task pool after the task is monitored to be completed. The task message processor is further used for adding the task corresponding to the next task identifier of the task identifier corresponding to the notification into the running task pool after receiving the notification of the task manager. The task package 3 corresponding to the task flow shown in fig. 2 will be described as an example.
Specifically, the task (including task3 and task 4) corresponding to the task identifier (including task3 and task 4) in the first execution sequence in the task package is put into the running task pool through the task message processor corresponding to the task stream, the task manager monitors the execution states of the task3 and task4, if the task message processor is notified after the task3 is monitored to complete running, the task message processor can put the task (i.e. task 4) corresponding to the task identifier (i.e. task 4) corresponding to the post task identifier (i.e. task 3) into the running task pool according to the post task identifier of task3, and delete the task 3. If the task message processor is notified after the task5 task is monitored to be completed, the task message processor can put the task (i.e. the task 6) corresponding to the task identifier (i.e. the task 6) corresponding to the post task identifier task5 into the running task pool according to the post task identifier of the task5, and delete the task 5.
By adopting the mode, the tasks stored in the running task pool are tasks which can be executed immediately, so that the task execution efficiency of other task flows can be prevented from being influenced under the condition of coping with a scene requiring processing of a plurality of task flows.
Based on the same inventive concept, the embodiments of the present disclosure further provide a task flow processing device, referring to fig. 6, the task flow processing device 600 may include:
the packing module 601 is configured to execute packing functions according to the sequence of each packing function in the packing code, where a call parameter of each packing function is a task identifier of at least one task in a task flow, where the packing function is configured to pack the task identifier as a call parameter into a task packet, where the task packet includes an execution sequence number and a task identifier, and the execution sequence number is determined according to the execution sequence of the packing function;
and the execution module 602 is configured to sequentially execute tasks corresponding to task identifiers included in each task package according to the execution sequence number of the task package.
Optionally, for each packing function, the packing function packs the task identifier as a call parameter of the packing function into a task package by:
creating a task package;
under the condition that the task cache is empty, taking the initial execution sequence number as the execution sequence number of the task package created at this time;
under the condition that the task cache is not empty, taking the sum of the execution sequence number of the task packet corresponding to the task stored in the last time in the task cache and a preset value as the execution sequence number of the task packet created at the time;
the packing function is also to: storing a task corresponding to a task identifier serving as a calling function into the task cache;
the execution module 602 is specifically configured to take out tasks from the task cache according to the execution sequence number of the task package, and sequentially according to task identifiers in each task package.
Optionally, the task flow includes parallel branches, task identifiers corresponding to a plurality of tasks on the parallel branches are used for calling the packing function as the same calling parameter;
the packing function is also to: setting a front task identifier corresponding to each task identifier after a first task identifier in each branch under the condition that the calling parameter of the packing function comprises task identifiers of a plurality of tasks; and is combined with the other components of the water treatment device,
and setting a post task identifier corresponding to the task identifier for each task identifier before the last task identifier in each branch.
Optionally, the execution module 602 is specifically configured to determine, when executing a task package including a plurality of task identifiers, a task execution order between tasks corresponding to the task identifiers according to the pre-task identifier and the post-task identifier, and sequentially take out the tasks from the task cache according to the task execution order for execution.
Optionally, the execution module includes an execution sub-module, configured to put, by a task message processor corresponding to the task flow, a task corresponding to a task identifier in the task package into an operation task pool of a task manager according to an execution sequence number of the task package, where the task manager is configured to execute a task in the operation task pool, monitor an execution state of the task in the operation task pool, and notify the task message processor after it is monitored that the task in the operation task pool is completed;
and the task message processor adds the task corresponding to the task identifier in the next task package into the running task pool after receiving the notification of the task manager.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Based on the same inventive concept, the embodiments of the present disclosure further provide a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the task flow processing method of any of the above-described method embodiments.
Based on the same inventive concept, the embodiments of the present disclosure further provide an electronic device, including:
a memory having a computer program stored thereon;
and a processor, configured to execute the computer program in the memory, to implement the steps of the task flow processing method in any of the foregoing method embodiments.
Fig. 7 is a block diagram of an electronic device, according to an example embodiment. As shown in fig. 7, the electronic device 700 may include: a processor 701, a memory 702. The electronic device 700 may also include one or more of a multimedia component 703, an input/output (I/O) interface 704, and a communication component 705.
The processor 701 is configured to control the overall operation of the electronic device 700 to perform all or part of the steps in the task flow processing method described above. The memory 702 is used to store various types of data to support operation on the electronic device 700, which may include, for example, instructions for any application or method operating on the electronic device 700, as well as application-related data, such as contact data, messages sent and received, pictures, audio, video, and so forth. The Memory 702 may be implemented by any type or combination of volatile or non-volatile Memory devices, such as static random access Memory (Static Random Access Memory, SRAM for short), electrically erasable programmable Read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM for short), erasable programmable Read-Only Memory (Erasable Programmable Read-Only Memory, EPROM for short), programmable Read-Only Memory (Programmable Read-Only Memory, PROM for short), read-Only Memory (ROM for short), magnetic Memory, flash Memory, magnetic disk, or optical disk. The multimedia component 703 can include a screen and an audio component. Wherein the screen may be, for example, a touch screen, the audio component being for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in the memory 702 or transmitted through the communication component 705. The audio assembly further comprises at least one speaker for outputting audio signals. The I/O interface 704 provides an interface between the processor 701 and other interface modules, which may be a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 705 is for wired or wireless communication between the electronic device 700 and other devices. Wireless communication, such as Wi-Fi, bluetooth, near field communication (Near Field Communication, NFC for short), 2G, 3G or 4G, or a combination of one or more thereof, the corresponding communication component 705 may thus comprise: wi-Fi module, bluetooth module, NFC module.
In an exemplary embodiment, the electronic device 700 may be implemented by one or more application specific integrated circuits (Application Specific Integrated Circuit, abbreviated ASIC), digital signal processor (Digital Signal Processor, abbreviated DSP), digital signal processing device (Digital Signal Processing Device, abbreviated DSPD), programmable logic device (Programmable Logic Device, abbreviated PLD), field programmable gate array (Field Programmable Gate Array, abbreviated FPGA), controller, microcontroller, microprocessor, or other electronic components for performing the task flow processing methods described above.
In another exemplary embodiment, a computer readable storage medium is also provided, comprising program instructions which, when executed by a processor, implement the steps of the task flow processing method described above. For example, the computer readable storage medium may be the memory 702 including program instructions described above, which are executable by the processor 701 of the electronic device 700 to perform the task flow processing method described above.
The preferred embodiments of the present disclosure have been described in detail above with reference to the accompanying drawings, but the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solutions of the present disclosure within the scope of the technical concept of the present disclosure, and all the simple modifications belong to the protection scope of the present disclosure.
In addition, the specific features described in the above embodiments may be combined in any suitable manner without contradiction. The various possible combinations are not described further in this disclosure in order to avoid unnecessary repetition.
Moreover, any combination between the various embodiments of the present disclosure is possible as long as it does not depart from the spirit of the present disclosure, which should also be construed as the disclosure of the present disclosure.

Claims (8)

1. A method of task flow processing, the method comprising:
executing packing functions according to the sequence of each packing function in packing codes, wherein the calling parameter of each packing function is the task identifier of at least one task in a task stream, the packing function is used for packing the task identifier serving as the calling parameter into a task packet, the task packet comprises an execution sequence number and a task identifier, and the execution sequence number is determined according to the execution sequence of the packing function;
according to the execution sequence number of the task package, sequentially executing tasks corresponding to task identifiers included in each task package; for each packing function, the packing function packs the task identifier as a call parameter of the packing function into a task package by:
creating a task package;
under the condition that the task cache is empty, taking the initial execution sequence number as the execution sequence number of the task package created at this time;
under the condition that the task cache is not empty, taking the sum of the execution sequence number of the task packet corresponding to the task stored in the last time in the task cache and a preset value as the execution sequence number of the task packet created at the time;
the packing function is also to: storing a task corresponding to a task identifier serving as a calling function into the task cache;
the task corresponding to the task identifier included in each task package is sequentially executed according to the execution sequence number of the task package, and the method comprises the following steps: and taking out tasks from the task caches according to the execution sequence numbers of the task packages and the task identifications in each task package in turn for execution.
2. The method of claim 1, wherein the task flow includes parallel branches, task identifications corresponding to a plurality of tasks on the parallel branches are used to call the packing function as the same call parameter;
the packing function is also to: setting a front task identifier corresponding to each task identifier after a first task identifier in each branch under the condition that the calling parameter of the packing function comprises task identifiers of a plurality of tasks; and is combined with the other components of the water treatment device,
and setting a post task identifier corresponding to the task identifier for each task identifier before the last task identifier in each branch.
3. The method according to claim 2, wherein the retrieving tasks from the task cache according to the task identifier in each task package in turn according to the execution sequence number of the task package for execution includes:
when executing a task package comprising a plurality of task identifications, determining task execution sequences among tasks corresponding to the task identifications according to the front task identification and the rear task identification, and sequentially taking out the tasks from the task cache according to the task execution sequences for execution.
4. The method according to claim 1, wherein the sequentially executing each task includes a task identifier corresponding to the task, including:
the task information processor corresponding to the task flow is used for placing a task corresponding to a task identifier in the task package into an operation task pool of a task manager according to an execution sequence number of the task package, wherein the task manager is used for executing the task in the operation task pool, monitoring the execution state of the task in the operation task pool and notifying the task information processor after the task in the operation task pool is monitored to be operated;
and the task message processor adds the task corresponding to the task identifier in the next task package into the running task pool after receiving the notification of the task manager.
5. A task flow processing device, the device comprising:
the packaging module is used for executing the packaging functions according to the sequence of each packaging function in the packaging code, wherein the calling parameter of each packaging function is the task identifier of at least one task in the task stream, the packaging function is used for packaging the task identifier serving as the calling parameter into a task packet, the task packet comprises an execution sequence number and a task identifier, and the execution sequence number is determined according to the execution sequence of the packaging function;
the execution module is used for sequentially executing tasks corresponding to task identifiers included in each task package according to the execution sequence number of the task package;
for each packing function, the packing function packs the task identifier as a call parameter of the packing function into a task package by:
creating a task package;
under the condition that the task cache is empty, taking the initial execution sequence number as the execution sequence number of the task package created at this time;
under the condition that the task cache is not empty, taking the sum of the execution sequence number of the task packet corresponding to the task stored in the last time in the task cache and a preset value as the execution sequence number of the task packet created at the time;
the packing function is also to: storing a task corresponding to a task identifier serving as a calling function into the task cache;
the execution module is specifically configured to take out tasks from the task cache according to the execution sequence number of the task package and the task identifier in each task package in turn for execution.
6. The apparatus of claim 5, wherein the task flow comprises parallel branches, task identifications corresponding to a plurality of tasks on the parallel branches are used to call the packing function as the same call parameter;
the packing function is also to: setting a front task identifier corresponding to each task identifier after a first task identifier in each branch under the condition that the calling parameter of the packing function comprises task identifiers of a plurality of tasks; and is combined with the other components of the water treatment device,
and setting a post task identifier corresponding to the task identifier for each task identifier before the last task identifier in each branch.
7. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the steps of the method according to any one of claims 1-4.
8. An electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of any one of claims 1-4.
CN202110343053.3A 2021-03-30 2021-03-30 Task stream processing method and device, storage medium and electronic equipment Active CN113176931B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110343053.3A CN113176931B (en) 2021-03-30 2021-03-30 Task stream processing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110343053.3A CN113176931B (en) 2021-03-30 2021-03-30 Task stream processing method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN113176931A CN113176931A (en) 2021-07-27
CN113176931B true CN113176931B (en) 2024-04-05

Family

ID=76922647

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110343053.3A Active CN113176931B (en) 2021-03-30 2021-03-30 Task stream processing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113176931B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115002224A (en) * 2022-05-26 2022-09-02 阿里巴巴(中国)有限公司 Message processing method, device, system, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108182131A (en) * 2017-12-13 2018-06-19 东软集团股份有限公司 Monitor method, apparatus, storage medium and the electronic equipment of application operation state
CN108958832A (en) * 2018-06-12 2018-12-07 北京蜂盒科技有限公司 The method, apparatus and storage medium and electronic equipment of custom service process
WO2018236691A1 (en) * 2017-06-20 2018-12-27 Vfunction, Inc. Systems and methods for running software applications on distributed application frameworks
CN110716748A (en) * 2019-09-24 2020-01-21 深圳中集智能科技有限公司 Service processing method and device, computer readable medium and electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170178056A1 (en) * 2015-12-18 2017-06-22 International Business Machines Corporation Flexible business task flow

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018236691A1 (en) * 2017-06-20 2018-12-27 Vfunction, Inc. Systems and methods for running software applications on distributed application frameworks
CN108182131A (en) * 2017-12-13 2018-06-19 东软集团股份有限公司 Monitor method, apparatus, storage medium and the electronic equipment of application operation state
CN108958832A (en) * 2018-06-12 2018-12-07 北京蜂盒科技有限公司 The method, apparatus and storage medium and electronic equipment of custom service process
CN110716748A (en) * 2019-09-24 2020-01-21 深圳中集智能科技有限公司 Service processing method and device, computer readable medium and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于XML的任务流编辑器的设计与实现;佟玲;周传生;;沈阳师范大学学报(自然科学版)(第04期);全文 *
基于复杂事件处理的业务规则管理系统的研究;余玉涵;刘锋;;电脑知识与技术(第10期);全文 *

Also Published As

Publication number Publication date
CN113176931A (en) 2021-07-27

Similar Documents

Publication Publication Date Title
US10664385B1 (en) Debugging in an actor-based system
CN105573755A (en) Method and device for acquiring application Activity rendering time
CN105512015A (en) Android target application crash calculation method and device
CN110162344B (en) Isolation current limiting method and device, computer equipment and readable storage medium
CN113176931B (en) Task stream processing method and device, storage medium and electronic equipment
CN113190427B (en) Method and device for monitoring blocking, electronic equipment and storage medium
CN105072461A (en) Data processing method and device
CN112181522A (en) Data processing method and device and electronic equipment
US20140075418A1 (en) Replacing contiguous breakpoints with control words
CN111400016A (en) Method and equipment for calling application program interface function
CN113703996B (en) Access control method, equipment and medium based on user and YANG model grouping
CN107368235A (en) The multitask switching method and function machine of function machine
CN109886861A (en) A kind of high efficiency map file format HEIF image loading method and device
CN112799791A (en) Method and device for calling distributed lock, electronic equipment and storage medium
CN107220811B (en) Method and device for activating nodes in process
CN116450347A (en) Video multitasking method, video analysis device, and storage medium
CN107342981B (en) Sensor data transmission method and device and virtual reality head-mounted equipment
CN116185592A (en) Service processing method and device for mobile application, storage medium and computer equipment
CN116192776A (en) Message order-preserving method and device capable of self-repairing, terminal and storage medium
CN114780346A (en) Method, device, storage medium and electronic equipment for acquiring program blockage information
CN104010078A (en) Method and device for processing intercepted information through terminal
CN113722022A (en) State management system and method
CN110673793B (en) Storage device node event management method and system, electronic device and storage medium
US9934035B2 (en) Device and method for tracing updated predicate values
CN103138952B (en) Reminding business method to set up, system and exchange network

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