A resource scheduling method, apparatus, device, and storage medium

By obtaining the resource request for the task with the highest priority on the cloud platform, determining the earliest node to be executed and allocating resources, the problems of low resource utilization and scheduling efficiency in the existing technology are solved, and efficient resource scheduling is achieved.

CN114518945BActive Publication Date: 2025-07-29GUANGZHOU WERIDE TECH LTD CO
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111683501.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-07-29
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

The existing cloud platform resource scheduling methods lead to a decrease in overall resource utilization and scheduling efficiency when handling tasks of different priorities.

Method used

By obtaining the task with the highest priority from the resource request queue, obtaining a resource snapshot of the node collection, determining the node that can perform the task at the earliest, and removing it from the node collection, and processing resource requests in the queue in turn.

Benefits of technology

It improves timely response to high-priority tasks, improves resource utilization and scheduling efficiency, and meets resource requests for different priorities tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114518945B_ABST
    Figure CN114518945B_ABST
Patent Text Reader

Abstract

The present invention relates to a resource scheduling method, apparatus, device, and storage medium. The method includes: S1: Obtain a first resource request to be scheduled from a resource request queue, and obtain a first resource amount required to execute a first task corresponding to the first resource request; S2: Obtain a set of nodes for executing tasks in the resource request queue, and obtain resource snapshots of each node in the set of nodes; S3: Determine a first node that can execute the first task earliest according to the first resource amount and the resource snapshots; S4: Remove the first node from the set of nodes; Process the next resource request in the resource request queue according to the method of S1 - S4 until the resource request queue is empty. In the above method, the resource amount of the first node is reserved for the first task with the highest current priority, and the remaining resources can be allocated to other resource requests, thereby satisfying the resource requests of tasks with different priorities and improving the overall resource utilization rate and scheduling efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular, to a resource scheduling method, apparatus, device, and storage medium. Background Art

[0002] In resource scheduling on a cloud platform, for the resource requirements of each task, considering the resource usage of the entire cloud platform, specific running nodes are arranged to execute the tasks.

[0003] In actual business scenarios, different tasks have different priorities, and it is often necessary to give priority to satisfying more important task requests. Currently, for tasks with different priorities, there are the following two resource scheduling schemes: First, block the resource requests of other tasks and only consider the tasks with high priorities until the resource requests of the high-priority tasks are satisfied. Second, divide different resource pools and reserve some resources for high-priority tasks.

[0004] Although these two schemes can give priority to satisfying the resource requests of high-priority tasks, they will reduce the overall resource utilization rate and scheduling efficiency. Summary of the Invention

[0005] The present invention aims to at least solve one of the technical problems existing in the prior art. To this end, a first aspect of the present invention provides a resource scheduling method, which includes:

[0006] S1: Obtain a first resource request to be scheduled from a resource request queue, and obtain a first resource amount required to execute a first task corresponding to the first resource request; the first task is the task with the highest current priority in the resource request queue;

[0007] S2: Obtain a set of nodes for executing the tasks in the resource request queue, and obtain a resource snapshot of each node in the set of nodes, where the resource snapshot includes the available resource amount of the node and the estimated running time of the current task of the node;

[0008] S3: Determine a first node that can execute the first task earliest according to the first resource amount and the resource snapshot;

[0009] S4: Remove the first node from the set of nodes;

[0010] S5: Process the next resource request in the resource request queue according to the method of S1-S4 until the resource request queue is empty.

[0011] Optionally, step S3 includes:

[0012] S31: Determine the nodes that can execute the first task at the current moment based on the first resource amount, the available resource amount of the node, and the estimated running time of the current task of the node, to obtain a first candidate node set;

[0013] S32: If the first candidate node set includes multiple first candidate nodes, determine the scores of the multiple first candidate nodes according to a preset evaluation parameter;

[0014] S33: Select the node with the highest score as the first node;

[0015] S34: If the first candidate node set is empty, determine the node that can execute the first task earliest after the current moment, and use the node as the first node.

[0016] Optionally, the preset evaluation parameter includes the network topology situation and resource health situation of the first candidate node, and the free resource situation of the first candidate node after executing the first task.

[0017] Optionally, step S34 includes:

[0018] S341: Sort the current tasks included in the node in ascending order according to the estimated running time to obtain a target task queue corresponding to the node;

[0019] S342: Starting from the first task in the target task queue, determine the available resource amount released after each task is executed;

[0020] S343: Calculate the sum of the released available resource amount and the available resource amount of the node to obtain the total available resource amount of the node after each task is executed;

[0021] S344: Determine the target moment when the node can execute the first task earliest according to the available resource amount corresponding to each task after execution and the first resource amount;

[0022] S345: Determine the node that can execute the first task earliest according to the target moment corresponding to each node to obtain the first node.

[0023] Optionally, the estimated running time of the current task in step S2 is obtained through the following steps S21 - step S22:

[0024] S21. Obtain the characteristic information of the current task; the characteristic information includes the task type, task name, associated person of the task, resource amount occupied by the task, and execution command of the task;

[0025] S22. Input the feature information into a pre-trained target prediction model to obtain the estimated running time of the current task.

[0026] Optionally, the target prediction model in step S22 is trained through the following steps S221 - S223:

[0027] S221. Obtain sample data, where the sample data includes the feature information of historical tasks that have been completed, as well as the actual running time of the historical tasks.

[0028] S222. Input the feature information of the historical tasks into an initial model to obtain the predicted running time output by the initial model.

[0029] S223. Adjust the parameters of the initial model according to the difference between the predicted running time and the actual running time, and continue to train the initial model until the difference is less than a preset threshold, then end the training to obtain the target prediction model.

[0030] Optionally, when the historical task in step S221 is a deep learning task, the feature information of the historical task further includes: the features of the model used to execute the deep learning task, the number of training steps of the model, and the average time consumed per step.

[0031] A second aspect of the present invention proposes a resource scheduling device, and the device includes:

[0032] A first acquisition module, configured to acquire a first resource request to be scheduled from a resource request queue, and acquire the first resource amount required to execute a first task corresponding to the first resource request; the first task is the task with the highest current priority in the resource request queue.

[0033] A second acquisition module, configured to acquire a set of nodes for executing the tasks in the resource request queue, and acquire resource snapshots of each node in the set of nodes, where the resource snapshots include the available resource amount of the node and the estimated running time of the current task of the node.

[0034] A first determination module, configured to determine a first node that can execute the first task earliest according to the first resource amount and the resource snapshots.

[0035] A removal module, configured to remove the first node from the set of nodes.

[0036] A processing module, configured to use the first acquisition module, the second acquisition module, the first determination module, and the removal module to process the next resource request in the resource request queue until the resource request queue is empty.

[0037] Optionally, the first determination module is further configured to:

[0038] Determine the nodes that can execute the first task at the current moment according to the first resource amount, the available resources of the node, and the estimated running time of the current task of the node, and obtain a first candidate node set;

[0039] If there are multiple first candidate nodes in the first candidate node set, determine the scores of the multiple first candidate nodes according to a preset evaluation parameter;

[0040] Select the node with the highest score as the first node;

[0041] If the first candidate node set is empty, determine the node that can execute the first task earliest after the current moment, and use the node as the first node.

[0042] Optionally, the preset evaluation parameter includes the network topology situation and resource health situation of the first candidate node, and the idle resource situation of the first candidate node after executing the first task.

[0043] Optionally, the first determination module is further configured to:

[0044] Sort the current tasks included in the node in ascending order of the estimated running time to obtain a target task queue corresponding to the node;

[0045] Starting from the first task in the target task queue, determine the available resource amount released after each task is completed;

[0046] Calculate the sum of the released available resource amount and the available resource amount of the node to obtain the total available resource amount of the node after each task is completed;

[0047] According to the available resource amount corresponding to each task after completion and the first resource amount, determine the target moment when the node can execute the first task earliest;

[0048] According to the target moments corresponding to each node, determine the node that can execute the first task earliest, and obtain the first node.

[0049] Optionally, the estimated running time of the current task in the second acquisition module is obtained through the following module:

[0050] A feature information acquisition module, configured to acquire the feature information of the current task; the feature information includes the task type, task name, associated person of the task, resource amount occupied by the task, and execution command of the task;

[0051] A running time determination module, configured to input the feature information into a pre-trained target prediction model to obtain the estimated running time of the current task.

[0052] Optionally, the target prediction model in the feature information acquisition module is trained by the following modules:

[0053] A sample data acquisition module, configured to acquire sample data, where the sample data includes the feature information of historical tasks that have been completed, and the actual running time of the historical tasks;

[0054] A prediction module, configured to input the feature information of the historical tasks into an initial model to obtain the predicted running time output by the initial model;

[0055] A training module, configured to adjust the parameters of the initial model according to the difference between the predicted running time and the actual running time, and continue to train the initial model until the difference is less than a preset threshold, at which point the training ends to obtain a target prediction model.

[0056] Optionally, when the historical task in the sample data acquisition module is a deep learning task, the feature information of the historical task further includes: the features of the model used to execute the deep learning task, the number of training steps of the model, and the average time consumed per step.

[0057] A third aspect of the present invention provides a device, where the device includes a processor and a memory, and the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the resource scheduling method as described in the first aspect.

[0058] A fourth aspect of the present invention provides a computer-readable storage medium, where the storage medium stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the resource scheduling method as described in the first aspect.

[0059] According to the specific embodiments provided by the present invention, the present invention has the following technical effects:

[0060] The resource scheduling method provided by the embodiments of the present invention includes: S1: Obtain a first resource request to be scheduled from a resource request queue, and obtain a first resource amount required to execute a first task corresponding to the first resource request; the first task is the task with the highest current priority in the resource request queue; S2: Obtain a set of nodes for executing tasks in the resource request queue, and obtain resource snapshots of each node in the set of nodes, where the resource snapshot includes the available resource amount of the node and the estimated running time of the current task of the node; S3: Determine a first node that can execute the first task earliest according to the first resource amount and the resource snapshots; S4: Remove the first node from the set of nodes; Process the next resource request in the resource request queue according to the method of S1 - S4 until the resource request queue is empty. In the above method, according to the first resource amount and the resource snapshots, determine the first node that can execute the first task earliest, and remove the first node from the set of nodes, so that the resource amount of the first node is reserved for the first task with the highest current priority, and moreover, by processing other tasks in the resource request queue according to the method of S1 - S4, the remaining resources can be allocated to other resource requests, thereby satisfying the resource requests of tasks with different priorities and improving the overall resource utilization rate and scheduling efficiency.

[0061] Additional aspects and advantages of the present invention will be given in part in the following description, become apparent in part from the following description, or be learned through the practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] In order to more clearly illustrate the technical solutions of the present invention, the drawings required for use in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present invention, and those of ordinary skill in the art can also obtain other drawings based on these drawings without creative efforts.

[0063] Figure 1 It is a flowchart of the steps of the first resource scheduling method provided by the embodiments of the present invention;

[0064] Figure 2 It is a flowchart of the steps of the second resource scheduling method provided by the embodiments of the present invention;

[0065] Figure 3 It is a flowchart of the steps of the third resource scheduling method provided by the embodiments of the present invention;

[0066] Figure 4 It is a flowchart of the steps of the fourth resource scheduling method provided by the embodiments of the present invention;

[0067] Figure 5The flowchart of steps of the fifth resource scheduling method provided by the embodiment of the present invention;

[0068] Figure 6 The structural block diagram of the resource scheduling device provided by the embodiment of the present invention. Detailed implementation manners

[0069] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0070] Figure 1 The flowchart of steps of the first resource scheduling method provided by the embodiment of the present invention. This specification provides the method operation steps as described in the embodiment or flowchart, but based on routine or non-creative labor, it may include more or fewer operation steps. When the actual system or server product is executed, it can be executed in the order of the method shown in the embodiment or the drawings or executed in parallel (for example, in an environment of parallel processors or multi-threaded processing).

[0071] The method may include the following steps:

[0072] S1: Obtain a first resource request to be scheduled from a resource request queue, and obtain a first resource amount required to execute a first task corresponding to the first resource request; the first task is the task with the highest current priority in the resource request queue.

[0073] The embodiment of the present invention is applied to a resource scheduling system on a cloud platform. The resource scheduling system includes a scheduling server and multiple nodes for executing tasks. The cloud platform is a comprehensive cloud computing platform that takes into account both computing and data storage processing.

[0074] Resource requests are uploaded to the cloud platform. The scheduling server can obtain a resource request queue to be scheduled from the cloud platform. The resource request queue includes multiple resource requests, and each resource request corresponds to a task to be executed. The resource request is specifically for the task to be executed, and requests the scheduling server to allocate corresponding resources, that is, allocate corresponding execution nodes.

[0075] The scheduling server obtains the resource requests in the queue, processes the resource requests, and determines which node will execute the tasks corresponding to the resource requests.

[0076] The resources may specifically include CPU (central processing unit) resources, memory resources, GPU (graphics processing unit) resources, bandwidth, I / O (Input / Output) interface resources, etc.

[0077] When a user submits a task to the cloud platform, a priority label can be set for the task. For the scheduling server, according to the priority label, the resource requests in the resource request queue are processed one by one in descending order of priority.

[0078] To improve the processing efficiency, the resource requests in the resource request queue can be sorted in descending order of priority. After the scheduling server processes a resource request, the resource request is removed from the resource request queue, and then the resource request currently ranked first in the resource request queue is retrieved for processing. In this way, the scheduling server always processes the task with the highest current priority in the resource request queue, avoiding the scheduling server from obtaining the task with the highest priority from the resource request queue each time, and improving the processing efficiency of the scheduling server.

[0079] Specifically, the scheduling server obtains the first resource request with the highest priority from the resource request queue. The first resource request is a resource request for the first task, and the scheduling server further obtains the first task amount required for the first task.

[0080] S2: Obtain a set of nodes for executing the tasks in the resource request queue, and obtain resource snapshots of each node in the set of nodes. The resource snapshot includes the available resource amount of the node and the estimated running time of the current task of the node.

[0081] In the embodiment of the present invention, a node refers to a machine for executing tasks, and the machine includes resources such as CPU, GPU, bandwidth, and I / O interface. Different tasks are deployed in each node, and the total amount of resources of the node itself is also different. Specifically, a long connection can be established through the watch command to monitor the running tasks on each node, obtain the task list on the node, as well as the consumed resources and available resource quantities, so as to obtain the resource snapshot of each node.

[0082] The resource snapshot may include the available resource amount of the node and the estimated running time of the current task in the node. The available resource amount of the node is the difference between the total resource amount of the node and the resource amount consumed by the current task. The estimated running time of the current task can be predicted by inputting the feature information of the task into the target prediction model.

[0083] In addition, the estimated running time of the current task can also be obtained through some calculation models in mathematical statistics. For example, the median or quantile of similar tasks is used as the estimated running time of the current task, or a formula is defined according to rules to calculate the estimated running time of the current task. The embodiments of the present invention do not specifically limit the method for obtaining the estimated running time.

[0084] S3: Determine a first node that can execute the first task earliest according to the first resource amount and the resource snapshot.

[0085] Specifically, the resource snapshot includes the available resource amount of the node and the estimated running time of the current task of the node. When the current available resource amount of the node or the available resource amount released by the node after executing the current task is greater than or equal to the first resource amount, then the node can meet the resource amount required for the first task.

[0086] Among the nodes that can meet the resource amount required for the first task, further determine the node that can execute the first task earliest. Specifically, if the current available resource amount of the node is greater than or equal to the first resource amount, then the node can execute the first task at the current moment; if the resource amount of the node is greater than or equal to the first resource amount after the node executes the current task, that is, after the estimated running time corresponding to the current task, then the node can execute the first task after the estimated running time.

[0087] Determine the time when each node can execute the first task, and use the node that can execute the first task earliest as the first node to execute the first task at the corresponding moment.

[0088] S4: Remove the first node from the node set.

[0089] After determining that the allocation result of the first task is the first node, remove the first node r from the node set R, that is:

[0090] R = R - r

[0091] In this way, the node set R can maintain the latest state, the resource snapshot corresponding to the node can maintain the latest state, and the updated resource snapshot can be directly used by the scheduling server when processing the next resource request, avoiding the consumption caused by re-obtaining the resource snapshot of the cloud platform.

[0092] S5: Process the next resource request in the resource request queue according to the method of S1 - S4 until the resource request queue is empty.

[0093] If the resource request queue is not empty, obtain the next resource request and process it according to the method of S1 - S4. Among them, the task corresponding to the next resource request obtained is always the task with the highest priority in the resource request queue.

[0094] For resource scheduling, scheduling efficiency and overall resource utilization are the two most important issues to consider. Scheduling efficiency means that for each resource requirement, a suitable allocation plan can be given as quickly as possible. Resource utilization refers to how much of the resources of the entire cloud platform can be effectively utilized. An inappropriate resource allocation plan will lead to resource fragmentation, and fragmented resources are difficult to utilize.

[0095] In the embodiment of the present invention, first, tasks in the resource request queue are sorted according to priority, and the next task processed by the scheduling server is always the task with the highest priority in the queue, so that each scheduling can preferentially satisfy more important task requests; second, according to the first resource amount and the resource snapshot, the first node that can execute the first task earliest is determined, and the reasonable scheduling rules described above improve the scheduling efficiency, and the node that can execute the first task earliest is used as the execution node of the first task, improving the resource utilization rate; third, after determining the execution node of the first task with the highest priority, the next resource request is processed. While ensuring that high-priority tasks are preferentially satisfied, it can also satisfy sub-priority tasks, avoiding the situation where all sub-priority tasks are blocked in order to preferentially satisfy high-priority tasks; fourth, obtaining the resource snapshots of each node in the node set is a hybrid step of network communication-intensive and computing, which can effectively utilize the I / O idle time, and one calculation can satisfy a large number of resource requests; fifth, determining the first node that can execute the first task earliest according to the first resource amount and the resource snapshot is a pure CPU calculation step, which can quickly and efficiently obtain a resource allocation plan.

[0096] In summary, the resource scheduling method provided by the embodiments of the present invention includes: S1: Obtain a first resource request to be scheduled from a resource request queue, and obtain a first resource amount required to execute a first task corresponding to the first resource request; the first task is the task with the highest current priority in the resource request queue; S2: Obtain a set of nodes for executing tasks in the resource request queue, and obtain a resource snapshot of each node in the set of nodes, where the resource snapshot includes the available resource amount of the node and the estimated running time of the current task of the node; S3: Determine a first node that can execute the first task earliest according to the first resource amount and the resource snapshot; S4: Remove the first node from the set of nodes; process the next resource request in the resource request queue according to the method of S1-S4 until the resource request queue is empty. In the above method, according to the first resource amount and the resource snapshot, determine the first node that can execute the first task earliest, and remove the first node from the set of nodes, so as to reserve the resource amount of the first node for the first task with the highest current priority. Moreover, by processing other tasks in the resource request queue according to the method of S1-S4, the remaining resources can be allocated to other resource requests, thereby meeting the resource requests of tasks with different priorities and improving the overall resource utilization rate and scheduling efficiency.

[0097] In a possible implementation manner, on the basis of the above embodiment, as Figure 2 shown, the estimated running time of the current task in step 2 above is obtained through the following steps S21-S22:

[0098] S21: Obtain the feature information of the current task; the feature information includes the task type, task name, associated person of the task, resource amount occupied by the task, and execution command of the task.

[0099] Specifically, through the task scheduling system of the cloud platform, obtain the feature information of the current task on the node. The task type, task name, associated person of the task, and execution command of the task have a decisive effect on the execution time of the task. Among them, the associated person of the task refers to the submitter and the affiliated team of the task.

[0100] S22: Input the feature information into a pre-trained target prediction model to obtain the estimated running time of the current task.

[0101] The estimated running time of each current task on each node can be obtained by inputting the feature information of all tasks on all nodes into a pre-trained target prediction model. Since the current task is already running on the node, this estimated running time is actually the remaining running time of the task.

[0102] Specifically, if the target prediction model is p and the estimated running time obtained for task t is c, we have:

[0103] C t = p(t)

[0104] If there are n nodes in total, T i (i ∈ [1, n]) represents the set of tasks running on the i-th node, t is a task in the task set T i in. Then the pseudocode for traversing all tasks of all nodes is:

[0105] For i in n;

[0106] For t in T i ;

[0107] C t = p(t)

[0108] In steps S21 - S22, by inputting the feature information into the pre-trained target prediction model, the estimated running time of the current task is obtained. The target prediction model is trained based on the sample data of historical tasks. Compared with other calculation methods, the prediction accuracy of the running time can be significantly improved.

[0109] In a possible implementation manner, on the basis of the above embodiment, as Figure 3 shown, the target prediction model in step S22 above is trained through the following steps S221 - S223:

[0110] S221. Obtain sample data, where the sample data includes the feature information of the historical tasks that have been completed and the true running time of the historical tasks.

[0111] Collect historical task data on the cloud platform. This data includes but is not limited to key information such as the task type, task name, associated person of the task, resource amount occupied by the task, execution command of the task, and true running time of the task.

[0112] Generally speaking, each task has an identifier. To avoid duplicate identifiers and ensure global uniqueness, a common method is to add a random number or timestamp before and after the identifier.

[0113] The historical task data is raw data, which contains a large amount of interfering data. Key information can be effectively extracted through feature engineering, and information such as random numbers and timestamps can be removed to obtain a sample data set. The sample data set is further divided into a training set and a test set.

[0114] S222. Input the feature information of the historical task into the initial model to obtain the predicted running time output by the initial model.

[0115] The initial model contains initial parameters, which are parameters that have not been trained and adjusted. Inputting the feature information of the historical task into the initial model can obtain the predicted running time output by the model.

[0116] S223. Adjust the parameters of the initial model according to the difference between the predicted running time and the actual running time, and continue to train the initial model until the difference is less than a preset threshold, then end the training to obtain the target prediction model.

[0117] By comparing the predicted running time output by the model with the actual running time, the difference is obtained, and the parameters of the initial model are adjusted according to the difference to make the predicted running time output by it closer to the actual running time, which can improve the accuracy of model prediction. When the difference between the predicted running time and the actual running time is less than the preset threshold, it means that the accuracy of the model has reached the set standard, and the model at this time is used as the target prediction model.

[0118] In a possible implementation manner, based on the above embodiment, when the historical task in the above step S221 is a deep learning task, the feature information of the historical task further includes: the features of the model for executing the deep learning task, the number of training steps of the model, and the time consumed per step on average.

[0119] In the embodiment of the present invention, for special task types, such as deep learning tasks, additional information can also be obtained, such as obtaining model features, the number of training steps of the model, the time consumed per step on average, etc. through the model repository. These information can greatly improve the accuracy of model prediction.

[0120] In steps S221 - S223, adjusting the parameters of the initial model according to the difference between the predicted running time and the actual running time improves the accuracy of the predicted running time of the target prediction model. Moreover, the model training and resource scheduling are asynchronous and will not affect the processing efficiency of actual business.

[0121] In a possible implementation manner, based on the above embodiment, as Figure 4 shown, the above step S3 includes the following steps S31 - S34:

[0122] S31. Determine the nodes that can execute the first task at the current moment according to the first resource amount, the available resource amount of the node, and the estimated running time of the current task of the node, to obtain the first candidate node set.

[0123] Specifically, when the available resource amount of a node is greater than or equal to the first resource amount and the estimated running time of the current task of the node is 0, the node can execute the first task at the current moment, and the node is determined as the first candidate node.

[0124] S32: If the first candidate node set includes multiple first candidate nodes, score the multiple first candidate nodes according to a preset evaluation parameter.

[0125] If the first candidate node set includes multiple first candidate nodes, the first candidate nodes can be scored according to the prediction evaluation parameter, so as to select an optimal execution node.

[0126] Optionally, the preset evaluation parameter includes the network topology situation and resource health situation of the first candidate node, and the idle resource situation of the first candidate node after executing the first task.

[0127] In the embodiment of the present invention, the network topology situation of the node can be obtained through the network topology label on the node. The network topology situation specifically refers to information such as the number of network interfaces of the node, the number of switch layers from the database, network bandwidth, and network topology structure between graphics cards.

[0128] For example, for the task of using two GPUs for deep learning model training, because there is a large amount of data exchange during training, whether there is NVLink (NVIDIA link) between the two GPUs will be used as an important evaluation parameter. As an evaluation index of a network topology situation, NVLink is used for the connection between the central processing unit (CPU) and the graphics processing unit (GPU), and can also be used for the mutual connection between multiple graphics processing units. For two nodes, there is NVLink between the two GPUs in one node, and there is no NVLink between the two GPUs in one node, then the former has a higher score than the latter.

[0129] The resource health situation includes the load situation of resources such as CPU and GPU, memory usage, and whether the resources have failed recently. The load situation is an index to measure the resource busy program of a node. The higher the load, the greater the pressure on the machine. Considering load balancing, the scheduling server can allocate tasks to the machine with less pressure.

[0130] The idle resource situation refers to the amount of idle resources in the memory after executing the current task. When the amount of idle resources is relatively large and the degree of resource fragmentation is lower, the score is higher.

[0131] S33: Select the node with the highest score as the first node.

[0132] Score each first candidate node based on the network topology, resource health, and available resources, and select the node with the highest score as the first node to execute the first task.

[0133] S34: If the set of first candidate nodes is empty, determine the node that can execute the first task earliest after the current moment, and use this node as the first node.

[0134] If the set of first candidate nodes is empty, it means that there is no node that can meet the conditions for executing the first task at the current moment. Then, obtain the node that can execute the first task earliest after the current moment and use it as the first node for executing the first task.

[0135] In steps S31 - S34, if the set of first candidate nodes includes multiple first candidate nodes, determine the scores of the multiple first candidate nodes according to the preset evaluation parameters, and select the node with the highest score as the first node. In this way, considering the network topology, resource health, and available resources, the node with the best conditions in all aspects can be selected as the execution node for the first task, so as to improve the execution efficiency of the first task and the resource utilization rate.

[0136] In a possible implementation, based on the above embodiments, as Figure 5 shown, the above step S34 may include steps S341 - S345:

[0137] S341: Sort the current tasks included in the node in ascending order according to the estimated running time to obtain the target task queue corresponding to the node.

[0138] If there is no node that can meet the conditions for executing the first task at the current moment, it means that each node has a task being executed at the current moment, or the available resource amount of each node at the current moment is less than the first resource amount. Then, when the current tasks of some nodes are completed, a part of the resources can be released, so that the conditions for executing the first task can be met.

[0139] Therefore, obtain the estimated running time of the current tasks deployed on the node, and sort the tasks on the node in ascending order according to the estimated running time to obtain the target task queue corresponding to the node.

[0140] S342: Starting from the first task in the target task queue, determine the available resource amount released after each task is executed.

[0141] For each task in the target task queue, determine the available resource amount that can be released after each task is executed.

[0142] S343: Calculate the sum of the released available resource amount and the available resource amount of the node to obtain the total available resource amount of the node after each task is completed.

[0143] The available resource amount in the resource snapshot is the current available resource amount of the node. When a part of the available resource amount is released after a task is completed, the total available resource amount of the node after each task is completed can be obtained.

[0144] S344: Determine the target time when the node can execute the first task earliest according to the available resource amount corresponding to each task after completion and the first resource amount.

[0145] Tasks on the node are executed in parallel. Each task has a declared resource requirement. Resources on the node are limited, and only tasks with a total sum not exceeding the resources on the node can run simultaneously. When the available resource amount corresponding to a certain task after completion is greater than or equal to the first resource amount, the first task can be executed after the task is completed.

[0146] Obtain the time when the available resource amount first reaches the first resource amount, and use it as the target time when the node can execute the first resource request earliest.

[0147] Using the above steps S341 - S344, the target time corresponding to each node can be obtained.

[0148] S345: Determine the node that can execute the first task earliest according to the target time corresponding to each node to obtain the first node.

[0149] Select the earliest target time from the target times corresponding to each node, determine the node corresponding to the target time, and use this node as the first node to execute the first task.

[0150] The following is an example of steps S341 - S345:

[0151] At the current time, there is no idle resource on node N. There are 3 current tasks A, B, and C, which occupy resource amounts of 3, 2, and 1 respectively. The estimated running times of tasks A, B, and C are 30 minutes, 20 minutes, and 10 minutes respectively, that is, tasks A, B, and C will be completed after 30, 20, and 10 minutes respectively. The first resource amount of the first task T is 3.

[0152] First, sort the current tasks included in node N in ascending order of the estimated running time. The obtained target task queue is: {C, B, A}. Then, starting from the first task in the target task queue, determine that the available resource amounts released after tasks C, B, and A are executed are: 1, 2, and 3 respectively. Then, calculate the sum of the released available resource amount and the available resource amount of the node. Since there is no idle resource at the current moment on node N, that is, the available resource amount of the node at the current moment is 0. After task C is executed, the total available resource amount of the node is 1. After task B is executed, the total available resource amount of the node is 1 + 2 = 3. After task C is executed, the total available resource amount of the node is 1 + 2 + 3 = 6. It can be seen from this that after task B is executed, the total available resource amount of the node can meet the requirement of the first resource amount.

[0153] Therefore, the target moment when node N can execute the first task earliest is the moment when task B is executed.

[0154] Apply the above method to determine the target moments corresponding to each node in turn, and determine the node that can execute the first task T earliest from them to obtain the first node.

[0155] In steps S341 - S345, according to the available resource amounts corresponding to each task after execution and the first resource amount, determine the target moment when the node can execute the first task earliest, and according to the target moments corresponding to each node, determine the node that can execute the first task earliest to obtain the first node. In this way, for each resource requirement, it can be allocated to the node that can execute the task earliest, improving the execution efficiency of the task. And only when the total available resource amount of the node meets the requirement of the first resource amount, the task starts to be executed, improving the resource utilization rate and avoiding resource fragmentation.

[0156] Figure 6 This is the structural block diagram of the resource scheduling device provided by the embodiment of the present invention.

[0157] As Figure 6 shown, the resource scheduling device 600 includes:

[0158] The first acquisition module 601 is configured to acquire the first resource request to be scheduled from the resource request queue, and acquire the first resource amount required to execute the first task corresponding to the first resource request; the first task is the task with the highest current priority in the resource request queue;

[0159] The second acquisition module 602 is configured to acquire the node set for executing the tasks in the resource request queue, and acquire the resource snapshots of each node in the node set. The resource snapshot includes the available resource amount of the node and the estimated running time of the current task of the node;

[0160] A first determination module 603, configured to determine a first node that can execute the first task earliest according to the first resource amount and the resource snapshot;

[0161] A removal module 604, configured to remove the first node from the node set;

[0162] A processing module 605, configured to use the first acquisition module, the second acquisition module, the first determination module, and the removal module to process the next resource request in the resource request queue until the resource request queue is empty.

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

[0164] In another embodiment provided by the present invention, there is also provided a device, where the device includes a processor and a memory, and the memory stores at least one instruction, at least one segment of program, a code set, or an instruction set, and the at least one instruction, the at least one segment of program, the code set, or the instruction set is loaded and executed by the processor to implement the resource scheduling method in the embodiments of the present invention.

[0165] In another embodiment provided by the present invention, there is also provided a computer-readable storage medium, where the storage medium stores at least one instruction, at least one segment of program, a code set, or an instruction set, and the at least one instruction, the at least one segment of program, the code set, or the instruction set is loaded and executed by a processor to implement the resource scheduling method in the embodiments of the present invention.

[0166] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer, or a data storage device such as a server or data center that includes one or more integrated available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).

[0167] It should be noted that in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise", or any other variation thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device that includes a series of elements includes not only those elements but also other elements that are not explicitly listed, or elements that are inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, or device that includes the element.

[0168] Each embodiment in this specification is described in a related manner. The same or similar parts among the embodiments can be referred to each other, and the differences between each embodiment and other embodiments are emphasized. In particular, for system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments.

[0169] The above are only the preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention are all included within the protection scope of the present invention.

Claims

1. A resource scheduling method, characterized in that, The method includes: S1: Obtain a first resource request to be scheduled from a resource request queue, and obtain a first resource amount required to execute a first task corresponding to the first resource request; the first task is the task with the highest current priority in the resource request queue; S2: Obtain a set of nodes for executing tasks in the resource request queue, and obtain resource snapshots of each node in the set of nodes, where the resource snapshot includes the available resource amount of the node and the estimated running time of the current task of the node; S3: Determine a first node that can execute the first task earliest according to the first resource amount and the resource snapshot; specifically, step S3 includes: S31: Determine nodes that can execute the first task at the current moment according to the first resource amount, the available resource amount of the node, and the estimated running time of the current task of the node, to obtain a first candidate node set; S32: If the first candidate node set includes multiple first candidate nodes, determine the scores of the multiple first candidate nodes according to a preset evaluation parameter; S33: Select the node with the highest score as the first node; S34: If the first candidate node set is empty, determine a node that can execute the first task earliest after the current moment, and use the node as the first node; specifically, step S34 includes: S341: Sort the current tasks included in the node in ascending order of the estimated running time to obtain a target task queue corresponding to the node; S342: Starting from the first task in the target task queue, determine the available resource amount released after each task is executed; S343: Calculate the sum of the released available resource amount and the available resource amount of the node to obtain the total available resource amount of the node after each task is executed; S344: Determine the target moment when the node can execute the first task earliest according to the available resource amount corresponding to each task after execution and the first resource amount; S345: Determine a node that can execute the first task earliest according to the target moment corresponding to each node to obtain a first node; S4: Remove the first node from the set of nodes; S5: Process the next resource request in the resource request queue according to the method of S1 - S4 until the resource request queue is empty.

2. The method according to claim 1, characterized in that, The preset evaluation parameter includes the network topology situation and resource health situation of the first candidate node, and the idle resource situation of the first candidate node after executing the first task.

3. The method according to claim 1, wherein The estimated running time of the current task in step S2 is obtained through the following steps S21 - S22: S21: Obtain the characteristic information of the current task; the characteristic information includes the task type, task name, associated person of the task, resource amount occupied by the task, and execution command of the task; S22: Input the characteristic information into a pre-trained target prediction model to obtain the estimated running time of the current task.

4. The method according to claim 3, characterized in that, The target prediction model in step S22 is obtained through the following steps S221 - S223: S221. Obtain sample data, where the sample data includes the feature information of historical tasks that have been completed, and the actual running time of the historical tasks; S222. Input the feature information of the historical tasks into the initial model to obtain the predicted running time output by the initial model; S223. Adjust the parameters of the initial model according to the difference between the predicted running time and the actual running time, and continue to train the initial model until the difference is less than a preset threshold, then end the training to obtain the target prediction model.

5. The method according to claim 4, wherein When the historical task in step S221 is a deep learning task, the feature information of the historical task further includes: the features of the model used to execute the deep learning task, the number of training steps of the model, and the average time consumed per step.

6. A resource scheduling device, characterized in that, The device includes: A first acquisition module, configured to acquire a first resource request to be scheduled from a resource request queue, and acquire the first resource amount required to execute a first task corresponding to the first resource request; the first task is the task with the highest current priority in the resource request queue; A second acquisition module, configured to acquire a set of nodes for executing the tasks in the resource request queue, and acquire resource snapshots of each node in the set of nodes, where the resource snapshot includes the available resource amount of the node and the estimated running time of the current task of the node; A first determination module, configured to determine a first node that can execute the first task earliest according to the first resource amount and the resource snapshot; specifically, the first determination module is further configured to: Determine the nodes that can execute the first task at the current moment according to the first resource amount, the available resource amount of the node, and the estimated running time of the current task of the node to obtain a first candidate node set; If the first candidate node set includes multiple first candidate nodes, then determine the scores of the multiple first candidate nodes according to a preset evaluation parameter; Select the node with the highest score as the first node; If the first candidate node set is empty, then determine the node that can execute the first task earliest after the current moment, and use the node as the first node; specifically, sort the current tasks included in the node in ascending order of the estimated running time to obtain a target task queue corresponding to the node; starting from the first task in the target task queue, determine the available resource amount released after each task is completed; calculate the sum of the released available resource amount and the available resource amount of the node to obtain the total available resource amount of the node after each task is completed; according to the available resource amount corresponding to each task after completion and the first resource amount, determine the target moment when the node can execute the first task earliest; according to the target moments corresponding to each node, determine the node that can execute the first task earliest to obtain the first node; A removal module, configured to remove the first node from the set of nodes; A processing module, configured to process the next resource request in the resource request queue by using the first acquisition module, the second acquisition module, the first determination module, and the removal module until the resource request queue is empty.

7. The device according to claim 6, characterized in that, The preset evaluation parameters include the network topology and resource health of the first candidate node, and the idle resource situation of the first candidate node after executing the first task.

8. The device according to claim 6, wherein The estimated running time of the current task in the second acquisition module is obtained through the following modules: A feature information acquisition module, configured to acquire the feature information of the current task; the feature information includes the task type, task name, associated person of the task, resource amount occupied by the task, and execution command of the task; A running time determination module, configured to input the feature information into a pre-trained target prediction model to obtain the estimated running time of the current task.

9. The device according to claim 8, characterized in that The target prediction model in the feature information acquisition module is trained through the following modules: A sample data acquisition module, configured to acquire sample data, where the sample data includes the feature information of historical tasks that have been executed and the actual running time of the historical tasks; A prediction module, configured to input the feature information of the historical tasks into an initial model to obtain the predicted running time output by the initial model; A training module, configured to adjust the parameters of the initial model according to the difference between the predicted running time and the actual running time, and continue to train the initial model until the difference is less than a preset threshold, at which point the training ends to obtain the target prediction model.

10. The device according to claim 9, characterized in that, When the historical task in the sample data acquisition module is a deep learning task, the feature information of the historical task further includes: the features of the model used to execute the deep learning task, the number of training steps of the model, and the average time consumed per step.

11. A resource scheduling device, characterized in that, The device includes a processor and a memory. At least one instruction, at least one program, a code set, or an instruction set is stored in the memory, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the resource scheduling method according to any one of claims 1-5.

12. A computer-readable storage medium, characterized in that, At least one instruction, at least one program, a code set, or an instruction set is stored in the storage medium, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the resource scheduling method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Task resource reservation method and device

    CN111143063A

  • Big data resource processing method and device, terminal and storage medium

    CN111198767A