Task resource scheduling method and device, electronic equipment and storage medium

By constructing a tree-structured queue model and a resource preemption strategy, the problem of Kubernetes schedulers accidentally damaging tasks during AI task resource scheduling was solved, achieving more stable resource utilization and task scheduling.

CN114721808BActive Publication Date: 2026-01-20BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210433317.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-24
Publication Date
2026-01-20
Estimated Expiration
2042-04-24

AI Technical Summary

Technical Problem

Existing Kubernetes schedulers are prone to accidentally damaging tasks during AI task resource scheduling, leading to task failures and ineffective utilization of physical resources.

Method used

A tree-structured queue model is constructed, where parent nodes manage the physical resources of child nodes, and tasks belong to leaf nodes. The tree-structured queue model is used to determine tasks to be preempted and to preempt and reclaim resources, ensuring that the guaranteed resources for high-priority tasks are not preempted, while the elastic resources for low-priority tasks can be preempted to meet the needs of tasks to be scheduled.

Benefits of technology

This reduces the chance of tasks being accidentally damaged during resource scheduling, improves the stability of business operations and resource utilization, and ensures that the priority of high-priority tasks is not compromised.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114721808B_ABST
    Figure CN114721808B_ABST
Patent Text Reader

Abstract

This disclosure relates to a task resource scheduling method, apparatus, electronic device, and storage medium. The method includes: constructing a tree-shaped queue model, where parent nodes manage the physical resources of child nodes, each child node allocates physical resources from its parent node, and tasks belong to leaf nodes in the tree-shaped queue model; for a target leaf node in the tree-shaped queue model, if the scheduled tasks in the target leaf node require resource preemption and reclamation, determining the tasks to be preempted from the leaf nodes in the tree-shaped queue model; the target leaf node preempts and reclaims the physical resources occupied by the tasks to be preempted, and schedules physical resources for the scheduled tasks in the target leaf node. Using this disclosure can mitigate the accidental damage to tasks during the preemption and reclamation process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a task resource scheduling method, apparatus, electronic device, and storage medium. Background Technology

[0002] With the continuous development of science, resource pools can now be used to provide physical resources for various services to perform their respective tasks. When multiple services share the physical resources provided by the resource pool, a pre-allocated quota of available resources can be assigned to each service. When any service's physical resources are insufficient, the Kubernetes scheduler can schedule physical resources among services. For example, resources can be borrowed from other services, or resources borrowed from other services can be reclaimed, thereby improving the utilization rate of physical resources.

[0003] In related technologies, the Kubernetes scheduler supports instance-level scheduling during the scheduling of physical resources. For example, suppose there are two business entities, A and B. When business entity A's resources are insufficient, it can borrow physical resources from business entity B. When business entity B's resources are insufficient, it can preempt and reclaim resources from tasks of business entity A that have borrowed its resources. At this time, tasks of business entity B will preempt instances of business entity A that have lower priority than themselves. For example, if business entity A includes tasks 1 and 2, it can preempt instance 1 (which has a lower priority than itself) and instance 2 (which has a lower priority than itself).

[0004] When the task is an AI (Artificial Intelligence) task, since there are relationships between multiple instances of an AI task, the failure of one instance may cause the task to fail. Therefore, the above instance-level scheduling method has too many accidental impacts in the scheduling of physical resources (taking the above strength as an example, when business A performs the preemption and reclamation of resource scheduling operations, it accidentally impacts two AI tasks, Task 1 and Task 2). Therefore, it is not suitable for resource scheduling of AI tasks. Summary of the Invention

[0005] This disclosure provides a task resource scheduling method, apparatus, electronic device, and storage medium to at least address the problem of frequent false alarms during AI task resource scheduling in related technologies. The technical solution of this disclosure is as follows:

[0006] According to a first aspect of the present disclosure, a task resource scheduling method is provided, comprising:

[0007] A tree-shaped queue model is constructed, in which the parent node is used to manage the physical resources of the child nodes, each child node is allocated physical resources from its parent node, and tasks belong to the leaf nodes in the tree-shaped queue model.

[0008] For a target leaf node in the tree queue model, if the scheduled task in the target leaf node needs to be preempted and reclaimed, the preempted task is determined from each of the leaf nodes in the tree queue model.

[0009] The target leaf node preempts and reclaims the physical resources occupied by the task to be preempted, and schedules physical resources for the task to be scheduled in the target leaf node.

[0010] In one embodiment, in the tree queue model, for any path from the root node to each of the leaf nodes, there exists a tag node with a private attribute label on the path, and in the subtree rooted at the tag node, all nodes share a physical resource pool.

[0011] In one embodiment, within the subtree rooted at the tag node, each node has a guaranteed resource quota, each child node has a flexible resource quota, and the sum of the guaranteed resource quotas of all the child nodes is the guaranteed resource quota of its parent node.

[0012] The tasks include high-priority tasks and low-priority tasks. High-priority tasks have a higher priority than low-priority tasks. High-priority tasks only occupy the guaranteed resource quota in their respective leaf nodes. The physical resources occupied by high-priority tasks are guaranteed resources, while the physical resources occupied by low-priority tasks are elastic resources.

[0013] In one embodiment, before determining the tasks to be preempted from each of the leaf nodes in the tree queue model when the scheduled tasks in the target leaf node of the tree queue model need to be preempted and reclaimed, the method further includes:

[0014] The remaining resource quota of the target leaf node is determined based on the guaranteed resource quota and the elastic resource quota of the target leaf node, as well as the amount of physical resources already occupied by the tasks within the target leaf node.

[0015] If the remaining resource quota of the target leaf node meets the physical resource quantity requested by the task to be scheduled, but the schedulable physical resource quantity does not meet the physical resource quantity requested by the task to be scheduled, then it is determined that the task to be scheduled needs to preempt resources.

[0016] In one embodiment, the remaining resource quota includes the remaining guaranteed resource quota and the total remaining physical resource quota. Determining the remaining resource quota of the target leaf node based on the guaranteed resource quota and the elastic resource quota of the target leaf node, and the amount of physical resources already occupied by tasks within the target leaf node, includes:

[0017] Based on the amount of guaranteed resources already occupied in the target leaf node and the guaranteed resource quota of the target leaf node, determine the remaining guaranteed resource quota in the target leaf node;

[0018] Based on the physical resource amount already occupied by all tasks within the target leaf node, the guaranteed resource quota and the elastic resource quota of the target leaf node, determine all remaining resource quotas within the target leaf node.

[0019] In one embodiment, determining that the task to be scheduled needs to preempt resources when the remaining resource quota of the target leaf node meets the amount of physical resources requested by the task to be scheduled, but the amount of schedulable physical resources does not meet the amount of physical resources requested by the task to be scheduled, includes:

[0020] If all remaining resource quotas within the target leaf node meet the physical resource requirements of the task to be scheduled, then physical resources are scheduled for the task to be scheduled within the target leaf node.

[0021] In the event of scheduling failure, it is determined that the amount of physical resources available for scheduling in the target leaf node does not meet the amount of physical resources requested by the task to be scheduled.

[0022] It has been determined that the task to be scheduled requires resource preemption.

[0023] In one embodiment, the task to be scheduled is a high-priority task. Before determining that the task to be scheduled needs to preempt resources when the remaining resource quota of the target leaf node meets the amount of physical resources requested by the task to be scheduled, but the amount of schedulable physical resources does not meet the amount of physical resources requested by the task to be scheduled, the method further includes:

[0024] If the remaining guaranteed resource quota meets the physical resource quantity requested by the task to be scheduled, but the total remaining resource quota in the target leaf node does not meet the physical resource quantity requested by the task to be scheduled, then it is determined that the schedulable physical resource quantity of the target leaf node does not meet the physical resource quantity requested by the task to be scheduled.

[0025] It has been determined that the task to be scheduled requires resource preemption.

[0026] In one embodiment, determining the task to be preempted from each of the leaf nodes of the target subtree includes:

[0027] If there are preemptible tasks in the target leaf node, and the remaining resource quota in the target leaf node does not meet the physical resource quantity requested by the task to be scheduled, a first preemptible task is determined from the preemptible tasks until there are no preemptible tasks in the target leaf node, or until the physical resource quantity available in the target leaf node meets the physical resource quantity requested by the task to be scheduled after the physical resource occupied by the first preemptible task is preempted and reclaimed.

[0028] If there is no preemptible task at the target leaf node, a second preemptible task is determined from other leaf nodes in the target subtree.

[0029] The first task to be preempted and / or the second task to be preempted are designated as tasks to be preempted.

[0030] In one embodiment, if the task to be scheduled is a high-priority task, then the low-priority task within the target leaf node is the preemptible task.

[0031] In one embodiment, determining the second preemptible task from other leaf nodes in the target subtree includes:

[0032] Identify the preemptible leaf nodes from the target subtree;

[0033] After determining the second preemptible task from the preemptible leaf nodes, if the amount of physical resources available for the target leaf node after preempting and reclaiming the physical resources occupied by the second preemptible task is insufficient to meet the amount of physical resources requested by the scheduled task, the step of determining the preemptible leaf node from the target subtree is repeated until the amount of physical resources available for the target leaf node meets the amount of physical resources requested by the scheduled task, thus obtaining at least one second preemptible task.

[0034] In one embodiment, determining the second preemptible task from other leaf nodes in the target subtree further includes:

[0035] If the task to be scheduled is a high-priority task, a first low-priority task is determined from the preemptible leaf nodes as the second task to be preempted; or...

[0036] When the task to be scheduled is a low-priority task, a second low-priority task is determined from the preemptible leaf nodes as the second preemptible task. After the physical resources occupied by the second low-priority task are preempted and reclaimed, the resource utilization rate of the target leaf node is lower than or equal to the resource utilization rate of the preemptible leaf node.

[0037] In one embodiment, determining the preemptible leaf node from the target subtree includes:

[0038] Starting from the child node whose parent is the root node of the target subtree, determine the first target child node from the target subtree;

[0039] Identify the child node with the highest resource utilization rate from the first target child node;

[0040] The child node with the highest resource utilization rate as its parent node is taken as the new first target child node. The step of determining the child node with the highest resource utilization rate from the first target child node is repeated until the child node with the highest resource utilization rate is a leaf node. The child node with the highest resource utilization rate is then taken as a preemptible leaf node.

[0041] In one embodiment, before determining the tasks to be preempted from each of the leaf nodes in the tree queue model when the scheduled tasks in the target leaf node of the tree queue model need to be preempted and reclaimed, the method further includes:

[0042] For any subtree rooted at a tag node with a private attribute label, determine that subtree as the target subtree;

[0043] Starting from the child node whose parent is the root node of the target subtree, determine the second target child node from the target subtree;

[0044] Identify the child node with the lowest resource utilization rate from the second target child nodes;

[0045] The child node with the lowest resource utilization rate as its parent node is taken as the new second target child node. The step of determining the child node with the lowest resource utilization rate from the target child nodes is repeated until the child node with the lowest resource utilization rate is a leaf node. The child node with the lowest resource utilization rate is then taken as the target leaf node.

[0046] The task with the highest priority and earliest submission time among the tasks to be called within the target leaf node is identified as the task to be scheduled.

[0047] According to a second aspect of the present disclosure, a task resource scheduling apparatus is provided, comprising:

[0048] The building unit is configured to execute the building of a tree queue model, in which the parent node is used to manage the physical resources of the child nodes, each of the child nodes is allocated physical resources from its parent node, and the tasks belong to the leaf nodes in the tree queue model.

[0049] The first determining unit is configured to perform the following: when a scheduled task in the target leaf node of the tree queue model needs to be preempted and reclaimed for resource preemption, determine the task to be preempted from each of the leaf nodes in the tree queue model.

[0050] The preemption unit is configured to preempt and reclaim the physical resources occupied by the task to be preempted in the target leaf node, and to schedule physical resources for the task to be scheduled in the target leaf node.

[0051] In one embodiment, in the tree queue model, for any path from the root node to each of the leaf nodes, there exists a tag node with a private attribute label on the path, and in the subtree rooted at the tag node, all nodes share a physical resource pool.

[0052] In one embodiment, within the subtree rooted at the tag node, each node has a guaranteed resource quota, each child node has a flexible resource quota, and the sum of the guaranteed resource quotas of all the child nodes is the guaranteed resource quota of its parent node.

[0053] The tasks include high-priority tasks and low-priority tasks. High-priority tasks have a higher priority than low-priority tasks. High-priority tasks only occupy the guaranteed resource quota in their respective leaf nodes. The physical resources occupied by high-priority tasks are guaranteed resources, while the physical resources occupied by low-priority tasks are elastic resources.

[0054] In one embodiment, prior to the first determining unit, the apparatus further includes:

[0055] The second determining unit is configured to determine the remaining resource quota of the target leaf node based on the guaranteed resource quota and the elastic resource quota of the target leaf node, as well as the amount of physical resources already occupied by the tasks within the target leaf node.

[0056] The third determining unit is configured to determine that the task to be scheduled needs to preempt resources when the remaining resource quota of the target leaf node meets the amount of physical resources requested by the task to be scheduled, but the amount of schedulable physical resources does not meet the amount of physical resources requested by the task to be scheduled.

[0057] In one embodiment, the remaining resource quota includes the remaining guaranteed resource quota and the total remaining physical resource quota, and the second determining unit is further configured to perform:

[0058] Based on the amount of guaranteed resources already occupied in the target leaf node and the guaranteed resource quota of the target leaf node, determine the remaining guaranteed resource quota in the target leaf node;

[0059] Based on the physical resource amount already occupied by all tasks within the target leaf node, the guaranteed resource quota and the elastic resource quota of the target leaf node, determine all remaining resource quotas within the target leaf node.

[0060] In one embodiment, the first determining unit is further configured to perform:

[0061] If all remaining resource quotas within the target leaf node meet the physical resource requirements of the task to be scheduled, then physical resources are scheduled for the task to be scheduled within the target leaf node.

[0062] In the event of scheduling failure, it is determined that the amount of physical resources available for scheduling in the target leaf node does not meet the amount of physical resources requested by the task to be scheduled.

[0063] It has been determined that the task to be scheduled requires resource preemption.

[0064] In one embodiment, the task to be scheduled is a high-priority task, and the first determining unit is further configured to execute:

[0065] If the remaining guaranteed resource quota meets the physical resource quantity requested by the task to be scheduled, but the total remaining resource quota in the target leaf node does not meet the physical resource quantity requested by the task to be scheduled, then it is determined that the schedulable physical resource quantity of the target leaf node does not meet the physical resource quantity requested by the task to be scheduled.

[0066] It has been determined that the task to be scheduled requires resource preemption.

[0067] In one embodiment, the first determining unit is further configured to perform:

[0068] If there are preemptible tasks in the target leaf node, and the remaining resource quota in the target leaf node does not meet the physical resource quantity requested by the task to be scheduled, a first preemptible task is determined from the preemptible tasks until there are no preemptible tasks in the target leaf node, or until the physical resource quantity available in the target leaf node meets the physical resource quantity requested by the task to be scheduled after the physical resource occupied by the first preemptible task is preempted and reclaimed.

[0069] If there is no preemptible task at the target leaf node, a second preemptible task is determined from other leaf nodes in the target subtree.

[0070] The first task to be preempted and / or the second task to be preempted are designated as tasks to be preempted.

[0071] In one embodiment, if the task to be scheduled is a high-priority task, then the low-priority task within the target leaf node is the preemptible task.

[0072] In one embodiment, the first determining unit is further configured to perform:

[0073] Identify the preemptible leaf nodes from the target subtree;

[0074] After determining the second preemptible task from the preemptible leaf nodes, if the amount of physical resources available for the target leaf node after preempting and reclaiming the physical resources occupied by the second preemptible task is insufficient to meet the amount of physical resources requested by the scheduled task, the step of determining the preemptible leaf node from the target subtree is repeated until the amount of physical resources available for the target leaf node meets the amount of physical resources requested by the scheduled task, thus obtaining at least one second preemptible task.

[0075] In one embodiment, the first determining unit is further configured to perform:

[0076] If the task to be scheduled is a high-priority task, a first low-priority task is determined from the preemptible leaf nodes as the second task to be preempted; or...

[0077] When the task to be scheduled is a low-priority task, a second low-priority task is determined from the preemptible leaf nodes as the second preemptible task. After the physical resources occupied by the second low-priority task are preempted and reclaimed, the resource utilization rate of the target leaf node is lower than or equal to the resource utilization rate of the preemptible leaf node.

[0078] In one embodiment, the first determining unit is further configured to perform:

[0079] Starting from the child node whose parent is the root node of the target subtree, determine the first target child node from the target subtree;

[0080] Identify the child node with the highest resource utilization rate from the first target child node;

[0081] The child node with the highest resource utilization rate as its parent node is taken as the new first target child node. The step of determining the child node with the highest resource utilization rate from the first target child node is repeated until the child node with the highest resource utilization rate is a leaf node. The child node with the highest resource utilization rate is then taken as a preemptible leaf node.

[0082] In one embodiment, prior to the first determining unit, the apparatus further includes:

[0083] The fourth determining unit is configured to perform the following: for any subtree rooted at a tag node with a private attribute label, determine the subtree as the target subtree;

[0084] The fifth determining unit is configured to determine a second target child node from the target subtree, starting from the child node whose parent node is the root node of the target subtree;

[0085] The sixth determining unit is configured to determine the child node with the lowest resource utilization rate from the second target child nodes;

[0086] The seventh determining unit is configured to execute the step of determining the child node with the lowest resource utilization rate as its parent node as the new second target child node, repeating the step of determining the child node with the lowest resource utilization rate from the target child nodes until the child node with the lowest resource utilization rate is a leaf node, and then taking the child node with the lowest resource utilization rate as the target leaf node.

[0087] The eighth determining unit is configured to determine the task with the highest priority and earliest submission time among the tasks to be called within the target leaf node as the task to be scheduled.

[0088] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions; wherein the processor is configured to execute the instructions to implement any of the methods described above.

[0089] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, characterized in that, when the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is able to perform any of the methods described above.

[0090] According to a fifth aspect of the present disclosure, a computer program product is provided that, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform any of the methods described above.

[0091] The technical solutions provided by the embodiments of this disclosure have at least the following beneficial effects:

[0092] The task resource scheduling method, apparatus, electronic device, and storage medium provided in this disclosure can construct a tree-like queue model. In this model, parent nodes manage the physical resources of child nodes, and each child node allocates physical resources from its parent node. Tasks belong to leaf nodes in the tree-like queue model. For a target leaf node in the tree-like queue model, if a scheduled task in that target leaf node requires resource preemption and reclamation, the task to be preempted can be determined from each leaf node in the tree-like queue model. The target leaf node preempts and reclaims the physical resources occupied by the task to be preempted, and schedules physical resources for the scheduled task within that target leaf node. Based on the task resource scheduling method, apparatus, electronic device, and storage medium provided in this disclosure, during task resource scheduling, if a scheduled task in a target leaf node requires resource preemption and reclamation, the task to be preempted can be determined from each leaf node in the tree-like queue model, and the physical resources occupied by the task to be preempted can be preempted and reclaimed in a timely manner. This reduces the number of tasks accidentally damaged during the preemption and reclamation process and improves the stability of business operations across different business units within the organizational structure.

[0093] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description

[0094] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure, and are not intended to unduly limit this disclosure.

[0095] Figure 1 This is a flowchart illustrating a task resource scheduling method according to an exemplary embodiment.

[0096] Figure 2 This is a schematic diagram illustrating a tree-shaped queue model according to an exemplary embodiment.

[0097] Figure 3 This is a schematic diagram illustrating a tree-shaped queue model according to an exemplary embodiment.

[0098] Figure 4 This is a schematic diagram illustrating a tree-shaped queue model according to an exemplary embodiment.

[0099] Figure 5 This is a flowchart illustrating a task resource scheduling method according to an exemplary embodiment.

[0100] Figure 6 This is a flowchart illustrating a task resource scheduling method according to an exemplary embodiment.

[0101] Figure 7 This is a schematic diagram illustrating a task resource scheduling method according to an exemplary embodiment.

[0102] Figure 8 This is a flowchart illustrating a task resource scheduling method according to an exemplary embodiment.

[0103] Figure 9 This is a schematic diagram illustrating a task resource scheduling method according to an exemplary embodiment.

[0104] Figure 10 This is a flowchart illustrating step 104 according to an exemplary embodiment.

[0105] Figure 11 This is a schematic diagram illustrating a task resource scheduling method according to an exemplary embodiment.

[0106] Figure 12 This is a flowchart illustrating step 1004 according to an exemplary embodiment.

[0107] Figure 13 This is a flowchart illustrating step 1202 according to an exemplary embodiment.

[0108] Figure 14a This is a schematic diagram illustrating a task resource scheduling method according to an exemplary embodiment.

[0109] Figure 14b This is a schematic diagram illustrating a task resource scheduling method according to an exemplary embodiment.

[0110] Figure 15 This is a flowchart illustrating step 104 according to an exemplary embodiment.

[0111] Figure 16 This is a block diagram illustrating a task resource scheduling apparatus according to an exemplary embodiment.

[0112] Figure 17 This is a block diagram illustrating an electronic device according to an exemplary embodiment. Detailed Implementation

[0113] To enable those skilled in the art to better understand the technical solutions of this disclosure, the technical solutions in the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings.

[0114] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this disclosure described herein can be implemented in orders other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this disclosure. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this disclosure as detailed in the appended claims.

[0115] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0116] Figure 1 This is a flowchart illustrating a task resource scheduling method according to an exemplary embodiment. This embodiment uses the application of this method to a terminal as an example for illustration. It is understood that this method can also be applied to a server, and further to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:

[0117] In step 102, a tree queue model is constructed. In the tree queue model, the parent node is used to manage the physical resources of the child nodes. Each child node is allocated physical resources from its parent node. Tasks belong to the leaf nodes in the tree queue model.

[0118] In this embodiment, a tree-like queue model can be pre-constructed based on the relationships between organizational departments at various levels, i.e., business entities, within the organizational structure. This tree-like queue model is a multi-level tree model. For example, taking a multi-level enterprise organizational structure as an example, the root node in the tree-like queue model can represent the resource queue corresponding to the entire enterprise level, while the remaining nodes represent the resource queues corresponding to each department within the organizational structure. Since there are relationships between upper and lower-level departments within the organizational structure, parent and child nodes can be used in the tree-like queue model to express the relationships between upper and lower-level departments within the enterprise. That is, lower-level departments can be child nodes, their upper-level departments can be parent nodes, and departments at the same level can be sibling nodes. Using a tree-like queue model can meet the management needs of resources for various business entities under a complex enterprise organizational structure.

[0119] In the tree queue model, the root node can allocate physical resources available to the entire enterprise. Child nodes can allocate physical resources from their parent nodes. In other words, the parent node can manage and allocate the physical resources available to the child nodes. The specific tasks submitted belong to the leaf nodes in the tree queue model.

[0120] For example, refer to Figure 2 In the tree-like queue model shown, the root node is the enterprise, which serves as the parent node. Figure 2 The root node (identified in the middle) can allocate physical resources (200 cores, 200GB) to its child nodes. The enterprise is divided into two primary departments: primary department 1 (…). Figure 2 The middle section is labeled Queue-1 and the first-level department 2 ( Figure 2 The first-level department (identified as Queue-2) and the second-level department (identified as Queue-2) are child nodes of the enterprise, and can be allocated (80 cores, 80G) and (120 cores, 120G) of physical resources respectively from the enterprise.

[0121] Department 1 is further divided into two secondary departments, namely Department 1-1 ( Figure 2 The middle section is labeled Queue-1-1) and the second-level department 1-2 ( Figure 2 The system is labeled Queue-1-2. Secondary departments 1-1 and 1-2, as child nodes of primary department 1, can be allocated (40 cores, 40GB) and (40 cores, 40GB) of physical resources respectively from primary department 1. Primary department 2 is further divided into two secondary departments: secondary department 2-1... Figure 2 The middle section is labeled Queue-2-1) and the secondary department 2-2 ( Figure 2 The first-level department (identified as Queue-2-2) and the second-level department 2-1 and the second-level department 2-2 are child nodes of the first-level department 2. They can be allocated (40 cores, 40G) and (80 cores, 80G) of physical resources respectively from the first-level department 2.

[0122] Department 1-1 is further divided into two business groups, namely Business Group 1-1-1 ( Figure 2 The middle is labeled Queue-1-1-1) and business group 1-1-2 ( Figure 2 The nodes are designated Queue-1-1-2. Business groups 1-1-1 and 1-1-2 are child nodes of secondary department 1-1, and can be allocated physical resources (10 cores, 10GB) and (30 cores, 30GB) respectively from secondary department 1-1. Secondary department 1-2 has a sub-group 1-2-1 (…). Figure 2 If the identifier is Queue-1-2-1, then business group 1-2-1, as a child node of secondary department 1-2, can be allocated (40 cores, 40G) of physical resources from secondary department 1-2.

[0123] The second-level department 2-1 is further divided into a business group 2-1-1. Figure 2If the node is identified as Queue-2-1-1, then business group 2-1-1, as a child node of secondary department 2-1, can be allocated physical resources (40 cores, 40GB) from secondary department 2-1. Secondary department 2-2 is further divided into two business groups, namely business group 2-2-1 (…). Figure 2 The middle is labeled Queue-2-2-1) and business group 2-2-2 ( Figure 2 The business group 2-2-1 and business group 2-2-2 are child nodes of the secondary department 2-2, and can be allocated (50 cores, 50G) and (30 cores, 30G) of physical resources respectively from the secondary department 2-2.

[0124] When a task is submitted, it needs to be submitted to a leaf node. That is, for any department corresponding to a child node, the task can be submitted to the corresponding task group (leaf node) under that department, and the physical resources required for task scheduling are determined based on the physical resource status of the leaf node.

[0125] In step 104, for the target leaf node in the tree queue model, if the scheduled tasks in the target leaf node need to be preempted and reclaimed, the tasks to be preempted are determined from each leaf node in the tree queue model.

[0126] In this embodiment of the disclosure, the target leaf node can be a leaf node in a tree queue model that has a task to be scheduled. The task to be scheduled can be a task currently awaiting physical resource allocation. In one example, the task to be scheduled can be an AI task. For example, when it is determined that the target leaf node has borrowed physical resources from other leaf nodes, and the remaining available physical resources do not meet the amount of physical resources requested by the task to be scheduled (the remaining available physical resources are less than the amount of physical resources requested by the task to be scheduled), after preempting and reclaiming the borrowed physical resources, the amount of physical resources available to the target leaf node can meet the amount of physical resources requested by the task to be scheduled. Therefore, it can be determined that the task to be scheduled needs to undergo resource preemption and reclamation.

[0127] When resource preemption and reclamation are required for scheduled tasks, the tasks to be preempted can be determined from the leaf nodes of the tree queue model. If the physical resources occupied by the tasks in the leaf node containing the tasks to be preempted exceed the physical resources that leaf node can call upon, meaning that the leaf node has borrowed physical resources from other leaf nodes, then the tasks in that leaf node can be preempted and reclaimed. The tasks to be preempted can be determined from the leaf nodes based on the preemption and reclamation principle: after preempting and reclamation of the physical resources occupied by the preempted task, the amount of physical resources available to the target leaf node can satisfy the amount of physical resources requested by the scheduled task.

[0128] In step 106, the target leaf node preempts and reclaims the physical resources occupied by the task to be preempted, and schedules physical resources for the task to be scheduled in the target leaf node.

[0129] In this embodiment of the disclosure, after determining the task to be preempted, the physical resources occupied by the task can be preempted and reclaimed. For example, the task can be terminated, and the physical resources occupied by the task can be released. After the physical resources occupied by the task to be preempted are released, the target leaf node reclaims the physical resources borrowed from the task to be preempted. The amount of physical resources that the current target leaf node can call can meet the amount of physical resources requested by the task to be scheduled, so physical resources can be scheduled for the task to be scheduled.

[0130] The task resource scheduling method provided in this disclosure can construct a tree-like queue model. In this model, parent nodes manage the physical resources of child nodes, and each child node receives physical resources from its parent node. Tasks belong to leaf nodes in the tree-like queue model. For a target leaf node in the tree-like queue model, if a scheduled task in that target leaf node requires resource preemption and reclamation, the task to be preempted can be determined from the leaf nodes in the tree-like queue model. The target leaf node preempts and reclaims the physical resources occupied by the preempted task, and schedules physical resources for the scheduled task within that target leaf node. Based on the task resource scheduling method provided in this disclosure, during task resource scheduling, if a scheduled task in a target leaf node requires resource preemption and reclamation, the task to be preempted can be determined from the leaf nodes in the tree-like queue model, and the physical resources occupied by the preempted task can be preempted and reclaimed in a timely manner. This reduces the number of tasks accidentally damaged during the preemption and reclamation process and improves the stability of business operations across different business units within the organizational structure.

[0131] In an exemplary embodiment, in the tree queue model, for any path from the root node to each leaf node, there exists a tag node with a private attribute label on the path, and in the subtree with the tag node as the root node, all nodes share a physical resource pool.

[0132] In this embodiment of the disclosure, for departments that require exclusive access to a physical resource pool, a dedicated physical resource pool can be set up for that department, and subordinate departments within that department can share this physical resource pool. In the tree queue model, the node corresponding to the business party can be set as a label node with a private attribute label, that is, physical resource pools can be filtered for each label node in the tree queue model.

[0133] Since lower-level departments allocate resources from their higher-level departments, in the tree queue model, any path from the root node to each leaf node contains only one tag node with a private attribute label. Within the subtree rooted at this tag node, all nodes can share the physical resource pool allocated to that tag node. That is, nodes within this subtree can borrow and preempt physical resources from each other, while nodes outside this subtree cannot borrow or preempt physical resources from nodes within this subtree.

[0134] Reference Figure 3 As shown, if Department 1, Department 2-1, and Department 2-2 each require exclusive resources, then Department 1, Department 2-1, and Department 2-2 can be set as tag nodes with private attribute labels. For Department 1, the subtree rooted at Department 1, its internal nodes (refer to...) Figure 3 The nodes within the dashed box corresponding to the first-level department 1 share the physical resource pool 1 corresponding to the first-level department 1. Similarly, the nodes within the subtree rooted at the second-level department 2-1 share the physical resource pool 2 corresponding to the second-level department 2-1, and the nodes within the subtree rooted at the second-level department 2-2 share the physical resource pool 3 corresponding to the second-level department 2-2.

[0135] It should be noted that, Figure 3 Identification of each node in the middle and Figure 2 The same applies to the embodiments disclosed herein, and will not be repeated here.

[0136] Based on the task resource scheduling method provided in this disclosure, multiple business parties can merge physical resources through the parent node to improve the resource utilization efficiency of the server; and the exclusive use of physical resources by a business party can be achieved through the tag node with private attribute tags. By using the server's physical isolation capability, the fairness of business resource usage can be ensured.

[0137] In an exemplary embodiment, within a subtree rooted at a tag node, each node has a guaranteed resource quota, each child node has an elastic resource quota, and the sum of the guaranteed resource quotas of each child node is the guaranteed resource quota of its parent node.

[0138] Tasks are categorized into high-priority tasks and low-priority tasks. High-priority tasks have a higher priority than low-priority tasks. High-priority tasks cannot be preempted and only occupy the guaranteed resource quota in their respective leaf nodes. The physical resources occupied by high-priority tasks are guaranteed resources. Low-priority tasks can be preempted and occupy elastic resources.

[0139] In this embodiment of the disclosure, within any subtree of the tree queue model rooted at a tag node with a private attribute label, each node has a guaranteed resource quota, and each child node has a flexible resource quota. The guaranteed resource quota is the maximum amount of physical resources a node can allocate from its parent node and can call upon itself, while the flexible resource quota is the maximum amount of physical resources a node can borrow from other nodes (this portion of physical resources is resources that can be preempted and reclaimed). Since child nodes allocate physical resources from their parent nodes, the sum of the guaranteed resource quotas of child nodes of the same parent node within the subtree is equal to the parent node's guaranteed resource quota.

[0140] Reference Figure 4 The subtree shown has Department 1 as its root node, which is a tag node with a private attribute. Therefore, all nodes within the subtree share the same physical resource pool. Each node's guaranteed resource quota is identified as G, and its elastic resource quota is identified as E. Assuming Department 1 receives a guaranteed resource quota of (300 cores, 300G) from its parent node, the elastic resource quota of each node in this subtree is 1 / 3 of its guaranteed quota. Department 1-1 can receive 2 / 3 of the guaranteed resource quota from Department 1, and Department 1-2 can receive 1 / 3 of the guaranteed resource quota from Department 1. That is, Department 1-1's guaranteed resource quota is (200 cores, 200G), and its elastic resource quota is (60 cores, 60G). Department 1-2's guaranteed resource quota is (100 cores, 100G), and its elastic resource quota is (30 cores, 30G).

[0141] Similarly, Business Group 1-1-1 and Business Group 1-1-2 can each allocate half of the guaranteed resource quota from Secondary Department 1-1. That is, Business Group 1-1-1's guaranteed resource quota is (100 cores, 100GB) and its elastic resource quota is (30 cores, 30GB), while Business Group 1-1-2's guaranteed resource quota is (100 cores, 100GB) and its elastic resource quota is (30 cores, 30GB). Business Group 1-2-1 can allocate the entire guaranteed resource quota from Secondary Department 1-2. That is, Business Group 1-2-1's guaranteed resource quota is (100 cores, 100GB) and its elastic resource quota is (30 cores, 30GB).

[0142] It should be noted that, Figure 4 The identifiers for each node can be referred to above. Figure 2 and Figure 3 The embodiments disclosed herein will not be described in detail here.

[0143] In this embodiment of the disclosure, tasks may include high-priority tasks and low-priority tasks, with high-priority tasks having a higher priority than low-priority tasks. The high-priority and low-priority tasks may be further subdivided into priority levels, but this embodiment of the disclosure does not specifically limit this.

[0144] High-priority tasks cannot be preempted; therefore, they cannot be preempted. In other words, high-priority tasks can only occupy the guaranteed resource quota within their respective leaf nodes to ensure that the physical resources they occupy are not preempted or reclaimed. The physical resources occupied by high-priority tasks can be called guaranteed resources. Low-priority tasks can be preempted; therefore, they can occupy the elastic resource quota within their respective leaf nodes, but not the guaranteed resource quota. The physical resources they occupy can be called elastic resources.

[0145] Based on the task resource scheduling method provided in this disclosure, the fairness of resource use among business groups can be guaranteed by ensuring resource quotas, the resource utilization rate within the physical resource pool can be improved by elastic resource quotas, and the stability of the business to which the high-priority task belongs can be guaranteed by ensuring the priority of tasks.

[0146] In one exemplary embodiment, reference is made to Figure 5 As shown, in step 104, for the target leaf node in the tree queue model, if the scheduled tasks in the target leaf node need to be preempted and reclaimed for resources, before determining the tasks to be preempted from each leaf node in the tree queue model, the method may further include:

[0147] In step 502, the remaining resource quota of the target leaf node is determined based on the guaranteed resource quota and elastic resource quota of the target leaf node, as well as the amount of physical resources already occupied by the tasks within the target leaf node.

[0148] In step 504, if the remaining resource quota of the target leaf node meets the physical resource amount requested by the task to be scheduled, but the schedulable physical resource amount does not meet the physical resource amount requested by the task to be scheduled, it is determined that the task to be scheduled needs to preempt resources.

[0149] In this embodiment, the occupancy status of the guaranteed resource quota and elastic resource quota of the target leaf node can be determined based on the amount of physical resources already occupied by the tasks within the target leaf node, thereby determining the remaining resource quota of the target leaf node. Furthermore, based on the remaining resource quota of the target leaf node, it can be determined whether the target leaf node satisfies the physical resources requested by the task to be scheduled. If the remaining resource quota of the target leaf node satisfies the amount of physical resources requested by the task to be scheduled, but the amount of schedulable physical resources within the target leaf node does not satisfy the amount of physical resources requested by the task to be scheduled, it can be determined that the target leaf node can satisfy the physical resources requested by the task to be scheduled through resource preemption and reclamation. Therefore, it can be determined that the task to be scheduled needs to preempt resources in this case.

[0150] If it is determined that the remaining resource quota of the target leaf node meets the physical resource requirement of the task to be scheduled, and the schedulable physical resource requirement also meets the physical resource requirement of the task to be scheduled, then physical resources can be directly scheduled for the task to be scheduled. Alternatively, if it is determined that the remaining resource quota of the target leaf node does not meet the physical resource requirement of the task to be scheduled, it means that the total schedulable and borrowable physical resources of the target leaf node cannot meet the physical resource requirement of the task to be scheduled, and it can be determined that physical resources cannot be scheduled at this time.

[0151] Based on the task resource scheduling method provided in this disclosure, the guaranteed resource quota and elastic resource quota of the target leaf node, as well as the amount of physical resources already occupied by the tasks within the target leaf node, can determine whether the target leaf node can preempt and reclaim physical resources to meet the amount of physical resources requested by the scheduled tasks. This allows the target leaf node to preempt and reclaim physical resources in a timely manner, thereby ensuring the fairness of resource use among nodes to a certain extent.

[0152] In an exemplary embodiment, the remaining resource quota may include the remaining guaranteed resource quota and the total remaining physical resource quota. In step 502, the remaining resource quota of the target leaf node is determined based on the guaranteed resource quota and elastic resource quota of the target leaf node, as well as the amount of physical resources already occupied by the tasks within the target leaf node. This can be achieved through the following steps:

[0153] Based on the amount of guaranteed resources already occupied in the target leaf node and the guaranteed resource quota of the target leaf node, determine the remaining guaranteed resource quota in the target leaf node;

[0154] Based on the physical resources already used by all tasks within the target leaf node, the guaranteed resource quota and elastic resource quota of the target leaf node, determine all remaining resource quotas within the target leaf node.

[0155] In this embodiment of the disclosure, the total resource quota of the target leaf node is the sum of the guaranteed resource quota and the elastic resource quota. The total remaining resource quota is the portion remaining after deducting the occupied portion (the physical resources occupied by all tasks in the target leaf node) from the total resource quota. In other words, the total remaining resource quota is the difference between the total resource quota and the amount of physical resources occupied by all tasks in the target leaf node, where the amount of physical resources occupied by all tasks includes the guaranteed resource amount occupied by high-priority tasks and the elastic resource amount occupied by low-priority tasks.

[0156] The remaining guaranteed resource quota is the portion remaining after deducting the guaranteed resources used by high-priority tasks from the guaranteed resource quota. In other words, the remaining guaranteed resource quota is the difference between the guaranteed resource quota and the guaranteed resources used by high-priority tasks. After determining the remaining guaranteed resource quota and the total remaining resource quota, it can be used to determine whether the tasks to be scheduled need to preempt resources.

[0157] Based on the task resource scheduling method provided in this disclosure, it is possible to determine whether a target leaf node can preempt and reclaim physical resources by using the remaining guaranteed resource quota and all remaining resource quota of the target leaf node, so as to meet the amount of physical resources requested by the task to be scheduled. This allows the target leaf node to preempt and reclaim physical resources in a timely manner, reducing accidental damage to tasks and ensuring the fairness of resource use among nodes to a certain extent.

[0158] In one exemplary embodiment, reference is made to Figure 6 As shown, if the remaining resource quota of the target leaf node meets the physical resource requirement of the task to be scheduled, but the schedulable physical resource requirement does not meet the physical resource requirement of the task to be scheduled, then it is determined that the task to be scheduled needs to preempt resources. This can be achieved through the following steps:

[0159] In step 602, if all remaining resource quotas in the target leaf node meet the amount of physical resources requested by the task to be scheduled, physical resources are scheduled for the task to be scheduled in the target leaf node.

[0160] In step 604, if scheduling fails, it is determined that the amount of physical resources available for scheduling in the target leaf node does not meet the amount of physical resources requested by the task to be scheduled.

[0161] In step 606, it is determined that the task to be scheduled needs to preempt resources.

[0162] In this embodiment of the disclosure, it can be determined whether all remaining resource quotas in the target leaf node meet the physical resource quantity requested by the task to be scheduled. If it is determined that all remaining resource quotas in the target leaf node meet the physical resource quantity requested by the task to be scheduled, it can be determined that the target leaf node has sufficient physical resources available for the task to be scheduled. Then, it can be attempted to schedule physical resources for the task to be scheduled in the target leaf node.

[0163] If scheduling fails at this point, it indicates that the physical resources of the target leaf node have been borrowed by other leaf nodes. Therefore, although the target leaf node has sufficient physical resources available for the scheduled task, the actual available resources are insufficient. Thus, it is necessary to preempt and reclaim the physical resources borrowed by the target leaf node from other leaf nodes for the scheduled task to use. After determining that the scheduled task needs to preempt resources, the resource preemption and reclamation of the target leaf node should be performed.

[0164] Reference Figure 7 As shown, when a user submits a low-priority job to business group B, it can be determined whether the remaining resource quota within the target leaf node corresponding to business group B meets the physical resource requirement requested by the low-priority task. If not, it can be determined that the currently available and borrowable physical resources of the target leaf node do not meet the physical resource requirement requested by the low-priority task, thus it is determined that physical resources cannot be scheduled for the low-priority task. Alternatively, if the resources are available, an attempt can be made to schedule physical resources for the task within the target leaf node. If scheduling fails, it can be determined that a portion of the remaining resource quota of the target leaf node has been lent to other leaf nodes. Therefore, it can be determined that the task needs to preempt resources, and a resource preemption operation will be performed.

[0165] Based on the task resource scheduling method provided in this disclosure, it is possible to determine whether a target leaf node can preempt and reclaim physical resources by using all remaining resource quotas of the target leaf node, so as to meet the amount of physical resources requested by the task to be scheduled. This allows the target leaf node to preempt and reclaim physical resources in a timely manner, alleviating the situation of accidental damage to tasks, and can ensure the fairness of resource use among nodes to a certain extent.

[0166] In one exemplary embodiment, reference is made to Figure 8 As shown, the task to be scheduled is a high-priority task. In step 602, if the remaining resource quota of the target leaf node meets the physical resource amount requested by the task to be scheduled, but the schedulable physical resource amount does not meet the physical resource amount requested by the task to be scheduled, before determining that the task to be scheduled needs to preempt resources, the above method may further include:

[0167] In step 802, if the remaining guaranteed resource quota meets the physical resource quantity requested by the task to be scheduled, but the total remaining resource quota within the target leaf node does not meet the physical resource quantity requested by the task to be scheduled, it is determined that the schedulable physical resource quantity of the target leaf node does not meet the physical resource quantity requested by the task to be scheduled.

[0168] In step 804, it is determined that the task to be scheduled needs to preempt resources.

[0169] In this embodiment of the disclosure, when the task to be scheduled is a high-priority task, since high-priority tasks only occupy the guaranteed resource quota, it can be determined in advance whether the remaining guaranteed resource quota in the target leaf node meets the amount of physical resources requested by the task to be scheduled. If it is determined that the remaining guaranteed resource quota in the target leaf node does not meet the amount of physical resources requested by the task to be scheduled, and the amount of physical resources currently available in the target leaf node cannot meet the amount of physical resources requested by the task to be scheduled, then it is determined that physical resources cannot be scheduled for the task to be scheduled.

[0170] Alternatively, if it is determined that the remaining guaranteed resource quota within the target leaf node meets the physical resource requirement of the task to be scheduled, further investigation is conducted to determine whether all remaining resource quotas within the target leaf node meet the physical resource requirement of the task to be scheduled. If it is determined that all remaining resource quotas within the target leaf node do not meet the physical resource requirement of the task to be scheduled, it can be determined that the task to be scheduled needs to preempt resources. Alternatively, if it is determined that all remaining resource quotas within the target leaf node meet the physical resource requirement of the task to be scheduled, an attempt can be made to schedule resources for the task to be scheduled within the target leaf node. If scheduling fails, it can be determined that the task to be scheduled needs to preempt resources. After determining that the task to be scheduled needs to preempt resources, the resources of the target leaf node are preempted and reclaimed.

[0171] Reference Figure 9 As shown, the current user has submitted a high-priority task job, and the leaf node of this high-priority task job is business group A. The scheduler first determines whether the remaining guaranteed resource quota of the target leaf node corresponding to business group A meets the physical resource requirements requested by the high-priority task job. If not, it is determined that physical resources cannot be scheduled for the high-priority task job; otherwise, it continues to determine whether the total remaining resource quota of the target leaf node meets the physical resource requirements requested by the high-priority task job. If it does, it attempts to schedule resources for the high-priority task within business group A. If scheduling fails, it is determined that the high-priority task job needs to preempt resources. After determining that the high-priority task job needs to preempt resources, a resource preemption and reclamation operation is performed.

[0172] Based on the task resource scheduling method provided in this disclosure, it is possible to determine whether a target leaf node can preempt and reclaim physical resources by using the remaining guaranteed resource quota and all remaining resource quota of the target leaf node, so as to meet the physical resources requested by high-priority tasks. This allows the target leaf node to preempt and reclaim physical resources in a timely manner, alleviates accidental damage to tasks, and ensures the fairness of resource use among nodes to a certain extent.

[0173] In one exemplary embodiment, reference is made to Figure 10As shown, in step 104, the tasks to be preempted are determined from the leaf nodes of the target subtree. This can be achieved through the following steps:

[0174] In step 1002, if there are preemptible tasks in the target leaf node and the remaining resource quota in the target leaf node does not meet the physical resource amount requested by the task to be scheduled, the first preemptible task is determined from the preemptible tasks until there are no preemptible tasks in the target leaf node, or until the physical resource amount available in the target leaf node meets the physical resource amount requested by the task to be scheduled after the physical resource occupied by the first preemptible task is preempted and reclaimed.

[0175] In step 1004, if there is no preemptible task in the target leaf node, a second preemptible task is determined from other leaf nodes in the target subtree.

[0176] In step 1006, the first preemptible task and / or the second preemptible task are designated as preemptible tasks.

[0177] In this embodiment of the disclosure, after determining that the task to be scheduled requires resource preemption, it is necessary to determine whether there are any preemptible tasks within the target leaf node. High-priority tasks can preempt low-priority tasks. Therefore, when the task to be scheduled is a high-priority task, if there are low-priority tasks within the target leaf node, the low-priority tasks can be considered preemptible tasks; when the task to be scheduled is a low-priority task, there are no preemptible tasks within the target leaf node.

[0178] Reference Figure 11 As shown, when the task to be scheduled is a high-priority task and there is a low-priority task in the target leaf node, it is determined whether all remaining resource quotas in the target leaf node meet the physical resource quantity requested by the task to be scheduled. Since the prerequisite for high-priority tasks to preempt resources is that the remaining guaranteed resource quotas meet the physical resource quantity requested by the task to be scheduled, if all remaining resource quotas do not meet the physical resource quantity requested by the task to be scheduled, it can be confirmed that the currently available physical resource quantity in the target leaf node does not meet the physical resource quantity requested by the task to be scheduled. Therefore, it is necessary to preempt the low-priority task in the target leaf node first, that is, mark the low-priority task in the target leaf node as the first task to be preempted.

[0179] Assuming that the physical resources occupied by the first preemptible task have been preempted, the remaining resource quota of the target leaf node is re-determined. If the remaining resource quota does not meet the physical resource requirements of the scheduled task, the first preemptible task is determined from the remaining low-priority tasks in the target leaf node. The above process is repeated until the available physical resources in the target leaf node meet the physical resource requirements of the scheduled task, or until all low-priority tasks in the target leaf node are marked as the first preemptible task.

[0180] In the process of determining the first preemptible task from the preemptible tasks, the preemptible tasks can be sorted according to their priority. The preemptible tasks with lower priority are given priority as the first preemptible task, that is, the physical resources occupied by the lower priority tasks are given priority to preempt. This can ensure the stability of high priority tasks. The embodiments of this disclosure do not make specific limitations on the priority level division method.

[0181] If the amount of physical resources available in the target leaf node meets the amount of physical resources requested by the task to be scheduled, resource scheduling can be performed for the task to be scheduled within the target leaf node.

[0182] If there are no preemptible tasks within the target leaf node (as above: all low-priority tasks have been identified as the first preemptible task, or the task to be scheduled is a low-priority task), then the second preemptible task can be identified from other leaf nodes of the target subtree. After the first preemptible task and / or the second preemptible task are designated as preemptible tasks, resource preemption and reclamation of the preemptible tasks are performed. After the resource preemption and reclamation of the preemptible tasks are completed, resource scheduling is performed for the task to be scheduled within the target child node.

[0183] Based on the task resource scheduling method provided in this disclosure, during the resource preemption and reclamation process, the physical resources occupied by preemptible tasks in the target leaf node can be preempted and reclaimed first. After there are no preemptible tasks in the target leaf node, physical resources can be preempted and reclaimed from other nodes, which can ensure the fairness of resource use among nodes to a certain extent.

[0184] In one exemplary embodiment, reference is made to Figure 12 As shown, in step 1004, the second task to be preempted is determined from the other leaf nodes in the target subtree. This can be achieved through the following steps:

[0185] In step 1202, preemptible leaf nodes are determined from the target subtree;

[0186] In step 1204, after determining the second preemptible task from the preemptible leaf nodes, if the amount of physical resources available for the target leaf node after preempting and reclaiming the physical resources occupied by the second preemptible task is insufficient to meet the amount of physical resources requested by the scheduled task, the step of determining the preemptible leaf node from the target subtree is repeated until the amount of physical resources available for the target leaf node meets the amount of physical resources requested by the scheduled task, thus obtaining at least one second preemptible task.

[0187] In this embodiment of the disclosure, during cross-node preemption, preemptible leaf nodes can be preferentially determined from the leaf nodes of the target subtree. The resource utilization rate of the preemptible leaf node is higher than that of its sibling node, and the resource utilization rate of the parent node of the preemptible leaf node is higher than that of the sibling node of the parent node.

[0188] The lowest priority task is determined from the preemptible leaf nodes and designated as the second preemptible task. For example, the lowest priority tasks can be sorted according to their priority, and then the task with the lowest priority is selected as the second preemptible task. When there are multiple tasks with the lowest priority, the task with the earliest submission time is selected as the second preemptible task.

[0189] After determining the second preemptible task from the preemptible leaf nodes, and after preempting and reclaiming the physical resources occupied by the second preemptible task, it is determined whether the amount of physical resources available in the target leaf node meets the amount of physical resources requested by the task to be scheduled. If not, the process of determining the second preemptible task from the remaining low-priority tasks in the target subtree is repeated until it is determined that the amount of physical resources available in the target leaf node meets the amount of physical resources requested by the task to be scheduled.

[0190] When the amount of physical resources available in the target leaf node meets the amount of physical resources requested by the task to be scheduled, the first task to be preempted and / or the second task to be preempted will be preempted as preempted tasks. After the resources of the preempted tasks are preempted and reclaimed, resources will be scheduled for the task to be scheduled.

[0191] Based on the task resource scheduling method provided in this disclosure, during the resource preemption and reclamation process, tasks to be preempted can be dynamically determined from other leaf nodes based on all remaining resource quotas of the target leaf node. This can ensure the fairness of resource use among nodes and improve the resource utilization rate of the physical resource pool.

[0192] In an exemplary embodiment, step 1004, determining the second preemptible task from other leaf nodes in the target subtree, further includes:

[0193] If the task to be scheduled is a high-priority task, determine a first low-priority task from the preemptible leaf nodes as the second task to be preempted; or...

[0194] If the task to be scheduled is a low-priority task, a second low-priority task is determined from the preemptible leaf nodes as the second preemptible task. After the physical resources occupied by the second low-priority task are preempted and reclaimed, the resource utilization rate of the target leaf node is lower than or equal to the resource utilization rate of the preemptible leaf nodes.

[0195] In this embodiment of the disclosure, when a second preemptible task is determined, if the task to be scheduled is a high-priority task, then each time a first low-priority task can be determined from the preemptible leaf nodes as the second preemptible task. The first low-priority task can be any of the low-priority tasks that can be preempted in the preemptible leaf nodes, or it can be the task with the lowest priority.

[0196] If the task to be scheduled is a low-priority task, then a second low-priority task can be determined from the preemptible leaf nodes as the second task to be preempted. The second low-priority task satisfies the following conditions: after the physical resources occupied by the second low-priority task are reclaimed, the resource utilization rate of the target leaf node is lower than or equal to the resource utilization rate of the preemptible leaf node. When the resource utilization rate of the target leaf node is equal to the resource utilization rate of the preemptible leaf node, the resource utilization rates of both the target leaf node and the preemptible leaf node are 1.

[0197] Based on the task resource scheduling method provided in this disclosure, during the resource preemption and reclamation process, high-priority tasks can preempt low-priority tasks, while low-priority tasks can only preempt low-priority tasks across nodes. When a low-priority task preempts a task across nodes, it can only preempt low-priority tasks in preemptible leaf nodes with a resource utilization rate higher than 1. This ensures that the resource utilization rate of the target leaf node after preemption is lower than or equal to the resource utilization rate of the preemptible leaf node, thereby guaranteeing the fairness of resource use among nodes and improving the resource utilization rate of the physical resource pool.

[0198] In one exemplary embodiment, reference is made to Figure 13 As shown, in step 1202, the preemptible leaf nodes are determined from the target subtree, which can be achieved through the following steps:

[0199] In step 1302, starting from the child node whose parent is the root node of the target subtree, the first target child node is determined from the target subtree;

[0200] In step 1304, the child node with the highest resource utilization rate is determined from the first target child nodes;

[0201] In step 1306, the child node with the highest resource utilization rate as its parent node is taken as the new first target child node. The step of determining the child node with the highest resource utilization rate from the first target child nodes is repeated until the child node with the highest resource utilization rate is a leaf node. The child node with the highest resource utilization rate is then taken as a preemptible leaf node.

[0202] In this embodiment of the disclosure, when it is determined that a task to be scheduled needs to be preempted for resources, it can start from the child node of the root node of the target subtree as the parent node, and determine the child node of the root node as the parent node as the target child node. The resource utilization rate of each target child node is determined, and the child node with the highest resource utilization rate is determined from the target child nodes. The child node with the highest resource utilization rate as the parent node is determined as the new target child node. The process of determining the resource utilization rate of the target child nodes and taking the child node with the highest resource utilization rate as the parent node and its child nodes as the new target child nodes is repeated until the child node with the highest resource utilization rate is determined as a leaf node. The leaf node with the highest resource utilization rate can be taken as a preemptible leaf node, and then the task to be preempted is determined from the preemptible leaf node. The task to be preempted is then preempted and its resources are reclaimed.

[0203] In one example, refer to Figure 14a As shown, assume the root node of the target subtree is Q-label, with a guaranteed resource quota G of (40 cores, 40G). Its child nodes include Q1 and Q2, where the guaranteed resource quota G of both Q1 and Q2 is (20 cores, 20G), and the elastic resource quota E of both is (6 cores, 6G). At this time, Q1 already contains a high-priority task job-1-1, occupying physical resources (10 cores, 10G), a low-priority task job-1-2, occupying physical resources (4 cores, 4G), and a low-priority task job-1-3, occupying physical resources (8 cores, 8G). At this time, Q2 already contains a high-priority task job-2-1, occupying physical resources (10 cores, 10G).

[0204] At this point, a high-priority task, job-2-2, has been submitted for scheduling in Q2, consuming physical resources (10 cores, 10GB). The remaining guaranteed resource quota for Q2 is 20 - 10 = 10, meaning the remaining guaranteed resource quota satisfies the high-priority task job-2-2. Further determining the total remaining resource quota for Q2, we find it to be 20 + 6 - 10 = 16. Since the total remaining resource quota satisfies the high-priority task job-2-2, we can attempt to schedule physical resources for it.

[0205] Since task Q1 occupies 22 physical resources, exceeding its guaranteed resource quota, meaning Q1 borrowed physical resources from Q2, the actual available physical resources for Q2 are lower than those requested by the high-priority task job-2-2. Therefore, scheduling of resources for high-priority task job-2-1 fails, and job-2-2 needs to preempt and reclaim resources. At this point, there are no low-priority tasks in Q2, so cross-node preemption and reclamation are necessary.

[0206] Q1's resource utilization rate is 22 / 20 = 1.1, so Q1 can be preempted and tasks to be preempted can be identified from it. Since the creation time of low-priority task job-1-3 is lower than that of low-priority task job-1-2, job-1-3 can be preempted. After preempting and reclaiming the physical resources occupied by low-priority task job-1-3, that is, after Q2 reclaims the (2 cores, 2G) lent to Q1, the actual schedulable physical resources of Q1 can meet the physical resources requested by high-priority task job-2-2. Therefore, the physical resources occupied by low-priority task job-1-3 can be preempted and high-priority task job-2-2 can be scheduled.

[0207] In another example, refer to Figure 14b As shown, assuming the root node of the target subtree is Q-label, its corresponding guaranteed resource quota G is (400 cores, 400G), and its child nodes include QA, QB and QC, where the child nodes of QA include Q1 and Q2, the child nodes of QB include Q3, and the child nodes of QC include Q4. The guaranteed resource quota G and elastic resource quota E of each node are shown in the figure. The embodiments of this disclosure will not be described in detail here.

[0208] At this point, high-priority task job-1-1, low-priority tasks job-1-2, and low-priority tasks job-1-3 already exist in Q1; high-priority task job-2-1 already exists in Q2; high-priority task job-3-1, low-priority tasks job-3-2, and low-priority tasks job-3-3 already exist in Q3; and high-priority task job-4-1 already exists in Q4. The physical resources occupied by each task are shown in the figure, and will not be described in detail here in this embodiment of the disclosure.

[0209] At this point, a low-priority task, job-4-2, has been submitted for scheduling in Q4, consuming physical resources (10 cores, 10GB). The total remaining resource quota for Q4 is 130 - 90 = 40, meaning the total remaining resource quota is sufficient for job-4-2. Therefore, we can attempt to schedule physical resources for job-4-2.

[0210] The scheduling failure indicates that a node is borrowing the physical resources of Q4. Therefore, cross-node resource preemption and reclamation are needed for the low-priority task job-4-2. Starting with QA and QB, determine their resource utilization rates. The resource utilization rate in node QB is 125 / 100 = 1.25, and the resource utilization rate in node QA is 180 / 200 = 0.9. Since the resource utilization rate of QA is less than 1, the low-priority task in QA cannot be preempted, thus QB is determined to be a preemptible node. Further determine the resource utilization rates of QB's child nodes. Since QB has only one child node Q3, and Q3 is a leaf node, Q3 can be determined as a node to be scheduled.

[0211] The tasks to be preempted can be identified from Q3. Since the creation time of low-priority task job-3-3 is lower than that of low-priority task job-3-2, and if low-priority task job-4-2 preempts and reclaims the physical resources of low-priority task job-3-3, the resource utilization rate of Q4 will be 1.0, which is lower than the resource utilization rate of Q3 (1.1). Therefore, low-priority task job-3-3 can be considered as a preemptible task at this time. After the physical resources occupied by low-priority task job-3-3 are preempted and reclaimed, that is, after Q4 reclaims the (10 cores, 10G) lent to Q2, the actual schedulable physical resources of Q4 can meet the physical resources requested by high-priority task job-4-2. Therefore, the physical resources occupied by low-priority task job-3-3 can be preempted and reclaimed, and physical resources can be scheduled for high-priority task job-4-2.

[0212] Based on the task resource scheduling method provided in this disclosure, during the resource preemption and reclamation process, it can start from the child node of the root node of the target subtree, and determine the node with the highest resource utilization rate by layer-by-layer determination, determine the preemptible node, and then preempt and reclaim resources from the preemptible node. This can ensure the fairness of resource use among nodes and improve the resource utilization rate of the physical resource pool.

[0213] In one exemplary embodiment, reference is made to Figure 15 As shown, in step 104, for the target leaf node in the tree queue model, if the scheduled tasks in the target leaf node need to be preempted and reclaimed for resources, before determining the tasks to be preempted from each leaf node in the tree queue model, the above method may further include:

[0214] In step 1502, for any subtree rooted at a tag node with a private attribute label, the subtree is determined as the target subtree;

[0215] In step 1504, starting from the child node whose parent is the root node of the target subtree, the second target child node is determined from the target subtree;

[0216] In step 1506, the child node with the lowest resource utilization rate is determined from the second target child nodes;

[0217] In step 1508, the child node with the lowest resource utilization rate as its parent node is taken as the new second target child node. The step of determining the child node with the lowest resource utilization rate from the target child nodes is repeated until the child node with the lowest resource utilization rate is a leaf node. The child node with the lowest resource utilization rate is then taken as the target leaf node.

[0218] In step 1510, the task with the highest priority and earliest submission time among the tasks to be called in the target leaf node is identified as the task to be scheduled.

[0219] In this embodiment of the disclosure, when the subtree resources of the exclusive physical resource pool are sufficient, the task to be scheduled can be determined and resource scheduling can be performed for it. Task resource scheduling can be performed in parallel between subtrees. This embodiment of the disclosure will not elaborate further. Taking the task resource scheduling process of a subtree as an example, this embodiment of the disclosure will be described. Hereinafter, the subtree is referred to as the target subtree.

[0220] For the target subtree, a breadth-first traversal is performed starting from the root node, prioritizing the node with the lowest resource utilization. If this node is not a leaf node, the process continues, selecting the node with the lowest utilization from its child nodes until a leaf node is selected. This leaf node is then designated as the target leaf node. Within the target leaf node, tasks are sorted by priority from highest to lowest, and tasks with the same priority are sorted by creation time from earliest to latest. Tasks with higher priority and earlier creation time are selected as the tasks to be invoked, and resource scheduling is performed for these tasks.

[0221] Based on the task resource scheduling method provided in this disclosure, before resource preemption and reclamation, during the resource scheduling process, it is possible to start from the child node of the root node of the target subtree, determine the node with the lowest resource utilization rate layer by layer, determine the target leaf node, and then perform task resource scheduling on the target leaf node. This can ensure the fairness of resource use among nodes and improve the resource utilization rate of the physical resource pool.

[0222] The task resource scheduling method provided in this disclosure uses the following selection rule for tasks to be scheduled: Starting from the root node of the target subtree, a breadth-first traversal is performed, prioritizing the node with the lowest resource utilization. This process continues, selecting the node with the lowest resource utilization from its child nodes, until a leaf node is reached. The leaf node with the lowest resource utilization is then selected as the target leaf node. Tasks within the target leaf node are sorted by priority from highest to lowest. If priorities are the same, they are sorted by submission time, and the task with the highest priority and earliest submission time is selected as the task to be scheduled.

[0223] When preempting resources, the selection logic for preemptible leaf nodes includes: starting from the root node of the target subtree, performing a depth-first traversal, prioritizing the node with the highest resource utilization, and then further selecting the node with the highest resource utilization from its child nodes, until a leaf node is reached. The leaf node with the highest resource utilization is selected as the preemptible leaf node. Tasks within the preemptible leaf node are sorted in ascending order of priority. If priorities are the same, they are sorted by submission time, selecting tasks with lower priority and earlier submission as the tasks to be preempted.

[0224] When the target leaf node lacks sufficient resources, cross-node preemption is required to reclaim resources. For subtrees that exclusively occupy the physical resource pool, reclamation can be performed in parallel. High-priority tasks cannot be preempted; as long as the remaining guaranteed resource quota within the target leaf node is sufficient, physical resource scheduling can be attempted for it. Low-priority tasks can be preempted; as long as all remaining resource quotas and remaining physical resources are sufficient, scheduling can be attempted for them. Low-priority tasks can preempt resources elastically borrowed from other sibling nodes across queues.

[0225] When preempting and reclaiming resources, it is necessary to determine whether the remaining resource quota of the target leaf node is sufficient. If it is insufficient, it is necessary to determine whether there are any preemptible tasks within the target leaf node. If so, the preemptible task can be designated as a task to be preempted. This ensures that the total resource quota of the target leaf node will not exceed the limit after preemption.

[0226] In this embodiment of the disclosure, preemption is based on the job level. If the scheduler determines that preempting the job to be preempted can meet the resource requirements of some of the scheduled tasks, then the entire job to be preempted will be preempted, including all instances of the job to be preempted.

[0227] During cross-node preemption, high-priority tasks in the target leaf node can preempt low-priority tasks within the same node; low-priority tasks on nodes whose occupied physical resources do not exceed the guaranteed resource quota are not allowed to be preempted by tasks on other nodes; high-priority tasks can preempt low-priority tasks on nodes whose occupied physical resources exceed the guaranteed resource quota; cross-node preemption of low-priority tasks requires that, after preemption, the resource utilization rate of the target leaf node is lower than the resource utilization rate of the node where the task to be preempted is located.

[0228] The task resource allocation method provided in this disclosure, using a tree-queue model, can maximally meet the management needs of various business resources under complex enterprise organizational structures. It can utilize server physical isolation capabilities to fully ensure the fairness of business resource usage, and also leverage the resource quota capabilities of merged servers to improve server resource utilization. Furthermore, based on the FairShare scheduling algorithm, it can guarantee the fairness of resource usage among business groups that have chosen resource merging while ensuring resource utilization. In addition, this disclosure's AI job-level resource preemption and reclamation method allows business parties that have chosen resource merging to promptly reclaim their borrowed resources. This also minimizes the impact on tasks of the preempted party while ensuring timely resource reclamation, thus guaranteeing task stability and ensuring a certain degree of resource utilization.

[0229] It should be understood that, although Figures 1-15The steps in the flowchart are shown sequentially as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order in which these steps are executed, and they can be performed in other orders. Figures 1-15 At least some of the steps in the process may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but may be executed at different times. The execution order of these steps or stages is not necessarily sequential, but may be executed in turn or alternately with other steps or at least some of the steps or stages in other steps.

[0230] It is understood that the same / similar parts between the various embodiments of the methods described above in this specification can be referred to each other. Each embodiment focuses on the differences from other embodiments, and relevant parts can be referred to the description of other method embodiments.

[0231] Figure 16 This is a block diagram illustrating a task resource scheduling apparatus according to an exemplary embodiment. (Refer to...) Figure 16 The device includes a construction unit 1602, a first determination unit 1604, and a preemption unit 1606.

[0232] The construction unit 1602 is configured to execute the construction of a tree queue model, in which the parent node is used to manage the physical resources of the child nodes, each child node is allocated physical resources from its parent node, and the task belongs to the leaf node in the tree queue model.

[0233] The first determining unit 1604 is configured to determine the tasks to be preempted from each of the leaf nodes in the tree queue model when the scheduled tasks in the target leaf node need to be preempted and reclaimed.

[0234] The preemption unit 1606 is configured to preempt and reclaim the physical resources occupied by the task to be preempted in the target leaf node, and to schedule physical resources for the task to be scheduled in the target leaf node.

[0235] The task resource scheduling device provided in this disclosure can construct a tree-shaped queue model. In this model, parent nodes manage the physical resources of child nodes, and each child node allocates physical resources from its parent node. Tasks belong to leaf nodes in the tree-shaped queue model. When a scheduled task in a target leaf node requires resource preemption and reclamation, the task to be preempted can be determined from the leaf nodes in the tree-shaped queue model. The target leaf node preempts and reclaims the physical resources occupied by the preempted task, and schedules physical resources for the scheduled task within the target leaf node. Based on the task resource scheduling device provided in this disclosure, during task resource scheduling, if a scheduled task in a target leaf node requires resource preemption and reclamation, the task to be preempted can be determined from the leaf nodes in the tree-shaped queue model, and the physical resources occupied by the preempted task can be promptly preempted and reclaimed. This reduces the number of tasks accidentally damaged during the preemption and reclamation process and improves the stability of business operations across different business units within the organizational structure.

[0236] In one embodiment, in the tree queue model, for any path from the root node to each of the leaf nodes, there exists a tag node with a private attribute label on the path, and in the subtree rooted at the tag node, all nodes share a physical resource pool.

[0237] In one embodiment, within the subtree rooted at the tag node, each node has a guaranteed resource quota, each child node has a flexible resource quota, and the sum of the guaranteed resource quotas of all the child nodes is the guaranteed resource quota of its parent node.

[0238] The tasks include high-priority tasks and low-priority tasks. High-priority tasks have a higher priority than low-priority tasks. High-priority tasks only occupy the guaranteed resource quota in their respective leaf nodes. The physical resources occupied by high-priority tasks are guaranteed resources, while the physical resources occupied by low-priority tasks are elastic resources.

[0239] In one embodiment, prior to the first determining unit, the apparatus further includes:

[0240] The second determining unit is configured to determine the remaining resource quota of the target leaf node based on the guaranteed resource quota and the elastic resource quota of the target leaf node, as well as the amount of physical resources already occupied by the tasks within the target leaf node.

[0241] The third determining unit is configured to determine that the task to be scheduled needs to preempt resources when the remaining resource quota of the target leaf node meets the amount of physical resources requested by the task to be scheduled, but the amount of schedulable physical resources does not meet the amount of physical resources requested by the task to be scheduled.

[0242] In one embodiment, the remaining resource quota includes the remaining guaranteed resource quota and the total remaining physical resource quota, and the second determining unit is further configured to perform:

[0243] Based on the amount of guaranteed resources already occupied in the target leaf node and the guaranteed resource quota of the target leaf node, determine the remaining guaranteed resource quota in the target leaf node;

[0244] Based on the physical resource amount already occupied by all tasks within the target leaf node, the guaranteed resource quota and the elastic resource quota of the target leaf node, determine all remaining resource quotas within the target leaf node.

[0245] In one embodiment, the first determining unit is further configured to perform:

[0246] If all remaining resource quotas within the target leaf node meet the physical resource requirements of the task to be scheduled, then physical resources are scheduled for the task to be scheduled within the target leaf node.

[0247] In the event of scheduling failure, it is determined that the amount of physical resources available for scheduling in the target leaf node does not meet the amount of physical resources requested by the task to be scheduled.

[0248] It has been determined that the task to be scheduled requires resource preemption.

[0249] In one embodiment, the task to be scheduled is a high-priority task, and the first determining unit is further configured to execute:

[0250] If the remaining guaranteed resource quota meets the physical resource quantity requested by the task to be scheduled, but the total remaining resource quota in the target leaf node does not meet the physical resource quantity requested by the task to be scheduled, then it is determined that the schedulable physical resource quantity of the target leaf node does not meet the physical resource quantity requested by the task to be scheduled.

[0251] It has been determined that the task to be scheduled requires resource preemption.

[0252] In one embodiment, the first determining unit is further configured to perform:

[0253] If there are preemptible tasks in the target leaf node, and the remaining resource quota in the target leaf node does not meet the physical resource quantity requested by the task to be scheduled, a first preemptible task is determined from the preemptible tasks until there are no preemptible tasks in the target leaf node, or until the physical resource quantity available in the target leaf node meets the physical resource quantity requested by the task to be scheduled after the physical resource occupied by the first preemptible task is preempted and reclaimed.

[0254] If there is no preemptible task at the target leaf node, a second preemptible task is determined from other leaf nodes in the target subtree.

[0255] The first task to be preempted and / or the second task to be preempted are designated as tasks to be preempted.

[0256] In one embodiment, if the task to be scheduled is a high-priority task, then the low-priority task within the target leaf node is the preemptible task.

[0257] In one embodiment, the first determining unit is further configured to perform:

[0258] Identify the preemptible leaf nodes from the target subtree;

[0259] After determining the second preemptible task from the preemptible leaf nodes, if the amount of physical resources available for the target leaf node after preempting and reclaiming the physical resources occupied by the second preemptible task is insufficient to meet the amount of physical resources requested by the scheduled task, the step of determining the preemptible leaf node from the target subtree is repeated until the amount of physical resources available for the target leaf node meets the amount of physical resources requested by the scheduled task, thus obtaining at least one second preemptible task.

[0260] In one embodiment, the first determining unit is further configured to perform:

[0261] If the task to be scheduled is a high-priority task, a first low-priority task is determined from the preemptible leaf nodes as the second task to be preempted; or...

[0262] When the task to be scheduled is a low-priority task, a second low-priority task is determined from the preemptible leaf nodes as the second preemptible task. After the physical resources occupied by the second low-priority task are preempted and reclaimed, the resource utilization rate of the target leaf node is lower than or equal to the resource utilization rate of the preemptible leaf node.

[0263] In one embodiment, the first determining unit is further configured to perform:

[0264] Starting from the child node whose parent is the root node of the target subtree, determine the first target child node from the target subtree;

[0265] Identify the child node with the highest resource utilization rate from the first target child node;

[0266] The child node with the highest resource utilization rate as its parent node is taken as the new first target child node. The step of determining the child node with the highest resource utilization rate from the first target child node is repeated until the child node with the highest resource utilization rate is a leaf node. The child node with the highest resource utilization rate is then taken as a preemptible leaf node.

[0267] In one embodiment, prior to the first determining unit, the apparatus further includes:

[0268] The fourth determining unit is configured to perform the following: for any subtree rooted at a tag node with a private attribute label, determine the subtree as the target subtree;

[0269] The fifth determining unit is configured to determine a second target child node from the target subtree, starting from the child node whose parent node is the root node of the target subtree;

[0270] The sixth determining unit is configured to determine the child node with the lowest resource utilization rate from the second target child nodes;

[0271] The seventh determining unit is configured to execute the step of determining the child node with the lowest resource utilization rate as its parent node as the new second target child node, repeating the step of determining the child node with the lowest resource utilization rate from the target child nodes until the child node with the lowest resource utilization rate is a leaf node, and then taking the child node with the lowest resource utilization rate as the target leaf node.

[0272] The eighth determining unit is configured to determine the task with the highest priority and earliest submission time among the tasks to be called within the target leaf node as the task to be scheduled.

[0273] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0274] Figure 17 This is a block diagram illustrating an electronic device 1700 for a task resource scheduling method according to an exemplary embodiment. For example, the electronic device 1700 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.

[0275] Reference Figure 17 The electronic device 1700 may include one or more of the following components: a processing component 1702, a memory 1704, a power supply component 1706, a multimedia component 1708, an audio component 1710, an input / output (I / O) interface 1712, a sensor component 1714, and a communication component 1716.

[0276] Processing component 1702 typically controls the overall operation of electronic device 1700, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 1702 may include one or more processors 1720 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 1702 may include one or more modules to facilitate interaction between processing component 1702 and other components. For example, processing component 1702 may include a multimedia module to facilitate interaction between multimedia component 1708 and processing component 1702.

[0277] Memory 1704 is configured to store various types of data to support the operation of electronic device 1700. Examples of such data include instructions for any application or method operating on electronic device 1700, contact data, phonebook data, messages, pictures, videos, etc. Memory 1704 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, optical disk, or graphene memory.

[0278] Power supply component 1706 provides power to various components of electronic device 1700. Power supply component 1706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 1700.

[0279] Multimedia component 1708 includes a screen that provides an output interface between the electronic device 1700 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 1708 includes a front-facing camera and / or a rear-facing camera. When the electronic device 1700 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.

[0280] Audio component 1710 is configured to output and / or input audio signals. For example, audio component 1710 includes a microphone (MIC) configured to receive external audio signals when electronic device 1700 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 1704 or transmitted via communication component 1716. In some embodiments, audio component 1710 also includes a speaker for outputting audio signals.

[0281] I / O interface 1712 provides an interface between processing component 1702 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.

[0282] Sensor assembly 1714 includes one or more sensors for providing state assessments of various aspects of electronic device 1700. For example, sensor assembly 1714 may detect the on / off state of electronic device 1700, the relative positioning of components such as the display and keypad of electronic device 1700, changes in position of electronic device 1700 or its components, the presence or absence of user contact with electronic device 1700, orientation or acceleration / deceleration of device 1700, and temperature changes of electronic device 1700. Sensor assembly 1714 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 1714 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 1714 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.

[0283] Communication component 1716 is configured to facilitate wired or wireless communication between electronic device 1700 and other devices. Electronic device 1700 can access wireless networks based on communication standards, such as WiFi, carrier networks (such as 2G, 3G, 4G, or 5G), or combinations thereof. In one exemplary embodiment, communication component 1716 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 1716 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.

[0284] In an exemplary embodiment, the electronic device 1700 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.

[0285] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 1704 including instructions, which can be executed by a processor 1720 of an electronic device 1700 to perform the above-described method. For example, the computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.

[0286] In an exemplary embodiment, a computer program product is also provided, the computer program product including instructions that can be executed by a processor 1720 of an electronic device 1700 to perform the above-described method.

[0287] It should be noted that the above-mentioned apparatus, electronic equipment, computer-readable storage medium, computer program product, etc., may also include other implementation methods according to the description of the method embodiments. For specific implementation methods, please refer to the description of the relevant method embodiments, which will not be elaborated here.

[0288] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the claims.

[0289] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.

Claims

1. A task resource scheduling method, characterized in that, include: A tree-shaped queue model is constructed, in which the parent node is used to manage the physical resources of the child nodes, each child node is allocated physical resources from its parent node, and tasks belong to the leaf nodes in the tree-shaped queue model. For a target leaf node in the tree queue model, if the scheduled tasks in the target leaf node need to be preempted and reclaimed, the tasks to be preempted are determined from each leaf node in the tree queue model. The scheduled tasks are AI tasks. Specifically, if it is determined that the target leaf node has borrowed physical resources from other leaf nodes, the remaining available physical resources do not meet the physical resources requested by the scheduled task, and after the borrowed physical resources are preempted and reclaimed, the available physical resources of the target leaf node can meet the physical resources requested by the scheduled task, then it is determined that the scheduled task needs to be preempted and reclaimed. The physical resources occupied by each task in the leaf node where the preempted task is located exceed the physical resources that the leaf node can call. The target leaf node preempts and reclaims the physical resources occupied by the task to be preempted, and schedules physical resources for the task to be scheduled in the target leaf node; In the tree-shaped queue model, for any path from the root node to each of the leaf nodes, there exists a tag node with a private attribute label on the path. In the subtree rooted at the tag node, all nodes share a physical resource pool, and the target subtree is the subtree rooted at the tag node with the private attribute label.

2. The method according to claim 1, characterized in that, Within the subtree rooted at the tag node, each node has a guaranteed resource quota, each child node has a flexible resource quota, and the sum of the guaranteed resource quotas of all the child nodes is the guaranteed resource quota of its parent node. The tasks include high-priority tasks and low-priority tasks. High-priority tasks have a higher priority than low-priority tasks. High-priority tasks only occupy the guaranteed resource quota in their respective leaf nodes. The physical resources occupied by high-priority tasks are guaranteed resources, while the physical resources occupied by low-priority tasks are elastic resources.

3. The method according to claim 2, characterized in that, Before determining the tasks to be preempted from each leaf node in the tree queue model, when the scheduled tasks in the target leaf node require resource preemption and reclamation, the method further includes: The remaining resource quota of the target leaf node is determined based on the guaranteed resource quota and the elastic resource quota of the target leaf node, as well as the amount of physical resources already occupied by the tasks within the target leaf node. If the remaining resource quota of the target leaf node meets the physical resource quantity requested by the task to be scheduled, but the schedulable physical resource quantity does not meet the physical resource quantity requested by the task to be scheduled, then it is determined that the task to be scheduled needs to preempt resources.

4. The method according to claim 3, characterized in that, The remaining resource quota includes the remaining guaranteed resource quota and the total remaining physical resource quota. Determining the remaining resource quota of the target leaf node based on the guaranteed resource quota and the elastic resource quota of the target leaf node, as well as the amount of physical resources already occupied by tasks within the target leaf node, includes: Based on the amount of guaranteed resources already occupied in the target leaf node and the guaranteed resource quota of the target leaf node, determine the remaining guaranteed resource quota in the target leaf node; Based on the physical resource amount already occupied by all tasks within the target leaf node, the guaranteed resource quota and the elastic resource quota of the target leaf node, determine all remaining resource quotas within the target leaf node.

5. The method according to claim 4, characterized in that, When the remaining resource quota at the target leaf node meets the physical resource quantity requested by the task to be scheduled, but the schedulable physical resource quantity does not meet the physical resource quantity requested by the task to be scheduled, determining that the task to be scheduled needs to preempt resources includes: If all remaining resource quotas within the target leaf node meet the physical resource requirements of the task to be scheduled, then physical resources are scheduled for the task to be scheduled within the target leaf node. In the event of scheduling failure, it is determined that the amount of physical resources available for scheduling in the target leaf node does not meet the amount of physical resources requested by the task to be scheduled. It has been determined that the task to be scheduled requires resource preemption.

6. The method according to claim 5, characterized in that, The task to be scheduled is a high-priority task. Before determining that the task to be scheduled needs to preempt resources when the remaining resource quota of the target leaf node meets the physical resource requirement requested by the task to be scheduled, but the schedulable physical resource requirement does not meet the physical resource requirement requested by the task to be scheduled, the method further includes: If the remaining guaranteed resource quota meets the physical resource quantity requested by the task to be scheduled, but the total remaining resource quota in the target leaf node does not meet the physical resource quantity requested by the task to be scheduled, then it is determined that the schedulable physical resource quantity of the target leaf node does not meet the physical resource quantity requested by the task to be scheduled. It has been determined that the task to be scheduled requires resource preemption.

7. The method according to claim 2, characterized in that, The step of determining the task to be preempted from each of the leaf nodes in the tree queue model includes: If there are preemptible tasks in the target leaf node, and the remaining resource quota in the target leaf node does not meet the physical resource quantity requested by the task to be scheduled, a first preemptible task is determined from the preemptible tasks until there are no preemptible tasks in the target leaf node, or until the physical resource quantity available in the target leaf node meets the physical resource quantity requested by the task to be scheduled after the physical resource occupied by the first preemptible task is preempted and reclaimed. If there is no preemptible task at the target leaf node, a second preemptible task is determined from other leaf nodes in the target subtree. The first task to be preempted and / or the second task to be preempted are designated as tasks to be preempted. Wherein, if the task to be scheduled is a high-priority task, the low-priority task within the target leaf node is the preemptible task.

8. The method according to claim 6, characterized in that, The step of determining the second preemptible task from other leaf nodes in the target subtree includes: Identify the preemptible leaf nodes from the target subtree; After determining the second preemptible task from the preemptible leaf nodes, if the amount of physical resources available for the target leaf node after preempting and reclaiming the physical resources occupied by the second preemptible task is insufficient to meet the amount of physical resources requested by the scheduled task, the step of determining the preemptible leaf node from the target subtree is repeated until the amount of physical resources available for the target leaf node meets the amount of physical resources requested by the scheduled task, thus obtaining at least one second preemptible task.

9. The method according to claim 8, characterized in that, The step of determining the second task to be preempted from other leaf nodes in the target subtree further includes: If the task to be scheduled is a high-priority task, a first low-priority task is determined from the preemptible leaf nodes as the second task to be preempted; or... When the task to be scheduled is a low-priority task, a second low-priority task is determined from the preemptible leaf nodes as the second preemptible task. After the physical resources occupied by the second low-priority task are preempted and reclaimed, the resource utilization rate of the target leaf node is lower than or equal to the resource utilization rate of the preemptible leaf node.

10. The method according to claim 8 or 9, characterized in that, The step of determining the preemptible leaf node from the target subtree includes: Starting from the child node whose parent is the root node of the target subtree, determine the first target child node from the target subtree; Identify the child node with the highest resource utilization rate from the first target child node; The child node with the highest resource utilization rate as its parent node is taken as the new first target child node. The step of determining the child node with the highest resource utilization rate from the first target child node is repeated until the child node with the highest resource utilization rate is a leaf node. The child node with the highest resource utilization rate is then taken as a preemptible leaf node.

11. The method according to claim 1, characterized in that, Before determining the tasks to be preempted from each leaf node in the tree queue model, when the scheduled tasks in the target leaf node require resource preemption and reclamation, the method further includes: Starting from the child node whose parent is the root node of the target subtree, determine the second target child node from the target subtree; Identify the child node with the lowest resource utilization rate from the second target child nodes; The child node with the lowest resource utilization rate as its parent node is taken as the new second target child node. The step of determining the child node with the lowest resource utilization rate from the target child nodes is repeated until the child node with the lowest resource utilization rate is a leaf node. The child node with the lowest resource utilization rate is then taken as the target leaf node. The task with the highest priority and earliest submission time among the tasks to be called within the target leaf node is identified as the task to be scheduled.

12. A task resource scheduling device, characterized in that, include: The building unit is configured to build a tree queue model, in which the parent node manages the physical resources of the child nodes, each child node is allocated physical resources from its parent node, and tasks belong to the leaf nodes in the tree queue model. The first determining unit is configured to perform resource preemption and reclamation on a target leaf node in the tree queue model. When the scheduled tasks in the target leaf node require resource preemption and reclamation, the unit determines the tasks to be preempted from each leaf node in the tree queue model. The scheduled tasks are AI tasks. Specifically, if it is determined that the target leaf node has already borrowed physical resources from other leaf nodes, the remaining available physical resources do not meet the physical resource requirements of the scheduled task, and after preemption and reclamation of the borrowed physical resources, the available physical resources of the target leaf node can meet the physical resource requirements of the scheduled task, then it is determined that the scheduled task requires resource preemption and reclamation. The physical resources occupied by each task in the leaf node containing the scheduled task exceed the physical resources that the leaf node can call. The preemption unit is configured to preempt and reclaim the physical resources occupied by the task to be preempted in the target leaf node, and to schedule physical resources for the task to be scheduled in the target leaf node. In the tree-shaped queue model, for any path from the root node to each of the leaf nodes, there exists a tag node with a private attribute label on the path. In the subtree rooted at the tag node, all nodes share a physical resource pool, and the target subtree is the subtree rooted at the tag node with the private attribute label.

13. The apparatus according to claim 12, characterized in that, Within the subtree rooted at the tag node, each node has a guaranteed resource quota, each child node has a flexible resource quota, and the sum of the guaranteed resource quotas of all the child nodes is the guaranteed resource quota of its parent node. The tasks include high-priority tasks and low-priority tasks. High-priority tasks have a higher priority than low-priority tasks. High-priority tasks only occupy the guaranteed resource quota in their respective leaf nodes. The physical resources occupied by high-priority tasks are guaranteed resources, while the physical resources occupied by low-priority tasks are elastic resources.

14. The apparatus according to claim 13, characterized in that, Prior to the first determining unit, the device further includes: The second determining unit is configured to determine the remaining resource quota of the target leaf node based on the guaranteed resource quota and the elastic resource quota of the target leaf node, as well as the amount of physical resources already occupied by the tasks within the target leaf node. The third determining unit is configured to determine that the task to be scheduled needs to preempt resources when the remaining resource quota of the target leaf node meets the amount of physical resources requested by the task to be scheduled, but the amount of schedulable physical resources does not meet the amount of physical resources requested by the task to be scheduled.

15. The apparatus according to claim 14, characterized in that, The remaining resource quota includes the remaining guaranteed resource quota and the total remaining physical resource quota. The second determining unit is further configured to perform: Based on the amount of guaranteed resources already occupied in the target leaf node and the guaranteed resource quota of the target leaf node, determine the remaining guaranteed resource quota in the target leaf node; Based on the physical resource amount already occupied by all tasks within the target leaf node, the guaranteed resource quota and the elastic resource quota of the target leaf node, determine all remaining resource quotas within the target leaf node.

16. The apparatus according to claim 15, characterized in that, The first determining unit is also configured to execute: If all remaining resource quotas within the target leaf node meet the physical resource requirements of the task to be scheduled, then physical resources are scheduled for the task to be scheduled within the target leaf node. In the event of scheduling failure, it is determined that the amount of physical resources available for scheduling in the target leaf node does not meet the amount of physical resources requested by the task to be scheduled. It has been determined that the task to be scheduled requires resource preemption.

17. The apparatus according to claim 16, characterized in that, The task to be scheduled is a high-priority task, and the first determining unit is further configured to execute: If the remaining guaranteed resource quota meets the physical resource quantity requested by the task to be scheduled, but the total remaining resource quota in the target leaf node does not meet the physical resource quantity requested by the task to be scheduled, then it is determined that the schedulable physical resource quantity of the target leaf node does not meet the physical resource quantity requested by the task to be scheduled. It has been determined that the task to be scheduled requires resource preemption.

18. The apparatus according to claim 13, characterized in that, The first determining unit is also configured to execute: If there are preemptible tasks in the target leaf node, and the remaining resource quota in the target leaf node does not meet the physical resource quantity requested by the task to be scheduled, a first preemptible task is determined from the preemptible tasks until there are no preemptible tasks in the target leaf node, or until the available physical resources in the target leaf node meet the physical resource quantity requested by the task to be scheduled after the physical resources occupied by the first preemptible task are preempted and reclaimed. If there is no preemptible task at the target leaf node, a second preemptible task is determined from other leaf nodes in the target subtree. The first task to be preempted and / or the second task to be preempted are designated as tasks to be preempted. Wherein, if the task to be scheduled is a high-priority task, the low-priority task within the target leaf node is the preemptible task.

19. The apparatus according to claim 17, characterized in that, The first determining unit is also configured to execute: Identify the preemptible leaf nodes from the target subtree; After determining the second preemptible task from the preemptible leaf nodes, if the amount of physical resources available for the target leaf node after preempting and reclaiming the physical resources occupied by the second preemptible task is insufficient to meet the amount of physical resources requested by the scheduled task, the step of determining the preemptible leaf node from the target subtree is repeated until the amount of physical resources available for the target leaf node meets the amount of physical resources requested by the scheduled task, thus obtaining at least one second preemptible task.

20. The apparatus according to claim 19, characterized in that, The first determining unit is also configured to execute: If the task to be scheduled is a high-priority task, a first low-priority task is determined from the preemptible leaf nodes as the second task to be preempted; or... When the task to be scheduled is a low-priority task, a second low-priority task is determined from the preemptible leaf nodes as the second preemptible task. After the physical resources occupied by the second low-priority task are preempted and reclaimed, the resource utilization rate of the target leaf node is lower than or equal to the resource utilization rate of the preemptible leaf node.

21. The apparatus according to claim 19 or 20, characterized in that, The first determining unit is also configured to execute: Starting from the child node whose parent is the root node of the target subtree, determine the first target child node from the target subtree; Identify the child node with the highest resource utilization rate from the first target child node; The child node with the highest resource utilization rate as its parent node is taken as the new first target child node. The step of determining the child node with the highest resource utilization rate from the first target child node is repeated until the child node with the highest resource utilization rate is a leaf node. The child node with the highest resource utilization rate is then taken as a preemptible leaf node.

22. The apparatus according to claim 12, characterized in that, Prior to the first determining unit, the device further includes: The fifth determining unit is configured to determine a second target child node from the target subtree, starting from the child node whose parent node is the root node of the target subtree; The sixth determining unit is configured to determine the child node with the lowest resource utilization rate from the second target child nodes; The seventh determining unit is configured to execute the step of determining the child node with the lowest resource utilization rate as its parent node as the new second target child node, repeating the step of determining the child node with the lowest resource utilization rate from the target child nodes until the child node with the lowest resource utilization rate is a leaf node, and then taking the child node with the lowest resource utilization rate as the target leaf node. The eighth determining unit is configured to determine the task with the highest priority and earliest submission time among the tasks to be called within the target leaf node as the task to be scheduled.

23. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute the instructions to implement the task resource scheduling method as described in any one of claims 1 to 11.

24. A computer-readable storage medium, characterized in that, When the instructions in the computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform the task resource scheduling method as described in any one of claims 1 to 11.

25. A computer program product, the computer program product comprising instructions, characterized in that, When the instruction is executed by the processor of the electronic device, the electronic device is able to perform the task resource scheduling method as described in any one of claims 1 to 11.