A scheduling method, device and medium for batch scheduler
By judging the waiting time and node resource availability of the PodGroup in Kubernetes, and selecting appropriate nodes to allocate resources to the Pod, the problem of excessive waiting and starvation of the PodGroup caused by the batch scheduler is solved, and the efficiency of resource scheduling is improved.
Patent Information
- Application Number
- CN202210612305.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-31
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2042-05-31
AI Technical Summary
In Kubernetes, due to insufficient resources of the batch scheduler, the problem of PodGroup waiting for a long time or even starving to death is difficult to effectively solve with existing technology.
By judging whether the waiting time of the PodGroup to be scheduled exceeds the preset time, and based on the available resources and reserved resources of the node resource device, select the appropriate target node to allocate resources to the Pod, and update the reserved resources to ensure that the PodGroup can be scheduled in time. .
This effectively prevents PodGroup from waiting for long periods of time and starving to death, improves the efficiency and reliability of resource scheduling, and ensures that PodGroup can obtain necessary computing resources in a timely manner.
Smart Images

Figure CN114924884B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a scheduling method, device and medium for a batch scheduler. Background Art
[0002] In a computer cluster, there may be tens of thousands of containers running. It is almost impossible to manage so many containers manually. Kubernetes (commonly known as k8s, an open source container cluster management system from Google Cloud Platform, used to automatically deploy, scale and manage containerized applications) is an open source platform that can automatically manage large-scale containers. It can complete important functions such as container deployment and replication, container expansion and contraction, and load balancing between containers. In kubernetes, Pod is a collection of containers and is the most basic scheduling unit. PodGroup is a group of Pod replicas. The Kubernetes controller is associated with a PodGroup and manages the life cycle of the Pod in the PodGroup. Controllers are often used in distributed computing tasks to meet the scenarios where Pods need to be scheduled in batches in such tasks. Correspondingly, the kubernetes batch scheduler is used to coordinate cluster computing resources and is responsible for selecting some of the best node resource devices for a group of Pods to run.
[0003] The batch scheduler must follow this basic principle: when a PodGroup applies for resources, but the resource margin of the current node resource equipment in the cluster cannot meet its requested resource amount, there may be no or only some Pods that can be allocated enough resources. If the number of these Pods is lower than the minimum value of the PodGroup limit, all Pods in this PodGroup will not be successfully scheduled (allocated computing resources). Therefore, the batch scheduler will encounter such a dilemma: two PodGroups A and PodGroup B are created successively, and the current resource margin of the cluster meets the resource amount requested by PodGroup B, but cannot meet the resource amount requested by PodGroup A. Then PodGroup B will be successfully scheduled, and PodGroup A will continue to wait for the cluster to release resources. If PodGroups similar to PodGroup B that can be successfully scheduled immediately are constantly created in the cluster, the cluster resource margin may not be able to accumulate to the resource application amount of PodGroup A for a long time, causing the task PodGroup A to wait for a very long time or even starve to death.
[0004] It can be seen that providing a resource scheduling and allocation method for a timed-out PodGroup is a technical problem that needs to be solved urgently by personnel in this field. Summary of the invention
[0005] The purpose of this application is to provide a scheduling method for a batch scheduler that avoids a PodGroup from waiting for an excessively long time or even starving to death.
[0006] In order to solve the above technical problems, the present application provides a scheduling method of a batch scheduler, comprising:
[0007] Determine whether the waiting time of the PodGroup to be scheduled exceeds the preset time;
[0008] If the waiting time of the PodGroup to be scheduled exceeds the preset time, determine whether the difference between the total resource amount of the node resource device and the reserved resource amount is greater than the Pod application resource amount of a Pod;
[0009] If the difference is greater than the resource amount requested by the Pod, the current node resource device is used as the candidate node resource device for the Pod;
[0010] Select the target node resource device of the Pod from all the candidate node resource devices;
[0011] Determine whether the remaining available resources of the target node resource device are less than the resource requested by the Pod;
[0012] If the remaining available resources are less than the Pod applied resources, the original reserved resources of the target node resource device are updated to the sum of the original reserved resources and the Pod applied resources;
[0013] When the number of the Pods that meet the allocation condition in the PodGroup to be scheduled is greater than a preset minimum value, the PodGroup to be scheduled is scheduled to the corresponding target node resource device.
[0014] Preferably, in the scheduling method of the batch scheduler, if it is determined that the remaining available resources of the target node resource device are not less than the Pod application resource amount, it also includes:
[0015] The original remaining available resource amount of the target node resource device is updated to the difference between the original remaining available resource amount and the resource amount requested by the Pod, and the original reserved resource amount is updated to the sum of the original reserved resource amount and the resource amount requested by the Pod;
[0016] When the number of the Pods that meet the allocation condition in the PodGroup to be scheduled is greater than a preset minimum value, the PodGroup to be scheduled is scheduled to the corresponding target node resource device.
[0017] Preferably, in the scheduling method of the batch scheduler, before determining whether the waiting time of the PodGroup to be scheduled exceeds the preset time, the method further includes:
[0018] Receive data information of the PodGroup to be scheduled, the Pod, and the node resource device.
[0019] Preferably, in the scheduling method of the batch scheduler, when the number of the Pods in the PodGroup to be scheduled that meet the allocation condition is greater than a preset minimum value, scheduling the PodGroup to be scheduled to the corresponding target node resource device includes:
[0020] Determine whether the reserved resource amounts of the target node resource devices corresponding to all the Pods in the currently scheduled PodGroup are less than the remaining available resource amounts;
[0021] If so, schedule the Pod in the current PodGroup to be scheduled to the corresponding target node resource device.
[0022] Preferably, in the scheduling method of the batch scheduler, if it is determined that the waiting time of the PodGroup to be scheduled does not exceed the preset time, it also includes:
[0023] Determine whether the remaining available resources of the node resource device are greater than the resource requested by the Pod;
[0024] If yes, use the current node resource device as the candidate node resource device for the current Pod;
[0025] The target node resource device of the current Pod is selected from all the candidate node resource devices.
[0026] Preferably, in the scheduling method of the batch scheduler, after selecting the target node resource device of the current Pod from all the candidate node resource devices, the method further includes:
[0027] Determine whether the number of Pods whose remaining available resources of the target node resource device corresponding to the Pod in the currently scheduled PodGroup is greater than the Pod's requested resources is not less than the preset minimum value;
[0028] If so, schedule the Pod in the current PodGroup to be scheduled to the corresponding target node resource device.
[0029] Preferably, in the scheduling method of the batch scheduler, if the remaining available resources of the target node resource device corresponding to the Pod in the current PodGroup to be scheduled are greater than the number of Pods applying for resources and less than the preset minimum value, it also includes:
[0030] Cancel the scheduling of the currently scheduled PodGroup and wait for the next scheduling cycle.
[0031] In order to solve the above technical problems, the present application also provides a scheduling device of a batch scheduler, comprising:
[0032] The first judgment module is used to judge whether the waiting time of the PodGroup to be scheduled exceeds the preset time; if the waiting time of the PodGroup to be scheduled exceeds the preset time, the second judgment module is triggered;
[0033] The second judgment module is used to judge whether the difference between the total resource amount and the reserved resource amount of the node resource device is greater than the Pod application resource amount of a Pod; if the difference is greater than the Pod application resource amount, triggering the selection module;
[0034] The selection module is used to use the current node resource device as the node resource device to be selected for the Pod;
[0035] A screening module, used to select a target node resource device of the Pod from all the candidate node resource devices;
[0036] The third judgment module is used to judge whether the remaining available resources of the target node resource device are less than the Pod application resource amount; if the remaining available resources are less than the Pod application resource amount, trigger the update module;
[0037] The updating module is used to update the original reserved resource amount of the target node resource device to the sum of the original reserved resource amount and the Pod application resource amount;
[0038] The scheduling module is used to schedule the PodGroup to be scheduled to the corresponding target node resource device when the number of the Pods that meet the allocation conditions in the PodGroup to be scheduled is greater than a preset minimum value.
[0039] In order to solve the above technical problems, the present application also provides a scheduling device of a batch scheduler, comprising:
[0040] Memory for storing computer programs;
[0041] A processor is used to implement the steps of the scheduling method of the batch scheduler when executing the computer program.
[0042] In order to solve the above technical problems, the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the scheduling method of the batch scheduler are implemented.
[0043] The scheduling method of the batch scheduler provided in the present application includes: judging whether the waiting time of the PodGroup to be scheduled exceeds the preset time; if the waiting time of the PodGroup to be scheduled exceeds the preset time, judging whether the difference between the total resource amount and the reserved resource amount of the node resource device is greater than the Pod application resource amount of a Pod; if the difference is greater than the Pod application resource amount, using the current node resource device as the candidate node resource device for the Pod; selecting the target node resource device of the Pod from all the candidate node resource devices; judging whether the remaining available resource amount of the target node resource device is less than the Pod application resource amount; if the remaining available resource amount is less than the Pod application resource amount, updating the original reserved resource amount of the target node resource device to the sum of the original reserved resource amount and the Pod application resource amount; when the number of Pods that meet the allocation conditions in the PodGroup to be scheduled is greater than the preset minimum value, scheduling the PodGroup to be scheduled to the corresponding target node resource device. When the waiting time of the PodGroup exceeds the preset time, and there are still insufficient remaining available resources to schedule the current Pod, this application sets reserved resources for the current Pod by selecting an appropriate target node resource device. Once the remaining available resources reach the reserved resources, the target node resource device is scheduled for the current Pod to prevent the node resource device from being unable to accumulate sufficient resources for scheduling the PodGroup due to other PodGroups constantly scheduling node resource devices, causing the PodGroup to wait for an excessively long time or even starve to death.
[0044] In addition, the present application also provides a device and a medium, which correspond to the above method and have the same effect as above. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0046] Figure 1 A flowchart of a scheduling method for a batch scheduler provided in an embodiment of the present application;
[0047] Figure 2A flowchart of another batch scheduler scheduling method provided in an embodiment of the present application;
[0048] Figure 3 A schematic diagram of a scheduling device of a batch scheduler provided in an embodiment of the present application;
[0049] Figure 4 A structural diagram of another scheduling device of a batch scheduler provided in an embodiment of the present application. DETAILED DESCRIPTION
[0050] 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.
[0051] The core of this application is to provide a scheduling method, device and medium for a batch scheduler.
[0052] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0053] Cloud computing is a technology that pools computer cluster resources and transmits data over the network to provide services to users. In traditional cloud computing, the resource pooling process is implemented using virtualization technology, which isolates computer hardware and software from each other. Later, container technology emerged, which can achieve similar functions as virtualization technology and is more lightweight. The emergence of the Docker project has made container technology really popular. It packages files and directories in the entire operating system to ensure the consistency of development, testing, and production environments, greatly reducing the complexity of application release.
[0054] Kubernetes is a portable, extensible, open source platform for managing containerized workloads and services that facilitates declarative configuration and automation. Kubernetes has a large and rapidly growing ecosystem with a wide range of services, support, and tools. Kubernetes provides a framework for running distributed systems in an elastic manner. Kubernetes will meet your scaling requirements, failover, deployment patterns, and more. However, in a computer cluster, there may be tens of thousands of containers running, and it is almost impossible to manually manage so many containers. In kubernetes, Pod is a collection of containers and is the most basic scheduling unit. PodGroup is a group of Pod replicas. Controllers are often used in distributed computing tasks to meet the scenarios where Pods need to be scheduled in batches in such tasks. Correspondingly, the kubernetes batch scheduler is used to coordinate cluster computing resources and is responsible for selecting some of the best node resource devices for a group of Pods to run. The Pod controller is the middle layer for managing Pods. After using the Pod controller, we only need to tell the Pod controller how many and what kind of Pods we want. It will create Pods that meet the conditions and ensure that each Pod is in the state expected by the user. If a Pod fails during operation, the controller will restart or rebuild the Pod based on the specified strategy.
[0055] Due to the existing batch scheduler scheduling principle: when a PodGroup applies for resources, but the resource margin of the current node resource equipment in the cluster cannot meet its requested resource amount, no or only some Pods may be allocated sufficient resources. If the number of these Pods is lower than the minimum value of the PodGroup limit, all Pods in this PodGroup will not be successfully scheduled (allocated computing resources). As a result, the cluster resource margin may not be accumulated to the resource application amount of the PodGroup for a long time, causing the PodGrou to wait for a very long time or even starve to death (in operating system theory, starvation means that a process will never be run and will be in a permanent waiting state).
[0056] In order to solve the above technical problems, Figure 1 A flowchart of a scheduling method for a batch scheduler provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, including:
[0057] S11: Determine whether the waiting time of the PodGroup to be scheduled exceeds the preset time; if the waiting time of the PodGroup to be scheduled exceeds the preset time, proceed to step S12;
[0058] When a PodGroup is not successfully scheduled in the previous scheduling cycle, it will enter the waiting state. This embodiment does not limit the specific preset time and can be designed according to actual needs. The preset time mentioned in this embodiment means that when the waiting time of the PodGroup exceeds this preset time, the subsequent process will not cause it to continue to wait for the node resource device that has accumulated the resource application amount of the PodGroup to appear before allocating the node resource device.
[0059] S12: Determine whether the difference between the total resource amount of the node resource device and the reserved resource amount is greater than the Pod application resource amount of a Pod; if the difference is greater than the Pod application resource amount, proceed to step S13;
[0060] PodGroup is a group of Pod copies, and Pod is a collection of containers, which is the most basic scheduling unit. Scheduling node resource devices for PodGroup means scheduling node resource devices for each Pod in PodGroup. Therefore, step S12 is to judge for each Pod in PodGroup. The total amount of resources required by Pod is the amount of resources applied for Pod. The total amount of resources of each node resource device is the sum of the used amount of resources and the remaining available amount of resources. The reserved amount of resources mentioned in this embodiment refers to the amount of resources reserved by this node resource device for other Pods. This part of the amount of resources is equivalent to the amount of resources reserved by other Pods and will not be distributed to other Pods. The initial value of the reserved amount of resources for each node resource device is 0. The value of this reserved amount of resources is variable. When other timed-out Pods select this node resource device in the previous scheduling cycle or before this scheduling cycle, the reserved amount of resources of the node resource device will change, resulting in the total amount of resources of the node resource device being the sum of the used amount of resources, the remaining available amount of resources and the reserved amount of resources.
[0061] This embodiment determines whether the difference between the total resource amount and the reserved resource amount of the node resource device is greater than the Pod application resource amount of a Pod; that is, the sum of the used resource amount and the remaining available resource amount is used as the remaining available resource amount of the Pod screening node resource device, so that the ratio uses the remaining available resource amount to screen the node resource device for the Pod to expand the range of options.
[0062] This application does not limit resource types, such as CPU resources, memory resources, transient storage resources, and expansion resources, etc. Each resource needs to be judged and screened.
[0063] S13: Use the current node resource device as the candidate node resource device for the Pod;
[0064] S14: Select the target node resource device of the Pod from all the node resource devices to be selected;
[0065] In a node resource device cluster, there may be multiple node resource devices that pass the screening in step S12, and the node resource devices that meet the screening conditions are selected as candidate node resource devices. Then, an optimal node resource device is selected from the candidate node resource devices as the target node resource device.
[0066] S15: Determine whether the remaining available resources of the target node resource device are less than the Pod's requested resources; If the remaining available resources are less than the Pod's requested resources, proceed to step S16;
[0067] Step S15 determines whether the remaining available resources of the target node resource device are less than the resource requested by the Pod. If the reserved resource amount of the target node resource device is 0, the remaining available resources are the difference between the total resources and the used resources. If the reserved resource amount of the target node resource device is not 0, it means that part of the resources have been reserved for other Pods. At this time, the remaining resources are the difference between the total resources and the used resources and the reserved resources.
[0068] If the remaining available resources are less than the Pod's requested resources, it means that the remaining available resources are insufficient to schedule the current Pod. When part of the used resources are released to become the remaining resources, the current target node resource equipment can be scheduled to the current Pod.
[0069] S16: Update the original reserved resource amount of the target node resource device to the sum of the original reserved resource amount and the Pod application resource amount;
[0070] Step S16 updates the original reserved resource amount of the target node resource device to the sum of the original reserved resource amount and the Pod application resource amount, that is, updates the reserved resource amount of the current target node resource device, and reserves enough application resource amount for the current Pod at the target node resource device.
[0071] S17: When the number of Pods that meet the allocation conditions in the PodGroup to be scheduled is greater than the preset minimum value, the PodGroup to be scheduled is scheduled to the corresponding target node resource device.
[0072] The allocation condition mentioned in this embodiment refers to that the remaining available resources of the current target node resource device are greater than or equal to the reserved resources of the target node resource device, and that the target node resource device has sufficient resources to be scheduled by the Pod.
[0073] The preset minimum value mentioned in this embodiment can be 0, that is, when all Pods in the PodGroup to be scheduled meet the allocation conditions, the node resource equipment is scheduled for the PodGroup to be scheduled. It can also be not 0, and when some of the Pods meet the allocation conditions, the node resource equipment is scheduled for the PodGroup to be scheduled. It can be designed according to actual needs.
[0074] Specifically, determine whether the waiting time of the PodGroup to be scheduled exceeds the preset time; if the waiting time of the PodGroup to be scheduled exceeds the preset time, determine whether the difference between the total resource amount of the node resource device and the reserved resource amount is greater than the Pod application resource amount of a Pod; if the difference is greater than the Pod application resource amount, use the current node resource device as the candidate node resource device for the Pod; select the target node resource device of the Pod from all the candidate node resource devices; determine whether the remaining available resources of the target node resource device are less than the Pod application resource amount; if the remaining available resources are less than the Pod application resource amount, update the original reserved resource amount of the target node resource device to the sum of the original reserved resource amount and the Pod application resource amount; when the number of Pods that meet the allocation conditions in the PodGroup to be scheduled is greater than the preset minimum value, schedule the PodGroup to be scheduled to the corresponding target node resource device. When the waiting time of the PodGroup exceeds the preset time, and there are still insufficient remaining available resources to schedule the current Pod, this application sets reserved resources for the current Pod by selecting an appropriate target node resource device. Once the remaining available resources reach the reserved resources, the target node resource device is scheduled for the current Pod to prevent the node resource device from being unable to accumulate sufficient resources for the PodGroup to schedule due to other PodGroups constantly scheduling node resource devices, causing the PodGroup to wait for an excessively long time or even starve to death.
[0075] According to the above embodiment, if it is determined in step S15 that the remaining available resources of the target node resource device are not less than the Pod application resource amount, such as Figure 2 As shown, it also includes:
[0076] S21: Update the original remaining available resources of the target node resource device to the difference between the original remaining available resources and the Pod application resources, and update the original reserved resources to the sum of the original reserved resources and the Pod application resources;
[0077] When the number of Pods that meet the allocation conditions in the PodGroup to be scheduled is greater than the preset minimum value, the PodGroup to be scheduled is scheduled to the corresponding target node resource device.
[0078] If it is determined that the remaining available resources of the target node resource equipment are not less than the Pod's requested resources, it means that the remaining available resources of the target node resource equipment are sufficient for Pod scheduling, and there is no need to wait for the used resources to be released. In this case, the original remaining available resources of the target node resource equipment are updated to the difference between the original remaining available resources and the Pod's requested resources, and the original reserved resources are updated to the sum of the original reserved resources and the Pod's requested resources, that is, the remaining available resources are reserved for the Pod's requested resources. This prevents subsequent scheduling from occupying this part of the resources.
[0079] The allocation condition mentioned in this embodiment refers to that the remaining available resources of the current target node resource device are greater than or equal to the reserved resources of the target node resource device, and that the target node resource device has sufficient resources to be scheduled by the Pod.
[0080] The preset minimum value mentioned in this embodiment can be 0, that is, when all Pods in the PodGroup to be scheduled meet the allocation conditions, the node resource equipment is scheduled for the PodGroup to be scheduled. It can also be not 0, and when some of the Pods meet the allocation conditions, the node resource equipment is scheduled for the PodGroup to be scheduled. It can be designed according to actual needs.
[0081] According to the above embodiment, before step S11 determines whether the waiting time of the PodGroup to be scheduled exceeds the preset time, it also includes:
[0082] S22: Receive data information of PodGroup, Pod, and node resource equipment to be scheduled.
[0083] Before a scheduling cycle, the data information of the PodGroup, Pod, and node resource equipment to be scheduled is obtained. This is an instantaneous value. The subsequent scheduling cycle uses the instantaneous data information obtained at this time for scheduling to prevent the data from changing in real time and causing calculation errors.
[0084] According to the above embodiment, when the number of Pods that meet the allocation conditions in the PodGroup to be scheduled is greater than the preset minimum value, the PodGroup to be scheduled is scheduled to the corresponding target node resource device, including:
[0085] Determine whether the reserved resources of the target node resource devices corresponding to all Pods in the current PodGroup to be scheduled are less than the remaining available resources;
[0086] If so, schedule the Pod in the current PodGroup to be scheduled to the corresponding target node resource device.
[0087] In this embodiment, preferably, the preset minimum value is zero, and all Pods meet the allocation conditions before resource scheduling is performed. The allocation condition is that the reserved resource amount of the target node resource device corresponding to the Pod is less than the remaining available resource amount, that is, the remaining available resources of the target node resource device of the Pod are greater than or equal to the reserved resource amount calculated previously. For example, in the previous judgment, the remaining resource amount is less than the Pod application resource amount, and the original reserved resource amount of the target node resource device is updated to the sum of the original reserved resource amount and the Pod application resource amount. In this case, after a part of the resources are released, the remaining resource amount increases, and is not less than the reserved resource amount, then the node resource device is scheduled for the Pod. In the previous judgment, if the remaining resource amount is less than the Pod application resource amount, the original remaining available resource amount of the target node resource device is directly updated to the difference between the original remaining available resource amount and the Pod application resource amount, and the original reserved resource amount is updated to the sum of the original reserved resource amount and the Pod application resource amount for scheduling, that is, the remaining available resource amount of the target node resource device is used for Pod scheduling.
[0088] According to the above embodiment, if it is determined in step S11 that the waiting time of the PodGroup to be scheduled does not exceed the preset time, the step further includes:
[0089] Determine whether the remaining available resources of the node resource device are greater than the resources requested by the Pod;
[0090] If yes, use the current node resource device as the candidate node resource device for the current Pod;
[0091] Select the target node resource device for the current Pod from all candidate node resource devices.
[0092] This embodiment refers to that when a normal PodGroup to be scheduled enters a scheduling cycle, resources are scheduled for its Pods, and the remaining available resources are preferentially used to schedule the Pods in the PodGroup to be scheduled, so as to improve the efficiency of scheduling.
[0093] Determine whether the number of Pods whose remaining available resources of the target node resource equipment corresponding to the Pod in the current PodGroup to be scheduled is greater than the Pod's requested resources is not less than the preset minimum value;
[0094] If so, schedule the Pod in the current PodGroup to be scheduled to the corresponding target node resource device.
[0095] The preset minimum value mentioned in this embodiment can be 0, that is, when all Pods in the PodGroup to be scheduled meet the allocation conditions, the node resource equipment is scheduled for the PodGroup to be scheduled. It can also be not 0, and when some of the Pods meet the allocation conditions, the node resource equipment is scheduled for the PodGroup to be scheduled. It can be designed according to actual needs.
[0096] That is, the remaining resources of the node resource device that can be used are determined to be the number of Pods scheduled by the Pods in the PodGroup to be scheduled. If this number is greater than or equal to the preset minimum value, the PodGroup to be scheduled is scheduled.
[0097] If the remaining available resources of the target node resource device corresponding to the Pod in the current PodGroup to be scheduled are greater than the number of Pods requested by the Pod and the number of Pods is less than the preset minimum value, then it also includes:
[0098] Cancel the scheduling of the current PodGroup to be scheduled and wait for the next scheduling cycle.
[0099] When the number of Pods that meet the conditions is less than the preset minimum value, the current PodGroup to be scheduled is abandoned in this scheduling cycle. The PodGroup to be scheduled will be re-determined and scheduled in the next scheduling cycle. The waiting time is calculated from the creation of the PodGroup to be scheduled. Each scheduling cycle determines whether the waiting time exceeds the preset time to select the corresponding scheduling plan.
[0100] In the above embodiments, the scheduling method of the batch scheduler is described in detail, and the present application also provides an embodiment corresponding to the scheduling device of the batch scheduler. It should be noted that the present application describes the embodiments of the device part from two perspectives, one is based on the perspective of the functional module, and the other is based on the perspective of the hardware.
[0101] Figure 3 A schematic diagram of a scheduling device of a batch scheduler provided in an embodiment of the present application, such as Figure 3 As shown, the scheduling device of the batch scheduler includes:
[0102] The first judgment module 31 is used to judge whether the waiting time of the PodGroup to be scheduled exceeds the preset time; if the waiting time of the PodGroup to be scheduled exceeds the preset time, the second judgment module 32 is triggered;
[0103] The second judgment module 32 is used to judge whether the difference between the total resource amount of the node resource device and the reserved resource amount is greater than the Pod application resource amount of a Pod; if the difference is greater than the Pod application resource amount, the selection module 33 is triggered;
[0104] A selection module 33 is used to use the current node resource device as a candidate node resource device for the Pod;
[0105] A screening module 34 is used to select a target node resource device of a Pod from all candidate node resource devices;
[0106] The third judgment module 35 is used to judge whether the remaining available resources of the target node resource equipment are less than the Pod application resources; if the remaining available resources are less than the Pod application resources, the update module 36 is triggered;
[0107] An updating module 36 is used to update the original reserved resource amount of the target node resource device to the sum of the original reserved resource amount and the Pod application resource amount;
[0108] The scheduling module 37 is used to schedule the PodGroup to be scheduled to the corresponding target node resource device when the number of Pods that meet the allocation conditions in the PodGroup to be scheduled is greater than a preset minimum value.
[0109] Specifically, the first judgment module 31 determines whether the waiting time of the PodGroup to be scheduled exceeds the preset time; if the waiting time of the PodGroup to be scheduled exceeds the preset time, the second judgment module 32 is triggered to determine whether the difference between the total resource amount and the reserved resource amount of the node resource device is greater than the Pod application resource amount of a Pod; if the difference is greater than the Pod application resource amount, the selection module 33 is triggered to use the current node resource device as the candidate node resource device for the Pod; the screening module 34 selects the target node resource device of the Pod from all the candidate node resource devices; the third judgment module 35 determines whether the remaining available resources of the target node resource device are less than the Pod application resource amount; if the remaining available resources are less than the Pod application resource amount, the update module 36 is triggered to update the original reserved resource amount of the target node resource device to the sum of the original reserved resource amount and the Pod application resource amount; the scheduling module 37 schedules the PodGroup to be scheduled to the corresponding target node resource device when the number of Pods that meet the allocation conditions in the PodGroup to be scheduled is greater than the preset minimum value.
[0110] When the waiting time of the PodGroup exceeds the preset time, and there are still insufficient remaining available resources to schedule the current Pod, this application sets reserved resources for the current Pod by selecting an appropriate target node resource device. Once the remaining available resources reach the reserved resources, the target node resource device is scheduled for the current Pod to prevent the node resource device from being unable to accumulate sufficient resources for scheduling the PodGroup due to other PodGroups constantly scheduling node resource devices, causing the PodGroup to wait for an excessively long time or even starve to death.
[0111] In addition, the third judgment module 35 judges that the remaining available resources of the target node resource device are not less than the Pod application resource amount, triggering the update subunit, which is used to update the original remaining available resources of the target node resource device to the difference between the original remaining available resources and the Pod application resource amount, and the original reserved resources are updated to the sum of the original reserved resources and the Pod application resource amount;
[0112] It also includes a receiving module for receiving data information of PodGroup, Pod, and node resource equipment to be scheduled;
[0113] The scheduling module 37 includes a first judgment subunit, which is used to judge whether the reserved resource amounts of the target node resource devices corresponding to all the Pods in the current PodGroup to be scheduled are less than the remaining available resource amounts; if so, the first scheduling subunit is triggered to schedule the Pods in the current PodGroup to be scheduled to the corresponding target node resource devices;
[0114] If the first judgment module 31 determines that the waiting time of the PodGroup to be scheduled does not exceed the preset time, the second judgment subunit is triggered to determine whether the remaining available resources of the node resource device are greater than the Pod application resources; if so, the second selection subunit is triggered to use the current node resource device as the candidate node resource device for the current Pod; and also includes a screening subunit to select the target node resource device of the current Pod from all the candidate node resource devices;
[0115] The third judgment sub-unit judges whether the number of Pods whose remaining available resources of the target node resource equipment corresponding to the Pod in the current PodGroup to be scheduled is greater than the Pod's applied resources is not less than a preset minimum value. If so, the second scheduling sub-unit is triggered to schedule the Pod in the current PodGroup to be scheduled to the corresponding target node resource equipment; if not, the cancellation sub-unit is triggered to cancel the scheduling of the current PodGroup to be scheduled and wait for the next scheduling cycle.
[0116] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.
[0117] Figure 4 A structural diagram of another scheduling device of a batch scheduler provided in an embodiment of the present application, such as Figure 4 As shown, the scheduling device of the batch scheduler includes: a memory 40 for storing a computer program;
[0118] The processor 41 is used to implement the steps of the method for obtaining user operation habit information in the above embodiment (scheduling method of batch scheduler) when executing the computer program.
[0119] The scheduling device of the batch scheduler provided in this embodiment may include but is not limited to a smart phone, a tablet computer, a laptop computer or a desktop computer.
[0120] Among them, the processor 41 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 41 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 41 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 41 may be integrated with a graphics processing unit (GPU), and the GPU is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 41 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0121] The memory 40 may include one or more computer-readable storage media, which may be non-transitory. The memory 40 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 40 is at least used to store the following computer program 401, wherein, after the computer program is loaded and executed by the processor 41, it can implement the relevant steps of the scheduling method of the batch scheduler disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 40 may also include an operating system 402 and data 403, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 402 may include Windows, Unix, Linux, etc. Data 403 may include, but is not limited to, data involved in implementing the scheduling method of the batch scheduler, etc.
[0122] In some embodiments, the scheduling device of the batch scheduler may further include a display screen 42 , an input / output interface 43 , a communication interface 44 , a power supply 45 , and a communication bus 46 .
[0123] Those skilled in the art will understand that Figure 4 The structure shown in the figure does not constitute a limitation on the scheduling device of the batch scheduler, and may include more or fewer components than those shown in the figure.
[0124] The scheduling device of the batch scheduler provided in the embodiment of the present application includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: the scheduling method of the batch scheduler. Determine whether the waiting time of the PodGroup to be scheduled exceeds the preset time; if the waiting time of the PodGroup to be scheduled exceeds the preset time, determine whether the difference between the total resource amount and the reserved resource amount of the node resource device is greater than the Pod application resource amount of a Pod; if the difference is greater than the Pod application resource amount, use the current node resource device as the candidate node resource device of the Pod; select the target node resource device of the Pod from all the candidate node resource devices; determine whether the remaining available resource amount of the target node resource device is less than the Pod application resource amount; if the remaining available resource amount is less than the Pod application resource amount, update the original reserved resource amount of the target node resource device to the sum of the original reserved resource amount and the Pod application resource amount; when the number of Pods that meet the allocation conditions in the PodGroup to be scheduled is greater than the preset minimum value, schedule the PodGroup to be scheduled to the corresponding target node resource device. When the waiting time of the PodGroup exceeds the preset time, and there are still insufficient remaining available resources to schedule the current Pod, this application sets reserved resources for the current Pod by selecting an appropriate target node resource device. Once the remaining available resources reach the reserved resources, the target node resource device is scheduled for the current Pod to prevent the node resource device from being unable to accumulate sufficient resources for scheduling the PodGroup due to other PodGroups constantly scheduling node resource devices, causing the PodGroup to wait for an excessively long time or even starve to death.
[0125] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. A computer program is stored on the computer-readable storage medium, and when the computer program is executed by the processor, the steps recorded in the above-mentioned batch scheduler scheduling method embodiment (which may be a method corresponding to the server side, or a method corresponding to the diagnostic device side, or a method corresponding to both the server side and the diagnostic device side) are implemented.
[0126] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the methods of each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0127] The computer-readable storage medium provided in this embodiment stores a computer program thereon, and when the processor executes the program, the following method can be implemented: a scheduling method of a batch scheduler, determining whether the waiting time of a PodGroup to be scheduled exceeds a preset time; if the waiting time of a PodGroup to be scheduled exceeds the preset time, determining whether the difference between the total resource amount and the reserved resource amount of a node resource device is greater than the Pod application resource amount of a Pod; if the difference is greater than the Pod application resource amount, using the current node resource device as the candidate node resource device for the Pod; selecting the target node resource device of the Pod from all the candidate node resource devices; determining whether the remaining available resource amount of the target node resource device is less than the Pod application resource amount; if the remaining available resource amount is less than the Pod application resource amount, updating the original reserved resource amount of the target node resource device to the sum of the original reserved resource amount and the Pod application resource amount; when the number of Pods that meet the allocation conditions in the PodGroup to be scheduled is greater than the preset minimum value, scheduling the PodGroup to be scheduled to the corresponding target node resource device. When the waiting time of the PodGroup exceeds the preset time, and there are still insufficient remaining available resources to schedule the current Pod, this application sets reserved resources for the current Pod by selecting an appropriate target node resource device. Once the remaining available resources reach the reserved resources, the target node resource device is scheduled for the current Pod to prevent the node resource device from being unable to accumulate sufficient resources for scheduling the PodGroup due to other PodGroups constantly scheduling node resource devices, causing the PodGroup to wait for an excessively long time or even starve to death.
[0128] The above is a detailed introduction to the scheduling method, device and medium of the batch scheduler provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can refer to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can refer to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
[0129] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
Claims
1. A scheduling method for a batch scheduler, It is characterized in that include: Determine whether the waiting time of the PodGroup to be scheduled exceeds the preset time; If the waiting time of the PodGroup to be scheduled exceeds the preset time, determine whether the difference between the total resource amount of the node resource device and the reserved resource amount is greater than the Pod application resource amount of a Pod; If the difference is greater than the resource amount requested by the Pod, the current node resource device is used as the candidate node resource device for the Pod; Select the target node resource device of the Pod from all the candidate node resource devices; Determine whether the remaining available resources of the target node resource device are less than the resource requested by the Pod; If the remaining available resources are less than the Pod applied resources, the original reserved resources of the target node resource device are updated to the sum of the original reserved resources and the Pod applied resources; When the number of the Pods that meet the allocation condition in the PodGroup to be scheduled is greater than a preset minimum value, scheduling the PodGroup to be scheduled to the corresponding target node resource device; Correspondingly, if it is determined that the remaining available resources of the target node resource device are not less than the Pod application resource amount, the method further includes: The original remaining available resource amount of the target node resource device is updated to the difference between the original remaining available resource amount and the resource amount requested by the Pod, and the original reserved resource amount is updated to the sum of the original reserved resource amount and the resource amount requested by the Pod; When the number of the Pods that meet the allocation condition in the PodGroup to be scheduled is greater than a preset minimum value, the PodGroup to be scheduled is scheduled to the corresponding target node resource device.
2. The batch scheduler scheduling method according to claim 1, It is characterized in that Before determining whether the waiting time of the PodGroup to be scheduled exceeds the preset time, the method further includes: Receive data information of the PodGroup to be scheduled, the Pod, and the node resource device.
3. The batch scheduler scheduling method according to claim 1, It is characterized in that When the number of the Pods that meet the allocation condition in the PodGroup to be scheduled is greater than a preset minimum value, scheduling the PodGroup to be scheduled to the corresponding target node resource device includes: Determine whether the reserved resource amounts of the target node resource devices corresponding to all the Pods in the currently scheduled PodGroup are less than the remaining available resource amounts; If so, schedule the Pod in the current PodGroup to be scheduled to the corresponding target node resource device.
4. The batch scheduler scheduling method according to claim 1, It is characterized in that If the waiting time of the PodGroup to be scheduled does not exceed the preset time, it also includes: Determine whether the remaining available resources of the node resource device are greater than the resource requested by the Pod; If yes, use the current node resource device as the candidate node resource device for the current Pod; The target node resource device of the current Pod is selected from all the candidate node resource devices.
5. The batch scheduler scheduling method according to claim 4, It is characterized in that After selecting the target node resource device of the current Pod from all the candidate node resource devices, the method further includes: Determine whether the number of Pods whose remaining available resources of the target node resource device corresponding to the Pod in the currently scheduled PodGroup is greater than the Pod's requested resources is not less than the preset minimum value; If so, schedule the Pod in the current PodGroup to be scheduled to the corresponding target node resource device.
6. The batch scheduler scheduling method according to claim 5, It is characterized in that If the remaining available resources of the target node resource device corresponding to the Pod in the currently scheduled PodGroup are greater than the Pod application resources, and the number of Pods is less than the preset minimum value, the method further includes: Cancel the scheduling of the currently scheduled PodGroup and wait for the next scheduling cycle.
7. A scheduling device for a batch scheduler, It is characterized in that include: The first judgment module is used to judge whether the waiting time of the PodGroup to be scheduled exceeds the preset time; If the waiting time of the PodGroup to be scheduled exceeds the preset time, the second judgment module is triggered; The second judgment module is used to judge whether the difference between the total resource amount and the reserved resource amount of the node resource device is greater than the Pod application resource amount of a Pod; if the difference is greater than the Pod application resource amount, triggering the selection module; The selection module is used to use the current node resource device as the node resource device to be selected for the Pod; A screening module, used to select a target node resource device of the Pod from all the candidate node resource devices; The third judgment module is used to judge whether the remaining available resources of the target node resource device are less than the Pod application resource amount; If the remaining available resources are less than the Pod applied resources, the update module is triggered; The updating module is used to update the original reserved resource amount of the target node resource device to the sum of the original reserved resource amount and the Pod application resource amount; A scheduling module, configured to schedule the PodGroup to be scheduled to the corresponding target node resource device when the number of the Pods meeting the allocation condition in the PodGroup to be scheduled is greater than a preset minimum value; Correspondingly, if it is determined that the remaining available resources of the target node resource device are not less than the Pod application resource amount, the method further includes: The original remaining available resource amount of the target node resource device is updated to the difference between the original remaining available resource amount and the resource amount requested by the Pod, and the original reserved resource amount is updated to the sum of the original reserved resource amount and the resource amount requested by the Pod; When the number of the Pods that meet the allocation condition in the PodGroup to be scheduled is greater than a preset minimum value, the PodGroup to be scheduled is scheduled to the corresponding target node resource device.
8. A scheduling device for a batch scheduler, It is characterized in that include: Memory for storing computer programs; A processor, configured to implement the steps of the batch scheduler scheduling method as described in any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the scheduling method of the batch scheduler according to any one of claims 1 to 6 are implemented.
