CN114237860A - Automatic task flow scheduling method and system - Google Patents
Automatic task flow scheduling method and system Download PDFInfo
- Publication number
- CN114237860A CN114237860A CN202210183309.3A CN202210183309A CN114237860A CN 114237860 A CN114237860 A CN 114237860A CN 202210183309 A CN202210183309 A CN 202210183309A CN 114237860 A CN114237860 A CN 114237860A
- Authority
- CN
- China
- Prior art keywords
- task
- independent
- queue
- tasks
- combined
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System Of A Hierarchy Structure (AREA)
Abstract
The application discloses an automatic task flow scheduling method and system, belonging to the technical field of communication, wherein the scheduling method comprises the following steps: acquiring a task queue, wherein the task queue comprises a combined task and/or an independent task; taking out a task from the task queue in sequence; judging whether the extracted current task is a combined task or an independent task; if the combined task is taken out, splitting the current combined task into a plurality of sub-combined tasks and/or sub-independent tasks, and returning the split sub-combined tasks and/or sub-independent tasks to the task queue again to form a new task; and if the independent task is taken out, scheduling the current independent task until all the independent tasks in the whole task queue are scheduled. By the scheduling method, various complex task flows can be disassembled and scheduled, universality is high, design difficulty is low, and the risk of errors in complex programming is reduced, so that the error rate of task flow scheduling is reduced.
Description
Technical Field
The invention belongs to the technical field of communication, and particularly relates to an automatic task flow scheduling method and system.
Background
The task flow is a set of task execution units, is a specific action sequence required by completing a function or service, and specifically, the task flow comprises a plurality of subtasks, when the task flow is processed, a task flow scheduling system needs to be designed to schedule each task in the task flow to a thread one by one for execution, the existing scheduling system needs to perform scheduling by independent programming aiming at each task in one task flow, which is very tedious, when the task flow set is large, the complexity of a scheduling system program is exponentially increased, which undoubtedly increases the difficulty of the design of the task flow scheduling system, increases the risk of design errors, easily causes task flow scheduling errors, and each task flow scheduling system can only schedule task flows adapted to the task flow scheduling system, when different task flows exist, the task flow scheduling system needs to be redesigned, and the workload is large.
Disclosure of Invention
Objects of the invention
In order to overcome the above disadvantages, the present invention aims to provide an automatic task flow scheduling method and system, so as to solve the technical problems that each existing scheduling system can only schedule the corresponding task flow, the universality is poor, the design difficulty is high, the risk of design error is increased, and the task flow scheduling is easy to generate errors.
(II) technical scheme
In order to achieve the above object, one aspect of the present application provides the following technical solutions:
an automated task flow scheduling method, comprising:
acquiring a task queue, wherein the task queue comprises a combined task and/or an independent task;
taking out a task from the task queue in sequence;
judging whether the extracted current task is a combined task or an independent task;
if the combination task is taken out, splitting the current combination task into a plurality of sub-combination tasks and/or a plurality of sub-independent tasks, and returning the split sub-combination tasks and/or the sub-independent tasks to the task queue again according to the arrangement sequence of the combination task in the original task queue to form a new task queue;
and if the independent task is taken out, scheduling the current independent task until all the independent tasks in the whole task queue are scheduled.
The scheduling method of the application carries out scheduling in a multi-layer disassembly mode, and in the scheduling process, after one task is taken out, whether the currently taken task is a combined task or an independent task is judged, if the currently taken task is the independent task, the independent task is directly scheduled, and if the currently taken task is the combined task, because the combined task also contains a plurality of independent tasks, the combined task needs to be disassembled layer by layer until the combined task is disassembled into a plurality of independent tasks, and then the separated independent tasks are scheduled, therefore, no matter how complex task flows are, the scheduling can be performed by the layer-by-layer recursion disassembly scheduling mode of the application, the universality is strong, in addition, the whole scheduling logic only involves three steps of judgment, disassembly and scheduling, the programming program is low in difficulty, the risk of errors in complex programming is reduced, and therefore the error rate of task flow scheduling is reduced.
Further, still include: and after one independent task is successfully scheduled, caching the successfully scheduled independent task into a successful execution queue.
Further, buffering the successfully scheduled independent tasks into the successfully executed queue includes: if all the independent tasks are successfully scheduled and all the independent tasks are cached in the successful execution queue, an execution success result is returned, the successful execution queue is used as a record carrier, and the scheduling success result is returned only after all the tasks are successfully scheduled, so that the scheduling integrity and accuracy are guaranteed.
Further, buffering the successfully scheduled independent tasks into the successfully executed queue includes: if an independent task fails to be scheduled in the scheduling process, the independent tasks which are cached in the successful execution queue are backed one by one, the successful execution queue is used as a record carrier, and when a task fails to be scheduled, the tasks which are successfully scheduled are backed off and need to be scheduled again, so that the consistency of the whole scheduling task is ensured.
Another aspect of the present invention provides an automated task flow scheduling system, configured to implement the foregoing scheduling method, where the system includes:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a task queue, and the task queue comprises a combined task and/or an independent task;
the taking-out module is used for taking out one task from the task queue in sequence;
the judging module is used for judging whether the taken current task is a combined task or an independent task;
the system comprises a splitting module and a returning module, wherein the splitting module is used for splitting the current combined task into a plurality of sub-combined tasks and/or a plurality of sub-independent tasks when the judging module judges that the combined task is taken out, and the returning module returns the split sub-combined tasks and/or the sub-independent tasks to the task queue again according to the arrangement sequence of the combined task in the original task queue to form a new task queue;
and the scheduling module is used for scheduling the current independent task until all the independent tasks in the whole task queue are scheduled.
Further, still include: and the cache module caches the successfully scheduled independent task into the successfully executed queue after the independent task is successfully scheduled.
Further, still include: and the returning module returns the successful execution result if all the independent tasks are successfully scheduled and all the independent tasks are cached in the successful execution queue.
Further, still include: and the returning module returns the execution failure result after all the tasks are returned.
Drawings
FIG. 1 is a flow diagram of an automated task flow scheduling method of the present invention;
FIG. 2 is a diagram of a task queue structure of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings in conjunction with the following detailed description. It should be understood that the description is intended to be exemplary only, and is not intended to limit the scope of the present invention. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present invention.
Referring to fig. 1, an automated task flow scheduling method provided by the present invention includes:
acquiring a task queue, wherein the task queue comprises a combined task and/or an independent task;
taking out a task from the task queue in sequence;
judging whether the extracted current task is a combined task or an independent task;
if the combination task is taken out, splitting the current combination task into a plurality of sub-combination tasks and/or a plurality of sub-independent tasks, and returning the split sub-combination tasks and/or the sub-independent tasks to the task queue again according to the arrangement sequence of the combination task in the original task queue to form a new task queue;
and if the independent task is taken out, scheduling the current independent task until all the independent tasks in the whole task queue are scheduled.
Specifically, initially, after the task queue is input, the task queue is judged not to be empty, task scheduling is performed step by step, after all tasks of the whole task queue are scheduled, the task queue is judged to be empty, and a result of successful scheduling is returned.
Specifically, initially, the task queue may include only independent tasks, only combined tasks, or both combined tasks and independent tasks, and each task queue may be different.
Specifically, the combination task includes: the method comprises the steps of synchronously executing a combined task or asynchronously executing the combined task, wherein the synchronously executing combined task comprises a plurality of tasks which are connected in series front and back, and the asynchronously executing combined task comprises a plurality of tasks which are connected in parallel. A combined task includes at least two independent tasks, which are modularly divided in synchronous execution or asynchronous execution.
Specifically, during scheduling, each scheduled task is processed by a thread, and the thread processes each task front and back or simultaneously according to the processing logic of the whole task queue.
Referring to fig. 2, the scheduling process is specifically described as an example:
scheduling task FL 1;
begin- >)
Manually inputting a task queue: start → FL1 → end;
- > judging that the task queue is not empty;
-fetch task FL 1;
-judging FL1 as a synchronous execution combined task;
- > split task FL1 into A → ASFL1 → E and return to the task queue;
- > fetch task A;
- > judging task A as an independent task;
- > scheduling the task A;
after the task A is successfully scheduled, caching the task A into a successful execution queue;
-fetch task ASFL 1;
determining that task ASFL1 is an asynchronous execution combination task;
- > fetch task B;
- > judging task B as an independent task;
- > scheduling task B;
b is cached in the successful execution queue after being successfully scheduled;
-fetch task FL 2;
determining that task FL2 is a synchronous execution combined task;
- > split task FL2 into C → D and then return to the task queue, forming a C → D → E task queue;
- > fetch task C;
- > judging task C as an independent task;
- > scheduling task C;
c is cached in the successful execution queue after being successfully scheduled;
-fetch task D;
- > judging task D as an independent task;
- > scheduling task D;
d is cached in the successful execution queue after being successfully scheduled;
- > fetch task E;
- > judging task E as an independent task;
- > scheduling task E;
buffer to the successful execution queue after E is successfully scheduled;
-return FL1 scheduling success;
- > end;
in the scheduling process, all the various task queues can be scheduled only by judging, splitting and independent task scheduling steps.
The existing scheduling mode is designed specifically for different task sequences, and when one task sequence changes or the number of individual tasks increases or decreases, the scheduling method needs to be redesigned, so that the existing scheduling mode is not universal.
Specifically, each time an independent task or a combined task is successfully scheduled, the successfully scheduled independent task is buffered in the successful execution queue.
More specifically:
and returning an execution success result when all the independent tasks and/or the combined tasks are successfully scheduled and all the independent tasks and/or the tasks are cached in the successful execution queue.
And when one independent task or the combination fails to execute, backing the independent tasks cached in the successfully executed queue one by one and returning an execution failure result.
For example, after task a is successfully scheduled, task a is cached in a successful execution queue, after task B is successfully scheduled, task B is cached in a successful execution queue, after task C and task D are cached in a successful execution queue, it is shown that task C and task D are combined into FL2 combined task which is successfully scheduled, combined task ASFL1 which is combined into FL2 and B is successfully scheduled, and so on until task E is successfully cached and FL1 is successfully scheduled, when one of tasks fails to be scheduled, for example, task B fails to be scheduled, task a which has been cached is rolled back, after rolling back, it is detected that the cache is empty in the successful execution queue, and an execution failure result is returned.
Specifically, after the task is successfully scheduled to the thread, the thread executes the task, and the task to be successfully executed is buffered in the successful execution queue.
Specifically, rollback means returning a task that has been successfully executed to an initial state when it is not executed.
The procedure of rollback is illustrated with an example:
for example, task a is "system jumps to a certain function", task B is "system calls a certain database", when task a is successfully scheduled to a thread, the thread processes task a according to the content of task a, jumps to a certain function, then task a is cached in a successfully executed queue, when scheduling task B fails, i.e. task B system cannot call a certain database, the system needs to back-back task a to a non-executed state, i.e. the system needs to return to a state that does not jump to a certain function, so as to ensure that the system is in an initial state when no task queue is executed, so that the system can process a next new task queue, if the system does not back, the system may be in a state that the function cannot receive a next task or a task in a next task queue is also jumped to the function, repeated operation of the system results in constant error reporting by the system.
Another aspect of the present invention provides an automated task flow scheduling system, configured to implement the foregoing scheduling method, where the system includes:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a task queue, and the task queue comprises a combined task and/or an independent task;
the taking-out module is used for taking out one task from the task queue in sequence;
the judging module is used for judging whether the taken current task is a combined task or an independent task;
the system comprises a splitting module and a returning module, wherein the splitting module is used for splitting the current combined task into a plurality of sub-combined tasks and/or a plurality of sub-independent tasks when the judging module judges that the taken-out combined task is the combined task, and the returning module is used for returning the split sub-combined tasks and/or the sub-independent tasks to a task queue again to form a new task;
and the scheduling module is used for scheduling the current independent task until all the independent tasks in the whole task queue are scheduled.
Further, still include: and the cache module caches the successfully scheduled independent task into the successfully executed queue after the independent task is successfully scheduled.
Further, still include: and the returning module returns the successful execution result if all the independent tasks are successfully scheduled and all the independent tasks are cached in the successful execution queue.
Further, still include: and the returning module returns the execution failure result after all the tasks are returned.
It is to be understood that the above-described embodiments of the present invention are merely illustrative of or explaining the principles of the invention and are not to be construed as limiting the invention. Therefore, any modification, equivalent replacement, improvement and the like made without departing from the spirit and scope of the present invention should be included in the protection scope of the present invention. Further, it is intended that the appended claims cover all such variations and modifications as fall within the scope and boundaries of the appended claims or the equivalents of such scope and boundaries.
Claims (9)
1. An automated task flow scheduling method, comprising:
acquiring a task queue, wherein the task queue comprises a combined task and/or an independent task;
taking out a task from the task queue in sequence;
judging whether the extracted current task is a combined task or an independent task;
if the combination task is taken out, splitting the current combination task into a plurality of sub-combination tasks and/or a plurality of sub-independent tasks, and returning the split sub-combination tasks and/or the sub-independent tasks to the task queue again according to the arrangement sequence of the combination task in the original task queue to form a new task queue;
and if the independent task is taken out, scheduling the current independent task until all the independent tasks in the whole task queue are scheduled.
2. The automated task flow scheduling method of claim 1, further comprising: and after one independent task is successfully scheduled, caching the successfully scheduled independent task into a successful execution queue.
3. The automated task flow scheduling method of claim 2, wherein the buffering the successfully scheduled independent tasks into a successful execution queue comprises: and returning an execution success result if all the independent tasks are successfully scheduled and all the independent tasks are cached in the successful execution queue.
4. The automated task flow scheduling method of claim 3, wherein the buffering the successfully scheduled independent tasks into a successful execution queue comprises: and if one independent task fails to be scheduled in the scheduling process, backing the independent tasks which are cached in the successful execution queue one by one and returning a failure result.
5. The automated task flow scheduling method of claim 1, wherein the combined task comprises: the combined tasks are executed synchronously or asynchronously.
6. An automated task flow scheduling system for implementing the scheduling method of any one of claims 1 to 5, the system comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring a task queue, and the task queue comprises a combined task and/or an independent task;
the taking-out module is used for taking out one task from the task queue in sequence;
the judging module is used for judging whether the taken current task is a combined task or an independent task;
the system comprises a splitting module and a returning module, wherein the splitting module is used for splitting the current combined task into a plurality of sub-combined tasks and/or a plurality of sub-independent tasks when the judging module judges that the combined task is taken out, and the returning module returns the split sub-combined tasks and/or the sub-independent tasks to the task queue again according to the arrangement sequence of the combined task in the original task queue to form a new task queue;
and the scheduling module is used for scheduling the current independent task until all the independent tasks in the whole task queue are scheduled.
7. The automated task flow scheduling system of claim 6, further comprising: and the cache module caches the successfully scheduled independent task into the successfully executed queue after the independent task is successfully scheduled.
8. The automated task flow scheduling system of claim 7, further comprising: and the returning module returns the successful execution result if all the independent tasks are successfully scheduled and all the independent tasks are cached in the successful execution queue.
9. The automated task flow scheduling system of claim 8, further comprising: and the returning module returns the execution failure result after all the independent tasks are backed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210183309.3A CN114237860A (en) | 2022-02-28 | 2022-02-28 | Automatic task flow scheduling method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210183309.3A CN114237860A (en) | 2022-02-28 | 2022-02-28 | Automatic task flow scheduling method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114237860A true CN114237860A (en) | 2022-03-25 |
Family
ID=80748187
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210183309.3A Pending CN114237860A (en) | 2022-02-28 | 2022-02-28 | Automatic task flow scheduling method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114237860A (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103294533A (en) * | 2012-10-30 | 2013-09-11 | 北京安天电子设备有限公司 | Task flow control method and task flow control system |
CN109840149A (en) * | 2019-02-14 | 2019-06-04 | 百度在线网络技术(北京)有限公司 | Method for scheduling task, device, equipment and storage medium |
CN111858125A (en) * | 2020-07-31 | 2020-10-30 | 中国工商银行股份有限公司 | Task processing method and device, electronic equipment and readable storage medium |
-
2022
- 2022-02-28 CN CN202210183309.3A patent/CN114237860A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103294533A (en) * | 2012-10-30 | 2013-09-11 | 北京安天电子设备有限公司 | Task flow control method and task flow control system |
CN109840149A (en) * | 2019-02-14 | 2019-06-04 | 百度在线网络技术(北京)有限公司 | Method for scheduling task, device, equipment and storage medium |
CN111858125A (en) * | 2020-07-31 | 2020-10-30 | 中国工商银行股份有限公司 | Task processing method and device, electronic equipment and readable storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111399989B (en) | Container cloud-oriented task preemption and scheduling method and system | |
US20150149507A1 (en) | Stream data multiprocessing method | |
CN109918141A (en) | Thread execution method, device, terminal and storage medium | |
CN110795254A (en) | Method for processing high-concurrency IO based on PHP | |
CN103593232A (en) | Task scheduling method and device of data warehouse | |
CN111813520A (en) | Thread scheduling method and device, storage medium and electronic equipment | |
CN113821322B (en) | Loosely coupled distributed workflow coordination system and method | |
CN115309519A (en) | Deterministic task scheduling and arranging method and system based on time trigger mechanism and storage medium | |
CN110968410A (en) | Task failure retry method and device, computer equipment and storage medium | |
CN112948096A (en) | Batch scheduling method, device and equipment | |
CN109766168B (en) | Task scheduling method and device, storage medium and computing equipment | |
CN114237860A (en) | Automatic task flow scheduling method and system | |
CN112162840A (en) | Coroutine processing and managing method based on interrupt reentrant mechanism | |
CN116627609A (en) | Hive batch processing-based scheduling method and device | |
CN112860401A (en) | Task scheduling method and device, electronic equipment and storage medium | |
CN115623019B (en) | Distributed operation flow scheduling execution method and system | |
CN109814989B (en) | Graded priority unified dyeing graphics processor warp scheduling device | |
CN115687491A (en) | Data analysis task scheduling system based on relational database | |
CN112835692B (en) | Log message driven task method, system, storage medium and equipment | |
CN111538604B (en) | Distributed task processing system | |
CN101634956A (en) | Dispatching method and dispatcher of information of polynuclear processor | |
CN108287753A (en) | Computer system fast dispatch method and device | |
JP5387083B2 (en) | Job management system and method | |
CN113934551A (en) | Task synchronous waiting method, device and system, electronic equipment and storage medium | |
CN113360256A (en) | Thread scheduling method and system based on control plane massive concurrent messages |
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 | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20220325 |