Queue scheduling method, electronic device, storage medium and program product
By dynamically allocating resources and prioritizing high-priority queues, the problem of low efficiency in large-scale queue scheduling in existing technologies is solved, enabling efficient execution of critical tasks.
Patent Information
- Application Number
- CN202511056034.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-30
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2045-07-30
AI Technical Summary
In existing technologies, queue scheduling schemes are mostly optimized for single tasks or small-scale tasks, which cannot meet the needs of large-scale queue scheduling scenarios, resulting in low efficiency.
By receiving information about tasks to be scheduled and current tasks, resources are dynamically allocated, and high-priority queues are processed first to ensure that critical tasks can obtain resources and be executed until the tasks are completed.
It improves the efficiency of queue scheduling, meets the real-time and business-critical requirements, and ensures that critical tasks receive resources and are executed first.
Smart Images

Figure CN120560864B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more particularly to a queue scheduling method, electronic device, storage medium, and program product. Background Technology
[0002] With the deep integration of next-generation information technologies such as cloud computing, big data, and the Internet of Things, the demands on the allocation and scheduling of underlying computing resources are increasing, as are the real-time processing of massive amounts of data, the collaborative operation of complex businesses, and the stable support of large-scale services. In related technologies, queue scheduling schemes are mostly optimized for single tasks or small-scale tasks. Their core execution logic is to prioritize tasks based on their submission time or preset rules, such as prioritizing earlier submitted tasks or manually allocating fixed resource quotas to specific tasks.
[0003] In the queue scheduling process described above, the system usually focuses on the resource requirements of a single task and allocates resources through a simple queue mechanism. However, this cannot meet the needs of large-scale queue scheduling scenarios, resulting in low efficiency of queue scheduling. Summary of the Invention
[0004] This application provides a queue scheduling method, electronic device, storage medium, and program product to at least solve the problem of low efficiency in queue scheduling in related technologies.
[0005] This application provides a queue scheduling method, including:
[0006] In response to receiving at least one task to be scheduled, obtain the current task information;
[0007] Based on at least one task to be scheduled and the current task information, determine the first resource quantity corresponding to the first queue and the second resource quantity corresponding to the second queue, with the priority of the first queue being greater than the priority of the second queue;
[0008] Execute tasks in the first queue based on the first resource quantity and tasks in the second queue based on the second resource quantity, and update the first and second resource quantities until the tasks in the first and second queues are completed.
[0009] This application also provides a queue scheduling device, including:
[0010] The acquisition module is used to acquire current task information in response to receiving at least one task to be scheduled;
[0011] The determination module is used to determine the first resource quantity corresponding to the first queue and the second resource quantity corresponding to the second queue based on at least one task to be scheduled and the current task information, wherein the priority of the first queue is greater than the priority of the second queue.
[0012] The execution module is used to execute tasks in the first queue according to the first resource quantity and to execute tasks in the second queue according to the second resource quantity, and to update the first resource quantity and the second resource quantity until the tasks in the first queue and the second queue are completed.
[0013] This application also provides an electronic device, including: a memory for storing a computer program; and a processor for executing the computer program to implement the steps of any of the above-described queue scheduling methods.
[0014] This application also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the steps of any of the above-described queue scheduling methods.
[0015] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of any of the above-described queue scheduling methods.
[0016] This application utilizes at least one pending task and current task information to determine a first resource quantity corresponding to a first queue and a second resource quantity corresponding to a second queue. The first queue has a higher priority than the second queue. Tasks in the first queue are executed based on the first resource quantity, and tasks in the second queue are executed based on the second resource quantity. The first and second resource quantities are then updated until all tasks in both queues are completed. By dynamically allocating resources and prioritizing high-priority queues, this ensures that critical tasks receive resources and are executed first, meeting real-time or business-critical requirements and improving queue scheduling efficiency. Attached Figure Description
[0017] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 This is a schematic diagram of the structure of a queue scheduling system provided in an embodiment of this application;
[0019] Figure 2 A flowchart illustrating a queue scheduling method provided in an embodiment of this application;
[0020] Figure 3 A flowchart illustrating another queue scheduling method provided in an embodiment of this application;
[0021] Figure 4This application provides a schematic diagram of a process for determining resource quantity in an embodiment.
[0022] Figure 5 A schematic diagram illustrating a resource allocation process provided in an embodiment of this application;
[0023] Figure 6 A flowchart illustrating another queue scheduling method provided in this application embodiment;
[0024] Figure 7 A flowchart illustrating a queue-based task execution method is provided as an embodiment of this application.
[0025] Figure 8 This is a schematic diagram of the structure of a queue scheduling device provided in an embodiment of this application;
[0026] Figure 9 A schematic diagram of the structure of the electronic device provided in this application. Detailed Implementation
[0027] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0028] It should be noted that, in the description of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. The terms "first," "second," etc., in this application are used to distinguish similar objects and are not used to describe a specific order or sequence.
[0029] With the deep integration of next-generation information technologies such as cloud computing, big data, and the Internet of Things, the demands on the allocation and scheduling of underlying computing resources are increasing, as are the real-time processing of massive amounts of data, the collaborative operation of complex businesses, and the stable support of large-scale services. In related technologies, queue scheduling schemes are mostly optimized for single tasks or small-scale tasks. Their core execution logic is to prioritize tasks based on their submission time or preset rules, such as prioritizing earlier submitted tasks or manually allocating fixed resource quotas to specific tasks.
[0030] In the queue scheduling process described above, the system usually focuses on the resource requirements of a single task and allocates resources through a simple queue mechanism. However, this cannot meet the needs of large-scale queue scheduling scenarios, resulting in low efficiency of queue scheduling.
[0031] To address the aforementioned technical problems, this application provides a queue scheduling method. Based on at least one task to be scheduled and current task information, a first resource quantity corresponding to a first queue and a second resource quantity corresponding to a second queue are determined. The first queue has a higher priority than the second queue. Tasks in the first queue are executed according to the first resource quantity, and tasks in the second queue are executed according to the second resource quantity. The first and second resource quantities are then updated until all tasks in both queues are completed. By dynamically allocating resources and prioritizing high-priority queues, this method ensures that critical tasks receive resources and are executed first, meeting real-time or business-critical requirements and improving the efficiency of queue scheduling.
[0032] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0033] Below, we will provide examples of specific application environment architectures or specific hardware architectures that the execution of the queue scheduling method depends on.
[0034] Figure 1 This is a schematic diagram of a queue scheduling system provided in an embodiment of this application. Please refer to [link / reference]. Figure 1 , Figure 1 This can include a queue scheduling system. The queue scheduling system can include an artificial intelligence platform, a task distribution layer, a computing resource layer, and a queue scheduler.
[0035] Artificial intelligence platforms can be used to provide interactive interfaces for users to submit training or inference tasks.
[0036] The task delivery layer can be used to receive multiple tasks sent by the artificial intelligence platform and send multiple tasks to the queue scheduler so that the queue scheduler can schedule multiple tasks.
[0037] The queue scheduler can be used to monitor the availability of cluster resources in the computing resource layer in real time. Based on task priority and available resources, it can divide multiple task queues into batches and execute the internal scheduling of the first queue and the internal scheduling of the second queue. The priority of the first queue is higher than that of the second queue.
[0038] The queue scheduler can support preemptive scheduling, round-robin scheduling within the queue, and other strategies.
[0039] The computing resource layer can include multiple distributed computing nodes.
[0040] Multiple distributed computing nodes can execute tasks according to the execution strategy of the queue scheduler until multiple tasks are completed.
[0041] The computing resource layer can monitor multiple distributed computing nodes and provide real-time feedback on available resources.
[0042] Figure 2 This is a flowchart illustrating a queue scheduling method provided in an embodiment of this application. The execution entity in this embodiment can be a processor. The processor can be implemented in software or through a combination of software and hardware. Please refer to... Figure 2 The method includes:
[0043] S201. In response to receiving at least one task to be scheduled, obtain the current task information.
[0044] The tasks to be scheduled can be model training tasks, model inference tasks, business tasks, etc., and there are no restrictions here.
[0045] The tasks to be scheduled can be issued by the artificial intelligence platform. When issuing the tasks, the artificial intelligence platform can label them, that is, define the priority of the tasks to be scheduled.
[0046] For multiple tasks to be scheduled, each task can be allocated different resources, or multiple tasks can be allocated the same resources; there is no limitation here.
[0047] The current task information can be the task information corresponding to the first queue and the second queue respectively.
[0048] The current task information of the first queue may include information on unexecuted tasks in the first queue, the initial resource amount of the first queue, the resource utilization rate of the first queue, etc.
[0049] The current task information of the second queue may include information on unexecuted tasks in the second queue, the initial resource amount of the second queue, the resource utilization rate of the second queue, etc.
[0050] It can receive at least one task to be scheduled, and in response to the received task, obtain the current task information through the scheduler.
[0051] S202. Based on at least one task to be scheduled and the current task information, determine the first resource quantity corresponding to the first queue and the second resource quantity corresponding to the second queue.
[0052] The first queue has a higher priority than the second queue.
[0053] The first resource quantity can be used to represent the amount of resources that can be used when executing tasks in the first queue.
[0054] The second resource quantity can be used to represent the amount of resources that can be used when executing tasks in the second queue.
[0055] Optionally, at least one task to be scheduled is classified to obtain a classification result, and the first queue and the second queue are updated according to the classification result and the current task information. The first resource quantity and the second resource quantity are determined according to the updated first queue and the updated second queue.
[0056] Optionally, obtain current resource information; classify at least one task to be scheduled based on the current resource information using a preset multi-dimensional weight model, determine a first task to be scheduled and a second task to be scheduled, wherein the priority of the first task to be scheduled is greater than the priority of the second task to be scheduled; update the first queue based on the first task to be scheduled; update the second queue based on the second task to be scheduled; determine the first resource quantity and the second resource quantity based on the current task information, the updated first queue, and the updated second queue.
[0057] In this way, by using dependency-aware synchronous output control and resource reservation strategies, the data dependency problem between multi-queue tasks can be solved, and the parameter synchronization delay caused by resource contention in distributed training can be reduced.
[0058] It should be noted that the first resource quantity corresponding to the first queue and the second resource quantity corresponding to the second queue can be determined according to any feasible implementation method, and the embodiments of this application do not limit this.
[0059] S203. Execute tasks in the first queue according to the first resource quantity and execute tasks in the second queue according to the second resource quantity, and update the first resource quantity and the second resource quantity until the tasks in the first queue and the second queue are completed.
[0060] The tasks in the first queue are high-priority tasks.
[0061] The tasks in the second queue are low-priority tasks.
[0062] The first queue can be empty, and the second queue can also be empty.
[0063] Optionally, a first task group to be executed can be determined in the first queue based on the first resource quantity, and the tasks in the first task group to be executed can be executed. A second task group to be executed can be determined in the second queue based on the second resource quantity, and the tasks in the second task group to be executed can be executed. The first and second resource quantities are updated until the tasks in the first and second queues are executed.
[0064] Optionally, based on the first resource quantity, a task execution operation is performed on the first queue, and based on the second resource quantity, a task execution operation is performed on the second queue, and the first and second queues are updated; it is determined whether there are tasks in the updated first and second queues; if so, the first and second resource quantities are updated, a task execution operation is performed on the first queue based on the updated first resource quantity, and a task execution operation is performed on the second queue based on the updated second resource quantity, until the tasks in the first and second queues are completed; if not, it is determined that the tasks in the first and second queues have been completed.
[0065] The process of updating the first and second resource quantities is similar to the process of determining the first and second resource quantities in S202, and will not be described in detail here.
[0066] Optionally, the method further includes:
[0067] Obtain the historical resource utilization rates of the first and second queues within a preset historical time period;
[0068] Determine if there is any historical resource utilization rate greater than the fourth threshold.
[0069] If not, an alarm message is generated and sent to the terminal. The alarm message is used to notify the terminal that the queue resources cannot be fully loaded.
[0070] In this way, when the tasks in the queue cannot be fully loaded due to resource quota limitations, an alarm is issued to prompt the administrator to adjust the resource allocation ratio.
[0071] It should be noted that tasks in the first and second queues can be executed and the first and second resource quantities updated according to any feasible implementation method. This application embodiment does not limit this.
[0072] This embodiment provides a queue scheduling method that, in response to receiving at least one task to be scheduled, obtains current task information; based on the at least one task to be scheduled and the current task information, determines a first resource quantity corresponding to a first queue and a second resource quantity corresponding to a second queue, wherein the priority of the first queue is higher than the priority of the second queue; executes tasks in the first queue according to the first resource quantity and tasks in the second queue according to the second resource quantity, and updates the first and second resource quantities until the tasks in the first and second queues are completed. In this way, by dynamically allocating resource quantities and prioritizing high-priority queues, it ensures that critical tasks can obtain resources and be executed first, meeting real-time or business-critical requirements and improving the efficiency of queue scheduling.
[0073] Below, in conjunction with Figure 3The process of determining the first resource quantity corresponding to the first queue and the second resource quantity corresponding to the second queue based on at least one task to be scheduled and current task information is explained.
[0074] Figure 3 This is a flowchart illustrating another queue scheduling method provided in an embodiment of this application. Based on the above embodiments, see [link to relevant documentation]. Figure 3 The method includes:
[0075] S301. Obtain current resource information.
[0076] The current resource information can be the resource information available for a specified node.
[0077] The current resource information of the specified node for the task to be scheduled can be obtained through the resource monitoring module in the computing resource layer.
[0078] S302. Using a preset multi-dimensional weight model, classify at least one task to be scheduled based on the current resource information to determine the first task to be scheduled and the second task to be scheduled.
[0079] The priority of the first task to be scheduled is higher than the priority of the second task to be scheduled.
[0080] Multidimensional weighting models can be used to determine the priority of tasks to be scheduled given the current resource information.
[0081] The current resource information and at least one task to be scheduled can be input into a preset multidimensional weight model to determine the first task to be scheduled and the second task to be scheduled.
[0082] In this way, task classification not only considers static priority labels, but also dynamically adjusts based on the real-time resource availability of the cluster (such as the number of available nodes and the degree of memory fragmentation), ensuring that high-priority tasks get resources first while avoiding queue blocking due to resource fragmentation.
[0083] S303. Update the first queue according to the first task to be scheduled.
[0084] A first task to be scheduled can be added to the first queue.
[0085] S304. Update the second queue according to the second task to be scheduled.
[0086] A second task can be added to the second queue.
[0087] S305. Based on the current task information, determine the initial resource quantity of the first queue and the initial resource quantity of the second queue.
[0088] The initial resource quantity can be the resource quantity corresponding to the first queue or the second queue in response to receiving at least one scheduled task.
[0089] After receiving at least one task to be scheduled, the resource amounts corresponding to the first queue and the second queue need to be readjusted.
[0090] The current task information can be parsed and processed to determine the initial resource quantity of the first queue and the initial resource quantity of the second queue.
[0091] S306. Determine whether the initial resource quantity of the second queue is greater than the first threshold.
[0092] If so, then execute S307;
[0093] If not, then execute S309.
[0094] The first threshold can be the amount of resources corresponding to the pre-defined second queue.
[0095] S307. Determine whether there is a task in the updated first queue and obtain the result.
[0096] The result of the judgment can be used to indicate whether there is a task in the first queue.
[0097] Based on the task information in the updated first queue, it can be determined whether there are any tasks in the updated first queue, and the result can be obtained.
[0098] S308. Based on the judgment result, the initial resource quantity of the first queue, and the initial resource quantity of the second queue, determine the first resource quantity and the second resource quantity.
[0099] If there are tasks in the updated first queue, the idle resources in the initial resource quantity of the second queue can be adjusted to the first resource quantity of the first queue to ensure that high-priority tasks (such as real-time inference requests) get resources first and reduce the queuing delay of critical tasks.
[0100] Optionally, the first and second resource quantities can be determined based on the judgment result, the initial resource quantity of the first queue, and the initial resource quantity of the second queue in the following manner: If there are tasks in the updated first queue, determine the second idle resource quantity of the second queue based on the current task information, and determine the first resource quantity as the sum of the second idle resource quantity and the initial resource quantity of the first queue, and determine the second resource quantity as the difference between the initial resource quantity and the second idle resource quantity of the second queue; if there are no tasks in the updated first queue, determine the second resource quantity as the sum of the initial resource quantity of the first queue and the initial resource quantity of the second queue, and determine the first resource quantity as 0.
[0101] Optionally, the first resource quantity and the second resource quantity can be determined based on the judgment result, the initial resource quantity of the first queue, and the initial resource quantity of the second queue in the following manner: if there are tasks in the updated first queue, determine the resource utilization rate of the first queue, and determine the first resource quantity and the second resource quantity based on the resource utilization rate, the initial resource quantity of the first queue, and the initial resource quantity of the second queue; if there are no tasks in the updated first queue, determine the second resource quantity as the sum of the initial resource quantity of the first queue and the initial resource quantity of the second queue, and determine the first resource quantity as 0.
[0102] Specifically, based on resource utilization rate, the initial resource quantity of the first queue, and the initial resource quantity of the second queue, the first and second resource quantities are determined as follows: It is determined whether the resource utilization rate is greater than a second threshold; if so, the second idle resource quantity of the second queue is determined, and the sum of the second idle resource quantity and the initial resource quantity of the first queue is determined as the first resource quantity, and the difference between the initial resource quantity and the second idle resource quantity of the second queue is determined as the second resource quantity; if not, if the resource utilization rate is less than a third threshold, the first idle resource quantity of the first queue is determined, and the difference between the initial resource quantity and the first idle resource quantity of the first queue is determined as the first resource quantity, and the sum of the first idle resource quantity and the initial resource quantity of the second queue is determined as the second resource quantity. If the resource utilization rate is greater than or equal to the third threshold, the initial resource quantity of the first queue is determined as the first resource quantity, and the initial resource quantity of the second queue is determined as the second resource quantity, and the third threshold is less than the second threshold.
[0103] In this way, when the resource utilization rate of the first queue is not high, there is no need to immediately reclaim the resources in the second queue. By dynamically analyzing the real-time resource balance of the cluster and combining task priority and resource demand, computing nodes are intelligently allocated to avoid resource idleness or overload, and the utilization efficiency of hardware such as GPUs and CPUs is significantly improved.
[0104] Below, in conjunction with Figure 4 An example is given to illustrate how to determine the first and second resource quantities based on resource utilization rate, the initial resource quantity of the first queue, and the initial resource quantity of the second queue.
[0105] Figure 4 This is a schematic diagram illustrating a process for determining resource quantities, provided as an embodiment of this application. Please refer to... Figure 4 .
[0106] Step 1: Monitor the first queue to determine resource utilization;
[0107] Step 2: Determine if the resource utilization rate is greater than 85%. If yes, proceed to Step 3; otherwise, proceed to Step 4.
[0108] Step 3: Determine the second idle resource amount in the second queue. The sum of the second idle resource amount and the initial resource amount in the first queue is determined as the first resource amount. The difference between the initial resource amount and the second idle resource amount in the second queue is determined as the second resource amount. In other words, reclaim the resources in the second queue.
[0109] Step 4: Determine if the resource utilization rate is less than 60%. If yes, proceed to step 5; otherwise, proceed to step 6.
[0110] Step 5: Determine the first free resource amount in the first queue. The difference between the initial resource amount in the first queue and the first free resource amount is determined as the first resource amount. The sum of the first free resource amount and the initial resource amount in the second queue is determined as the second resource amount. That is, borrow the resources from the first queue.
[0111] Step 6: Determine the initial resource amount for the first queue as the first resource amount, and determine the initial resource amount for the second queue as the second resource amount. That is, maintain the current resource allocation.
[0112] S309. Determine the first resource quantity and the second resource quantity based on the updated first queue and the updated second queue.
[0113] The allocation ratio can be obtained, and the first and second resource quantities can be determined based on the allocation ratio, the updated first queue, and the updated second queue.
[0114] Optionally, the first resource quantity and the second resource quantity can be determined based on the updated first queue and the updated second queue in the following manner: determine whether there are any tasks in the updated first queue; if yes, if there are tasks in the updated second queue, obtain the allocation ratio, and determine the first resource quantity and the second resource quantity based on the initial resource quantity of the first queue, the initial resource quantity of the second queue, and the allocation ratio; if there are no tasks in the updated second queue, determine the first resource quantity as the sum of the initial resource quantity of the first queue and the initial resource quantity of the second queue, and determine the second resource quantity as 0; if not, determine the second resource quantity as the sum of the initial resource quantity of the first queue and the initial resource quantity of the second queue, and determine the first resource quantity as 0.
[0115] The allocation ratio can be a pre-set resource allocation ratio.
[0116] For example, the allocation ratio could be that the first queue allocates 80% of the total resources and the second queue allocates 20% of the total resources, where the total resources are the total amount of resources available in the first and second queues.
[0117] Below, in conjunction with Figure 5 The allocation ratio will be illustrated with an example.
[0118] Figure 5 This is a schematic diagram illustrating a resource allocation process provided in an embodiment of this application. Please refer to [link / reference]. Figure 5 .
[0119] Step 1: Determine the updated first queue and the updated second queue;
[0120] Step 2: If there are tasks in both the updated first queue and the updated second queue, the queue scheduler allocates resources to different queues according to a preset allocation ratio.
[0121] Step 3: The first queue determines the first resource quantity based on the allocation ratio of the first queue, and the second queue determines the second resource quantity based on the allocation ratio of the second queue.
[0122] The implementation details of each step in this application embodiment can be found in the description of the corresponding steps or operations in the above method embodiments; repeated content will not be repeated.
[0123] This embodiment provides a queue scheduling method that obtains current resource information; uses a preset multi-dimensional weight model to classify at least one task to be scheduled based on the current resource information, determining a first task to be scheduled and a second task to be scheduled, with the first task having a higher priority than the second task; updates a first queue based on the first task to be scheduled; updates a second queue based on the second task to be scheduled; determines the initial resource quantity of the first queue and the initial resource quantity of the second queue based on the current task information; determines whether the initial resource quantity of the second queue is greater than a first threshold; if so, determines whether there are any tasks in the updated first queue, obtains the determination result, and determines the first and second resource quantities based on the determination result, the initial resource quantities of the first and second queues; if not, determines the first and second resource quantities based on the updated first and second queues. In this way, by dynamically allocating resources and prioritizing high-priority queues, it ensures that critical tasks can obtain resources and execute first, meeting real-time or business-critical requirements and improving the efficiency of queue scheduling.
[0124] Below, in conjunction with Figure 6 The specific process of executing tasks in the first queue based on the first resource quantity and executing tasks in the second queue based on the second resource quantity, and updating the first and second resource quantities, until the tasks in the first and second queues are completed, is explained.
[0125] Figure 6 This is a flowchart illustrating another queue scheduling method provided in an embodiment of this application. Based on the above embodiments, see [link to relevant documentation]. Figure 6 The method includes:
[0126] S601. Based on the first resource quantity, determine the first task group to be executed in the first queue.
[0127] Each task in the first queue can have a task state, which can include waiting state, running state, failure state, etc.
[0128] The first group of tasks to be executed can be selected from the head of the first queue until the sum of the resource requirements of the selected tasks does not exceed the amount of resources allocated to the first queue.
[0129] The first task group to be executed can be empty or can include at least one task.
[0130] Based on the first resource quantity, the first task group to be executed corresponding to the first resource quantity can be determined in the first queue.
[0131] Optionally, the first task group to be executed can be determined in the first queue based on the first resource quantity as follows: determine the timestamp of at least one task in the first queue; sort the first queue in order of timestamp from earliest to latest to obtain a first order; and determine the first task group to be executed based on the first resource quantity and the first order.
[0132] Among them, the resource requirement corresponding to the first task group to be executed is less than or equal to the first resource quantity.
[0133] S602. Within a preset time period, execute the tasks in the first task group to be executed and obtain the first execution result.
[0134] The preset duration can be a pre-set duration for the alternating scheduling.
[0135] For example, each task can run for a maximum of 10 minutes at a time, and then actively yield resources to other tasks in the queue to prevent large tasks from occupying resources for a long time and causing other tasks to starve.
[0136] Each task in the first task group can be executed in parallel within a preset time period to obtain the first execution result.
[0137] The first execution result may include the execution result of each task.
[0138] S603. Based on the second resource quantity, determine the second task group to be executed in the second queue.
[0139] The process of determining the second task group to be executed is similar to the process of determining the first task group to be executed in S601, and will not be described in detail here.
[0140] S604. Within a preset time period, execute the tasks in the second task group to be executed and obtain the second execution result.
[0141] The process of obtaining the second execution result is similar to the process of obtaining the first execution result in S602, and will not be described in detail here.
[0142] S605. Based on the first execution result, update the first queue.
[0143] The first queue can be updated based on the execution result of each task in the first execution result.
[0144] Optionally, the first queue can be updated based on the first execution result as follows: Based on the first execution result, at least one first task and / or at least one second task are determined, where the first task is a successfully executed task in the first task group to be executed, and the second task is a failed task in the first task group to be executed; if the first execution result contains a first task, at least one first task is deleted from the first queue; if the first execution result contains a second task, the execution count corresponding to each of the at least one second task is determined, and the second task with an execution count greater than or equal to a third threshold is deleted from the first queue.
[0145] S606. Based on the second execution result, update the second queue.
[0146] The second queue can be updated based on the execution result of each task in the second execution result.
[0147] Optionally, the second queue can be updated based on the second execution result as follows: Based on the second execution result, at least one third task and / or at least one fourth task are determined, where the third task is a successfully executed task in the second task group to be executed, and the fourth task is a failed task in the second task group to be executed; if the second execution result contains a third task, at least one third task is deleted from the second queue; if the second execution result contains a fourth task, the execution count corresponding to each of the at least one fourth task is determined, and the fourth task with an execution count greater than or equal to a third threshold is deleted from the second queue.
[0148] S607. Determine whether there are any tasks in the updated first queue and the updated second queue.
[0149] If so, then execute S608;
[0150] If not, then execute S609.
[0151] S608. Update the first resource quantity and the second resource quantity, perform a task execution operation on the first queue based on the updated first resource quantity, and perform a task execution operation on the second queue based on the updated second resource quantity, until the tasks in the first queue and the second queue are completed.
[0152] If there are tasks in the updated first queue and the updated second queue, update the first resource quantity and the second resource quantity according to the updated first queue and the updated second queue. Perform a task execution operation on the first queue according to the updated first resource quantity and perform a task execution operation on the second queue according to the updated second resource quantity, until the tasks in the first queue and the second queue are completed.
[0153] The process of updating the first and second resource quantities is similar to the process of determining the first and second resource quantities described above, and will not be limited here.
[0154] In this way, elastic scheduling enhances the robustness of the system. By adopting a multi-level queue rotation and cross-queue preemption mechanism, the task execution order is dynamically adjusted when resources fluctuate. This can not only quickly respond to sudden high-priority tasks, but also maintain the progress of low-priority tasks through breakpoint continuation, thus ensuring the stability of the system during peak load periods.
[0155] S609. Confirm that the tasks in the first and second queues have been completed.
[0156] Below, in conjunction with Figure 7 The process of executing tasks in the first queue will be illustrated with an example.
[0157] Figure 7 This is a flowchart illustrating a task execution queue as provided in an embodiment of this application. Please refer to [link / reference]. Figure 7 , Figure 7 It includes a queue scheduler, a computing resource layer, and nodes.
[0158] Step 1: The queue scheduler requests the first amount of resources from the computing resource layer;
[0159] Step 2: The computational resource layer provides the initial amount of resources to the queue scheduler;
[0160] Step 3: The queue scheduler sorts the tasks according to their timestamps to determine the first group of tasks to be executed;
[0161] Step 4: Allocate resources to the nodes corresponding to the first group of tasks to be executed, so that the nodes can execute the tasks;
[0162] Step 5: Check the task status corresponding to the node within the preset time period to obtain the execution result;
[0163] Step 6: Based on the execution results, update the first queue, release the node resources of successfully executed tasks, update the first group of tasks to be executed, until the tasks in the first queue are completed.
[0164] Steps 5 and 6 are cyclical steps.
[0165] The implementation details of each step in this application embodiment can be found in the description of the corresponding steps or operations in the above method embodiments; repeated content will not be repeated.
[0166] This embodiment provides a queue scheduling method that, based on a first resource quantity, determines a first task group to be executed in a first queue; within a second preset time period, executes the tasks in the first task group to be executed, obtaining a first execution result; based on a second resource quantity, determines a second task group to be executed in a second queue; within a second preset time period, executes the tasks in the second task group to be executed, obtaining a second execution result; based on the first execution result, updates the first queue; based on the second execution result, updates the second queue; and determines whether there are tasks in the updated first and second queues. If so, the first and second resource quantities are updated, and a task execution operation is performed on the first queue based on the updated first resource quantity and on the second queue based on the updated second resource quantity, until the tasks in the first and second queues are completed; otherwise, the tasks in the first and second queues are determined to be completed. In this way, by dynamically allocating resource quantities, it ensures that critical tasks can obtain resources and be executed first, meeting real-time or business-critical requirements and improving the efficiency of queue scheduling.
[0167] 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.
[0168] Figure 8 This is a schematic diagram of a queue scheduling device provided in an embodiment of this application. Please refer to [link / reference]. Figure 8 The queue scheduling device 800 includes an acquisition module 801, a determination module 802, and an execution module 803.
[0169] The acquisition module 801 is used to acquire current task information in response to receiving at least one task to be scheduled;
[0170] The determination module 802 is used to determine the first resource quantity corresponding to the first queue and the second resource quantity corresponding to the second queue based on at least one task to be scheduled and current task information, wherein the priority of the first queue is greater than the priority of the second queue.
[0171] The execution module 803 is used to execute tasks in the first queue according to the first resource quantity and to execute tasks in the second queue according to the second resource quantity, and to update the first resource quantity and the second resource quantity until the tasks in the first queue and the second queue are completed.
[0172] In one possible implementation, the determining module 802 is specifically used for:
[0173] Get current resource information;
[0174] Using a pre-defined multi-dimensional weight model, at least one task to be scheduled is classified and processed based on the current resource information to determine the first task to be scheduled and the second task to be scheduled, with the priority of the first task to be scheduled being higher than that of the second task to be scheduled.
[0175] Update the first queue based on the first task to be scheduled.
[0176] Update the second queue based on the second task to be scheduled.
[0177] Based on the current task information, the updated first queue, and the updated second queue, determine the first resource quantity and the second resource quantity.
[0178] In one possible implementation, the determining module 802 is specifically used for:
[0179] Based on the current task information, determine the initial resource amount for the first queue and the initial resource amount for the second queue;
[0180] Determine whether the initial resource amount of the second queue is greater than the first threshold;
[0181] If so, determine whether there are any tasks in the updated first queue, obtain the determination result, and determine the first resource quantity and the second resource quantity based on the determination result, the initial resource quantity of the first queue and the initial resource quantity of the second queue;
[0182] If not, determine the first and second resource quantities based on the updated first and second queues.
[0183] In one possible implementation, the determining module 802 is specifically used for:
[0184] If there are tasks in the updated first queue, determine the second idle resource quantity of the second queue based on the current task information. The sum of the second idle resource quantity and the initial resource quantity of the first queue is determined as the first resource quantity. The difference between the initial resource quantity and the second idle resource quantity of the second queue is determined as the second resource quantity.
[0185] If there are no tasks in the updated first queue, the sum of the initial resource amount of the first queue and the initial resource amount of the second queue is determined as the second resource amount, and the first resource amount is determined to be 0.
[0186] In one possible implementation, the determining module 802 is specifically used for:
[0187] If there are tasks in the updated first queue, determine the resource utilization rate of the first queue, and determine the first resource quantity and the second resource quantity based on the resource utilization rate, the initial resource quantity of the first queue and the initial resource quantity of the second queue.
[0188] If there are no tasks in the updated first queue, the sum of the initial resource amount of the first queue and the initial resource amount of the second queue is determined as the second resource amount, and the first resource amount is determined to be 0.
[0189] In one possible implementation, the determining module 802 is specifically used for:
[0190] Determine if the resource utilization rate is greater than the second threshold;
[0191] If so, determine the second idle resource quantity of the second queue, and determine the first resource quantity as the sum of the second idle resource quantity and the initial resource quantity of the first queue; determine the second resource quantity as the difference between the initial resource quantity and the second idle resource quantity of the second queue.
[0192] If not, if the resource utilization rate is less than the third threshold, determine the first idle resource quantity of the first queue, and determine the first resource quantity as the difference between the initial resource quantity of the first queue and the first idle resource quantity. Determine the second resource quantity as the sum of the first idle resource quantity and the initial resource quantity of the second queue. If the resource utilization rate is greater than or equal to the third threshold, determine the first resource quantity as the initial resource quantity of the first queue and the second resource quantity as the initial resource quantity of the second queue. The third threshold is less than the second threshold.
[0193] In one possible implementation, the determining module 802 is specifically used for:
[0194] Determine if any tasks exist in the updated first queue;
[0195] If there are tasks in the updated second queue, obtain the allocation ratio, and determine the first and second resource amounts based on the initial resource amount of the first queue, the initial resource amount of the second queue, and the allocation ratio. If there are no tasks in the updated second queue, determine the first resource amount by the sum of the initial resource amount of the first queue and the initial resource amount of the second queue, and determine the second resource amount as 0.
[0196] If not, the sum of the initial resource quantity of the first queue and the initial resource quantity of the second queue is determined as the second resource quantity, and the first resource quantity is determined to be 0.
[0197] In one possible implementation, execution module 803 is specifically used for:
[0198] Based on the first resource quantity, perform a task execution operation on the first queue, and based on the second resource quantity, perform a task execution operation on the second queue, and update the first and second queues.
[0199] Determine whether there are tasks in the updated first queue and the updated second queue;
[0200] If so, update the first and second resource quantities, perform a task execution operation on the first queue based on the updated first resource quantity, and perform a task execution operation on the second queue based on the updated second resource quantity, until the tasks in the first and second queues are completed;
[0201] If not, then it is determined that the tasks in the first and second queues have been completed.
[0202] In one possible implementation, execution module 803 is specifically used for:
[0203] Based on the first resource quantity, determine the first group of tasks to be executed in the first queue;
[0204] Within a preset time period, execute the tasks in the first task group to be executed and obtain the first execution result;
[0205] Based on the second resource quantity, determine the second group of tasks to be executed in the second queue;
[0206] Within a preset time period, execute the tasks in the second task group to be executed, and obtain the second execution result;
[0207] Based on the first execution result, update the first queue;
[0208] Based on the second execution result, update the second queue.
[0209] In one possible implementation, execution module 803 is specifically used for:
[0210] Determine the timestamp of at least one task in the first queue;
[0211] Sort the first queue according to the timestamps from earliest to latest to obtain the first order;
[0212] Based on the first resource quantity and the first order, determine the first task group to be executed. The resource requirement of the first task group to be executed is less than or equal to the first resource quantity.
[0213] In one possible implementation, execution module 803 is specifically used for:
[0214] Based on the first execution result, at least one first task and / or at least one second task are determined, wherein the first task is a task that was successfully executed in the first task group to be executed, and the second task is a task that failed to be executed in the first task group to be executed;
[0215] If the first execution result contains a first task, delete at least one first task from the first queue;
[0216] If a second task exists in the first execution result, determine the execution count of at least one second task and delete the second task whose execution count is greater than or equal to the third threshold from the first queue.
[0217] In one possible implementation, the device further includes an alarm module 804, which is used for:
[0218] Obtain the historical resource utilization rates of the first and second queues within a preset historical time period;
[0219] Determine if there is any historical resource utilization rate greater than the fourth threshold.
[0220] If not, an alarm message is generated and sent to the terminal. The alarm message is used to notify the terminal that the queue resources cannot be fully loaded.
[0221] For a description of the features in the embodiment corresponding to the queue scheduling device, please refer to the relevant description of the embodiment corresponding to the queue scheduling method, which will not be repeated here.
[0222] Figure 9 A schematic diagram of the structure of the electronic device provided in this application. Figure 9 As shown, the electronic device 90 provided in this embodiment includes at least one processor 901 and a memory 902. Optionally, the electronic device 90 further includes a communication component 903. The processor 901, memory 902, and communication component 903 are connected via a bus.
[0223] In a specific implementation, at least one processor 901 executes computer execution instructions stored in memory 902, causing at least one processor 901 to execute the above-described queue scheduling method embodiment.
[0224] The specific implementation process of processor 901 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.
[0225] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0226] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.
[0227] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.
[0228] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above-described queue scheduling method embodiments at runtime.
[0229] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0230] Embodiments of this application also provide a computer program product, which includes a computer program that, when executed by a processor, implements the steps in any of the above-described queue scheduling method embodiments.
[0231] Embodiments of this application also provide another computer program product, including a non-volatile computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in any of the above-described queue scheduling method embodiments.
[0232] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0233] The queue scheduling method provided in this application has been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are only for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A queue scheduling method, characterized in that, include: In response to receiving at least one task to be scheduled, obtain the current task information; Using a pre-defined multi-dimensional weighting model, the at least one task to be scheduled is classified based on the current resource information to determine a first task to be scheduled and a second task to be scheduled, wherein the priority of the first task to be scheduled is greater than the priority of the second task to be scheduled. Update the first queue according to the first task to be scheduled; Update the second queue according to the second task to be scheduled; Based on the current task information, determine the initial resource amount of the first queue and the initial resource amount of the second queue; Determine whether the initial resource amount of the second queue is greater than the first threshold; If so, determine whether there is a task in the updated first queue, obtain the determination result, and determine the first resource quantity and the second resource quantity based on the determination result, the initial resource quantity of the first queue and the initial resource quantity of the second queue; If not, determine the first resource quantity and the second resource quantity based on the updated first queue and the updated second queue, wherein the priority of the first queue is greater than the priority of the second queue; Execute tasks in the first queue according to the first resource quantity and tasks in the second queue according to the second resource quantity, and update the first resource quantity and the second resource quantity until the tasks in the first queue and the second queue are completed; Based on the judgment result, the initial resource quantity of the first queue, and the initial resource quantity of the second queue, the determination of the first resource quantity and the second resource quantity includes: If there are tasks in the updated first queue, based on the current task information, determine the second idle resource amount of the second queue, and determine the first resource amount as the sum of the second idle resource amount and the initial resource amount of the first queue; determine the second resource amount as the difference between the initial resource amount of the second queue and the second idle resource amount. If there are no tasks in the updated first queue, determine the second resource amount as the sum of the initial resource amount of the first queue and the initial resource amount of the second queue, and determine the first resource amount as 0; or If there are tasks in the updated first queue, determine the resource utilization rate of the first queue, and determine the first resource quantity and the second resource quantity based on the resource utilization rate, the initial resource quantity of the first queue and the initial resource quantity of the second queue; if there are no tasks in the updated first queue, determine the second resource quantity as the sum of the initial resource quantity of the first queue and the initial resource quantity of the second queue, and determine the first resource quantity as 0.
2. The method according to claim 1, characterized in that, Determining the first resource quantity and the second resource quantity based on the resource utilization rate, the initial resource quantity of the first queue, and the initial resource quantity of the second queue includes: Determine whether the resource utilization rate is greater than the second threshold; If so, determine the second idle resource quantity of the second queue, and determine the first resource quantity as the sum of the second idle resource quantity and the initial resource quantity of the first queue; determine the second resource quantity as the difference between the initial resource quantity of the second queue and the second idle resource quantity. If not, if the resource utilization rate is less than the third threshold, determine the first idle resource amount of the first queue, determine the difference between the initial resource amount of the first queue and the first idle resource amount as the first resource amount, and determine the sum of the first idle resource amount and the initial resource amount of the second queue as the second resource amount. If the resource utilization rate is greater than or equal to the third threshold, determine the initial resource amount of the first queue as the first resource amount, determine the initial resource amount of the second queue as the second resource amount, and the third threshold is less than the second threshold.
3. The method according to claim 1, characterized in that, Based on the updated first queue and the updated second queue, determine the first resource quantity and the second resource quantity, including: Determine if any tasks exist in the updated first queue; If there are tasks in the updated second queue, obtain the allocation ratio, determine the first resource quantity and the second resource quantity based on the initial resource quantity of the first queue, the initial resource quantity of the second queue and the allocation ratio. If there are no tasks in the updated second queue, determine the first resource quantity as the sum of the initial resource quantity of the first queue and the initial resource quantity of the second queue, and determine the second resource quantity as 0. If not, the sum of the initial resource amount of the first queue and the initial resource amount of the second queue is determined as the second resource amount, and the first resource amount is determined to be 0.
4. The method according to any one of claims 1-3, characterized in that, Execute tasks in the first queue based on the first resource quantity and tasks in the second queue based on the second resource quantity, and update the first and second resource quantities until the tasks in the first and second queues are completed, including: Based on the first resource quantity, perform a task execution operation on the first queue, and based on the second resource quantity, perform a task execution operation on the second queue, and update the first queue and the second queue. Determine whether there are tasks in the updated first queue and the updated second queue; If so, update the first resource quantity and the second resource quantity, perform a task execution operation on the first queue according to the updated first resource quantity, and perform a task execution operation on the second queue according to the updated second resource quantity, until the tasks in the first queue and the second queue are completed; If not, then it is determined that the tasks in the first queue and the second queue have been completed.
5. The method according to claim 4, characterized in that, Based on the first resource quantity, perform a task execution operation on the first queue, and based on the second resource quantity, perform a task execution operation on the second queue, and update the first queue and the second queue, including: Based on the first resource quantity, determine the first group of tasks to be executed in the first queue; Within a preset time period, the tasks in the first task group to be executed are executed to obtain the first execution result; Based on the second resource quantity, determine the second group of tasks to be executed in the second queue; Within a preset time period, the tasks in the second task group to be executed are executed to obtain the second execution result; Based on the first execution result, the first queue is updated; Based on the second execution result, the second queue is updated.
6. The method according to claim 5, characterized in that, Based on the first resource quantity, a first group of tasks to be executed is determined in the first queue, including: Determine the timestamp of at least one task in the first queue; Sort the first queue according to the timestamps from earliest to latest to obtain the first order; Based on the first resource quantity and the first order, a first task group to be executed is determined, wherein the resource requirement corresponding to the first task group to be executed is less than or equal to the first resource quantity.
7. The method according to claim 5, characterized in that, Based on the first execution result, the first queue is updated, including: Based on the first execution result, at least one first task and / or at least one second task are determined, wherein the first task is a task that was successfully executed in the first task group to be executed, and the second task is a task that failed to be executed in the first task group to be executed; If the first execution result contains the first task, delete the at least one first task from the first queue; If the first execution result contains a second task, determine the execution count corresponding to each of the at least one second task, and delete the second task whose execution count is greater than or equal to a third threshold from the first queue.
8. The method according to any one of claims 1-3 or 5-7, characterized in that, The method further includes: Obtain multiple historical resource utilization rates for the first queue and the second queue within a preset historical time period; Determine if there is any historical resource utilization rate greater than the fourth threshold. If not, an alarm message is generated and sent to the terminal. The alarm message is used to notify the terminal that the queue resources cannot be fully loaded.
9. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the queue scheduling method as described in any one of claims 1 to 8 when executing the computer program.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program, when executed by a processor, implements the steps of the queue scheduling method as described in any one of claims 1 to 8.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the queue scheduling method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for dynamically managing cluster resources
CN112749002A
Resource management method and device, electronic equipment, storage medium and server
CN114968565A