A task scheduling method, device, terminal device and storage medium

By detecting the status of external and predecessor tasks in task scheduling and ensuring that subtasks are executed when they are completed, the problem that traditional methods cannot handle complex topological relationships is solved, and the accuracy and completeness of task scheduling is achieved.

CN113010276BActive Publication Date: 2025-07-18SHENZHEN KEMAI TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202010528315.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-11
Publication Date
2025-07-18
Estimated Expiration
2040-06-11

AI Technical Summary

Technical Problem

Traditional task scheduling methods cannot effectively handle services with complex topological relationships, resulting in poor user experience.

Method used

Select the currently to be executed subtask from the preset compound task, detect the execution of external tasks and predecessor tasks, execute the subtask only when both are completed, and re-select unexecuted subtasks after the subtask is completed until all subtasks are completed.

Benefits of technology

By detecting the status of dependency and predecessor tasks, avoiding subtasks being executed when they are not completed, ensuring the accuracy and completeness of task scheduling, and dealing with business problems of complex topological relationships.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113010276B_ABST
    Figure CN113010276B_ABST
Patent Text Reader

Abstract

This application is applicable to the technical field of task scheduling, and provides a task scheduling method, device, terminal device and storage medium. In the embodiments of this application, a subtask to be currently executed is selected from a preset composite task; if the subtask depends on an external task, the execution status of the external task is obtained; if the subtask has a predecessor task, the execution status of the predecessor task is obtained; if the execution status of the external task and the execution status of the predecessor task are both completed, the subtask is executed; when the execution of the subtask is completed, if there are still unexecuted subtasks in the composite task, a subtask to be currently executed is reselected from the unexecuted subtasks until all the subtasks in the composite task are executed, thereby handling business problems with relatively complex topological relationships.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the technical field of task scheduling, and particularly relates to a task scheduling method, apparatus, terminal device, and storage medium. Background Art

[0002] With the development of society, there are various operations in any enterprise, and these operations can be uniformly managed and executed through task scheduling. However, with the expansion of operations and the accumulation of various operation functions, users have higher and higher requirements for task processing. Traditional task scheduling can only process simple tasks with a single linear connection and cannot handle operations with a relatively complex topological relationship, resulting in a poor user experience. Summary of the Invention

[0003] Embodiments of this application provide a task scheduling method, apparatus, terminal device, and storage medium, which can solve the problem of how to process operations with a relatively complex topological relationship.

[0004] In a first aspect, embodiments of this application provide a task scheduling method, including:

[0005] Select a currently to-be-executed subtask from a preset composite task;

[0006] If the subtask has dependent external tasks, obtain the execution status of the external tasks;

[0007] If the subtask has predecessor tasks, obtain the execution status of the predecessor tasks;

[0008] If the execution status of the external tasks and the execution status of the predecessor tasks are both completed, execute the subtask;

[0009] When the execution of the subtask is completed, if there are still unexecuted subtasks in the composite task, select a currently to-be-executed subtask again from the unexecuted subtasks until all subtasks in the composite task are executed.

[0010] Optionally, after executing the subtask, it includes:

[0011] If the subtask fails to execute, obtain the preset attributes of the subtask, and determine whether to re-execute the subtask according to the preset attributes;

[0012] If the execution time of the subtask exceeds a preset time threshold, determine whether to re-execute the subtask according to the preset attributes;

[0013] If the number of re-execution operations exceeds a preset number of re-execution times, determine whether to ignore the abnormal operation of the subtask according to the preset attributes.

[0014] Optionally, the task scheduling method includes:

[0015] If a skip instruction is received, skip the execution of the subtask according to the skip instruction when executing the subtask;

[0016] If an insertion instruction is received, insert a preset execution period during the execution of the subtask according to the insertion instruction;

[0017] If a deletion instruction is received, delete a preset execution period during the execution of the subtask according to the deletion instruction.

[0018] Optionally, the task scheduling method includes:

[0019] If the working duration of the composite task is greater than a preset time threshold, end the work of the composite task after the currently executed subtask in the composite task is completed.

[0020] Optionally, the creation process of the composite task includes:

[0021] Obtain composite task information, and create the composite task according to the composite task information;

[0022] Import a preset task template into the composite task, generate each subtask, and perform a topological arrangement on the subtasks.

[0023] Optionally, before importing the preset task template into the composite task to generate each subtask, it includes:

[0024] Obtain interface information, and create a task import interface according to the interface information;

[0025] Verify the import interface, and when the verification passes, obtain task template information;

[0026] Generate the task template according to the task template information from the verified task import interface.

[0027] Optionally, before performing the topological arrangement on the subtasks, it includes:

[0028] When a drag instruction is received, load a preset task type to a preset position in the composite task;

[0029] Obtain task information, and generate subtasks from the task type according to the task information.

[0030] In a second aspect, an embodiment of the present application provides a task scheduling device, including:

[0031] A selection module, configured to select a subtask to be currently executed from a preset composite task;

[0032] An external task module, configured to obtain the execution status of the external task if the subtask has a dependent external task;

[0033] A predecessor task module, configured to obtain the execution status of the predecessor task if the subtask has a predecessor task;

[0034] An execution module, configured to execute the subtask if the execution status of the external task and the execution status of the predecessor task are both completed;

[0035] A completion module, configured to, when the execution of the subtask is completed, if there are still unexecuted subtasks in the composite task, re-select the subtask to be currently executed from the unexecuted subtasks until all subtasks in the composite task are executed.

[0036] In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, a scheduler, an executor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the steps of any one of the above task scheduling methods are implemented.

[0037] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the steps of any one of the above task scheduling methods are implemented.

[0038] In a fifth aspect, an embodiment of the present application provides a computer program product, which when running on a terminal device causes the terminal device to execute any one of the task scheduling methods in the first aspect above.

[0039] In the embodiments of the present application, a current sub-task to be executed is selected from a preset composite task; if the sub-task has dependent external tasks, the execution status of the external tasks is obtained; if the sub-task has predecessor tasks, the execution status of the predecessor tasks is obtained; if the execution status of the external tasks and the execution status of the predecessor tasks are both completed, the sub-task is executed; when the execution of the sub-task is completed, if there are still unexecuted sub-tasks in the composite task, a current sub-task to be executed is re-selected from the unexecuted sub-tasks until all the sub-tasks in the composite task are executed. Through the embodiments of the present application, a sub-task to be executed is selected from a preset composite task. By detecting whether the current sub-task has external tasks or predecessor tasks, it is avoided that the sub-task is executed when some conditions are not completed, resulting in deviation of the execution result. When both the external task and the predecessor task are executed, the current sub-task is executed. After the current sub-task is executed, it is determined whether there are still sub-tasks in the composite task, and a sub-task to be executed is selected from the unexecuted sub-tasks until all the sub-tasks in the composite task are executed, thereby handling business problems with a relatively complex topological relationship. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.

[0041] Figure 1 is the first flowchart of the task scheduling method provided by the embodiments of the present application;

[0042] Figure 2 is the second flowchart of the task scheduling method provided by the embodiments of the present application;

[0043] Figure 3 is the third flowchart of the task scheduling method provided by the embodiments of the present application;

[0044] Figure 4 is the fourth flowchart of the task scheduling method provided by the embodiments of the present application;

[0045] Figure 5 is the fifth flowchart of the task scheduling method provided by the embodiments of the present application;

[0046] Figure 6 is the sixth flowchart of the task scheduling method provided by the embodiments of the present application;

[0047] Figure 7It is the seventh process schematic diagram of the task scheduling method provided by the embodiments of the present application;

[0048] Figure 8 It is the structural schematic diagram of the task scheduling device provided by the embodiments of the present application;

[0049] Figure 9 It is the structural schematic diagram of the terminal device provided by the embodiments of the present application. Detailed implementation manners

[0050] In the following description, specific details such as specific system structures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present application.

[0051] It should be understood that when used in the specification and appended claims of the present application, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.

[0052] It should also be understood that the term "and / or" as used in the specification and appended claims of the present application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0053] As used in the specification and appended claims of the present application, the term "if" can be interpreted as "when", "once", "in response to determining", or "in response to detecting" according to the context. Similarly, the phrase "if determined" or "if [the described condition or event] is detected" can be interpreted as meaning "once determined", "in response to determining", "once [the described condition or event] is detected", or "in response to detecting [the described condition or event]" according to the context.

[0054] In addition, in the description of the specification and appended claims of the present application, the terms "first", "second", "third", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.

[0055] Figure 1 Shown is the process schematic diagram of a task scheduling method in the embodiments of the present application. As Figure 1 shown, the task scheduling method may include the following steps:

[0056] Step S101: Select the currently to-be-executed subtask from the preset composite task.

[0057] In this embodiment, a subtask to be executed is selected from a pre-created composite task. Among them, the above-mentioned subtask to be executed can be selected in topological order, so as to prompt the selected subtask to perform related operations.

[0058] Optionally, the above selection method can be that the subtasks in the composite task are selected in topological order.

[0059] It can be understood that when the pre-created composite task is commanded to work, starting from the start node of the composite task, each subtask is executed in a certain order. As Figure 2 shown, due to the different external situations of each subtask, that is, the prerequisite conditions for the execution of the subtask are different, the actual execution time of each subtask has to be determined according to its external situation. Therefore, there is a situation where the selected subtask does not meet the execution conditions, and thus the selection has to be made again.

[0060] Step S102: If the subtask has a dependent external task, obtain the execution status of the external task.

[0061] In this embodiment, after the current subtask to be executed is selected, the external situation of the current subtask to be executed is detected. If it is detected that the current subtask to be executed has an external task on which it depends for the task, obtain the execution status of the dependent external task, and determine whether to execute the current subtask to be executed according to the execution status of the external task. Among them, the above-mentioned existing dependent external task refers to an external task that depends on the current subtask for the task, that is, the current subtask to be executed depends on the execution status of a certain external task to perform its own task execution, and the external task here is a task independent of this composite task. It can be a subtask in another composite task or a simple task executed alone. As Figure 2 shown, Figure 2 subtask 3 in

[0062] Optionally, each subtask in the composite task can depend on one or more external tasks, and the external tasks it depends on are low-frequency relative to the subtask. Among them, the above-mentioned low-frequency means that the frequency period of task execution is relatively less compared to the subtask. For example, if the execution frequency period of the current subtask is once every minute, then the external task it depends on should be lower than the execution frequency period of the above subtask, such as once every hour. When the subtask has a dependent external task, it is necessary to ensure that the external task in the current period has been executed successfully before the subtask can be executed. Generally, the subtask is based on the last execution status of the external task on the current day at the current time period.

[0063] Optionally, if an external task on which the above subtask depends has not been executed, the above subtask will not be executed until it is detected that the task on which it depends externally has been successfully executed, and then the above subtask will be executed. It can be understood that if there are other external conditions for the above subtask, then the above subtask will be executed again under the condition that other external conditions and external tasks are both satisfied.

[0064] As a specific example rather than a limitation, since the subtask is high-frequency relative to the external task on which it depends, it is set that the subtask is executed once at 8:00 am and 5:00 pm every day, and the external task on which the above subtask depends is executed at 11:00 am every day. Then, when the subtask to be executed at 8:00 am is about to be executed, if it is detected that there is an external task on which it depends and the external task has not started to be executed, the current subtask will not be executed until it is detected that the external task has been executed at 11:00 am. Then, according to the execution status of the external task at 11:00 am, the subtask will be executed. When the subtask to be executed at 5:00 pm is about to be executed, it will be executed according to the last execution status of the external task, that is, the execution status of the external task at 11:00 am.

[0065] Step S103: If there is a predecessor task for the subtask, obtain the execution status of the predecessor task.

[0066] In this embodiment, after selecting the currently to-be-executed subtask, the external situation of the currently to-be-executed subtask is detected. If it is detected that there is a predecessor task for the currently to-be-executed subtask, obtain the execution status of the above predecessor task, and decide whether to execute the currently to-be-executed subtask according to the execution status of the predecessor task. Among them, the above predecessor task refers to the task that is connected to the currently to-be-executed subtask and sorted before the currently to-be-executed subtask after the topological sorting of each subtask in the composite task. After the predecessor task is executed, the above subtask can be executed.

[0067] Optionally, each subtask in the composite task can have one or more predecessor tasks. If the above subtask has two predecessor tasks, such as Figure 2 shown, Figure 2 Subtask 4 in has two predecessor tasks, namely Subtask 1 and Subtask 2. Then, Subtask 4 can be executed only when both Subtask 1 and Subtask 2 are executed. It can be understood that if there are other external conditions for the above subtask, then the above subtask will be executed again under the condition that other external conditions and predecessor tasks are both satisfied.

[0068] By way of specific example rather than limitation, after the predecessor task B is executed and completed, its successor subtask A is selected as the currently pending subtask to be executed. Moreover, subtask A has another predecessor task C. At this time, subtask A has two predecessor tasks, namely predecessor task B and predecessor task C. Predecessor task B has been executed and completed. At this time, it is necessary to detect the execution status of predecessor task C and decide whether to execute subtask A according to the execution status of predecessor task C. Among them, the above-mentioned successor task refers to the task that is connected to the currently pending subtask after the topological sorting of each subtask in the composite task and is sorted after the currently pending subtask. After the currently pending subtask is executed and completed, its successor task can be selected as the next pending subtask according to the topological order.

[0069] Step S104: If the execution status of the external task and the execution status of the predecessor task are both executed and completed, then execute the subtask.

[0070] In this embodiment, when it is detected that the execution status of the external task and the predecessor task of the currently pending subtask are both executed and completed, the currently pending subtask is executed.

[0071] Optionally, if the currently pending subtask has only an external task and no predecessor task, then when its external task is executed and completed, the currently pending subtask is executed; if the currently pending subtask has only a predecessor task and no external task, then when its predecessor task is executed and completed, the currently pending subtask is executed; if the currently pending subtask has two or more predecessor tasks and external tasks, then when its two or more predecessor tasks and external tasks are executed and completed, the currently pending subtask is executed.

[0072] Step S105: When the subtask is executed and completed, if there are still unexecuted subtasks in the composite task, then re-select the currently pending subtask from the unexecuted subtasks until all the subtasks in the composite task are executed and completed.

[0073] In this embodiment, after the currently selected subtask to be executed is completed, if it is detected that there are still unexecuted subtasks in the composite task, a subtask is reselected from the unexecuted subtasks as the currently to-be-executed subtask until it is detected that all subtasks in the composite task are completed. Among them, the above selection method can select the successor task of the currently completed subtask according to the topological order. If after the above steps, the external environment of the successor task does not meet the execution conditions, that is to say, the successor task has other predecessor tasks and the other predecessor tasks have not started to be executed, or the successor task has external tasks and the external tasks have not started to be executed, etc., then another one is reselected in the order of topological arrangement.

[0074] It can be understood that the composite task can form a directed acyclic graph, that is, the subtasks in the composite task can be arranged in a complex topological order. As Figure 2 shown, when all subtasks are completed according to the topological arrangement, the composite task will be completed.

[0075] Optionally, if the unexecuted subtasks in the composite task do not meet the execution conditions after going through the above steps, wait until it is detected that the execution conditions of a certain subtask are met, and then execute.

[0076] Optionally, as Figure 3 shown, after step S104 includes:

[0077] Step S301, if the subtask fails to execute, obtain the preset attributes of the subtask, and determine whether to re-execute the subtask according to the preset attributes.

[0078] In this embodiment, during the process of establishing subtasks in the composite task, obtain the task information of the task, and preset the attribute values of each parameter of the subtask according to the task information. For example, when a subtask fails to execute, whether to re-execute the failed subtask, and the number of times to re-execute the subtask, etc. By setting the attribute values of the subtask, if the current subtask fails to execute, it is determined whether to re-execute the failed subtask according to the preset attribute values of the parameters.

[0079] As a specific example rather than a limitation, if the preset subtask fails to execute, re-execute the subtask. After the current subtask fails to execute, re-execute the failed subtask according to the preset attributes.

[0080] Optionally, if the subtask fails to execute, an alarm reminder can be given. The failed subtask can be marked in red in the composite task through the log query module, so that the user can immediately discover the problem and thus perform real-time control. It can also remind the user by sending an email or other means, which is not limited here.

[0081] In step S302, if the execution time of the subtask exceeds the preset time threshold, it is determined whether to re-execute the subtask according to the preset attribute.

[0082] In this embodiment, during the process of establishing subtasks in a composite task, the task information of the task is obtained, and the attribute values of each parameter of the subtask are preset according to the task information. For example, when the execution time of the subtask exceeds the preset time threshold, whether to re-execute the timed-out subtask, and the number of times to re-execute the subtask, etc. By setting the attribute values of the subtask, if the execution time of the current subtask exceeds the preset time threshold, it is determined whether to re-execute the timed-out subtask according to the attribute values of the preset parameters.

[0083] As a specific example rather than a limitation, if the execution time of the preset subtask exceeds the preset time threshold, the failed subtask is re-executed according to the preset attribute after the execution time of the current subtask exceeds the preset time threshold.

[0084] Optionally, different time thresholds are determined according to the different execution situations of each subtask. Here, the time threshold refers to the execution time of the preset subtask. Generally, the set time threshold is a little more than the normal execution time of the subtask, and the extra time is the timeout time recognized by the user.

[0085] Optionally, the subtasks can be divided into two execution methods, one is synchronous execution and the other is asynchronous execution. The subtasks executed synchronously have a very fast response speed. Generally, the execution and response are close to synchronous, and at this time, the set time threshold is small; the subtasks executed asynchronously have a very slow response speed. Generally, the time difference between execution and response may be several hours, and at this time, the set time threshold is large.

[0086] Optionally, if the execution time of the subtask exceeds the preset time threshold, an alarm reminder can be given, and the user can make real-time parameter changes according to the relevant reminder, such as changing the time threshold, forcing success, etc., so as to facilitate the successful execution of the subtask.

[0087] In step S303, if the number of times of the re-execution operation exceeds the preset number of re-executions, it is determined whether to ignore the abnormal operation of the subtask according to the preset attribute.

[0088] In this embodiment, when a subtask is re-executed, after the number of times of the above-mentioned subtask re-execution operation exceeds the preset number of re-execution times, if the execution of the subtask still fails or times out, etc., determine whether to ignore the abnormal operation of the subtask according to the attribute values of each parameter of the preset subtask, that is, whether to automatically ignore the abnormality when the number of times of the subtask re-execution operation exceeds the preset number of re-execution times. If the abnormal operation of the subtask is ignored, the subtask is successfully executed and the subsequent judgment continues. The above process is as Figure 4 shown.

[0089] Taking a specific example rather than a limitation, if the number of times of re-execution operation of a preset subtask exceeds the preset number of re-execution times, the abnormal operation of the subtask is automatically ignored. After the number of times of re-execution operation of the current subtask exceeds the preset number of re-execution times, the abnormal operation of the subtask is automatically ignored according to the preset attribute.

[0090] Optionally, if a skip instruction is received, the execution of the subtask is skipped according to the skip instruction when executing the subtask.

[0091] In this embodiment, during the working process of a composite task, the user can control the task in real time. For example, a skip instruction for a subtask is issued. If the task scheduling center receives a skip instruction for a certain subtask, that is, the subtask is no longer executed, and when it comes to the execution of this subtask, it is skipped and the execution of the next subtask is carried out. Among them, the above-mentioned skip instruction includes the relevant information of this subtask, that is, the information that identifies this subtask.

[0092] Optionally, if an insertion instruction is received, a preset execution period is inserted into the execution process of the subtask according to the insertion instruction.

[0093] In this embodiment, during the working process of a composite task, if an insertion instruction for a certain subtask is received, analyze how much the preset execution period included in the insertion instruction is, and insert the execution period included in the insertion instruction into the execution process of the subtask according to the insertion instruction, and the subtask can execute the execution period included in the insertion instruction. That is to say, on the basis of the original execution period of the subtask, a preset execution period of the subtask is inserted again. According to the above insertion instruction, during the execution process of the subtask, according to the preset execution period included in the insertion instruction, in addition to executing its original preset period, it also executes the preset specific period included in the insertion instruction, which improves the execution frequency of the subtask. Among them, the above-mentioned insertion instruction refers to inserting a specific period during the execution process of the task; the above-mentioned preset execution period refers to the execution frequency of the period inserted midway, for example, running once at 8:00 am on Monday every week.

[0094] Optionally, the above insertion instruction can also be applied to composite tasks to comprehensively control each subtask in the composite task. For example, if the fixed execution period of a composite task is to run once at 5 pm at the end of each month, and on this basis, an insertion instruction including running once at 9 am on every Saturday is sent to the task scheduling center, then the task scheduling center will use its internal executor to run the composite task not only once at 5 pm at the end of each month, but also once at 9 am on every Saturday, thereby driving the internal subtasks to run accordingly.

[0095] Optionally, if a deletion instruction is received, the preset execution period is deleted during the execution of the subtask according to the deletion instruction.

[0096] In this embodiment, during the operation of the composite task, if a deletion instruction for a certain subtask is received, analyze how much the preset execution period included in the deletion instruction is, and insert the execution period included in the deletion instruction into the execution process of the subtask according to the deletion instruction. When the execution time of the subtask during execution meets the execution period marked by the deletion instruction, the subtask during this time period is not executed. According to the above deletion instruction, when the subtask executes its original preset period, if it detects that the current execution period meets the preset specific period included in the deletion instruction, the current period is not executed, so as to better control the subtask and improve efficiency. Herein, the above deletion instruction refers to deleting a specific period during the execution of the task.

[0097] Optionally, the above deletion instruction can also be applied to composite tasks to comprehensively control each subtask in the composite task. For example, if the fixed execution period of a composite task is to run once at 5 pm at the end of each month, and on this basis, since there are special activities in May, the composite task is not executed in May, then a deletion instruction including running once at 5 pm at the end of May can be sent to the task scheduling center, and the task scheduling center will use its internal executor not to execute the composite task at 5 pm at the end of May, so that the internal subtasks will not be executed either.

[0098] Optionally, if the working duration of the composite task is greater than the preset time threshold, after the currently executing subtask in the composite task is completed, the work of the composite task ends.

[0099] In this embodiment, since the composite task comprehensively regulates each of its subtasks, a working time is preset in the composite task, which is the above-mentioned preset time threshold. If, when the composite task is working, its working duration is greater than the preset time threshold, that is, the current composite task fails to complete its work within the specified time and thus times out, then after the subtask currently being executed in the composite task is completed, the next unexecuted subtask is not selected again, and the work of the composite task is ended to prevent situations from occurring due to the composite task working for too long. Among them, the above time threshold is determined according to the normal working duration of the composite task. Generally, the time threshold is set to be a little more than the normal execution time of the composite task, and the extra time is the timeout time recognized by the user.

[0100] Optionally, after ending the work of the above-mentioned timed-out composite task because the working duration of the composite task is greater than the preset time threshold, it is possible to choose to re-run the above-mentioned timed-out composite task after changing some parameters according to the operation result, such as changing the timeout time; it is also possible to choose to continue starting from the subtask that has been executed in the composite task and select the next unexecuted subtask to continue running.

[0101] Optionally, the creation process of the composite task includes:

[0102] Obtain composite task information and create the composite task according to the composite task information.

[0103] In this embodiment, according to the creation instruction for creating a composite task issued by the user, composite task information is obtained, and the composite task is created according to the obtained composite task information. Among them, the above composite task information refers to the attribute information required for creating a composite task, which can be adjusted according to different user requirements. The composite task information includes but is not limited to the normal cycle, insertion cycle, exclusion cycle, number of times the task is re-executed, synchronous task timeout time, asynchronous task timeout time, etc. The above normal cycle refers to the execution cycle of the above composite task; the above insertion cycle refers to the execution cycle carried in the above insertion instruction; the above exclusion cycle refers to the execution cycle carried in the above deletion instruction.

[0104] Import a preset task template into the composite task, generate each subtask, and perform a topological arrangement on the subtasks.

[0105] In this embodiment, a task template for some tasks to be batch-processed is preset in advance, and the preset task template is imported into the composite task to directly generate each subtask. The relevant task information already exists in each subtask, and these subtasks are topologically arranged under the start node, which can form a directed acyclic graph. This process can avoid omission of subtasks and errors in the task information of some subtasks by batch-importing the template into the composite task to generate each subtask, improve the efficiency of adding subtasks to the composite task and the correctness of the subtasks, and reduce the workload of operators in creating scheduling tasks.

[0106] It can be understood that the creation of a composite task can perform overall control on each subtask inside it.

[0107] Optionally, the above-mentioned preset task module can be imported into the composite task in a visual drag-and-drop manner, and during this process, if the user has a need, the task information of the subtask can be changed in real time.

[0108] Optionally, as Figure 5 shown, if a simple task is created, the task information is directly obtained, and a simple task is created according to the task information.

[0109] Optionally, as Figure 6 shown, before importing the preset task template into the composite task to generate each subtask, it includes:

[0110] Step S601: Obtain interface information and create a task import interface according to the interface information.

[0111] In this embodiment, according to the creation instruction for creating a task import interface issued by the user, the interface information is obtained, and a task import interface is created according to the obtained interface information. Among them, the above-mentioned interface information can be adjusted according to different user requirements, and the interface information includes but is not limited to the interface name, URL request address, request method, interface description, etc. The above-mentioned task import interface is to create an interface, and a task template can be generated and converted into subtasks according to this interface.

[0112] Step S602: Verify the import interface, and when the verification passes, obtain the task template information.

[0113] Step S603: Generate the task template according to the task template information for the task import interface that has passed the verification.

[0114] In this embodiment, the created import interface is verified. When the verification of the interface passes, the task template information required for creating the task template is obtained, and the verified task import interface is used to generate a task template through the task template information. Among them, the above-mentioned task template information refers to the task attribute information required for creating the task module, which can be filled in and changed by the user according to needs, including but not limited to the response timeout time, the number of re-executions, whether to automatically ignore exceptions, etc.; the above-mentioned task template means that all task information has been set, and the task template can be directly imported into the composite task to generate subtasks without adding other task information.

[0115] Optionally, the above task template can directly convert the corresponding task template into a subtask or a simple task according to the conversion instruction issued by the user.

[0116] Optionally, there are various ways to verify the above import interface, which are not limited here. For example, it is determined whether the interface verification passes by verifying whether the data returned by the interface is consistent with the expected result.

[0117] Optionally, as Figure 7 shown, before generating the task template, verify which batch tasks are currently available, and generate a task template corresponding to the batch tasks according to the interface information. After generating the above task template, execute the above task template and view the execution log. When the content displayed in the execution log meets the expected result, it proves that the above task template verification passes and can be used. Through layer-by-layer verification, the correctness of the composite task is improved.

[0118] Optionally, before topologically arranging the subtasks, it includes:

[0119] When a drag instruction is received, load a preset task type to a preset position in the composite task.

[0120] Obtain task information, and generate subtasks according to the task information for the task type.

[0121] In this embodiment, some commonly used task types supported by the current device are preset in advance. When a drag instruction for a certain task type is received, this preset task type is loaded to a preset position in the editing area of the subtasks in the created composite task, and the task information for this task type is obtained. Subtasks are generated for the task type loaded into the composite task according to the task information. Among them, the above-mentioned task information refers to the task attribute information required for creating subtasks, which can be filled in and changed by the user according to needs, including but not limited to the response timeout time, the number of re-executions, whether to automatically ignore exceptions, etc.

[0122] It is understandable that the above task template can generate the same subtasks in batches. The relevant task information in the task template has been filled in and can also be changed accordingly, but generally the changes are not significant. For the subtasks generated by the task type, the relevant task information is filled in according to the user's needs. For subtasks that do not require batch import, they can be loaded into the composite task by generating subtasks in the task type way.

[0123] Optionally, the above task type can be extended according to the user's needs. The above task type also includes a start task type, which is used at the start of the task. The task starts to execute with the start node formed by the start task type in the composite task. Therefore, the subtasks generated by other task types are located after the start node generated by the start type.

[0124] Optionally, the log of the composite task scheduling can be viewed in real time during the operation of the composite task. Through the log, the execution progress of each subtask can be viewed, and the execution of each subtask can be controlled in real time according to the progress. For example, technical means such as forcing success, forcing failure, skipping execution, and re-executing can be used for the selected subtasks. And each subtask is displayed in different colors and sizes according to the current execution situation, which is convenient for users to check and perform corresponding operations. For example, the subtasks that have failed in execution are displayed in red, the subtasks in operation are displayed in yellow, and the subtasks that have not been run are displayed in black, etc. Among them, the above-mentioned forcing success means that when an exception occurs in a subtask, the subtask is forced to succeed to avoid affecting the subsequent tasks; the above-mentioned skipping execution means skipping a subtask according to the user's needs, and the subtask will no longer be executed.

[0125] Optionally, tags can be added to the composite task, and the composite task can be queried through the tags and grouped and managed according to the tags, so as to isolate the permissions for scheduling tasks between different departments or project teams.

[0126] In the embodiments of the present application, a sub-task to be currently executed is selected from a preset composite task; if the sub-task has a dependent external task, the execution status of the external task is obtained; if the sub-task has a predecessor task, the execution status of the predecessor task is obtained; if the execution status of the external task and the execution status of the predecessor task are both completed, the sub-task is executed; when the execution of the sub-task is completed, if there are still unexecuted sub-tasks in the composite task, a sub-task to be currently executed is re-selected from the unexecuted sub-tasks until all sub-tasks in the composite task are executed. Through the embodiments of the present application, a sub-task to be executed is selected from a preset composite task, and by detecting whether the current sub-task has an external task or a predecessor task, it is avoided that the sub-task is executed when it is not completed in some cases, resulting in a deviation in the execution result. When both the external task and the predecessor task are executed, the current sub-task is executed. After the current sub-task is executed, it is determined whether there are still sub-tasks in the composite task, and a sub-task to be executed is selected from the unexecuted sub-tasks until all sub-tasks in the composite task are executed, thereby handling business problems with a relatively complex topological relationship.

[0127] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution is prior or posterior. The order of execution of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0128] Figure 8 The following is a schematic structural diagram of a task scheduling device in the embodiments of the present application, as Figure 5 shown, the task scheduling device may include:

[0129] A selection module 81, configured to select a sub-task to be currently executed from a preset composite task.

[0130] An external task module 82, configured to obtain the execution status of the external task if the sub-task has a dependent external task.

[0131] A predecessor task module 83, configured to obtain the execution status of the predecessor task if the sub-task has a predecessor task.

[0132] An execution module 84, configured to execute the sub-task if the execution status of the external task and the execution status of the predecessor task are both completed.

[0133] A completion module 85, configured to, when the execution of the sub-task is completed, if there are still unexecuted sub-tasks in the composite task, re-select a sub-task to be currently executed from the unexecuted sub-tasks until all sub-tasks in the composite task are executed.

[0134] Optionally, the task scheduling device may further include:

[0135] A first re - execution module, configured to, if the subtask execution fails, obtain the preset attributes of the subtask, and determine whether to re - execute the subtask according to the preset attributes.

[0136] A second re - execution module, configured to, if the execution time of the subtask exceeds a preset time threshold, determine whether to re - execute the subtask according to the preset attributes.

[0137] An ignore exception operation module, configured to, if the number of re - execution operations exceeds a preset number of re - execution times, determine whether to ignore the exception operation of the subtask according to the preset attributes.

[0138] Optionally, the task scheduling device may further include:

[0139] A skip task module, configured to, if a skip instruction is received, skip the execution of the subtask when executing the subtask according to the skip instruction.

[0140] An insert cycle module, configured to, if an insert instruction is received, insert a preset execution cycle during the execution process of the subtask according to the insert instruction.

[0141] A delete cycle module, configured to, if a delete instruction is received, delete a preset execution cycle during the execution process of the subtask according to the delete instruction.

[0142] Optionally, the task scheduling device may further include:

[0143] An end work module, configured to, if the working duration of the composite task is greater than a preset time threshold, end the work of the composite task after the currently executed subtask in the composite task is completed.

[0144] Optionally, the task scheduling device may further include:

[0145] A creation module, configured to obtain composite task information and create the composite task according to the composite task information.

[0146] A topology arrangement module, configured to import a preset task template into the composite task, generate each subtask, and perform a topology arrangement on the subtasks.

[0147] Optionally, the task scheduling device may further include:

[0148] An acquisition module, configured to obtain interface information and create a task import interface according to the interface information.

[0149] A verification module is used to verify the import interface and obtain task template information when the verification is passed.

[0150] A conversion module is used to generate the task template from the task import interface that has passed verification according to the task template information.

[0151] Optionally, the task scheduling device may further include:

[0152] A loading module is used to load a preset task type to a preset position in the composite task when a drag instruction is received.

[0153] A generation module is used to obtain task information and generate subtasks from the task type according to the task information.

[0154] In the embodiment of the present application, a subtask to be currently executed is selected from a preset composite task; if the subtask has dependent external tasks, the execution status of the external tasks is obtained; if the subtask has predecessor tasks, the execution status of the predecessor tasks is obtained; if the execution status of the external tasks and the execution status of the predecessor tasks are both completed, the subtask is executed; when the execution of the subtask is completed, if there are still unexecuted subtasks in the composite task, a subtask to be currently executed is reselected from the unexecuted subtasks until all subtasks in the composite task are executed. Through the embodiment of the present application, a subtask to be executed is selected from a preset composite task, and by detecting whether the current subtask has external tasks or predecessor tasks, it is avoided that the subtask is executed when it is not completed in some cases, resulting in deviation of the execution result. When the external tasks and the predecessor tasks are both executed, the current subtask is executed. After the current subtask is executed, it is determined whether there are still subtasks in the composite task, and a subtask to be executed is selected from the unexecuted subtasks until all subtasks in the composite task are executed, thereby handling business problems with a relatively complex topological relationship.

[0155] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the foregoing system embodiments and method embodiments, and will not be elaborated herein.

[0156] Figure 9 It is a schematic structural diagram of a terminal device provided by an embodiment of the present application. For the convenience of description, only parts related to the embodiment of the present application are shown.

[0157] As Figure 9 shown, the terminal device 9 of this embodiment includes: at least one processor 900( Figure 9(only one is shown in the figure), a memory 901 connected to the processor 900, a scheduler 902, an executor 903, and a computer program 904 stored in the memory 901 and executable on the at least one processor 900, such as a task scheduler. When the processor 900 executes the computer program 904, the steps in the above-mentioned embodiments of each task scheduling method are implemented, such as Figure 1 the steps S101 to S105 shown. Alternatively, when the processor 900 executes the computer program 904, the functions of each module in the above-mentioned device embodiments are implemented, such as Figure 8 the functions of the modules 81 to 85 shown. The scheduler 902 is used for task scheduling. The executor 903 is used for task execution after task scheduling

[0158] Exemplarily, the computer program 904 can be divided into one or more modules. The one or more modules are stored in the memory 901 and executed by the processor 900 to complete this application. The one or more modules can be a series of computer program instruction segments capable of completing specific functions, and this instruction segment is used to describe the execution process of the computer program 904 in the terminal device 9. For example, the computer program 602 can be divided into a selection module 81, an external task module 82, a predecessor task module 83, an execution module 84, and a completion module 85. The specific functions of each module are as follows:

[0159] The selection module 81 is used to select the currently to-be-executed subtask from the preset composite task.

[0160] The external task module 82 is used to obtain the execution status of the external task if the subtask has a dependent external task.

[0161] The predecessor task module 83 is used to obtain the execution status of the predecessor task if the subtask has a predecessor task.

[0162] The execution module 84 is used to execute the subtask if the execution status of the external task and the execution status of the predecessor task are both completed.

[0163] The completion module 85 is used to, when the execution of the subtask is completed, if there are still unexecuted subtasks in the composite task, re-select the currently to-be-executed subtask from the unexecuted subtasks until all the subtasks in the composite task are executed.

[0164] The terminal device 9 may include, but is not limited to, a processor 900, a memory 901, a scheduler 902, and an executor 903. Those skilled in the art can understand, Figure 9The above are only examples of the terminal device 9, which do not constitute a limitation to the terminal device 9. It may include more or fewer components than those shown in the figure, or combine certain components, or different components. For example, it may also include input / output devices, network access devices, buses, etc.

[0165] The so-called processor 900 may be a central processing unit (CPU). The processor 900 may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0166] In some embodiments, the memory 901 may be an internal storage unit of the terminal device 9, such as the hard disk or memory of the terminal device 9. In some other embodiments, the memory 901 may also be an external storage device of the terminal device 9, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 9. Further, the memory 901 may also include both the internal storage unit and the external storage device of the terminal device 9. The memory 901 is used to store an operating system, application programs, a boot loader, data, and other programs, such as the program code of the computer program. The memory 901 may also be used to temporarily store data that has been output or is to be output.

[0167] Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional units and modules according to needs, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of the functional units and modules are only for the convenience of mutual distinction and do not limit the protection scope of this application. The specific working processes of the units and modules in the above system can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0168] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0169] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0170] In the embodiments provided in this application, it should be understood that the disclosed device / terminal device and method can be implemented in other ways. For example, the device / terminal device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division, and there can be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.

[0171] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0172] In addition, in each embodiment of the present application, each functional unit can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0173] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above-mentioned embodiment methods of the present application, a computer program can be used to instruct relevant hardware to complete. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-mentioned various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file or some intermediate form, etc. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the photographing device / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disc, etc. In some jurisdictions, according to legislation and patent practice, the computer-readable medium cannot be an electrical carrier signal and a telecommunication signal.

[0174] The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A task scheduling method, characterized in that, Including: Select the current subtask to be executed from the preset composite task; wherein, the selection method is to select the subtasks in the composite task in the order of topological arrangement; If the subtask has dependent external tasks, obtain the execution status of the external tasks; wherein, the external tasks are tasks independent of the composite task; If the subtask has predecessor tasks, obtain the execution status of the predecessor tasks; If the execution status of the external tasks and the execution status of the predecessor tasks are both completed, execute the subtask; When the execution of the subtask is completed, if there are still unexecuted subtasks in the composite task, reselect the current subtask to be executed from the unexecuted subtasks until all subtasks in the composite task are executed; If an insertion instruction is received, insert a preset execution cycle during the execution of the subtask according to the insertion instruction; If a deletion instruction is received, delete a preset execution cycle during the execution of the subtask according to the deletion instruction; Wherein, the creation process of the composite task includes: Obtain composite task information and create the composite task according to the composite task information; Obtain interface information and create a task import interface according to the interface information; verify the import interface, and when the verification passes, obtain task template information; generate the task template from the task import interface that has passed the verification according to the task template information; wherein, the task template information includes the response timeout time, the number of re-executions, and whether to automatically ignore exceptions, and the task template means that all task information has been set; Import a preset task template into the composite task to generate each subtask and arrange the subtasks in topological order.

2. The task scheduling method according to claim 1, wherein After executing the subtask, including: If the subtask execution fails, obtain the preset attributes of the subtask and determine whether to re-execute the subtask according to the preset attributes; If the execution time of the subtask exceeds the preset time threshold, determine whether to re-execute the subtask according to the preset attributes; If the number of re-execution operations exceeds the preset number of re-executions, determine whether to ignore the abnormal operation of the subtask according to the preset attributes.

3. The task scheduling method according to claim 1, wherein Including: If a skip instruction is received, skip the execution of the subtask when executing the subtask according to the skip instruction.

4. The task scheduling method according to claim 1, wherein Including: If the working duration of the composite task is greater than the preset time threshold, end the work of the composite task after the currently executed subtask in the composite task is completed.

5. The task scheduling method according to claim 1, characterized in that Before arranging the subtasks in topological order, including: When a drag instruction is received, load a preset task type to a preset position in the composite task; Obtain task information and generate subtasks from the task type according to the task information.

6. A task scheduling device, characterized in that, Including: A selection module for selecting the current subtask to be executed from the preset composite task; wherein, the selection method is to select the subtasks in the composite task in the order of topological arrangement; An external task module, configured to obtain the execution status of the external task if the subtask depends on an external task; wherein the external task is a task independent of the composite task; A predecessor task module, configured to obtain the execution status of the predecessor task if the subtask has a predecessor task; An execution module, configured to execute the subtask if the execution status of the external task and the execution status of the predecessor task are both completed; A completion module, configured to, when the execution of the subtask is completed, if there are still unexecuted subtasks in the composite task, reselect the currently to-be-executed subtask from the unexecuted subtasks until all subtasks in the composite task are executed; An insertion cycle module, configured to insert a preset execution cycle during the execution of the subtask if an insertion instruction is received; A deletion cycle module, configured to delete a preset execution cycle during the execution of the subtask if a deletion instruction is received; A creation module, configured to obtain composite task information and create the composite task according to the composite task information; An acquisition module, configured to obtain interface information and create a task import interface according to the interface information; A verification module, configured to verify the import interface, and obtain task template information when the verification passes; A conversion module, configured to generate the task template from the task import interface that passes the verification according to the task template information; wherein the task template information includes the response timeout time, the number of re-executions, and whether to automatically ignore exceptions, and the task template means that all task information has been set; A topology arrangement module, configured to import a preset task template into the composite task, generate each subtask, and perform a topology arrangement on the subtasks.

7. A terminal device, comprising a memory, a processor, a scheduler, an executor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, the steps of a task scheduling method according to any one of claims 1 to 5 are implemented.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, the steps of a task scheduling method according to any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Task scheduling method, task scheduling system, storage medium and computer equipment

    CN110134499A

  • Task processing method, device and system, equipment and storage medium

    CN110187958A

  • Label task generation method and device, storage medium and electronic equipment

    CN110955481A