Resource scheduling method, resource scheduler, electronic equipment and storage medium
By obtaining cluster status and task requirements in real time and dynamically allocating resource scheduling tasks, the problem of resource scheduling algorithms in the existing technology is difficult to respond to resource requirements and load changes, and efficient resource utilization and load balancing are achieved.
Patent Information
- Application Number
- CN202411731487.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-21
AI Technical Summary
The resource scheduling algorithms in the prior art are difficult to respond to resource demand and load changes in real time, and it is difficult to balance scheduling fairness and efficient utilization of resources, resulting in the coexistence of idle or overload of resources.
By obtaining the status data of multiple clusters and preset task requirements information for pre-scheduled tasks, grouping tasks according to preset grouping rules, calculating the amount of allocable tasks for each cluster, and automatically dispatching the task group to the target cluster according to the amount of allocable tasks and the needs of the task group, and scheduling tasks in real time to adapt to cluster state changes.
Dynamic adjustment tasks are issued, resource utilization is improved, resource overload or vacancy is avoided, and load balancing between clusters and efficient resource allocation is ensured.
Smart Images

Figure CN119668852A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of task scheduling, and in particular to a resource scheduling method, a resource scheduler, an electronic device and a storage medium. Background Art
[0002] With the rapid development of cloud computing and big data technologies, resource scheduling algorithms play an increasingly important role in data centers and distributed systems. The core goal of resource scheduling is to optimize resource allocation, improve resource utilization, and reduce operating costs while ensuring service quality. Traditional resource scheduling algorithms, such as polling scheduling and random scheduling, are simple and easy to implement, but they often fail to fully utilize the computing resources of the cluster, resulting in resource waste and low scheduling efficiency.
[0003] At present, some advanced resource scheduling algorithms have been proposed and applied, such as scheduling based on resource quotas, scheduling based on priorities, and intelligent scheduling algorithms based on machine learning. For example, the resource quota scheduling algorithm can allocate limited amounts of resources, such as CPU time, memory space, disk storage, etc., to different users or tasks according to preset rules and policies. Although it can ensure fair allocation of resources, it is difficult to adapt to dynamically changing resource requirements and load conditions. Taking Kubenetes as an example, the allocation method of its scheduling engine only simply considers the Request / Limit Quota (Kubenetes sets the request value Request and the constraint value Limit for the container as the resource quota for the user to apply for the container), which belongs to static resource allocation. As a result, although different hosts are allocated with various resources, the resource utilization of the hosts also varies greatly due to the differences in the services of the hosts.
[0004] In summary, resource scheduling algorithms in the prior art often rely on preset static parameters when making scheduling decisions, and are difficult to respond to resource demand and load changes in real time; and are difficult to balance scheduling fairness and efficient resource utilization, resulting in the coexistence of resource idleness or overload. Summary of the invention
[0005] In view of this, the present application provides a resource scheduling method, a resource scheduler, an electronic device and a storage medium, which solve the technical problem that the resource scheduling algorithm in the prior art is difficult to respond to resource demand and load changes in real time, and is difficult to balance scheduling fairness and efficient use of resources, resulting in the coexistence of resource idleness or overload.
[0006] As the first aspect of the present application, the present application provides a resource scheduling method, including: obtaining status data of multiple clusters; obtaining multiple pre-scheduled tasks, each pre-scheduled task has corresponding preset task requirement information; grouping the multiple pre-scheduled tasks according to preset grouping rules and the preset task requirement information of each pre-scheduled task to generate multiple task groups to be issued; calculating the allocatable task volume of each cluster according to the status data of each cluster and the preset scheduling strategy; issuing a target task group to a target cluster according to the allocatable task volume of each cluster and the required task resources of each task group to be issued, the target task group including at least one pre-scheduled task in a task group to be issued; scheduling each pre-scheduled task in the corresponding target task group according to the status data of the target cluster.
[0007] In one embodiment of the present application, each of the pre-scheduled tasks has a priority level; the target task group is sent to the target cluster according to the allocatable task volume of each cluster and the required task resources of each task group to be sent, including: determining the first task group to be sent corresponding to the target cluster and the first number of pre-scheduled tasks scheduled in the first task group to be sent according to the allocatable task volume of each cluster and the required task resources of each task group to be sent; based on the priority level of each pre-scheduled task in the first task group to be sent, selecting a first number of pre-scheduled tasks in the first task group to be sent to form a target task group; and sending the target task group to the target cluster.
[0008] In one embodiment of the present application, the scheduling of each pre-scheduled task in the corresponding target task group according to the status data of the target cluster includes: allocating a corresponding target computing node to each pre-scheduled task in the target task group according to the status data of the target cluster, each pre-scheduled task corresponding to a target computing node; and scheduling each pre-scheduled task to the corresponding target computing node in turn based on the priority level of each pre-scheduled task.
[0009] In one embodiment of the present application, the status data includes the resource usage status of the cluster and the working status of each computing node in the cluster; the corresponding target computing node is allocated to each pre-scheduled task in the target task group according to the status data of the target cluster, including: when the number of computing nodes in the target cluster whose working status is idle is less than the number of pre-scheduled tasks in the target task group, and the resource usage status of the target cluster is a resource-sufficient state, the expansion operation is triggered in sequence according to the priority level of at least some of the pre-scheduled tasks to add at least one new computing node; according to the priority level of each pre-scheduled task, the computing nodes in the idle state and the new computing nodes, the target computing nodes are allocated to each pre-scheduled task in sequence.
[0010] In one embodiment of the present application, the status data also includes the running status of each pod in the node pool of the cluster; the capacity expansion operation is triggered in sequence according to the priority levels of at least some of the pre-scheduled tasks to add at least one new computing node, including: obtaining the number of pods in a waiting state in the node pool of the target cluster, where one pod corresponds to a pre-scheduled task; calculating the upper limit of the number of new computing nodes that can be added according to a preset reduction ratio of the node pool and the number of pods in a waiting state; and the capacity expansion operation is triggered in sequence according to the priority levels of at least some of the pre-scheduled tasks to add new computing nodes not exceeding the upper limit.
[0011] In one embodiment of the present application, the resource scheduling method further includes: adjusting the upper limit of the number of nodes in the node pool according to the upper limit of the number of new computing nodes and the number of computing nodes in operation in the node pool.
[0012] In one embodiment of the present application, the adjusting the upper limit of the number of nodes in the node pool according to the upper limit of the number of new computing nodes and the number of computing nodes in operation in the node pool includes: when the number of pods in a waiting state in the node pool increases, calculating the time interval between the current time and the last time the upper limit of the number of nodes in the node pool was adjusted; when the time interval is greater than a preset time interval, increasing the upper limit of the number of nodes in the node pool according to the upper limit of the number of new computing nodes and the number of computing nodes in operation in the node pool;
[0013] When the number of pods in the waiting state in the node pool decreases, the upper limit of the number of nodes in the node pool is lowered according to the upper limit of the number of new computing nodes and the number of computing nodes in the running state in the node pool.
[0014] In one embodiment of the present application, scheduling a pre-scheduled task to a corresponding target computing node includes: obtaining a node type of the target computing node, the node type including: an on-demand allocation node or a preemptive node; when the node type of the target computing node is an on-demand allocation node, issuing a pre-scheduled task matching the target computing node to the target computing node; when the node type of the target computing node is a preemptive node, obtaining a current price of the target computing node and a historical interruption rate of the target computing node; when the current price of the target computing node is less than a preset price, and the historical interruption rate of the target computing node is less than the preset interruption rate, issuing a pre-scheduled task matching the target computing node to the target computing node; when the current price of the target node is greater than or equal to the preset price, and / or the historical interruption rate of the target computing node is greater than or equal to the preset interruption rate, stopping issuing the pre-scheduled task to the target computing node.
[0015] In one embodiment of the present application, the calculation of the allocatable task amount of each cluster based on the status data of each cluster and the preset scheduling strategy includes: obtaining the preset weight of each cluster; and calculating the allocatable task amount of each cluster based on the status data of each cluster, the preset weight of each cluster and the preset scheduling strategy.
[0016] In one embodiment of the present application, the preset task requirement information of the pre-scheduled task includes the required processor type and the required number of cores of the pre-scheduled task, and the multiple pre-scheduled tasks are grouped according to the preset grouping rules and the preset task requirement information of each pre-scheduled task to generate multiple task groups to be issued, including: grouping multiple pre-scheduled tasks according to the preset grouping rules and the required processor type and the required number of cores of each pre-scheduled task to generate multiple task groups to be issued.
[0017] As a second aspect of the present application, the present application also provides a resource scheduler, including: a data acquisition module, used to obtain status data of multiple clusters; a task grouping module, used to obtain multiple pre-scheduled tasks, each pre-scheduled task has corresponding preset task requirement information; and according to the preset grouping rules and the preset task requirement information of each pre-scheduled task, the multiple pre-scheduled tasks are grouped to generate multiple task groups to be issued; a calculation module, used to calculate the allocatable task volume of each cluster according to the status data of each cluster and the preset scheduling strategy; a scheduling module, used to issue a target task group to a target cluster according to the allocatable task volume of each cluster and the required task resources of each task group to be issued, the target task group including at least one pre-scheduled task in a task group to be issued; and scheduling each pre-scheduled task in the corresponding target task group according to the status data of the target cluster.
[0018] As a third aspect of the present application, the present application further provides an electronic device, comprising: a processor; and a memory for storing information executable by the processor; wherein the processor is used to execute any one of the above-mentioned resource scheduling methods.
[0019] As a fourth aspect of the present application, the present application further provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, any one of the above-mentioned resource scheduling methods is implemented.
[0020] The resource scheduling method provided by the present application first groups the acquired pre-scheduled tasks into groups to obtain a plurality of task groups to be issued, then calculates the allocatable task amount of each cluster according to the status data of each cluster and the preset scheduling strategy, and automatically issues the pre-scheduled tasks to the corresponding cluster according to the allocatable task amount of each cluster and the required task resources in each task group to be issued. The issuance of tasks can be dynamically adjusted according to the allocatable task amount of each cluster and the required task resources of each task group to be issued. For clusters with limited resources, the task allocation can be reduced. For clusters with sufficient resources, the task allocation can be reasonably increased to achieve load balancing between clusters and prevent resource overload or vacancy. In addition, when multiple pre-scheduled tasks are issued to a cluster, each pre-scheduled task in the corresponding target task group is scheduled by real-time monitoring of the real-time status data of the cluster, and the pre-scheduled tasks can be automatically issued in real time according to the status of the cluster, and resource allocation can be intelligently adjusted. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] By describing the embodiments of the present application in more detail in conjunction with the accompanying drawings, the above and other purposes, features and advantages of the present application will become more apparent. The accompanying drawings are used to provide a further understanding of the embodiments of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the accompanying drawings, the same reference numerals generally represent the same components or steps.
[0022] Figure 1 A schematic diagram of a resource scheduling method according to an embodiment of the present application;
[0023] Figure 2 FIG. 1 is a flow chart of a resource scheduling method provided by another embodiment of the present application;
[0024] Figure 3 FIG. 1 is a flow chart of a resource scheduling method provided by another embodiment of the present application;
[0025] Figure 4 FIG. 1 is a flow chart of a resource scheduling method provided by another embodiment of the present application;
[0026] Figure 5 FIG. 1 is a flow chart of a resource scheduling method provided by another embodiment of the present application;
[0027] Figure 6 FIG. 1 is a flow chart of a resource scheduling method provided by another embodiment of the present application;
[0028] Figure 7 FIG. 1 is a flow chart of a resource scheduling method provided by another embodiment of the present application;
[0029] Figure 8FIG. 1 is a flow chart of a resource scheduling method provided by another embodiment of the present application;
[0030] Fig. 9 The figure is a flow chart of S7 (adjusting the upper limit of the number of nodes in the node pool according to the upper limit of the number of new computing nodes and the number of computing nodes in operation in the node pool) in the resource scheduling method provided by another embodiment of the present application;
[0031] Fig.10 FIG. 1 is a working block diagram of a resource scheduler provided in an embodiment of the present application;
[0032] Fig.11 Shown is a working principle diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0033] In the description of the application, the meaning of "multiple" is at least two, for example, two, three, etc., unless otherwise clearly and specifically limited. In the embodiment of the present application, all directional indications (such as up, down, left, right, front, back, top, bottom ...) are only used to explain the relative position relationship, motion conditions, etc. between the components under a certain specific posture (as shown in the drawings). If the specific posture changes, the directional indication also changes accordingly. In addition, the terms "including" and "having" and any of their deformations are intended to cover non-exclusive inclusions. For example, the process, method, system, product or equipment comprising a series of steps or units are not limited to the steps or units listed, but optionally also include the steps or units not listed, or optionally also include other steps or units inherent to these processes, methods, products or equipment.
[0034] In addition, the reference to "embodiment" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiment may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0035] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0036] Definition of terms
[0037] K8S: Kubernetes (application software) is an open source container orchestration engine for automating the deployment, expansion, and management of containerized applications. It provides a declarative configuration and automation mechanism for managing containerized applications across clusters. The K8S cluster is the environment for running Kubernetes, which consists of multiple computing nodes, which can be physical machines or virtual machines.
[0038] Pod: The smallest deployable computing unit created and managed in Kubernetes; it is a logical unit in Kubernetes that represents one or more processes running on the cluster. It consists of one or more closely related containers that share the same network and storage resources and can communicate with each other through localhost. It should be noted that although Pod is the smallest computing unit in Kubernetes, Kubernetes generally does not manage Pod directly, but manages it through a scheduling controller.
[0039] Preemptible nodes (Spot): It is a new instance operation mode of the cloud server ECS. Preemptible nodes allow users to bid for currently idle resources. When the bid is higher than or equal to the real-time market price and the inventory is sufficient, users can obtain these resources and run containers or applications. However, if other customers bid higher or the resource inventory is insufficient, the preemptible node may be recycled so that the resources can be allocated to customers with higher bids. Applicable scenarios: Short-running Job tasks: These tasks usually do not need to run for a long time, so they can withstand occasional instance recycling.
[0040] CA: Cluster Autoscaler is a component of Kubernetes that automatically adjusts the number of nodes based on the resource requirements of Pods in the cluster. For example, CA can scale to increase the number of compute nodes to meet these requirements.
[0041] Quigon SDK: A development toolkit for accessing computing platform resources, providing a series of management operations such as creating, updating, querying, and deleting tasks.
[0042] Exemplary Methods
[0043] As a first aspect of the present application, the present application provides a resource scheduling method, such as Figure 1 As shown, a resource scheduling method provided by the present application includes the following steps:
[0044] S1: Get the status data of multiple clusters;
[0045] Specifically, the status data may include, but is not limited to, the resource usage status of the cluster (such as the resource usage of multiple processors in the cluster) and the working status of each computing node in the cluster;
[0046] Specifically, the cluster in the embodiment of the present application can be a K8S cluster, and an Agent can be deployed in each K8S cluster in advance (Agent refers to a program or service running in a Kubernetes cluster). The Agent can monitor and manage each node or resource in the cluster in real time, such as monitoring the cluster status, resource usage (such as CPU and GPU resource usage status), collecting node information of each computing node in the cluster (such as the working status of the computing node), the running status of the pod, executing management operations, responding to cluster events and other key indicators.
[0047] Specifically, the status data is key indicator information detected by the Agent deployed in each cluster, which may include: resource usage status (such as CPU and GPU resource usage status), and the working status of each computing node in the cluster (such as idle state, busy state, allocated state, offline state, maintenance state, etc.).
[0048] When the Agent in each cluster detects the status data of each cluster, it can send the status data of the cluster to the scheduler. The scheduler can obtain the status data of each cluster in real time.
[0049] S2: Acquire multiple pre-scheduled tasks, each pre-scheduled task having corresponding preset task requirement information;
[0050] Specifically, the pre-scheduled task can be generated autonomously or created by the user. For example, the user can create a pre-scheduled task in the configuration center (such as Quigon SDK). When creating each pre-scheduled task, preset task requirement information is configured for each pre-scheduled task. The preset task requirement information may include, but is not limited to, at least one of the task status, the required number of cores, the priority, the required processor type (such as the required CPU, the required GPU), etc.
[0051] S3: grouping the multiple pre-scheduled tasks according to the preset grouping rule and the preset task requirement information of each pre-scheduled task to generate multiple task groups to be issued;
[0052] After the user configures multiple pre-scheduled tasks in the configuration center, the multiple pre-scheduled tasks can be grouped according to the preset grouping rules and the preset task requirement information of each pre-scheduled task to generate multiple task groups to be issued, each of which includes at least one pre-scheduled task.
[0053] Optionally, the preset grouping rules may include, but are not limited to: grouping tasks according to the processor type (eg, CPU or GPU) required for the task and / or the number of cores required for the task.
[0054] Optionally, the preset grouping rule may also be: grouping according to one or more of task status, priority, image, tenant name, virtual cluster name, queue name, etc. That is, multiple pre-scheduled tasks configured by the user can be grouped into multiple task groups to be issued through S3.
[0055] S4: Calculate the allocatable task volume of each cluster based on the status data of each cluster and the preset scheduling strategy;
[0056] Specifically, the preset scheduling strategy may include a preset static configuration (for example, including but not limited to at least one of a cluster blacklist, a forced number of tasks to be sent, a maximum number of runnable tasks, a maximum number of waiting tasks, etc.).
[0057] The amount of allocable tasks in each cluster can be calculated based on the preset scheduling strategy and the status data of each cluster.
[0058] For example, the amount of allocatable tasks for the CPU processors in the cluster is calculated as: Sum(nodeA.Allocatable.cpu+nodeB.Allocatable.cpu+…+nodeN.Allocatable.cpu) / number of CPUs required for a single group of CPU tasks.
[0059] The calculation formula for the amount of tasks that can be assigned to the GPU is:
[0060] Sum(nodeA.Allocatable.gpu+nodeB.Allocatable.gpu+……+nodeN.Allocatable.gpu) / number of GPUs required for a single group of GPU tasks.
[0061] The amount of tasks that can be assigned to each cluster can be determined by calculation.
[0062] S5: according to the allocatable task amount of each cluster and the required task resources of each task group to be issued, issue the target task group to the target cluster, where the target task group includes at least one pre-scheduled task in the task group to be issued;
[0063] According to the allocatable task amount of each cluster and the required task resources of each task group to be sent (such as the required processor type, the required number of cores, etc.), each cluster is grouped and matched with the pre-scheduled tasks in each task group to be sent. For example, there are three clusters, namely cluster A, cluster B and cluster C, and there are three task groups to be sent, namely task group 1 to be sent, task group 2 to be sent and task group 3 to be sent. Each task group to be sent includes at least one pre-scheduled task. Then, according to the allocatable task amount of cluster A, cluster B and cluster C, and the required task resources of task group 1 to be sent, task group 2 to be sent and task group 3 to be sent, it can be determined which task group to be sent matches which cluster. For example, if cluster A matches task 1 to be sent, then it is further determined how many pre-scheduled tasks in task group 1 to be sent are assigned to cluster A. The corresponding relationship between the target cluster and the target task group can be determined by matching. The target cluster is one of multiple clusters. Since there are multiple pre-scheduled tasks in the task group to be sent, not every pre-scheduled task in the sent task group is necessarily sent to the target cluster. It is possible that at least one pre-scheduled task in the task group to be sent is sent to the target cluster. Then, the target task group corresponding to the target cluster is composed of at least some of the pre-scheduled tasks in the task group to be sent corresponding to the target cluster.
[0064] After S5 , it can be determined to allocate multiple pre-scheduled tasks in multiple task groups to be issued to different clusters, that is, each cluster is allocated to which pre-scheduled tasks in which task group to be issued.
[0065] The dispatching of tasks can be dynamically adjusted according to the allocatable task volume of each cluster and the task resources required by each task group to be dispatched. For clusters with limited resources, task dispatching can be reduced. For clusters with sufficient resources, task dispatching can be reasonably increased to achieve load balancing between clusters and prevent resource overload or idleness.
[0066] S6: Schedule each pre-scheduled task in the corresponding target task group according to the state data of the target cluster.
[0067] After the target cluster and the corresponding target task group are determined, the target task group is sent to the target cluster, and the status data of the target cluster is detected in real time. Then, each pre-scheduled task in the corresponding target task group is scheduled according to the status data of the target cluster.
[0068] Specifically, the real-time detection of the state data of the target cluster may be based on a preset data scanning frequency (or a preset data scanning period). For example, if the preset data scanning period is 5 seconds, the state data of the target cluster is acquired every 5 seconds.
[0069] After the target task group is sent to the target cluster, the status data of the target cluster is monitored in real time, and the sending of each pre-scheduled task in the target task group can be automatically adjusted according to the status data of the target cluster.
[0070] The resource scheduling method provided by the present application first groups the acquired pre-scheduled tasks into groups to obtain a plurality of task groups to be issued, then calculates the allocatable task amount of each cluster according to the status data of each cluster and the preset scheduling strategy (preset static configuration), and automatically issues the pre-scheduled tasks to the corresponding cluster according to the allocatable task amount of each cluster and the required task resources in each task group to be issued. The issuance of tasks can be dynamically adjusted according to the allocatable task amount of each cluster and the required task resources of each task group to be issued. For clusters with limited resources, the task allocation can be reduced. For clusters with sufficient resources, the task allocation can be reasonably increased to achieve load balancing between clusters and prevent resource overload or vacancy. In addition, when multiple pre-scheduled tasks are issued to a cluster, each pre-scheduled task in the corresponding target task group is scheduled by real-time monitoring of the status data of the cluster, and the pre-scheduled tasks can be automatically issued in real time according to the status of the cluster, and resource allocation can be intelligently adjusted.
[0071] In one embodiment of the present application, each pre-scheduled task has a priority level, which can be set by default according to the task type or assigned by the user. For example, when the user creates each pre-scheduled task, a priority field value is pre-set for each pre-scheduled task, and each priority field value corresponds to a priority level. Each priority field value has a one-to-one correspondence with the priority level, which is pre-configured in a configuration file. For example, the one-to-one correspondence between the priority field value and the corresponding priority level can be shown in Table 1 below:
[0072] Table 1: Correspondence between priority field values and priority levels
[0073] Priority field value Priority Level Category Name Priority Level L l-priority-nonpreempting-1000 1000 M m-priority-nonpreempting-1000000 1000000 H h-priority-nonpreempting-10000000 10000000 VH vh-priority-nonpreempting-1000000000 1000000000
[0074] like Figure 2 As shown, after each pre-scheduled task is set with a priority level, when the grouped pre-scheduled tasks are sent to the cluster, that is, S5 (sending the target task group to the target cluster according to the allocatable task volume of each cluster and the required task resources of each task group to be sent), the following steps are specifically included:
[0075] S51: Determine a first task group to be issued corresponding to a target cluster and a first number of pre-scheduled tasks to be scheduled in the first task group to be issued according to the allocatable task amount of each cluster and the required task resources of each task group to be issued;
[0076] Specifically, the first task group to be issued is one of the task groups to be issued after the plurality of pre-scheduled tasks are grouped in S3. For ease of understanding, one task group to be issued corresponding to one cluster is defined as the first task group to be issued.
[0077] That is, first determine the task group to be sent (i.e., the first task group to be sent) corresponding to a cluster (target cluster) and the first number of pre-scheduled tasks scheduled in the first task group to be sent based on the allocatable task volume of each cluster, the required task resources of each task group to be sent, and the preset scheduling strategy.
[0078] For example, the first task group to be sent corresponding to cluster A is task group 1 to be sent (including 8 pre-scheduled tasks), but according to the allocatable task amount of cluster A and the task resources required by task group 1 to be sent, 5 pre-scheduled tasks out of the 8 pre-scheduled tasks in the first task group to be sent can be scheduled. That is to say, cluster A allows 5 (i.e., the first number) pre-scheduled tasks to be scheduled.
[0079] S52: based on the priority level of each pre-scheduled task in the first task group to be issued, sequentially selecting a first number of pre-scheduled tasks in the first task group to be issued to form a target task group;
[0080] Since each pre-scheduled task has a corresponding priority field value, the priority level of each pre-scheduled task can be determined according to the priority field value of each pre-scheduled task in the first task group to be issued. And according to the priority level of the pre-scheduled task, the first number of pre-scheduled tasks are selected in sequence to form a target task group.
[0081] For example, the priority levels of the 8 pre-scheduled tasks in the first task group to be issued are: the priority level of the first pre-scheduled task is L, the priority level of the second pre-scheduled task is H, the priority level of the third pre-scheduled task is VH, the priority level of the fourth pre-scheduled task is VH, the priority level of the fifth pre-scheduled task is L, the priority level of the sixth pre-scheduled task is M, the priority level of the seventh pre-scheduled task is H, and the priority level of the eighth pre-scheduled task is VH. Since the priority levels are: VH>H>M>L, if the first number is 5, then the third pre-scheduled task, the fourth pre-scheduled task, the eighth pre-scheduled task, the second pre-scheduled task and the seventh pre-scheduled task constitute the target task group.
[0082] S53: Send the target task group to the target cluster.
[0083] Once the target task group is selected, it can be sent to the target cluster.
[0084] For example, a target task group consisting of the third pre-scheduling task, the fourth pre-scheduling task, the eighth pre-scheduling task, the second pre-scheduling task, and the seventh pre-scheduling task is sent to target cluster A.
[0085] When the pre-scheduled tasks in the target task group are sent to the target cluster, the priority field value of the pre-scheduled tasks is also sent.
[0086] By setting the priority of each pre-scheduled task, this application can sort the pre-scheduled tasks according to the priority, and give priority to issuing high-priority tasks. Regardless of the resource status of the cluster, it can ensure that high-priority tasks can obtain the right to priority execution.
[0087] Optional, such as Figure 3 As shown, the specific calculation method for calculating the allocatable task amount of each cluster, that is, S4 (calculating the allocatable task amount of each cluster according to the status data of each cluster and the preset scheduling strategy) includes the following steps:
[0088] S41: Obtaining a preset weight of each cluster;
[0089] Each cluster has a corresponding preset weight, which can be a default setting or a user setting, which is not limited here. For example, there are 3 clusters, namely Cluster A, Cluster B and Cluster C, then the preset weights of Cluster A, Cluster B and Cluster C can be 0.5, 0.2, and 0.3 respectively. Given that clusters of different cloud service providers differ in stability, concurrency, resource pool size, and maintenance costs, it is particularly important to assign differentiated weights to each cluster. The preset weight of each cluster can be adjusted dynamically. Specifically, the scheduler can continuously update and load the latest cluster weight configuration to achieve intelligent allocation during task delivery.
[0090] The setting of the preset weights can allocate different amounts of allocatable tasks to cluster A, cluster B, and cluster C, so as to intelligently allocate each batch of tasks.
[0091] S42: Calculate the allocatable task amount of each cluster according to the status data of each cluster, the preset weight of each cluster, and the preset scheduling strategy;
[0092] After the preset weight of each cluster is determined, the amount of tasks that can be assigned to each cluster can be calculated based on the status data of each cluster, the preset weight of each cluster, and the preset scheduling strategy.
[0093] For example, a user creates 100 pre-scheduled tasks (eg, 100 GPU tasks), and the 100 pre-scheduled tasks may be divided into a plurality of task groups to be issued.
[0094] When the preset weights of cluster A, cluster B and cluster C are 0.5, 0.2 and 0.3 respectively, the allocatable task amounts allocated to cluster A, cluster B and cluster C are 50 GPU tasks, 20 GPU tasks and 30 GPU tasks respectively.
[0095] That is to say, when other conditions are met, 50 GPU tasks can be sent to cluster A, 20 GPU tasks to cluster B, and 30 GPU tasks to cluster C.
[0096] This application sets a preset weight for each cluster. When sending multiple tasks to each cluster, it first calculates the amount of allocatable tasks for each cluster based on the preset weight of each cluster, and then intelligently allocates each batch of tasks based on the weight of each cluster, making the task distribution more balanced and comprehensively improving the overall efficiency of task execution.
[0097] In one embodiment of the present application, Figure 4 As shown, after each pre-scheduled task is set with a corresponding priority, the pre-scheduled tasks with higher priorities are preferentially sent to the cluster at the scheduler level. That is to say, after the target task group is sent to the target cluster, the specific scheduling method when the pre-scheduled tasks in the target task group are scheduled at the target cluster level, i.e., S6 (scheduling each pre-scheduled task in the corresponding target task group according to the status data of the target cluster) specifically includes the following steps:
[0098] S61: assigning a corresponding target computing node to each pre-scheduled task in the target task group according to the state data of the target cluster, wherein each pre-scheduled task corresponds to one target computing node;
[0099] When the target task group is sent to the cluster, multiple computing nodes in the cluster can be matched to each pre-scheduled task, and the matching process can use the label value. When the label value of the computing node matches (for example, is the same as) the label value of the pre-scheduled task, the computing node can be determined to be the target computing node that matches the pre-scheduled task. Among them, each pre-scheduled task can be set with one or more label values, and each computing node can be set with one or more label values.
[0100] S62: Based on the priority level of each pre-scheduled task, schedule each pre-scheduled task to a corresponding target computing node in turn.
[0101] Specifically, when the target task group is sent to the target cluster, the priority field value of the pre-scheduled tasks in the target task group is also sent down. Therefore, the priority level of each pre-scheduled task can be determined by parsing the priority field value of each pre-scheduled task in the target task group.
[0102] Since each pre-scheduled task has a priority level, when the preset scheduling task is successfully matched with the target computing node, the priority level of the preset scheduling task can be bound to the attribute of the priority category of the target computing node. When the target computing node is successfully bound to the priority level of the pre-scheduled task, each pre-scheduled task can be scheduled to the corresponding target computing node in turn according to the priority level of each pre-scheduled task, so that the target computing node executes the corresponding pre-scheduled task. Among them, one pre-scheduled task corresponds to one target computing node.
[0103] Specifically, multiple target computing nodes can be scheduled according to the resource usage status of the target cluster. For example, when the resource usage status of the target cluster is in a resource-constrained state, once the historical tasks are completed and the resources are released, the pre-scheduled tasks with higher priority levels will be given priority in resource allocation.
[0104] When the resource usage status of the target cluster is a sufficient resource status, multiple target computing nodes can be scheduled in sequence according to the priority levels of the pre-scheduled tasks, so that the target computing nodes execute the corresponding pre-scheduled tasks.
[0105] This application is based on the priority field value of the pre-scheduled task specified by the user, which is transmitted step by step to the scheduler. The scheduler binds the priority level to the priority category attribute on the computing node corresponding to the pre-scheduled task to ensure that the urgency requirements of different business scenarios are met. It can flexibly respond to different business needs, optimize resource allocation, and improve the priority and efficiency of task execution.
[0106] Optionally, the status data includes the resource usage status of the cluster and the working status of each computing node in the cluster. Figure 5 As shown, S61 (assigning a corresponding target computing node to each pre-scheduled task in the target task group according to the state data of the target cluster) specifically includes the following steps:
[0107] S611: When the number of computing nodes in the target cluster that are in an idle state is less than the number of pre-scheduled tasks in the target task group, and the resource usage status of the target cluster is a sufficient resource status, triggering a capacity expansion operation in sequence according to the priority levels of at least some of the pre-scheduled tasks to add at least one new computing node;
[0108] S612: Allocate target computing nodes to each pre-scheduled task in sequence according to the priority level of each pre-scheduled task, the computing nodes in the idle state, and the new computing nodes.
[0109] After adding new computing nodes, each pre-scheduled task can be assigned to the target computing node in turn according to the priority level of each pre-scheduled task, the idle computing nodes and the new computing nodes, so as to avoid the task being in a waiting state for a long time.
[0110] The resource sufficient state may refer to having the necessary resources required to complete the capacity expansion operation, that is, having sufficient resources to provision new computing nodes.
[0111] Optionally, when the number of computing nodes in the target cluster that are in an idle state is greater than or equal to the number of pre-scheduled tasks in the target task group, the target computing nodes can be directly allocated to each pre-scheduled task in turn according to the priority level of the pre-scheduled tasks without the need for capacity expansion operations.
[0112] Optional, such as Figure 6 As shown, in S62, the specific scheduling method of each pre-scheduled task in scheduling each pre-scheduled task to the corresponding target computing node can be, that is, S62 (scheduling the pre-scheduled task to the corresponding target computing node) includes the following steps:
[0113] S620: Obtain the node type of the target computing node, where the node type includes: an on-demand allocation node or a preemptive node;
[0114] Specifically, after the corresponding target computing node is matched for the pre-scheduled task, the node type of the target computing node is determined, and the node type includes an on-demand allocation node and a preemptive node Spot.
[0115] Among them, the preemptible node Spot has a price, and resources will be allocated preferentially to the preemptible nodes with higher prices.
[0116] S621: When the node type of the target computing node is an on-demand allocation node, a pre-scheduled task matching the target computing node is sent to the target computing node;
[0117] When it is determined that the node type of the target computing node is allocated on demand, the pre-scheduled task matching the target computing is directly sent to the target computing node, so that the priority level of the pre-scheduled task can be bound to the attribute of the priority category of the target computing node.
[0118] S622: When the node type of the target computing node is a preemptible node, obtain the current price of the target computing node and the historical interruption rate of the target computing node;
[0119] S623: When the current price of the target computing node is less than the preset price and the historical interruption rate of the target computing node is less than the preset interruption rate, the pre-scheduled task matching the target computing node is sent to the target computing node;
[0120] S624: When the current price of the target node is greater than or equal to the preset price, and / or the historical interruption rate of the target computing node is greater than or equal to the preset interruption rate, stop sending the pre-scheduled task to the target computing node.
[0121] When the node type of the target computing node is a preemptive node, only when the current price of the target computing node is less than the preset price and the historical interruption rate of the target computing node is less than the preset interruption rate, the pre-scheduled task matching the target computing node will be sent to the target computing node, so that the priority level of the pre-scheduled task can be bound to the priority category attribute of the target computing node. If the above conditions are not met, the pre-scheduled task will stop being sent to the target computing node.
[0122] In this application, before sending the pre-scheduled task to the matching computing node, the price data and historical interruption rate data of the preemptive computing node can be used for dynamic adjustment, allowing users to enjoy efficient computing power at a lower cost, and real-time monitoring and analysis of the price and historical interruption rate of the preemptive computing node, so that the scheduler can flexibly adjust the task scheduling strategy to adapt to market changes. By setting the maximum price threshold and maximum acceptable interruption rate of the preemptive computing node, the scheduler can avoid scheduling tasks during high-risk periods, reduce the risk of task failure, and improve the stability and reliability of task execution.
[0123] In one embodiment of the present application, as shown above, when the resource usage status of the target cluster is sufficient, the pre-scheduled task with a high priority level will trigger the expansion tool to open a new computing node. At this time, the number of computing nodes in the target cluster will increase. The status data also includes the running status of each pod in the node pool of the cluster, such as Figure 7 As shown, in S611, triggering the expansion operation in sequence according to the priority levels of at least some of the pre-scheduled tasks to add at least one new computing node may specifically include the following steps:
[0124] S6111: Get the number of pods in the waiting state in the node pool of the target cluster;
[0125] Specifically, the node pool in the target cluster includes multiple computing nodes, one computing node corresponds to one pod, and one pod corresponds to one pre-scheduled task. Therefore, the multiple computing nodes can be the target computing nodes corresponding to the pre-scheduled tasks, or they can be new computing nodes newly opened by the expansion tool.
[0126] The running status of different pods in the node pool may be different, so get the pods in the node pool that are in the waiting state. Pods are generated when tasks are received and disappear when tasks are completed. When a task is completed, the corresponding pod disappears, and the new computing node expanded by the pod also disappears if it is not scheduled for a certain period of time.
[0127] S6112: Calculate the upper limit of the number of new computing nodes that can be added based on the preset reduction ratio of the node pool and the number of pods in the waiting state;
[0128] Specifically, the preset reduction ratio is pre-configured in the configuration file, and the preset reduction ratio is less than 1.
[0129] The upper limit of the number of new computing nodes that can be added is calculated based on the preset reduction ratio of the node pool and the number of pods in the waiting state. The upper limit of the number of new computing nodes is calculated as follows: upper limit of new computing nodes = N*(1-K), where N is the number of pods in the waiting state in the node pool, and K is the preset reduction ratio.
[0130] For example, when the number of pods in the waiting state in the node pool is 100 and the preset reduction ratio of the node pool is 0.5, the upper limit of the number of new computing nodes is 100*(1-0.5)=50. When expanding capacity, a maximum of 50 new computing nodes can be added to the node pool.
[0131] The preset reduction ratio is a parameter that can be set manually. The purpose of setting this parameter is to reduce the number of machines (computing nodes) that need to be expanded. For example, if there are 100 pods in a waiting state, then it is reasonable to expand 100 machines so that each pod can run on one node. However, in fact, it takes 2-3 minutes to expand the machine, while some tasks only take tens of seconds to execute. In order to improve the utilization rate, we hope to use 50 machines to run 100 tasks. In this way, the preset reduction ratio parameter is needed, so that the nodes that are expanded first can quickly execute a task and then execute the next task.
[0132] S6113: Trigger expansion operations in sequence according to the priority levels of at least some of the pre-scheduled tasks to add new computing nodes that do not exceed an upper limit.
[0133] After calculating the upper limit of the number of new computing nodes that can be expanded in the node pool in S6112, the expansion operation can be triggered in sequence according to the priority levels of the pre-adjusted tasks to add new computing nodes, and the number of new computing nodes does not exceed the upper limit.
[0134] Optional, such as Figure 8 As shown, the resource scheduling method also includes the following steps:
[0135] S7: Adjust the upper limit of the number of nodes in the node pool according to the upper limit of the number of new computing nodes and the number of computing nodes in running state in the node pool.
[0136] After calculating the upper limit of the number of new computing nodes that can be expanded in the node pool in S6112, the upper limit of the number of nodes in the node pool can be calculated based on the number of computing nodes in operation in the node pool and the upper limit of the number of new computing nodes, that is, the maximum number of computing nodes that the node pool can accommodate.
[0137] Specifically, the upper limit of the number of nodes in the node pool is equal to the sum of the number of running computing nodes in the node pool and the upper limit of the number of new computing nodes.
[0138] After the upper limit of the number of nodes in the node pool is calculated, the upper limit of the number of nodes in the node pool can be adjusted according to the upper limit of the number of nodes.
[0139] It should be noted that since the number of pods in the waiting state in the node pool will change, the number of new computing nodes that can be added to the node pool will also change accordingly, and the upper limit of the number of computing nodes in the node pool will also change accordingly.
[0140] This application uses a preset reduction ratio of the node pool of the target cluster to control the upper limit of the number of new computing nodes when the expansion tool adds new computing nodes, thereby avoiding the phenomenon that may cause expansion operations of a large number of machines in a short period of time; in addition, the number of pods in a waiting state in the node pool will change, so the number of new computing nodes that can be added to the node pool will also change accordingly, so the node pool size can be automatically adjusted according to the task execution time and resource requirements, further reducing resource waste and improving the response speed and flexibility of the cluster.
[0141] Optional, such as Fig. 9 As shown, S7 (adjusting the upper limit of the number of nodes in the node pool according to the upper limit of the number of new computing nodes and the number of computing nodes in operation in the node pool) specifically includes the following steps:
[0142] S71: Determine whether the number of pods in the waiting state in the node pool increases;
[0143] The number of pods in the waiting state in the node pool changes at any time. Therefore, it is necessary to determine whether the number of pods in the waiting state in the node pool has increased compared with the number of pods in the waiting state in the node pool at the last data scan.
[0144] When the judgment result of S71 is yes, it means that the number of pods in the current node pool that are in the waiting state has increased compared with the number of pods in the node pool that were in the waiting state during the last data scan. At this time, the upper limit of the number of nodes in the node pool needs to be increased, and S72-S74 are executed;
[0145] When the judgment result of S71 is no, it means that the number of pods in the waiting state in the current node pool has decreased compared with the number of pods in the waiting state in the node pool during the last data scan. At this time, the upper limit of the number of nodes in the node pool needs to be lowered, and S75 is executed;
[0146] S72: Calculate the time interval between the current time and the last time the upper limit of the number of nodes in the node pool was adjusted;
[0147] Specifically, the last adjustment time of the upper limit of the number of nodes in the node pool can be obtained through the adjustment record, and the time interval can be calculated based on the current time and the last adjustment time of the upper limit of the number of nodes in the node pool. The last adjustment time of the upper limit of the number of nodes in the node pool can be the time of adjusting the upper limit of the number of nodes in the node pool upward or downward, which is not limited here.
[0148] S73: Determine whether the time interval is greater than a preset time interval;
[0149] Specifically, the preset time interval may be pre-configured by the user, for example, the preset time interval is 2 to 10 minutes.
[0150] When the judgment result of S73 is yes, it means that the time interval is greater than the preset time interval, and the upper limit of the number of adjustment points can be increased at this time, that is, S74 is executed.
[0151] When the judgment result of S73 is no, it means that the time interval is less than or equal to the preset time interval, and no processing is performed at this time, that is, no adjustment is made to the upper limit of the number of nodes in the node pool.
[0152] S74: According to the upper limit of the number of new computing nodes and the number of computing nodes in operation in the node pool, the upper limit of the number of nodes in the node pool is increased.
[0153] S75: According to the upper limit of the number of new computing nodes and the number of computing nodes in operation in the node pool, the upper limit of the number of nodes in the node pool is lowered.
[0154] In this application, as the number of pods in the waiting state in the node pool increases, the number of new computing nodes that can be added also increases, and the upper limit of the number of computing nodes in the node pool may also increase. Therefore, compared with the last adjustment of the upper limit of the number of nodes in the node pool, this adjustment is to increase the upper limit of the number of nodes in the node pool. Therefore, a delay mechanism is set to increase the upper limit of the number of nodes in the node pool. Only when the time from the last adjustment of the upper limit of the number of nodes in the node pool exceeds the preset time interval, the upper limit of the number of nodes in the node pool is increased to achieve the goal of completing more tasks with the least resources. Short and concise tasks can make better use of existing computing resources and complete as many tasks as possible. At the same time, when it is necessary to lower the upper limit of the number of nodes in the node pool, it can be adjusted immediately without delay.
[0155] Example Scheduler
[0156] As a second aspect of the present application, the present application also provides a resource scheduler, such as Fig.10 As shown, the resource scheduler 1 includes:
[0157] A data acquisition module 101 is used to acquire status data of multiple clusters;
[0158] Specifically, the status data includes the resource usage status of the cluster and the working status of each computing node in the cluster;
[0159] The task grouping module 102 is used to obtain a plurality of pre-scheduled tasks, each of which has corresponding preset task requirement information; and group the plurality of pre-scheduled tasks according to a preset grouping rule and the preset task requirement information of each pre-scheduled task, so as to generate a plurality of task groups to be issued;
[0160] A calculation module 103 is used to calculate the allocatable task amount of each cluster according to the status data of each cluster and a preset scheduling strategy;
[0161] The scheduling module 104 is used to send the target task group to the target cluster according to the allocatable task amount of each cluster and the required task resources of each task group to be sent, wherein the target task group includes at least one pre-scheduled task in the task group to be sent; and schedule each pre-scheduled task in the corresponding target task group according to the status data of the target cluster.
[0162] Optionally, each pre-scheduled task has a priority level; the scheduling module 104 sends the target task group to the target cluster according to the allocatable task amount of each cluster and the required task resources of each task group to be sent, including:
[0163] Determine a first task group to be issued corresponding to the target cluster and a first number of pre-scheduled tasks scheduled in the first task group to be issued according to the allocatable task amount of each cluster and the required task resources of each task group to be issued;
[0164] Based on the priority level of each pre-scheduled task in the first task group to be issued, sequentially selecting a first number of pre-scheduled tasks from the first task group to be issued to form a target task group;
[0165] Send the target task group to the target cluster.
[0166] Optionally, the scheduling module 104 schedules each pre-scheduled task in the corresponding target task group according to the state data of the target cluster, including:
[0167] According to the state data of the target cluster, a corresponding target computing node is allocated to each pre-scheduled task in the target task group, and each pre-scheduled task corresponds to one target computing node;
[0168] Based on the priority level of each pre-scheduled task, each pre-scheduled task is scheduled to the corresponding target computing node in turn.
[0169] Optionally, the status data includes the resource usage status of the cluster and the working status of each computing node in the cluster; the scheduling module 104 allocates a corresponding target computing node to each pre-scheduled task in the target task group according to the status data of the target cluster, including:
[0170] When the number of computing nodes in the target cluster that are in an idle state is less than the number of pre-scheduled tasks in the target task group, and the resource usage state of the target cluster is a sufficient resource state, a capacity expansion operation is triggered in sequence according to the priority levels of at least some of the pre-scheduled tasks to add at least one new computing node;
[0171] According to the priority level of each pre-scheduled task, the idle computing nodes and the new computing nodes, the target computing nodes are allocated to each pre-scheduled task in turn.
[0172] Optionally, the status data also includes the running status of each pod in the node pool of the cluster; the scheduling module 104 triggers the expansion operation in sequence according to the priority level of at least part of the pre-scheduled tasks to add at least one new computing node, including:
[0173] Obtain the number of pods in the waiting state in the node pool of the target cluster; wherein one pod corresponds to one pre-scheduled task;
[0174] Calculate the upper limit of the number of new computing nodes that can be added according to the preset reduction ratio of the node pool and the number of pods in a waiting state;
[0175] Capacity expansion operations are triggered in sequence according to the priority levels of at least some of the pre-scheduled tasks, so as to add new computing nodes that do not exceed the upper limit.
[0176] Optionally, the scheduling module 104 is further configured to adjust the upper limit of the number of nodes in the node pool according to the upper limit of the number of new computing nodes and the number of computing nodes in operation in the node pool.
[0177] Optionally, the scheduling module 104 adjusts the upper limit of the number of nodes in the node pool according to the upper limit of the number of new computing nodes and the number of computing nodes in operation in the node pool, including:
[0178] When the number of pods in the waiting state in the node pool increases, the time interval between the current time and the last time the upper limit of the number of nodes in the node pool was adjusted is calculated; when the time interval is greater than the preset time interval, the upper limit of the number of nodes in the node pool is increased according to the upper limit of the number of new computing nodes and the number of computing nodes in the running state in the node pool;
[0179] When the number of pods in the waiting state in the node pool decreases, the upper limit of the number of nodes in the node pool is lowered according to the upper limit of the number of new computing nodes and the number of computing nodes in the running state in the node pool.
[0180] Optionally, the scheduling module 104 schedules the pre-scheduled task to the corresponding target computing node, including:
[0181] Obtaining a node type of a target computing node, wherein the node type includes: an on-demand allocation node or a preemptive node;
[0182] When the node type of the target computing node is an on-demand allocation node, a pre-scheduled task matching the target computing node is sent to the target computing node;
[0183] When the node type of the target computing node is a preemptible node, obtaining the current price of the target computing node and the historical interruption rate of the target computing node;
[0184] When the current price of the target computing node is less than the preset price, and the historical interruption rate of the target computing node is less than the preset interruption rate, the pre-scheduled task matching the target computing node is sent to the target computing node;
[0185] When the current price of the target node is greater than or equal to the preset price, and / or the historical interruption rate of the target computing node is greater than or equal to the preset interruption rate, stop sending the pre-scheduled task to the target computing node.
[0186] Optionally, the calculation module 103 calculates the allocatable task amount of each cluster according to the status data of each cluster and a preset scheduling strategy, including:
[0187] Get the preset weights for each cluster; and
[0188] The amount of tasks that can be assigned to each cluster is calculated based on the status data of each cluster, the preset weight of each cluster, and the preset scheduling strategy.
[0189] Optionally, the preset task requirement information of the pre-scheduled task includes the required processor type and the required number of cores of the pre-scheduled task. The task grouping module 102 groups the multiple pre-scheduled tasks according to the preset grouping rule and the preset task requirement information of each pre-scheduled task to generate multiple task groups to be issued, including:
[0190] According to the preset grouping rule and the required processor type and required number of cores of each pre-scheduled task, multiple pre-scheduled tasks are grouped to generate multiple task groups to be issued.
[0191] The specific execution operations of the above modules can refer to the relevant content in the above resource scheduling method embodiment, which will not be repeated here.
[0192] Exemplary Electronic Devices
[0193] Below, reference Fig.11 To describe an electronic device according to an embodiment of the present application. Fig.11 Shown is a schematic structural diagram of an electronic device provided in one embodiment of the present application.
[0194] like Fig.11 As shown, the electronic device 600 includes one or more processors 601 and a memory 602 .
[0195] The processor 601 may be a central processing unit (CPU) or other forms of processing units having information processing capabilities and / or information execution capabilities, and may control other components in the electronic device 600 to perform desired functions.
[0196] The memory 602 may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc. One or more computer program information may be stored on the computer-readable storage medium, and the processor 601 may run the program information to implement the resource scheduling method or other desired functions of the various embodiments of the present application described above.
[0197] In one example, the electronic device 600 may further include: an input device 603 and an output device 604 , and these components are interconnected via a bus system and / or other forms of connection mechanisms (not shown).
[0198] The input device 603 may include, for example, a keyboard, a mouse, etc.
[0199] The output device 604 can output various information to the outside. The output device 604 can include, for example, a display, a communication network and a remote output device connected thereto.
[0200] Of course, to simplify, Fig.11 Only some of the components related to the present application in the electronic device 600 are shown, and components such as a bus, an input / output interface, etc. are omitted. In addition, according to specific application situations, the electronic device 600 may also include any other appropriate components.
[0201] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program information, which, when executed by a processor, enables the processor to execute the steps of the resource scheduling method according to various embodiments of the present application described in this specification.
[0202] The computer program product may be written in any combination of one or more programming languages to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0203] In addition, an embodiment of the present application may also be a computer-readable storage medium on which computer program information is stored. When the computer program information is executed by a processor, the processor executes the steps of the resource scheduling method in accordance with various embodiments of the present application.
[0204] The computer readable storage medium can adopt any combination of one or more readable media. The readable medium can be a readable signal medium or a readable storage medium. The readable storage medium can include, for example, but is not limited to, a system, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0205] The basic principles of the present application are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present application are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present application. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, not for limitation, and the above details do not limit the present application to being implemented by adopting the above specific details.
[0206] The block diagrams of the devices, apparatuses, equipment, and systems involved in this application are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The words "such as" used here refer to the phrase "such as but not limited to", and can be used interchangeably with them.
[0207] It should also be noted that in the apparatus, device and method of the present application, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as an equivalent mode of the present application.
[0208] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present application. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present application. Therefore, the present application is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features of the present invention.
[0209] The above description is only a preferred embodiment of the invention of the present application and is not intended to limit the invention of the present application. Any modifications, equivalent substitutions, etc. made within the spirit and principles of the invention of the present application shall be included in the protection scope of the invention of the present application.
Claims
1. A resource scheduling method, characterized in that: include: Get status data of multiple clusters; Acquire multiple pre-scheduled tasks, each pre-scheduled task having corresponding preset task requirement information; According to the preset grouping rules and the preset task requirement information of each pre-scheduled task, multiple pre-scheduled tasks are grouped to generate multiple task groups to be issued; Calculate the amount of tasks that can be assigned to each cluster based on the status data of each cluster and the preset scheduling strategy; According to the allocatable task amount of each cluster and the required task resources of each task group to be issued, issue a target task group to the target cluster, wherein the target task group includes at least one pre-scheduled task in the task group to be issued; Each pre-scheduled task in the corresponding target task group is scheduled according to the state data of the target cluster.
2. The resource scheduling method according to claim 1, characterized in that: Each of the pre-scheduled tasks has a priority level; the sending of the target task group to the target cluster according to the allocatable task amount of each cluster and the required task resources of each task group to be sent includes: Determine a first task group to be issued corresponding to the target cluster and a first number of pre-scheduled tasks scheduled in the first task group to be issued according to the allocatable task amount of each cluster and the required task resources of each task group to be issued; Based on the priority level of each pre-scheduled task in the first task group to be issued, sequentially selecting a first number of pre-scheduled tasks from the first task group to be issued to form a target task group; Send the target task group to the target cluster.
3. The resource scheduling method according to claim 1 or 2, characterized in that: The step of scheduling each pre-scheduled task in the corresponding target task group according to the state data of the target cluster includes: According to the state data of the target cluster, a corresponding target computing node is allocated to each pre-scheduled task in the target task group, and each pre-scheduled task corresponds to one target computing node; Based on the priority level of each pre-scheduled task, each pre-scheduled task is scheduled to the corresponding target computing node in turn.
4. The resource scheduling method according to claim 3, characterized in that: The status data includes the resource usage status of the cluster and the working status of each computing node in the cluster; The step of allocating a corresponding target computing node to each pre-scheduled task in the target task group according to the state data of the target cluster includes: When the number of computing nodes in the target cluster that are in an idle state is less than the number of pre-scheduled tasks in the target task group, and the resource usage state of the target cluster is a sufficient resource state, a capacity expansion operation is triggered in sequence according to the priority levels of at least some of the pre-scheduled tasks to add at least one new computing node; According to the priority level of each pre-scheduled task, the idle computing nodes and the new computing nodes, the target computing nodes are allocated to each pre-scheduled task in turn.
5. The resource scheduling method according to claim 4, characterized in that: The state data also includes the running state of each pod in the node pool of the cluster; the expansion operation is triggered in sequence according to the priority levels of at least some of the pre-scheduled tasks to add at least one new computing node, including: Obtain the number of pods in the waiting state in the node pool of the target cluster; wherein one pod corresponds to one pre-scheduled task; Calculate the upper limit of the number of new computing nodes that can be added according to the preset reduction ratio of the node pool and the number of pods in a waiting state; Capacity expansion operations are triggered in sequence according to the priority levels of at least some of the pre-scheduled tasks, so as to add new computing nodes that do not exceed the upper limit.
6. The resource scheduling method according to claim 5, characterized in that: The method further comprises: The upper limit of the number of nodes in the node pool is adjusted according to the upper limit of the number of new computing nodes and the number of computing nodes in operation in the node pool.
7. The resource scheduling method according to claim 6, characterized in that: The adjusting the upper limit of the number of nodes in the node pool according to the upper limit of the number of new computing nodes and the number of computing nodes in operation in the node pool includes: When the number of pods in the waiting state in the node pool increases, the time interval between the current time and the last time the upper limit of the number of nodes in the node pool was adjusted is calculated; when the time interval is greater than the preset time interval, the upper limit of the number of nodes in the node pool is increased according to the upper limit of the number of new computing nodes and the number of computing nodes in the running state in the node pool; When the number of pods in the waiting state in the node pool decreases, the upper limit of the number of nodes in the node pool is lowered according to the upper limit of the number of new computing nodes and the number of computing nodes in the running state in the node pool.
8. The resource scheduling method according to claim 3, characterized in that: Schedule the pre-scheduled tasks to the corresponding target computing nodes, including: Obtaining a node type of a target computing node, wherein the node type includes: an on-demand allocation node or a preemptive node; When the node type of the target computing node is an on-demand allocation node, a pre-scheduled task matching the target computing node is sent to the target computing node; When the node type of the target computing node is a preemptible node, obtaining the current price of the target computing node and the historical interruption rate of the target computing node; When the current price of the target computing node is less than the preset price, and the historical interruption rate of the target computing node is less than the preset interruption rate, the pre-scheduled task matching the target computing node is sent to the target computing node; When the current price of the target node is greater than or equal to the preset price, and / or the historical interruption rate of the target computing node is greater than or equal to the preset interruption rate, stop sending the pre-scheduled task to the target computing node.
9. The resource scheduling method according to any one of claims 1 to 8, characterized in that: The calculating the allocatable task amount of each cluster according to the status data of each cluster and the preset scheduling strategy includes: Get the preset weights for each cluster; and The amount of tasks that can be assigned to each cluster is calculated based on the status data of each cluster, the preset weight of each cluster, and the preset scheduling strategy.
10. The resource scheduling method according to any one of claims 1 to 8, characterized in that: The preset task requirement information of the pre-scheduled task includes the required processor type and the required number of cores of the pre-scheduled task, and the grouping of the multiple pre-scheduled tasks according to the preset grouping rule and the preset task requirement information of each pre-scheduled task to generate multiple task groups to be issued includes: According to the preset grouping rule and the required processor type and required number of cores of each pre-scheduled task, multiple pre-scheduled tasks are grouped to generate multiple task groups to be issued.
11. A resource scheduler, characterized in that: include: Data acquisition module, used to obtain status data of multiple clusters; A task grouping module is used to obtain a plurality of pre-scheduled tasks, each of which has corresponding preset task requirement information; And according to the preset grouping rules and the preset task requirement information of each pre-scheduled task, multiple pre-scheduled tasks are grouped to generate multiple task groups to be issued; A calculation module is used to calculate the amount of tasks that can be assigned to each cluster based on the status data of each cluster and the preset scheduling strategy; A scheduling module, used to send a target task group to a target cluster according to the allocatable task amount of each cluster and the required task resources of each task group to be sent, wherein the target task group includes at least one pre-scheduled task in a task group to be sent; And schedule each pre-scheduled task in the corresponding target task group according to the status data of the target cluster.
12. An electronic device, characterized in that: The electronic device comprises: Processor; and a memory for storing information executable by the processor; The processor is used to execute the resource scheduling method described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the resource scheduling method described in any one of claims 1 to 10 is implemented.