Task scheduling method and device and electronic equipment
By using asynchronous thread management and subtask priority scheduling, the problem of high-priority tasks waiting due to resource consumption during business task execution is solved, achieving flexibility and efficiency in task scheduling.
Patent Information
- Application Number
- CN202511423017.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2025-12-23
AI Technical Summary
During the execution of business tasks, low-priority tasks consume resources, causing high-priority tasks to wait, which affects execution efficiency and user experience. Existing technologies make it difficult to achieve flexible task scheduling.
The system employs asynchronous execution, with the first, second, and third threads managing the subtask set, scheduling subtasks, and detecting subtask status, respectively. Scheduling is performed based on subtask priority and status, enabling timely updates and flexible scheduling of task status.
It improves the execution efficiency of high-priority tasks and the flexibility of business task scheduling, avoids waiting issues caused by resource consumption, and enhances the user experience.
Smart Images

Figure CN121187733A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data processing, and particularly relates to a task scheduling method and device and electronic equipment. BACKGROUND
[0002] With the development of the Internet, more and more business tasks are executed online, so as to improve the efficiency and convenience of business task execution. However, with the increasing number of online business tasks, the efficiency of business task execution through online is affected to a certain extent. For example, during a business task execution peak, after the execution of one business task is completed, the execution of another business task is performed, and the execution of a low-priority business task occupies computing resources, so that a high-priority business task is in a waiting state, thereby affecting the efficiency of business task execution and the experience of users participating in business tasks. How to improve the flexibility of business task execution is a focus of users and business task execution institutions. SUMMARY
[0003] In view of the above problems, the present application provides a task scheduling method, device and electronic equipment which overcome the above problems or at least partially solve the above problems, and the technical solutions are as follows: A task scheduling method, the method comprising: a first thread acquires a subtask associated with a business task and updates the subtask to a subtask set after a first condition is met; the subtask set stores a subtask priority and a subtask state of the subtask; the subtask state of the subtask in the subtask set is a first state; a second thread acquires a to-be-scheduled subtask according to the subtask priority and the subtask state of each subtask in the subtask set after a second condition is met, performs scheduling processing on the to-be-scheduled subtask, and updates the subtask state of the to-be-scheduled subtask in the subtask set to a second state; a third thread acquires a target state of a to-be-detected subtask whose subtask state in the subtask set is the second state after a third condition is met, and sends the third state to a business server in a case where the target state is a third state, so as to update a task state of the business task to the third state in a case where the subtask state of each subtask associated with the business task is the third state; wherein the first thread, the second thread and the third thread are executed asynchronously.
[0004] The task scheduling method provided in the application deploys a first thread, a second thread and a third thread to execute asynchronously. The first thread updates a subtask associated with a business task to a subtask set after a first condition is met, and a subtask state of the subtask updated to the subtask set is a first state. In this way, the first thread updates the subtask set to improve the effectiveness of the subtask set. The second thread acquires a to-be-scheduled subtask in the subtask set according to a subtask priority and a subtask state after a second condition is met. In this way, the to-be-scheduled subtask is acquired in combination with the subtask priority, so that the subtask with a higher priority is scheduled preferentially, and the execution efficiency of the business task with a higher priority is improved. Further, the to-be-scheduled subtask is scheduled and processed, and a subtask state of the to-be-scheduled subtask is updated to a second state. In this way, the subtask state in the subtask set is updated in a timely manner. The third thread acquires a target state of a to-be-detected subtask with the second state after a third condition is met, and sends a third state to a business server in a case where the target state is the third state. In this way, the task execution of the business task is flexibly scheduled through the asynchronous manner of subtask management, subtask scheduling and state detection.
[0005] Optionally, the acquiring the to-be-scheduled subtask according to the subtask priority and the subtask state of each subtask in the subtask set comprises: acquiring a number of subtasks with the second state in the subtask set; if the number of subtasks is less than a preset number threshold, calculating a number of to-be-scheduled subtasks according to the number of subtasks and the preset number threshold; and filtering the to-be-scheduled subtasks from each candidate subtask with the first state in the subtask set according to the number of to-be-scheduled subtasks and the subtask priority of each candidate subtask.
[0006] In the optional embodiment, in the process of acquiring the to-be-scheduled subtask according to the subtask priority and the subtask state of each subtask in the subtask set, the number of to-be-scheduled subtasks is calculated according to the preset number threshold and the number of subtasks with the second state in the subtask set, and the to-be-scheduled subtasks are filtered according to the number of to-be-scheduled subtasks and the subtask priority of each candidate subtask with the first state in the subtask set. In this way, the to-be-scheduled subtasks are determined according to the preset number threshold and the number of subtasks with the second state, so that the adaptability of the determined to-be-scheduled subtasks to the scheduling capability is improved, and the case that too many to-be-scheduled subtasks are acquired to affect the scheduling efficiency and the scheduling stability is avoided.
[0007] Optionally, the filtering the to-be-scheduled sub-tasks from the candidate sub-tasks according to the number of to-be-scheduled sub-tasks and the sub-task priority of each candidate sub-task in the sub-task set whose sub-task state is the first state comprises: performing sorting processing on the plurality of candidate sub-tasks according to the sub-task priority of each candidate sub-task to obtain a candidate sub-task sequence; and determining the candidate sub-tasks before the bit position corresponding to the number of to-be-scheduled sub-tasks in the candidate sub-task sequence as the to-be-scheduled sub-tasks.
[0008] In the optional embodiment, in the process of filtering the to-be-scheduled sub-tasks from the candidate sub-tasks according to the number of to-be-scheduled sub-tasks and the sub-task priority of each candidate sub-task in the sub-task set whose sub-task state is the first state, firstly, the plurality of candidate sub-tasks are sorted according to the sub-task priority of each candidate sub-task to obtain a candidate sub-task sequence; and then the candidate sub-tasks before the bit position corresponding to the number of to-be-scheduled sub-tasks in the candidate sub-task sequence are determined as the to-be-scheduled sub-tasks, so that the obtained to-be-scheduled sub-tasks are the to-be-scheduled sub-tasks with the highest priority, and the effectiveness of the obtained to-be-scheduled sub-tasks is improved.
[0009] Optionally, the scheduling processing of the to-be-scheduled sub-tasks comprises: determining a corresponding priority queue according to the sub-task priority of the to-be-scheduled sub-tasks; and storing the sub-task information of the to-be-scheduled sub-tasks into the priority queue, so as to perform sub-task scheduling processing on the to-be-scheduled sub-tasks when the available computing resources of the priority queue meet the resource requirement of the to-be-scheduled sub-tasks.
[0010] In the optional embodiment, in the process of scheduling processing of the to-be-scheduled sub-tasks, the sub-task information of the to-be-scheduled sub-tasks is stored into the priority queue corresponding to the sub-task priority of the to-be-scheduled sub-tasks, so that the to-be-scheduled sub-tasks are scheduled when the available computing resources of the priority queue meet the resource requirement of the to-be-scheduled sub-tasks, and in this way, the sub-task execution efficiency of the to-be-scheduled sub-tasks is ensured by storing the sub-task information of the to-be-scheduled sub-tasks with different priorities into the corresponding priority queue.
[0011] Optionally, the number of computing resources of the priority queue is proportional to the corresponding sub-task priority; and the priority queue obtains available computing resources after the sub-task state is updated to the third state.
[0012] In the optional embodiment, the number of computing resources of the priority queue is proportional to the corresponding sub-task priority, so that the to-be-scheduled sub-tasks with high priority can directly use sufficient resources in the corresponding priority queue for sub-task execution, and the to-be-scheduled sub-tasks with low priority do not cause the to-be-scheduled sub-tasks with high priority to be in a waiting state due to resource occupation.
[0013] Optionally, the sub-task scheduling processing on the to-be-scheduled sub-task comprises: acquiring a computing cluster type of a computing cluster associated with the priority queue; and if a resource type of the to-be-scheduled sub-task matches the computing cluster type, invoking a sub-task execution platform to schedule the to-be-scheduled sub-task to the computing cluster.
[0014] In the optional embodiment, in the process of scheduling processing on the to-be-scheduled sub-task, the to-be-scheduled sub-task is scheduled to a computing resource cluster matching a resource type of the to-be-scheduled sub-task, so as to improve the task execution efficiency, avoid performance loss caused by resource type mismatch, reduce the complexity of cross-cluster scheduling, improve the stability of sub-task execution, and avoid execution exception caused by resource type mismatch.
[0015] Optionally, the acquiring of the target state of the to-be-detected sub-task in the sub-task set with the second state comprises: acquiring a sub-task identifier of the to-be-detected sub-task in the sub-task set with the second state; and according to the sub-task identifier, invoking a sub-task execution platform to query the corresponding target state.
[0016] In the optional embodiment, in the process of acquiring the target state of the to-be-detected sub-task in the sub-task set with the second state, the third thread invokes a sub-task execution platform to query the corresponding target state according to the sub-task identifier of the to-be-detected sub-task in the sub-task set with the second state, so as to obtain the accurate target state of the to-be-detected sub-task from the sub-task execution platform.
[0017] Optionally, the second thread and the third thread are isolated by using the same distributed lock.
[0018] In the optional embodiment, the second thread and the third thread are isolated by using the same distributed lock, so as to prevent the state modification of the sub-task from being disordered.
[0019] A task scheduling apparatus, the apparatus comprising: A first module configured to, after a first condition is met, acquire, by a first thread, a sub-task associated with a business task, and update the sub-task to a sub-task set; the sub-task set stores a sub-task priority and a sub-task state of the sub-task; the sub-task state of the sub-task in the sub-task set is a first state; A second module configured to, after a second condition is met, acquire, by a second thread, a to-be-scheduled sub-task according to the sub-task priority and the sub-task state of each sub-task in the sub-task set, perform scheduling processing on the to-be-scheduled sub-task, and update the sub-task state of the to-be-scheduled sub-task in the sub-task set to a second state. The third module is configured to, after the third condition is met, acquire, by a third thread, a target state of a to-be-detected subtask in the subtask set whose subtask state is the second state, and send the third state to the service server in a case where the target state is a third state, so as to update a task state of the service task to the third state in a case where the subtask states of the subtasks associated with the service task are the third state. The first thread, the second thread, and the third thread are executed asynchronously.
[0020] Optionally, the second module is configured to, when acquiring the to-be-scheduled subtask according to the subtask priority and the subtask state of each subtask in the subtask set, acquire a number of subtasks in the subtask set whose subtask state is the second state, calculate a number of to-be-scheduled subtasks according to the number of subtasks and a preset number threshold in a case where the number of subtasks is less than the preset number threshold, and select the to-be-scheduled subtask from the candidate subtasks according to the number of to-be-scheduled subtasks and the subtask priority of each candidate subtask whose subtask state is the first state in the subtask set.
[0021] Optionally, the second module is configured to, when selecting the to-be-scheduled subtask from the candidate subtasks according to the number of to-be-scheduled subtasks and the subtask priority of each candidate subtask whose subtask state is the first state in the subtask set, perform sorting processing on a plurality of candidate subtasks according to the subtask priority of each candidate subtask, to obtain a candidate subtask sequence, and determine the candidate subtask before a bit order corresponding to the number of to-be-scheduled subtasks in the candidate subtask sequence as the to-be-scheduled subtask.
[0022] Optionally, the second module is configured to, when performing scheduling processing on the to-be-scheduled subtask, determine a corresponding priority queue according to the subtask priority of the to-be-scheduled subtask, and store subtask information of the to-be-scheduled subtask to the priority queue, so as to perform subtask scheduling processing on the to-be-scheduled subtask in a case where available computing resources of the priority queue meet resource requirements of the to-be-scheduled subtask.
[0023] Optionally, the number of computing resources of the priority queue is proportional to the corresponding subtask priority, and the priority queue obtains available computing resources after the subtask state is updated to a third state.
[0024] Optionally, the second module is configured to, when performing subtask scheduling processing on the to-be-scheduled subtask, acquire a computing cluster type of a computing cluster associated with the priority queue, and invoke a subtask execution platform to schedule the to-be-scheduled subtask to the computing cluster in a case where a resource type of the to-be-scheduled subtask matches the computing cluster type.
[0025] Optionally, the third module is specifically configured to: acquire the subtask identifier of the to-be-detected subtask in the subtask set in the second state when acquiring the target state of the to-be-detected subtask in the subtask set in the second state; and acquire the target state by calling the subtask execution platform according to the subtask identifier.
[0026] Optionally, the second thread and the third thread are isolated by the same distributed lock.
[0027] A vehicle, comprising a memory and a processor, wherein the memory stores executable program code, and the processor is configured to invoke and execute the executable program code to implement the task scheduling method according to any one of the preceding embodiments.
[0028] An electronic device, comprising: a memory configured to store a computer program; and a processor configured to implement the steps of the task scheduling method according to any one of the preceding embodiments when executing the computer program.
[0029] A computer readable storage medium, which stores a computer program, and the computer program is configured to implement the steps of the task scheduling method according to any one of the preceding embodiments when executed by a processor.
[0030] A computer program product, comprising a computer program, and the computer program is configured to implement the steps of the task scheduling method according to any one of the preceding embodiments when executed by a processor.
[0031] The above description is only a summary of the technical solutions of the present application. In order to enable the technical means of the present application to be more clearly understood, and to be implemented according to the content of the description, and in order to enable the above and other purposes, characteristics and advantages of the present application to be more apparent and easy to understand, the following detailed description of the specific embodiments of the present application is given. BRIEF DESCRIPTION OF DRAWINGS
[0032] Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The accompanying drawings are included to provide a description of the preferred embodiments and are not meant to limit the present application. Moreover, the same reference numerals in the attached drawings indicate the same or similar components. In the drawings: Figure 1 is a schematic flowchart of a task scheduling method provided by an embodiment of the present application Figure 1 ; Figure 2 is a schematic flowchart of a task scheduling method provided by an embodiment of the present application Figure 2 ; Figure 3 is a schematic structural diagram of a task scheduling device provided by an embodiment of the present application Figure 4FIG. 1 is a structural schematic diagram of a vehicle provided by an embodiment of the present application. DETAILED DESCRIPTION
[0033] Exemplary embodiments of the present application will be described in greater detail below with reference to the accompanying drawings. Although exemplary embodiments of the present application are shown in the drawings, it is understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present application can be more thoroughly understood, and the scope of the present application can be accurately conveyed to those skilled in the art.
[0034] With the development of the Internet, more and more business tasks are executed online. In the execution of a large-scale business task, the business tasks are sorted according to the acquisition time of the business tasks, and the business tasks are executed according to the sorting result. In the execution of the business tasks, the next business task is executed after the execution of a business task, or the next subtask is executed after the execution of a subtask. In this case, if the acquisition time of a business task with a low priority is earlier than that of a business task with a high priority, the business task with the low priority will be executed first, and the business task with the high priority will be executed after the execution of the business task with the low priority. In this case, the execution effect of the business tasks is affected, and the user's experience of participating in the business tasks is also affected. For example, in the execution of a business task of an automatic labeling service of intelligent driving data of a vehicle, the intelligent driving data is divided into multiple subtasks to avoid affecting the processing efficiency when all the intelligent driving data is processed together, because there is a large amount of intelligent driving data that needs to be labeled. After the execution of a previous business task, the business task is executed according to the order of the subtasks of the business task. In this case, if the priority of the previous business task is lower than that of the business task of the automatic labeling service of the intelligent driving data of the vehicle, the resources are occupied after the execution of the previous business task, and the business task of the automatic labeling service of the intelligent driving data of the vehicle cannot be acquired, and the subtask execution of the business task of the automatic labeling service of the intelligent driving data of the vehicle cannot be performed, resulting in that the business task with the high priority cannot be executed in time, that is, the scheduling of the execution process of the business task is not flexible enough.
[0035] To solve the above problems, the task scheduling method provided by the present embodiment is configured to implement flexible scheduling of the business tasks by configuring a first thread, a second thread and a third thread for asynchronous execution. The first thread is configured to update and manage the subtask set, the second thread is configured to perform scheduling processing on the to-be-scheduled subtasks in the subtask set, and the third thread is configured to perform state detection on the to-be-detected subtasks. In this way, different threads are used to asynchronously implement different processing in the task execution process, so that each processing stage is independent, and the flexibility of the business task scheduling is improved. In the specific implementation process, the first thread updates the subtasks associated with the business task to the subtask set, obtains the subtasks to be executed in the business task execution process, and prepares for subtask scheduling. The second thread determines the to-be-scheduled subtasks according to the subtask priorities and the subtask states of the subtasks in the subtask set, performs scheduling processing on the to-be-scheduled subtasks, and updates the subtask states of the to-be-scheduled subtasks in the subtask set to the second state. The to-be-scheduled subtasks are determined in combination with the subtask priorities, high-priority subtasks are scheduled first, and the execution timeliness of the high-priority subtasks is improved. The third thread obtains the target state of the to-be-detected subtasks in the second state, and sends the third state to the business server in the case where the target state is the third state, so as to update the task state of the business task to the third state in the case where the subtask states of the subtasks associated with the business task are the third state. In this way, the subtask management, the subtask scheduling, and the state detection are independently executed, the execution of the three stages of the business task does not need to depend on each other, and flexible scheduling of the business task execution process is implemented.
[0036] As shown in Figure 1 Figure 1 is a schematic flowchart of a task scheduling method provided by an embodiment of the present application. The method comprises the following steps. Step 101: After a first condition is met, a first thread acquires subtasks associated with a business task, and updates the subtasks to a subtask set.
[0037] In this embodiment, the first thread, the second thread, and the third thread that are asynchronously executed are deployed to perform the subtask set management, the subtask scheduling, and the state detection of the subtasks in the business task execution process, respectively. The business task in this embodiment can be a task corresponding to a business that needs to be executed in different scenarios, for example, an automatic labeling business of intelligent driving data or a model training business.
[0038] In actual application, a business task is often executed by executing a subtask (JOB) generated according to the business task in the execution process. In this embodiment, the first thread acquires the subtasks associated with the business task, and updates the subtasks to the subtask set, so as to maintain the subtasks of the business task to be executed by the subtask set, so that the second thread performs scheduling processing on the to-be-scheduled subtasks based on the subtask set, and the third thread performs state detection on the to-be-detected subtasks based on the subtask set. The subtasks in this embodiment include the smallest schedulable computing unit after the business task is decomposed.
[0039] In order to implement subsequent scheduling processing and state detection based on the subtask set, the subtask set can store subtask information, wherein the subtask information can include subtask identification representing the uniqueness of the subtask and resource information representing the resources required in the execution process of the subtask; for example, the subtask information includes subtask ID (Identity Document), resource type, and resource requirement; wherein the resource type can be GPU (Graphics Processing Unit) type or CPU (Central Processing Unit) type, and the resource requirement includes information such as memory required in the execution process of the subtask. In addition, in order to represent the task to which the subtask belongs, the subtask information can also include task information of the task to which the subtask belongs, such as task ID.
[0040] In order to improve the effectiveness of managing the subtasks of the business task, and to improve the effectiveness of subsequent subtask scheduling, in the embodiment, the subtask set can also store the subtask priority of each subtask, wherein the subtask priority can be determined according to the task priority of the business task to which the subtask belongs, for example, the priority of the subtask is consistent with the priority of the business task to which the subtask belongs. In addition, in order to further improve the effectiveness of subsequent subtask scheduling and state detection, avoid scheduling subtasks in the scheduling process, and avoid detecting subtasks in the state detection process, the subtask set can also store the subtask state of the subtask, wherein the subtask state is used to represent the scheduling state of the subtask, such as the to-be-scheduled state, the scheduling state, the scheduling completion state, and the scheduling failure state. The first state in the embodiment can be the to-be-scheduled state, the second state can be the scheduling state, the third state can be the scheduling completion state, and the fourth state can be the scheduling failure state.
[0041] It should be noted that in the embodiment, after the subtask is updated to the subtask set, the initial subtask state of the subtask in the subtask set is the first state. That is, optionally, the subtask set stores the subtask priority and the subtask state of the subtask, and the subtask state of the subtask updated to the subtask set in the subtask set is the first state.
[0042] In specific implementation, the first thread can obtain the subtask associated with the business task after meeting the first condition, and update the subtask to the subtask set. The first condition can be the expiration of the timing task of the first thread. That is, the first thread can obtain the subtask associated with the business task after detecting the expiration of the first timing task, for example, the first timing task is 5 minutes, and the first thread obtains the subtask associated with the business task every 5 minutes, and updates the subtask to the subtask set.
[0043] It should be noted that the first thread in the embodiment can be replaced by a first timing task, and correspondingly, the first thread meeting the first condition can be replaced by the expiration of the first timing task. Similarly, the second thread can be replaced by a second timing task, the second thread meeting the second condition can be replaced by the expiration of the second timing task, the third thread can be replaced by a third timing task, and the third thread meeting the third condition can be replaced by the expiration of the third timing task. The embodiment does not limit this.
[0044] In a specific implementation, the embodiment can be applied to a resource scheduling server or a resource scheduling platform. The resource scheduling server can be based on a service orchestration engine configured by DSL (Digital Subscriber Line), a resource scheduling interface and a plug-in design of a subtask execution platform or a subtask execution server. In the service process orchestration engine, DSL can be used to configure service orchestration rules to define and describe the execution process of a service task. The resource scheduling platform can provide a configuration interface through which a user can configure node resources and bring nodes online and cooperate with the DSL service orchestration engine to improve the online of the node service process. For example, after the user configures node resources and brings nodes online through the configuration interface, the user selects nodes to constitute the execution process of a service task. In this way, the user can configure different nodes associated with different service tasks, and the resource scheduling platform also stores the node resource requirements of each node. In the process of executing a service task, the node configuration of the service task does not need to be performed again, and the nodes associated with the service task can be obtained according to the task identifier of the service task. It should be noted that one node can represent one subtask, and the subtasks associated with the service task can be obtained when the nodes associated with the service task are obtained.
[0045] In a specific implementation, after the service server obtains the task creation request, the service server can first create a service task and record service task information and a task state. Alternatively, after the service server obtains a service task, the service server records service task information and a task state. The service task information can include a subtask identifier associated with the service task, and the task state can include the subtask states of each subtask associated with the service task.
[0046] Specifically, after the business server obtains the task creation request, the business server can send a task query request to the resource scheduling server according to the task identifier carried in the task creation request, the resource scheduling server queries the execution flow associated with the task identifier according to the task query request and sends the execution flow to the business server, the business server generates a subtask according to a node included in the execution flow, and records the subtask identifier and the subtask state. Similarly, after the business server obtains the business task, the business server first queries the business flow from the resource scheduling server according to the task identifier, and generates a subtask according to the business flow, and records the subtask identifier and the subtask state.
[0047] It should be noted that the above-mentioned related content that the business server creates a business task after obtaining a task creation request, records business task information and task state, and records business task information and task state after obtaining a business task, can be performed by the resource scheduling server. For example, after the resource scheduling server obtains the task creation request, the resource scheduling server first stores the task information in the business task set, obtains the execution flow corresponding to the business task according to the task identifier, binds the task identifier with the execution flow, sends the node trigger message automatically after the binding, and the first thread can consume the node trigger message after obtaining the node trigger message, and generate at least one subtask associated with the business task according to the node information and resource requirement in the node trigger message. Optionally, the priority of the business task can be stored in the business task set.
[0048] In this embodiment, after obtaining the node trigger message, it can be first judged whether the node needs to be scheduled. If yes, the first thread can consume the node trigger message, and if no, no processing is needed. In this way, by judging whether the node needs to be scheduled before consuming the node trigger message, invalid scheduling of the node is avoided.
[0049] That is, after the resource scheduling server obtains the task creation request sent by the business platform, the resource scheduling server can first store the task identifier and the task priority in the business task set, then obtain the corresponding execution flow according to the task identifier, bind the execution flow with the task identifier, and send the node trigger message automatically after the binding. After obtaining the node trigger message, it can be detected whether the node corresponding to the node trigger message needs to be scheduled. If yes, the node is stored in the node record table. For example, as shown in Figure 2 After obtaining the task creation request, the task priority and the task state are first stored, and the node trigger message is sent after the task identifier is bound with the corresponding execution flow. After receiving the node trigger message, it is judged whether the node corresponding to the node trigger message needs to be scheduled. If yes, the node trigger message is stored, and if no, no processing is needed.
[0050] It should be noted that the node triggering message in this embodiment can be a node triggering message for one node, or a node triggering message for multiple nodes associated with a service task, which is not limited in this embodiment. The node triggering message can be sent through a message queue (kafka), which is also not limited in this embodiment.
[0051] In addition, the service server can also send the node triggering message. After the resource scheduling server receives the node triggering message, it determines whether the node corresponding to the node triggering message needs to be scheduled. If yes, the node triggering message is stored. If no, no processing is performed. The specific execution process is similar to the above, which is not repeated here.
[0052] In specific implementation, after the first condition is met, the first thread can obtain the stored node triggering message. Since the node and the subtask can be one-to-one corresponding, the stored node triggering message is obtained, that is, the subtask of the service task is obtained. In this embodiment, the number of obtained subtasks can be the first number.
[0053] For example, as shown in Figure 2 The first thread calls the Fetch interface (data acquisition interface) to read 10 subtasks from the stored node triggering message every 5 seconds, and updates the 10 subtasks to the subtask set. The subtask state of the 10 subtasks in the subtask set is the pending state. In addition, the subtask priority of each subtask in the subtask set is also stored.
[0054] In order to improve the timely perception of the service server or the resource scheduling server, after the subtask is updated to the subtask set, the first state of the subtask can be sent through the kafka message. For example, the subtask state of the subtask updated to the subtask set is the pending state. After the service server or the resource scheduling server obtains the pending state, the recorded task state will be updated according to the pending state. The subtask state of the service task 1-subtask 1 stored in the service task 1 is updated from the empty state to the pending state.
[0055] It should be noted that the subtask identifier and / or the task identifier also need to be sent in the process of sending the subtask state or the task state.
[0056] In step 102, after the second condition is met, the second thread obtains the pending subtask according to the subtask priority and the subtask state of each subtask in the subtask set, schedules the pending subtask, and updates the subtask state of the pending subtask in the subtask set to the second state.
[0057] In implementation, in the process of scheduling the sub-tasks, the second thread acquires the to-be-scheduled sub-tasks according to the sub-task priorities and the sub-task states of the sub-tasks in the sub-task set, schedules the to-be-scheduled sub-tasks, and updates the sub-task states of the to-be-scheduled sub-tasks in the sub-task set to the second state. The second thread can configure a second timing task. After detecting that the second timing task expires, the second thread acquires the to-be-scheduled sub-tasks according to the sub-task priorities and the sub-task states of the sub-tasks in the sub-task set, schedules the to-be-scheduled sub-tasks, and updates the sub-task states of the to-be-scheduled sub-tasks in the sub-task set to the second state.
[0058] The process of acquiring the to-be-scheduled sub-tasks according to the sub-task priorities and the sub-task states of the sub-tasks in the sub-task set, scheduling the to-be-scheduled sub-tasks, and updating the sub-task states of the to-be-scheduled sub-tasks in the sub-task set to the second state is described below.
[0059] (1) Acquiring the to-be-scheduled sub-tasks according to the sub-task priorities and the sub-task states of the sub-tasks in the sub-task set.
[0060] In implementation, in order to avoid too many to-be-scheduled sub-tasks being acquired and thus unable to be scheduled, in the process of acquiring the to-be-scheduled sub-tasks, the to-be-scheduled sub-tasks can be acquired according to the sub-task priorities and the sub-task states of the sub-tasks in the sub-task set. In an optional implementation provided by the embodiment, in the process of acquiring the to-be-scheduled sub-tasks according to the sub-task priorities and the sub-task states of the sub-tasks in the sub-task set, the number of sub-tasks in the sub-task set whose sub-task states are the second state can be acquired first. If the number of sub-tasks is less than a preset number threshold, the number of to-be-scheduled sub-tasks is calculated according to the number of sub-tasks and the preset number threshold, and the to-be-scheduled sub-tasks are selected from the candidate sub-tasks according to the number of to-be-scheduled sub-tasks and the sub-task priorities of the candidate sub-tasks whose sub-task states are the first state in the sub-task set. In addition, if the number of sub-tasks is greater than or equal to the preset number threshold, no processing is performed.
[0061] That is, in the process of acquiring the to-be-scheduled sub-tasks according to the sub-task priorities and the sub-task states of the sub-tasks in the sub-task set, the number of schedulable sub-tasks can be calculated according to the preset number threshold and the number of sub-tasks in the scheduling state, and the number of schedulable sub-tasks is determined according to the sub-task priorities of the sub-tasks in the sub-task set whose sub-task states are the to-be-scheduled state.
[0062] For example, as shown in FIG. 2, the number of schedulable sub-tasks is calculated according to the preset number threshold and the number of sub-tasks in the scheduling state, and the number of schedulable sub-tasks is determined according to the sub-task priorities of the sub-tasks in the sub-task set whose sub-task states are the to-be-scheduled state. Figure 2As shown, the second thread is executed every 5 seconds: obtain the number m of subtasks in the scheduling state in the subtask set, detect whether m is greater than or equal to a preset number threshold M, if not, do not process, if m is less than M, calculate M-m as the number of to-be-scheduled subtasks, and call the argo (an open source project in the cloud native field) interface to obtain M-m to-be-scheduled subtasks with the highest priority from the subtask set; in order to ensure the effectiveness of the subtask state in the subtask set, the subtask state of the to-be-scheduled subtask in the subtask set is updated to the second state, that is, the scheduling state.
[0063] After updating the subtask state of the to-be-scheduled subtask in the subtask set to the second state, the second state can be sent through the kafka message, and the specific process is similar to the sending and receiving of the first state described above. For details, refer to the related content described above, which will not be described here in detail.
[0064] In the specific execution process, in order to improve the effectiveness of the determined to-be-scheduled subtask, in an optional implementation provided by the embodiment, in the process of selecting the to-be-scheduled subtask from the candidate subtasks according to the number of to-be-scheduled subtasks and the subtask priority of each candidate subtask with the first state in the subtask set, first, sort the multiple candidate subtasks according to the subtask priority of each candidate subtask to obtain a candidate subtask sequence, and then determine the candidate subtasks before the position corresponding to the number of to-be-scheduled subtasks in the candidate subtask sequence as the to-be-scheduled subtasks.
[0065] For example, the number m of subtasks in the scheduling state is 15, the preset number threshold M is 20, M-m is calculated as 5, the candidate subtasks in the subtask set with the scheduling state are arranged in descending order of priority to obtain a candidate subtask sequence, and the first 5 candidate subtasks in the candidate subtask sequence are determined as the to-be-scheduled subtasks.
[0066] The subtask execution platform in the embodiment can be K8S (Kubernetes, a container orchestration platform). It should be noted that in the process of calling the subtask execution platform to schedule the to-be-scheduled subtask to the computing cluster, the resource scheduling interface of the K8S platform is called to generate a POD (container group object) in the corresponding computing cluster. Alternatively, the subtask information of the to-be-scheduled subtask can also include a POD, and the POD can be directly scheduled to the corresponding computing cluster.
[0067] (2) Perform scheduling processing on the to-be-scheduled subtask.
[0068] In specific implementation, the scheduling processing on the to-be-scheduled subtask refers to sending the to-be-scheduled subtask to the subtask execution platform to schedule the to-be-scheduled subtask to the computing cluster for subtask execution.
[0069] In a specific implementation process, in order to further improve the scheduling efficiency and effectiveness of the scheduling, the embodiment can configure a priority queue for each subtask priority, and allocate computing resources to each priority queue, so that the priority queue performs subtask scheduling processing on the corresponding to-be-scheduled subtask. The priority queue in the embodiment includes a VolcanoJob (core task unit in the Volcano batch computing framework) priority queue. In the embodiment, the VolcanoJob priority queue is used as a basic unit to carry the to-be-scheduled subtask, and is used to implement batch scheduling and management of the subtask.
[0070] In an optional implementation provided by the embodiment, in the process of scheduling processing of the to-be-scheduled subtask, first, the corresponding priority queue is determined according to the subtask priority of the to-be-scheduled subtask; and then the subtask information of the to-be-scheduled subtask is stored in the priority queue, so that the to-be-scheduled subtask is subjected to subtask scheduling processing when the available computing resources of the priority queue meet the resource requirements of the to-be-scheduled subtask. The available computing resources meeting the resource requirements of the to-be-scheduled subtask can be that the available computing resources are greater than the resource requirements of the to-be-scheduled subtask, for example, the available GPU is greater than the GPU requirements of the to-be-scheduled subtask, and the available memory is greater than the memory requirements of the to-be-scheduled subtask.
[0071] In order to ensure that the to-be-scheduled subtask with high priority can be normally scheduled, and to avoid that the low-priority subtask occupies resources to cause the to-be-scheduled subtask with high priority to be in a waiting state, in the embodiment, the number of computing resources of the priority queue can be proportional to the corresponding subtask priority, so that the priority queue with high priority has sufficient computing resources to perform subtask scheduling processing on the to-be-scheduled subtask with high priority. Optionally, the available computing resources are obtained after the subtask state in the priority queue is updated to the third state. That is, the computing resources in the priority queue are released after the corresponding to-be-scheduled subtask is scheduled.
[0072] In the specific implementation process of the subtask scheduling processing of the to-be-scheduled subtask, the computing cluster type of the computing cluster associated with the priority queue can be acquired first. If the resource type of the to-be-scheduled subtask matches the computing cluster type, the subtask execution platform is called to schedule the to-be-scheduled subtask to the computing cluster. In addition, if the resource type of the to-be-scheduled subtask does not match the computing cluster type, the to-be-scheduled subtask can be stored in the priority queue with the matching resource type, so as to schedule the to-be-scheduled subtask to the computing cluster with the matching resource type, avoid performance loss caused by the mismatch of the resource type, improve the stability of the subtask execution, and avoid execution exceptions caused by the mismatch of the resource type.
[0073] For example, if the resource type of the to-be-scheduled subtask is a GPU type, the to-be-scheduled subtask is preferentially scheduled to a GPU computing cluster. For another example, if the resource type of the to-be-scheduled subtask is a CPU type, the to-be-scheduled subtask is preferentially scheduled to a CPU computing cluster.
[0074] In addition, the computing cluster association can also not be performed on the priority queue. In the process of performing the subtask scheduling processing on the to-be-scheduled subtask, the to-be-scheduled subtask can be scheduled to a computing cluster of a corresponding type according to the resource type of the to-be-scheduled subtask.
[0075] In step 103, the third thread acquires a target state of a to-be-detected subtask in the subtask set whose subtask state is the second state, and sends the third state to the business server in a case where the target state is the third state, so as to update the task state of the business task to the third state in a case where the subtask state of each subtask associated with the business task is the third state.
[0076] In a specific implementation, in the process of state detection, the third thread acquires a target state of a to-be-detected subtask in the subtask set whose subtask state is the second state, and sends the third state to the business server in a case where the target state is the third state, so as to update the task state of the business task to the third state in a case where the subtask state of each subtask associated with the business task is the third state.
[0077] In the embodiment, the target state of the to-be-detected subtask includes a state of the to-be-detected subtask obtained by querying the subtask execution platform. In the process of acquiring the target state of the to-be-detected subtask in the subtask set whose subtask state is the second state, the subtask identifier of the to-be-detected subtask in the subtask set whose subtask state is the second state can be acquired first, and then the target state corresponding to the subtask identifier is queried from the subtask execution platform according to the subtask identifier.
[0078] In a specific execution process, the third thread can be configured with a third timing task and / or a third number, where the third number includes the number of to-be-detected subtasks in the subtask set whose subtask state is the second state. In a specific execution process, the third thread can acquire the third number of to-be-detected subtasks in the subtask set whose subtask state is the second state after detecting that the third timing task is up, and query the target state of the to-be-detected subtask from the subtask execution platform according to the subtask identifier of the to-be-detected subtask.
[0079] For example, as shown in FIG. 8, the third thread acquires the subtask identifier of the to-be-detected subtask in the subtask set whose subtask state is the second state every 5 seconds, and queries the target state of the to-be-detected subtask from the K8S platform by calling the argo interface according to the subtask identifier. Figure 2
[0080] On the basis of querying the target state of the to-be-detected subtask, it is detected whether the target state triggers the state update condition. If yes, the target state is sent. If no, no processing is performed. For example, as shown in FIG. 8, it is detected whether the target state triggers the state update condition. If yes, the target state is sent. If no, no processing is performed. Figure 2
[0081] In the embodiment, the state update condition includes that the target state is the third state or the fourth state. In the specific execution process, if the target state is the third state or the fourth state, it is determined that the state update condition is triggered. If the target state is the second state, it is determined that the state condition is not triggered.
[0082] The following describes the state update with the target state being the third state as an example.
[0083] In the specific implementation, after the third thread obtains the target state of the to-be-detected subtask, in the case where the target state is the third state, the third state is sent to the business server. The business server can update the task state of the business task to the third state in the case where the subtask state of each subtask associated with the business task is the third state.
[0084] For example, after the business server receives the scheduling completion state of subtask 1 of business task 1, the stored subtask state of subtask 1 of business task 1 is updated from the scheduling state to the scheduling completion state. After it is detected that the subtask states of subtask 1, subtask 2, and subtask 3 associated with business task 1 are all the scheduling completion state, the task state of business task 1 is updated to the scheduling completion state.
[0085] In the case where the node trigger message corresponds to one node, after the business server performs the subtask state update, the node trigger message of the next node can also be sent.
[0086] In the process of sending the third state, the third thread can send the third state through the kafka message. The first thread, the second thread, and the resource scheduling server can also obtain the third state. After the first thread obtains the third state, the first thread can update the subtask state of the to-be-detected subtask in the subtask set to the third state. For the subtasks in the subtask set whose subtask state is the third state, the subtasks can be deleted from the subtask set. After the second thread obtains the third state, the second thread can also update the subtask state of the to-be-detected subtask in the subtask set to the third state. After the resource scheduling server obtains the third state, the resource scheduling server can perform the process performed by the business server. For example, as shown in FIG. 10, after the resource scheduling server receives the first state, the second state, and / or the third state, the stored state can be modified. Figure 2
[0087] During the state update process where the target state is the fourth state, after the third thread obtains the target state of the subtask to be detected, it sends the fourth state to the business server if the target state is the fourth state. The business server can update the task state of the business task to the fourth state if the subtask state of any associated subtask is the fourth state. Other content is similar to the relevant content of the third state described above, and can be referred to the relevant content of the third state described above. This embodiment will not repeat it here.
[0088] It should be noted that in this embodiment, the first thread, the second thread, and / or the third thread will all send status messages. To avoid confusion in status modification, the first thread, the second thread, and / or the third thread can be isolated using the same distributed lock. In this embodiment, both status messages and node trigger messages can be sent based on Kafka messages.
[0089] In summary, the task scheduling method provided in this application deploys the first thread, the second thread, and the third thread for asynchronous execution. After the first condition is met, the first thread updates the subtasks associated with the business task to the subtask set. The subtask status of the updated subtasks in the subtask set is set to the first state. In this way, the first thread updates the subtask set, improving its effectiveness. After the second condition is met, the second thread obtains the subtasks to be scheduled in the subtask set based on their priority and status. This allows for prioritizing the scheduling of higher-priority subtasks, improving the execution efficiency of higher-priority business tasks. Furthermore, the thread processes the scheduling of the subtasks to be scheduled and updates their status to the second state, thus achieving timely updates to the subtask status in the subtask set. After the third condition is met, the third thread queries the target status of the subtasks to be checked in the second state. If the target status is the third state, the thread sends the third status to the business server, updating the business task's status to the third state if the subtask status of all associated subtasks is in the third state. In this way, subtask management, subtask scheduling, and status detection are implemented asynchronously, enabling flexible scheduling of business task execution.
[0090] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method.
[0091] like Figure 3 As shown, Figure 3 A schematic structural diagram of a task scheduling device provided for embodiments of this application, the device comprising: The first module 301 is configured to acquire a subtask associated with a service task through a first thread after a first condition is met, and update the subtask to a subtask set; the subtask set stores a subtask priority and a subtask state of the subtask; the subtask state of the subtask in the subtask set is a first state. The second module 302 is configured to acquire a to-be-scheduled subtask according to the subtask priority and the subtask state of each subtask in the subtask set through a second thread after a second condition is met, perform scheduling processing on the to-be-scheduled subtask, and update the subtask state of the to-be-scheduled subtask in the subtask set to a second state. The third module 303 is configured to acquire a target state of a to-be-detected subtask whose subtask state in the subtask set is the second state through a third thread after a third condition is met, and send the third state to a service server in a case where the target state is a third state, so as to update a task state of the service task to the third state in a case where the subtask state of each subtask associated with the service task is the third state; the first thread, the second thread, and the third thread are executed asynchronously.
[0092] In one specific embodiment, the second module 302 is configured to acquire a number of subtasks whose subtask state in the subtask set is the second state when acquiring the to-be-scheduled subtask according to the subtask priority and the subtask state of each subtask in the subtask set, calculate a number of to-be-scheduled subtasks according to the number of subtasks and a preset number threshold in a case where the number of subtasks is less than the preset number threshold, and select the to-be-scheduled subtasks from candidate subtasks according to the number of to-be-scheduled subtasks and the subtask priority of each candidate subtask whose subtask state in the subtask set is the first state.
[0093] In one specific embodiment, the second module 302 is configured to sort a plurality of candidate subtasks according to the subtask priority of each candidate subtask to obtain a candidate subtask sequence when selecting the to-be-scheduled subtasks from the candidate subtasks according to the number of to-be-scheduled subtasks and the subtask priority of each candidate subtask whose subtask state in the subtask set is the first state, and determine the candidate subtasks before a bit corresponding to the number of to-be-scheduled subtasks in the candidate subtask sequence as the to-be-scheduled subtasks.
[0094] In one specific embodiment, the second module 302 is configured to determine a corresponding priority queue according to the subtask priority of the to-be-scheduled subtask when performing the scheduling processing on the to-be-scheduled subtask, and store the subtask information of the to-be-scheduled subtask to the priority queue, so as to perform subtask scheduling processing on the to-be-scheduled subtask in a case where the available computing resource of the priority queue meets the resource demand of the to-be-scheduled subtask.
[0095] In one specific embodiment, the number of computing resources of the priority queue is proportional to the priority of the corresponding subtask; the priority queue obtains the available computing resources after the state of the subtask is updated to the third state.
[0096] In one specific embodiment, the second module 302 is specifically configured to, when performing the subtask scheduling process on the to-be-scheduled subtask, acquire the computing cluster type of the computing cluster associated with the priority queue; and if the resource type of the to-be-scheduled subtask matches the computing cluster type, invoke the subtask execution platform to schedule the to-be-scheduled subtask to the computing cluster.
[0097] In one specific embodiment, the third module 303 is specifically configured to, when acquiring the target state of the to-be-detected subtask whose state in the subtask set is the second state, acquire the subtask identifier of the to-be-detected subtask whose state in the subtask set is the second state; and according to the subtask identifier, invoke the subtask execution platform to query the corresponding target state.
[0098] In one specific embodiment, the second thread and the third thread are isolated by the same distributed lock.
[0099] As to the apparatus in the above-described embodiments, the specific manners in which various units perform operations have been described in detail in the embodiments of the method, and thus will not be described in detail here.
[0100] Figure 4 is a structural schematic diagram of a vehicle provided by an embodiment of the present application.
[0101] For example, as shown in Figure 4 The vehicle includes a memory 401 and a processor 402, where the memory 401 stores executable program code 4011, and the processor 402 is configured to invoke and execute the executable program code 4011 to perform the task scheduling method.
[0102] The embodiment can divide the functional modules of the vehicle according to the above-described method examples. For example, each functional module can be provided, or two or more functions can be integrated into one processing module. The integrated module can be implemented in the form of hardware. It should be noted that the division of the modules in the embodiment is illustrative, and is only a logical functional division. In actual implementation, another division manner can be used. When each functional module is divided according to each function, the vehicle can include a first module, a second module, a third module, and the like. It should be noted that all related contents of each step involved in the above method embodiments can be referred to the function description of the corresponding functional module, and will not be described here.
[0103] The vehicle provided by the embodiment is used to perform the above-described task scheduling method, and thus can achieve the same effect as the above-described implementation method.
[0104] In the case of employing the integrated unit, the vehicle can include a processing module, a storage module. The processing module can be used to control and manage the actions of the vehicle. The storage module can be used to support the vehicle to execute relevant program codes and data, etc.
[0105] The processing module can be a processor or a controller, which can realize or execute various exemplary logical blocks, modules and circuits described in combination with the disclosure. The processor can also be a combination of computing functions, such as including one or more microprocessor combinations, digital signal processing (digital signal processing, DSP) and microprocessor combinations, etc. The storage module can be a memory.
[0106] Embodiments of the present application also provide an electronic device, comprising a memory and a processor, the memory stores a computer program, and the processor is configured to run the computer program to perform the steps in any of the above task scheduling method embodiments.
[0107] Embodiments of the present application also provide a computer readable storage medium, which stores a computer program, wherein the computer program is configured to perform the steps in any of the above task scheduling method embodiments when running.
[0108] In an exemplary embodiment, the above computer readable storage medium can include but not limited to: U disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), mobile hard disk, magnetic or optical disk and other various computer program storage media.
[0109] Embodiments of the present application also provide a computer program product, which comprises a computer program, and the computer program is executed by a processor to realize the steps in any of the above task scheduling method embodiments.
[0110] Embodiments of the present application also provide another computer program product, which comprises a non-volatile computer readable storage medium, and the non-volatile computer readable storage medium stores a computer program, and the computer program is executed by a processor to realize the steps in any of the above task scheduling method embodiments.
[0111] The beneficial effects of the above embodiments can refer to the beneficial effects of the corresponding methods provided above, which will not be repeated here.
[0112] Through the description of the above embodiments, those skilled in the art can understand that, for the convenience and brevity of description, only the above division of functional modules is taken as an example, and in actual application, the above functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
[0113] In the embodiments provided in the present application, it should be understood that the disclosed device and method can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of modules or units is only a logical function division, and there can be another division manner in actual implementation. For example, a plurality of units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or components shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0114] In the description of the present application, it should be understood that, if the orientation or position relationship indicated by the terms such as "upper", "lower", "front", "back", "left" and "right" is based on the orientation or position relationship shown in the drawings, it is only for the convenience of describing the present application and simplifying the description, and does not indicate or imply that the indicated position or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present application.
[0115] It should be noted that, in this document, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. It should also be noted that the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, product or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, product or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, product or device including the element.
[0116] The above are only embodiments of the present application and are not used to limit the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. within the spirit and principles of the present application shall be included in the scope of claims of the present application.
Claims
1. A task scheduling method, characterized in that, include: After the first condition is met, the first thread obtains the subtasks associated with the business task and updates the subtasks to the subtask set. The subtask set stores the subtask priority and subtask status of the subtasks; The subtask state of the subtask in the subtask set is the first state; After the second condition is met, the second thread obtains the subtasks to be scheduled according to the subtask priority and subtask status of each subtask in the subtask set, performs scheduling processing on the subtasks to be scheduled, and updates the subtask status of the subtasks to be scheduled in the subtask set to the second status. After the third condition is met, the third thread obtains the target state of the subtask to be detected in the subtask set whose subtask state is the second state, and sends the third state to the business server when the target state is the third state, so as to update the task state of the business task to the third state when the subtask state of each subtask associated with the business task is the third state. The first thread, the second thread, and the third thread are executed asynchronously.
2. The method according to claim 1, characterized in that, The step of obtaining the subtasks to be scheduled based on the subtask priority and subtask status of each subtask in the subtask set includes: Obtain the number of subtasks in the subtask set whose subtask status is the second state; If the number of subtasks is less than a preset threshold, the number of subtasks to be scheduled is calculated based on the number of subtasks and the preset threshold. Based on the number of subtasks to be scheduled and the subtask priority of each candidate subtask in the subtask set whose subtask status is the first state, the subtasks to be scheduled are selected from the candidate subtasks.
3. The method according to claim 2, characterized in that, The step of selecting the subtask to be scheduled from the candidate subtasks based on the number of subtasks to be scheduled and the subtask priority of each candidate subtask in the subtask set whose subtask status is the first state includes: According to the subtask priority of each candidate subtask, the multiple candidate subtasks are sorted to obtain a candidate subtask sequence; The candidate subtasks preceding the position corresponding to the number of scheduled subtasks in the candidate subtask sequence are determined as the scheduled subtasks.
4. The method according to claim 1, characterized in that, The scheduling process for the subtask to be scheduled includes: Determine the corresponding priority queue based on the subtask priority of the subtask to be scheduled; The subtask information of the subtask to be scheduled is stored in the priority queue, so that the subtask to be scheduled is scheduled after the available computing resources in the priority queue meet the resource requirements of the subtask to be scheduled.
5. The method according to claim 4, characterized in that, The number of computing resources in the priority queue is proportional to the priority of the corresponding subtask; The priority queue gains available computing resources after the subtask state is updated to the third state.
6. The method according to claim 4, characterized in that, The subtask scheduling process for the subtask to be scheduled includes: Obtain the computing cluster type of the computing cluster associated with the priority queue; If the resource type of the subtask to be scheduled matches the computing cluster type, the subtask execution platform is invoked to schedule the subtask to be scheduled to the computing cluster.
7. The method according to claim 1, characterized in that, The step of obtaining the target state of the subtask to be detected in the subtask set whose subtask state is the second state includes: Obtain the subtask identifier of the subtask to be detected in the subtask set whose subtask status is the second state; Based on the subtask identifier, the subtask execution platform is invoked to query the corresponding target status.
8. The method according to claim 1, characterized in that, The second thread and the third thread are isolated using the same distributed lock.
9. A task scheduling device, characterized in that, include: The first module is used to obtain the subtask associated with the business task through the first thread after the first condition is met, and update the subtask to the subtask set. The subtask set stores the subtask priority and subtask status of the subtasks; The subtask state of the subtask in the subtask set is the first state; The second module is used to, after the second condition is met, obtain the subtasks to be scheduled by the second thread according to the subtask priority and subtask status of each subtask in the subtask set, perform scheduling processing on the subtasks to be scheduled, and update the subtask status of the subtasks to be scheduled in the subtask set to the second status. The third module is used to, after satisfying the third condition, obtain the target state of the subtask to be detected in the subtask set whose subtask state is the second state through the third thread, and send the third state to the business server when the target state is the third state, so as to update the task state of the business task to the third state when the subtask state of each subtask associated with the business task is the third state; wherein, the first thread, the second thread and the third thread are executed asynchronously.
10. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the task scheduling method as described in any one of claims 1 to 8 when executing the computer program.
