Resource scheduling method and related device, equipment and storage medium
The resource scheduling method and device efficiently manage both CPU and GPU resources by setting parameters, obtaining node labels, and mapping devices to queues, addressing the limitations of existing systems in managing mixed resource environments.
Patent Information
- Application Number
- CN202111592745.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-23
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2041-12-23
AI Technical Summary
Existing resource management systems, such as YARN, primarily support scheduling of CPU resources, failing to efficiently manage both CPU and GPU resources simultaneously, which are often required by processing programs like FLINK.
A resource scheduling method and device that sets resource parameters based on the available quantity of various computing resources, obtains node labels, maps and binds node devices to task queues, and selects target devices and queues based on task requirements, allowing simultaneous scheduling of CPU and GPU resources without the need for GPU resource index discovery through plug-ins.
Improves the convenience of scheduling and managing multiple computing resources by reflecting available quantities and eliminating the need for additional operator programs, enhancing flexibility and scalability in resource allocation.
Smart Images

Figure CN114356516B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a resource scheduling method and related devices, equipment and storage media. Background Art
[0002] In the process of computing task processing, in order to improve the efficiency of resource scheduling, resource management systems are currently usually used to implement resource scheduling and management. Representatively, Yet Another Resource Negotiator (YARN) is a general resource management system used by the Hadoop platform since version 2.X, providing unified management and scheduling of central processing unit (CPU) resources and memory resources for upper-layer applications.
[0003] Currently, existing resource management systems, such as the aforementioned YARN, usually only support scheduling of CPU resources. However, in real-world scenarios, processing programs such as FLINK often call CPU resources and GPU resources at the same time. Therefore, how to improve the convenience of scheduling and managing various computing resources at the same time has become an urgent problem to be solved. Summary of the invention
[0004] The main technical problem solved by the present application is to provide a resource scheduling method and related devices, equipment and storage media, which can improve the convenience of simultaneous scheduling and management of various computing resources.
[0005] In order to solve the above technical problems, the first aspect of the present application provides a resource scheduling method, including: obtaining a node label of a node device based on the type of computing resources possessed by the node device; wherein the node device is provided with resource parameters, and the resource parameters reflect the available quantity of various computing resources of the node device; based on the node label of each node device, mapping and binding each node device to at least one of a number of task queues; based on the task information of the task to be executed and the resource parameters of the node device, selecting the node device as the target device, and selecting the task queue mapped and bound to the target device as the target queue; wherein the task information includes whether the task to be executed requires GPU resources, and the required quantity of various computing resources required for the task to be executed; scheduling the computing resources of the target device in the target queue to execute the task to be executed.
[0006] In order to solve the above-mentioned technical problems, the second aspect of the present application provides a resource scheduling device, including: a label acquisition module, a mapping and binding module, a selection module and a scheduling module; the label acquisition module is used to obtain the node label of the node device based on the type of computing resources possessed by the node device; wherein the node device is provided with resource parameters, and the resource parameters reflect the available quantity of various computing resources of the node device; the mapping and binding module is used to map and bind each node device to at least one of a number of task queues based on the node label of each node device; the selection module is used to select the node device as the target device based on the task information of the task to be executed and the resource parameters of the node device, and select the task queue mapped and bound to the target device as the target queue; wherein the task information includes whether the task to be executed requires GPU resources, and the required quantity of various computing resources required for the task to be executed; the scheduling module is used to schedule the computing resources of the target device in the target queue to execute the task to be executed.
[0007] In order to solve the above technical problems, the third aspect of the present application provides a resource scheduling device, including a communication circuit, a memory and a processor, the communication circuit and the memory are coupled to the processor, the memory stores program instructions, and the processor is used to execute the program instructions to implement the resource scheduling method in the above first aspect.
[0008] In order to solve the above technical problem, the fourth aspect of the present application provides a computer-readable storage medium, which stores program instructions that can be executed by a processor, and the program instructions are used to implement the resource scheduling method in the above first aspect.
[0009] The above scheme sets resource parameters for node devices through the available number of various computing resources of node devices, obtains node labels of node devices, and maps and binds node devices to task queues according to the node labels of each node device. On this basis, the node device is selected as the target device according to whether the task to be executed requires GPU resources and the required number of various computing resources required for the task to be executed, and the task queue mapped and bound to the target device is selected as the target queue. Therefore, on the one hand, the available number of various computing resources of the node device is reflected through resource parameters without the need to discover the index number of GPU resources through plug-ins. On the other hand, the computing resources of the target device in the target queue are scheduled to execute the task to be executed through the mapping and binding of the node device and the task queue. There is no need to configure an operator program specifically for scheduling GPU resources. Therefore, in the resource scheduling process, the convenience of scheduling and managing various computing resources at the same time can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 It is a flowchart of an embodiment of a resource scheduling method provided by the present application;
[0011] Figure 2 yes Figure 1 The flowchart of step S13 is shown as an embodiment;
[0012] Figure 3 yes Figure 2 The flowchart of step S132 of an embodiment is shown;
[0013] Figure 4 Figure 1 The flowchart of step S14 is shown as an embodiment;
[0014] Figure 5 It is a schematic diagram of a framework of an embodiment of a resource scheduling device provided by the present application;
[0015] Figure 6 It is a schematic diagram of a framework of an embodiment of an electronic device provided by the present application;
[0016] Figure 7 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium provided by the present application. DETAILED DESCRIPTION
[0017] The scheme of the embodiment of the present application is described in detail below in conjunction with the drawings of the specification.
[0018] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.
[0019] The terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. In addition, "many" in this article means two or more than two.
[0020] See also Figure 1 , Figure 1 It is a flow chart of an embodiment of the resource scheduling method provided by the present application. It should be noted that if there are substantially the same results, this embodiment does not take Figure 1 The process sequence shown is limited. Figure 1 As shown, this embodiment includes:
[0021] Step S11: Based on the type of computing resources possessed by the node device, obtain the node label of the node device.
[0022] In this embodiment, the node label of the node device is obtained according to the type of computing resources possessed by the node device. That is to say, different node devices have different node labels obtained due to the different types of computing resources they possess, and the node label reflects the type of computing resources possessed by the node device. Optionally, in one embodiment, the types of computing resources include but are not limited to CPU resources, graphics processing unit (GPU) resources or other memory resources, etc., which are not specifically limited here. It should be noted that, hereinafter, for the sake of ease of description, this application will take the types of computing resources including CPU resources and GPU resources as an example for description and explanation, but it can be understood that such a description does not limit the types of computing resources.
[0023] For example, the computing resources of a certain node device are CPU resources. For another example, the computing resources of a certain node device are GPU resources. For another example, the computing resources of a certain node device are CPU resources and GPU resources.
[0024] Among them, the node device is equipped with resource parameters, and the resource parameters reflect the available number of various computing resources of the node device. In other words, the available number of various computing resources of each node device can be known through the resource parameters of each node device. For example, the computing resources of a certain node device include CPU resources and GPU resources. According to the resource parameters of the node device, it can be known that the available number of CPU resources is 32 cores and the available number of GPU resources is 4.
[0025] In one embodiment, the resource parameters include virtual core values of various computing resources, and the virtual core value of each computing resource is determined based on the available number of computing resources of the corresponding type. For example, the computing resources possessed by a certain node device include CPU resources and GPU resources, and the virtual core values of the CPU resources and GPU resources can be determined based on their respective available numbers. In a specific embodiment, when the computing resources include CPU resources, the number of virtual cores of the CPU resources is determined according to the number of physical cores of the CPU resources. In other specific embodiments, when the computing resources include GPU resources, the number of virtual cores of the GPU resources is determined according to the number of graphics cards of the GPU resources. In other specific embodiments, when the computing resources include CPU resources and GPU resources, the number of virtual cores of the CPU resources is determined according to the number of physical cores of the CPU resources, and the number of graphics cards of the GPU resources is converted into the number of virtual cores of the CPU resources. At this time, the position corresponding to the GPU resource in the resource parameters is marked accordingly to let the system know that the marked position corresponds to the GPU resource.
[0026] Optionally, in one embodiment, the number of physical cores of CPU resources or the number of graphics cards of GPU resources can be directly used as the virtual core value. For example, the computing resources of a certain node device only include CPU resources, and the available number of CPU resources is 32 cores, that is, the number of physical cores of CPU resources is 32, so the number of physical cores of CPU resources is directly used as the virtual core value, that is, the virtual core value of CPU resources is 32. For another example, the computing resources of a certain node device only include GPU resources, and the available number of GPU resources is 4, that is, the number of graphics cards of GPU resources is 4, so the number of graphics cards of GPU resources is directly used as the virtual core value, that is, the virtual core value of GPU resources is 4. It can be understood that in other embodiments, the value obtained by multiplying the number of physical cores of CPU resources or the number of graphics cards of GPU resources by a coefficient of a certain size can also be used as the virtual core value, wherein the size of the coefficient is not limited and can be specifically set according to actual use needs.
[0027] Step S12: Based on the node label of each node device, each node device is mapped and bound to at least one of the plurality of task queues.
[0028] In this embodiment, according to the node label of each node device, each node device is mapped and bound to at least one of several task queues. Among them, the number of task queues and the number of task queues mapped and bound to each node device are not limited, and can be specifically set according to actual use needs. Optionally, in one embodiment, several task queues include but are not limited to CPU queues, GPU queues, etc. The CPU queue is mainly used to process tasks such as instructions, that is, the CPU queue is better at processing tasks such as instructions, and the CPU queue can certainly be used to process other tasks, and the corresponding mapped and bound node devices only include CPU resources or the available number of CPU resources included is large; the GPU queue is mainly used to process tasks such as parallel numerical calculations of graphics, that is, the GPU queue is better at processing tasks such as parallel numerical calculations of graphics, and the GPU queue can certainly be used to process other tasks, and the corresponding mapped and bound node devices only include GPU resources or the available number of GPU resources included is large.
[0029] That is to say, mapping and binding each node device to at least one of several task queues is equivalent to specifying the type of tasks that each node device can perform. For example, several task queues include CPU queues and GPU queues, and mapping and binding node A device to CPU queue, the CPU queue is mainly used for processing instructions and other tasks, which is equivalent to specifying node A device to be mainly used for processing instructions and other tasks; for another example, several task queues include CPU queues and GPU queues, and mapping and binding node B device to GPU queue, the GPU queue is mainly used for processing graphics-related parallel numerical calculations and other tasks, which is equivalent to specifying node B device to be mainly used for processing graphics-related parallel numerical calculations and other tasks.
[0030] It should be noted that, in the following, for the sake of ease of description, this application will take several task queues including a CPU queue and a GPU queue as an example for description, but it can be understood that such a description does not limit the number and type of several task queues.
[0031] Step S13: Based on the task information of the task to be executed and the resource parameters of the node device, a node device is selected as the target device, and a task queue mapped and bound to the target device is selected as the target queue.
[0032] In this embodiment, according to the task information of the task to be executed and the resource parameters of the node device, the node device is selected as the target device, and the task queue bound to the target device mapping is selected as the target queue. Among them, the task information includes whether the task to be executed requires GPU resources and the required quantity of various computing resources required for the task to be executed. In other words, the node device will be selected as the target device according to whether the task to be executed requires GPU resources and the required quantity of various computing resources required for the task to be executed, and the task queue bound to the target device mapping will be selected as the target queue.
[0033] For example, several task queues include CPU queues and GPU queues. A node device that has GPU resources as a computing resource and whose required number of computing resources is sufficient to complete the task to be executed will be selected as the target device, and the GPU queue bound to the target device will be selected as the target queue.
[0034] In one embodiment, after a certain node device is selected as a target device, the node label of the target device is modified to a preset label. The node device with the preset label is executing a task. That is, after a node device is selected as a target device, its node label is modified to a preset label, which is different from any node label, and the preset label is used to indicate that the corresponding node device has been occupied by the task.
[0035] In one embodiment, when there are multiple node devices that have GPU resources as computing resources and the required number of computing resources is sufficient to complete the task to be executed, the node devices that meet the requirements can be used as candidate devices, and a node device is selected from the candidate devices as the target device.
[0036] Step S14: Scheduling computing resources of target devices in the target queue to execute tasks to be executed.
[0037] In this embodiment, the computing resources of the target devices in the target queue are scheduled to execute the tasks to be executed. That is, according to the target devices and target queues determined in the above manner, the computing resources of the target devices in the target queue are scheduled to execute the tasks to be executed, thereby realizing resource scheduling.
[0038] In one embodiment, resource scheduling can be achieved by allocating virtual cores of the target device to schedule corresponding computing resources. For example, the resource parameters of the target device include a virtual core (vcore) value of 32 for its CPU resources, and according to the task information, the required number of CPU resources to execute the task to be executed is 2, and the virtual cores with IDs i to i+1 can be scheduled to execute the task to be executed. Of course, the value of i can be set according to actual conditions. Exemplarily, i can be set to the minimum value of the ID in the virtual cores available to the target device, which is not limited here. Other situations can be deduced by analogy, and examples are not given one by one here.
[0039] It should be noted that in order to realize the scheduling of GPU resources, the GPU resource index (index) can also be discovered through the GPU plug-in. The index can be obtained from ExternalResourceInfo (extended resource information), and the GPU resources can be discovered through the script, which is not flexible enough. In addition, in Standalone mode, it is necessary to ensure that all nodes are correctly in accordance with the driver of the GPU resources, and the GPU resources on all node devices in the cluster can be accessed. The scalability is insufficient and is not suitable for production environments; at the same time, this method cannot take into account the scheduling of CPU resources and GPU resources. Therefore, compared with the method of obtaining GPU resources through a GPU plug-in, the technical solution of the present application can take into account the scheduling of CPU resources and GPU resources, and does not require GPU resources to exist on all node devices, thereby improving flexibility, scalability and compatibility.
[0040] In the above implementation, resource parameters are set for the node device according to the available quantity of various computing resources of the node device, and the node label of the node device is obtained, and the node device is mapped and bound to the task queue according to the node label of each node device. On this basis, the node device is selected as the target device according to whether the task to be executed requires GPU resources and the required quantity of various computing resources required for the task to be executed, and the task queue mapped and bound to the target device is selected as the target queue. Therefore, on the one hand, the available quantity of various computing resources of the node device is reflected through resource parameters without the need to discover the index number of the GPU resource through a plug-in. On the other hand, the computing resources of the target device in the target queue are scheduled to execute the task to be executed by mapping and binding the node device to the task queue, and there is no need to additionally configure an operator program to specifically schedule GPU resources. Therefore, in the resource scheduling process, the convenience of simultaneously scheduling and managing various computing resources can be improved.
[0041] See also Figure 2 , Figure 2 yes Figure 1 It should be noted that if there is substantially the same result, this embodiment does not use Figure 2 The process sequence shown is limited. Figure 2 As shown, this embodiment includes:
[0042] S131: Select several candidate devices based on the first task information of the task to be executed and the resource parameters of each node device.
[0043] In this embodiment, a number of candidate devices are selected based on the first task information of the task to be performed and the resource parameters of each node device. The first task information includes the required quantity of various computing resources required for the task to be performed. That is to say, based on the required quantity of various computing resources required for the task to be performed and the available quantity of computing resources of each node device, the node device whose available quantity of computing resources can meet the required quantity of computing resources required for the task to be performed is selected as a candidate device.
[0044] Specifically, according to the available number of computing resources of each node device, it is determined whether the available number of computing resources of the node device can meet the required number of various computing resources required for the task to be executed. If not, the node device is not used as a candidate device; if it is, the node device is used as a candidate device for executing the task to be executed. It is determined one by one whether the available number of computing resources of each node device can meet the required number of various computing resources required for the task to be executed, so as to select a number of candidate devices.
[0045] In one implementation, if the node label of a certain node device is modified to a preset label, it indicates that the node device is being occupied by a certain task, so the node device will not be selected as a candidate device.
[0046] In one implementation, if the available quantity of computing resources of each node device cannot meet the required quantity of each computing resource required for the task to be executed, the current resources are insufficient and resource scheduling fails.
[0047] S132: Select a target device and a target queue based on the task queues mapped and bound to each candidate device and the second task information of the task to be executed.
[0048] In this embodiment, the target device and the target queue are selected according to the task queues mapped and bound to each candidate device and the second task information of the task to be executed. The second task information includes whether the task to be executed requires GPU resources. In other words, the target device and the target queue are selected from a number of candidate devices according to whether the task to be executed requires GPU resources and the task queues mapped and bound to each candidate device.
[0049] In one embodiment, after the target device is selected, the node tag of the target device is recorded, so that when scheduling computing resources to execute the task to be executed, the computing resources of the target device are scheduled according to the recorded node tag. That is, after a certain node device is determined as the target device, the node tag corresponding to the node device is recorded for use in the subsequent scheduling of computing resources, so that the task to be executed can be directly assigned to the node device corresponding to the recorded node tag for processing.
[0050] In one embodiment, if Figure 3 As shown, Figure 3 yes Figure 2 The flowchart of step S132 of an embodiment is shown, and the selection of the target device and the target queue specifically includes the following sub-steps:
[0051] Step S1321: Determine whether the to-be-executed task included in the second task information requires GPU resources.
[0052] In this embodiment, the target device and the target queue are determined by judging whether the task to be executed included in the second task information requires GPU resources. If the task to be executed requires GPU resources, step S1322 is executed; if the task to be executed does not require GPU resources, step S1323 is executed.
[0053] Step S1322: In response to the second task information including that the to-be-executed task requires GPU resources, select a candidate device mapped to a bound GPU queue as a target device, and select a GPU queue mapped to the target device as a target queue.
[0054] In this embodiment, the plurality of task queues include a CPU queue and a GPU queue, and in response to the second task information including that the task to be executed requires GPU resources, a candidate device mapped to the bound GPU queue is selected as the target device, and the GPU queue mapped to the bound target device is selected as the target queue. That is, when the task to be executed requires GPU resources, a candidate device mapped to the bound GPU queue is selected from the plurality of candidate devices as the target device, and the GPU queue mapped to the bound target device is selected as the target queue.
[0055] In one embodiment, if there are multiple candidate devices among several candidate devices, one of the candidate devices can be selected as the target device. It can be understood that in other embodiments, a candidate device whose available number of computing resources is close to the required number of each computing resource required by the task to be executed can also be selected as the target device to improve resource utilization and avoid resource waste.
[0056] Step S1323: In response to the second task information including that the to-be-executed task does not require GPU resources, a candidate device mapped to a bound CPU queue is selected as a target device, and a CPU queue mapped to the target device is selected as a target queue.
[0057] In this embodiment, in response to the second task information including that the task to be executed does not require GPU resources, a candidate device mapped with a bound CPU queue is selected as the target device, and the CPU queue mapped with the target device is selected as the target queue. That is, when the task to be executed does not require GPU resources, a candidate device mapped with a bound CPU queue is selected from a number of candidate devices as the target device, and the CPU queue mapped with the target device is used as the target queue.
[0058] In one embodiment, if there are multiple candidate devices among several candidate devices, one of the candidate devices can be selected as the target device. It can be understood that in other embodiments, a candidate device whose available number of computing resources is close to the required number of each computing resource required for the task to be executed can also be selected as the target device to improve resource utilization and avoid resource waste.
[0059] See also Figure 4 , Figure 4 Figure 1 It should be noted that if there is substantially the same result, this embodiment does not use Figure 4 The process sequence shown is limited. Figure 4 As shown, this embodiment includes:
[0060] Step S41: Based on the required quantity, specify a number of virtual cores of the target device as target cores.
[0061] In this embodiment, resource scheduling is achieved by allocating virtual cores to the tasks to be executed. Specifically, according to the required number of various computing resources required by the tasks to be executed, a number of virtual cores of the target device are designated as target cores.
[0062] Step S42: Schedule computing resources corresponding to the target core to execute the task to be executed.
[0063] In this implementation, computing resources corresponding to the target core are scheduled to execute the tasks to be executed, thereby achieving resource scheduling.
[0064] In one implementation, after the task to be executed is completed, the corresponding target core is released, and the computing resources corresponding to the target core are released so that they can be subsequently scheduled for use by other tasks.
[0065] In one embodiment, the tasks to be executed are executed in the first mode. In the first mode, the tasks to be executed are submitted to the target queue as flink tasks, and the computing resources corresponding to the target core execute the flink tasks. In a specific embodiment, the first mode is the yarn-cluster mode, which specifically treats each flink task as an application and manages them separately on yarn. The flink tasks corresponding to different tasks to be executed are independent of each other and can be directly monitored separately.
[0066] In one embodiment, the task to be executed is executed in the second mode. In the second mode, multiple scheduling sessions are pre-started in the target queue, and the multiple scheduling sessions include a first scheduling session and a second scheduling session. The GPU resources occupied by the first scheduling session are more than the CPU resources occupied, and the CPU resources occupied by the second scheduling session are more than the GPU resources occupied, and the task to be executed is submitted to the first scheduling session or the second scheduling session as a flink task according to the task information of the task to be executed, and is executed by the computing resources corresponding to the target core. In a specific embodiment, the second mode is yarn-session, and the target queue will pre-start two yarn-sessions. After starting, there will be two applications in yarn corresponding to two flinkyarn-session clusters that can use CPU resources and GPU resources respectively. After the task is started, the corresponding flink task is submitted to the corresponding yarn-session cluster by analyzing whether the task needs to use GPU resources.
[0067] In one implementation, in the second mode, the scheduling session where the flink tasks corresponding to different tasks to be executed are located is monitored as a whole. In the second mode, a yarn-session is first started as a flink container, and then all flink tasks submitted to yarn are submitted to this flink container. Each flink task is independent of each other, but because they all exist in the flink container, only one flink service, i.e., the flink container, can be monitored on yarn, and a single flink task cannot be monitored. It is necessary to enter the flink container to see it.
[0068] See also Figure 5 , Figure 5 It is a framework diagram of an embodiment of a resource scheduling device provided by the present application. The resource scheduling device 50 includes a label acquisition module 51, a mapping and binding module 52, a selection module 53 and a scheduling module 54. The label acquisition module 51 is used to obtain the node label of the node device based on the type of computing resources possessed by the node device; wherein the node device is provided with resource parameters, and the resource parameters reflect the available quantity of various computing resources of the node device; the mapping and binding module 52 is used to map and bind each node device to at least one of several task queues based on the node label of each node device; the selection module 53 is used to select the node device as the target device based on the task information of the task to be executed and the resource parameters of the node device, and select the task queue mapped and bound to the target device as the target queue; wherein the task information includes whether the task to be executed requires GPU resources, and the required quantity of various computing resources required for the task to be executed; the scheduling module 54 is used to schedule the computing resources of the target device in the target queue to execute the task to be executed.
[0069] The above scheme sets resource parameters for node devices through the available number of various computing resources of node devices, obtains node labels of node devices, and maps and binds node devices to task queues according to the node labels of each node device. On this basis, the node device is selected as the target device according to whether the task to be executed requires GPU resources and the required number of various computing resources required for the task to be executed, and the task queue mapped and bound to the target device is selected as the target queue. Therefore, on the one hand, the available number of various computing resources of the node device is reflected through resource parameters without the need to discover the index number of GPU resources through plug-ins. On the other hand, the computing resources of the target device in the target queue are scheduled to execute the task to be executed through the mapping and binding of the node device and the task queue. There is no need to configure an operator program specifically for scheduling GPU resources. Therefore, in the resource scheduling process, the convenience of scheduling and managing various computing resources at the same time can be improved.
[0070] Among them, the selection module 53 is used to select a node device as the target device based on the task information of the task to be executed and the resource parameters of the node device, and select the task queue mapped and bound to the target device as the target queue, specifically including: selecting several candidate devices based on the first task information of the task to be executed and the resource parameters of each node device; selecting the target device and the target queue based on the task queue mapped and bound to each candidate device and the second task information of the task to be executed; wherein the first task information includes the required quantity of various computing resources required for the task to be executed, and the second task information includes whether the task to be executed requires GPU resources.
[0071] Therefore, based on the first task information of the task to be executed and the resource parameters of each node device, several candidate devices are selected. On this basis, based on the task queues mapped and bound to each candidate device and the second task information of the task to be executed, the target device and target queue are selected. The first task information includes the required quantity of various computing resources required for the task to be executed, and the second task information includes whether the task to be executed requires GPU resources. In this way, the candidate devices can be determined one by one, and the target queue and target device can be determined based on the candidate devices, which is conducive to improving the accuracy of determining the target queue and target device.
[0072] Among them, the above-mentioned several task queues include a GPU queue and a CPU queue, and the selection module 53 is used to select a target device and a target queue based on the task queues mapped and bound to each candidate device and the second task information of the task to be executed, specifically including: in response to the second task information including that the task to be executed requires GPU resources, selecting the candidate device mapped and bound to the GPU queue as the target device, and selecting the GPU queue mapped and bound to the target device as the target queue; in response to the second task information including that the task to be executed does not require GPU resources, selecting the candidate device mapped and bound to the CPU queue as the target device, and selecting the CPU queue mapped and bound to the target device as the target queue.
[0073] Therefore, based on whether the task to be executed included in the second task information requires GPU resources, a target device and a target queue are selected.
[0074] Among them, after selecting the target queue and target device based on the task queues bound by each candidate device mapping and the second task information of the task to be executed, the selection module 53 is also used to: record the node label of the target device so as to schedule the computing resources of the target device based on the recorded node label when scheduling computing resources to execute the task to be executed.
[0075] Therefore, the node label of the target device can be recorded so that the task to be executed can be directly assigned to the target device corresponding to the node label for processing later.
[0076] Among them, the above-mentioned resource parameters include virtual core values of various computing resources, and the virtual core value of each computing resource is determined based on the available number of computing resources of the corresponding type; the scheduling module 54 is used to schedule the computing resources of the target device in the target queue to execute the tasks to be executed, specifically including: based on the demand quantity, specifying a number of virtual cores of the target device as target cores; scheduling the computing resources corresponding to the target core to execute the tasks to be executed.
[0077] Therefore, the virtual core value of each computing resource can be determined according to the available number of computing resources of the corresponding type.
[0078] Among them, the step of determining the above-mentioned virtual core value includes at least one of the following: when the computing resources include CPU resources, determining the number of virtual cores of the CPU resources based on the number of physical cores of the CPU resources; when the computing resources include GPU resources, determining the number of virtual cores of the GPU resources based on the number of graphics cards of the GPU resources.
[0079] Therefore, the number of virtual cores of CPU resources can be determined by the number of physical cores of CPU resources, and the number of virtual cores of GPU resources can be determined by the number of graphics cards of GPU resources.
[0080] Before scheduling the computing resources corresponding to the target core to execute the task to be executed, the scheduling module 54 is also used to: modify the node label of the target device to a preset label; wherein the node device with the preset label is executing the task.
[0081] Therefore, the node label of the target device is modified to a preset label to indicate that the target device is executing a task and cannot accept resource scheduling.
[0082] The above-mentioned tasks to be executed are executed in either the first mode or the second mode; in the first mode, the tasks to be executed are submitted to the target queue as flink tasks and are executed by the computing resources corresponding to the target core, and in the second mode, multiple scheduling sessions are pre-started in the target queue, the multiple scheduling sessions include a first scheduling session and a second scheduling session, the GPU resources occupied by the first scheduling session are more than the CPU resources occupied, the CPU resources occupied by the second scheduling session are more than the GPU resources occupied, and based on the task information of the tasks to be executed, the tasks to be executed are submitted to the first scheduling session or the second scheduling session as flink tasks, and are executed by the computing resources corresponding to the target core.
[0083] Therefore, the task to be executed can be selected to be executed in the first mode or the second mode according to the actual situation.
[0084] The resource scheduling device 50 further includes a release module 55. The release module 55 is used to release the target core and the computing resources corresponding to the target core after the task to be executed is completed.
[0085] Therefore, after the task to be executed is completed, the target core and the computing resources corresponding to the target core are released for use in subsequent resource scheduling.
[0086] See also Figure 6 , Figure 6 6 is a schematic diagram of a framework of an embodiment of an electronic device provided by the present application. The electronic device 60 includes a communication circuit 61, a memory 62 and a processor 63. The communication circuit 61 and the memory 62 are coupled to the processor 63. The memory 62 stores program instructions. The processor 63 is used to execute the program instructions to implement the steps in any of the above resource scheduling method embodiments. Specifically, the electronic device 60 may include, but is not limited to: a desktop computer, a laptop computer, a server, a mobile phone, a tablet computer, etc., which are not limited here.
[0087] Specifically, the processor 63 is used to control itself and the memory 62 to implement the steps in any of the above-mentioned resource scheduling method embodiments. The processor 63 can also be called a CPU (Central Processing Unit). The processor 63 may be an integrated circuit chip with signal processing capabilities. The processor 63 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 63 can be implemented by an integrated circuit chip.
[0088] The above scheme sets resource parameters for node devices through the available number of various computing resources of node devices, obtains node labels of node devices, and maps and binds node devices to task queues according to the node labels of each node device. On this basis, the node device is selected as the target device according to whether the task to be executed requires GPU resources and the required number of various computing resources required for the task to be executed, and the task queue mapped and bound to the target device is selected as the target queue. Therefore, on the one hand, the available number of various computing resources of the node device is reflected through resource parameters without the need to discover the index number of GPU resources through plug-ins. On the other hand, the computing resources of the target device in the target queue are scheduled to execute the task to be executed through the mapping and binding of the node device and the task queue. There is no need to configure an operator program specifically for scheduling GPU resources. Therefore, in the resource scheduling process, the convenience of scheduling and managing various computing resources at the same time can be improved.
[0089] See also Figure 7 , Figure 7 The computer-readable storage medium 70 stores program instructions 71 that can be executed by a processor, and the program instructions 71 are used to implement the steps in any of the above resource scheduling method embodiments.
[0090] The above scheme sets resource parameters for node devices through the available number of various computing resources of node devices, obtains node labels of node devices, and maps and binds node devices to task queues according to the node labels of each node device. On this basis, the node device is selected as the target device according to whether the task to be executed requires GPU resources and the required number of various computing resources required for the task to be executed, and the task queue mapped and bound to the target device is selected as the target queue. Therefore, on the one hand, the available number of various computing resources of the node device is reflected through resource parameters without the need to discover the index number of GPU resources through plug-ins. On the other hand, the computing resources of the target device in the target queue are scheduled to execute the task to be executed through the mapping and binding of the node device and the task queue. There is no need to configure an operator program specifically for scheduling GPU resources. Therefore, in the resource scheduling process, the convenience of scheduling and managing various computing resources at the same time can be improved.
[0091] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0092] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0093] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0094] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0095] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0096] If the integrated unit 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, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0097] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A resource scheduling method, characterized in that: include: Based on the type of computing resources possessed by the node device, a node label of the node device is obtained; wherein the node device is provided with resource parameters, the resource parameters reflect the available quantity of various computing resources of the node device, the resource parameters include virtual core values of various computing resources, and the virtual core value of each computing resource is determined based on the available quantity of computing resources of the corresponding type; Based on the node label of each of the node devices, each of the node devices is mapped and bound to at least one of the plurality of task queues; Based on the task information of the task to be executed and the resource parameters of the node device, the node device is selected as the target device, and the task queue mapped and bound to the target device is selected as the target queue; wherein the task information includes whether the task to be executed requires GPU resources, and the required quantity of various computing resources required for the task to be executed; Scheduling computing resources of target devices in the target queue to execute the tasks to be executed; The step of scheduling the computing resources of the target device in the target queue to execute the task to be executed includes: Based on the required quantity, specifying a number of the virtual cores of the target device as target cores; Scheduling the computing resources corresponding to the target core to execute the task to be executed, wherein the task to be executed is executed in either a first mode or a second mode. In the first mode, the task to be executed is submitted to the target queue as a flink task and is executed by the computing resources corresponding to the target core. In the second mode, a plurality of scheduling sessions are pre-started in the target queue, wherein the plurality of scheduling sessions include a first scheduling session and a second scheduling session, the GPU resources occupied by the first scheduling session are more than the CPU resources occupied, the CPU resources occupied by the second scheduling session are more than the GPU resources occupied, and based on the task information of the task to be executed, the task to be executed is submitted to the first scheduling session or the second scheduling session as the flink task and is executed by the computing resources corresponding to the target core.
2. The method according to claim 1, characterized in that The selecting the node device as the target device based on the task information of the task to be executed and the resource parameters of the node device, and selecting the task queue mapped and bound to the target device as the target queue, comprises: Selecting a number of candidate devices based on first task information of the task to be performed and resource parameters of each of the node devices; Selecting the target device and the target queue based on the task queues mapped and bound to each of the candidate devices and the second task information of the task to be executed; The first task information includes the required quantities of various computing resources required for the task to be executed, and the second task information includes whether the task to be executed requires the GPU resources.
3. The method according to claim 2, characterized in that The plurality of task queues include a GPU queue and a CPU queue, and the selecting the target device and the target queue based on the task queues mapped and bound to each of the candidate devices and the second task information of the task to be executed includes: In response to the second task information including that the to-be-executed task requires the GPU resource, selecting a candidate device mapped and bound to the GPU queue as the target device, and selecting the GPU queue mapped and bound to the target device as the target queue; In response to the second task information including that the to-be-executed task does not require the GPU resources, a candidate device mapped and bound to the CPU queue is selected as the target device, and a CPU queue mapped and bound to the target device is selected as the target queue.
4. The method according to claim 2, characterized in that: After selecting the target queue and the target device based on the task queues mapped and bound to each of the candidate devices and the second task information of the task to be executed, the method further includes: The node tag of the target device is recorded so that when scheduling the computing resources to execute the task to be executed, the computing resources of the target device are scheduled based on the recorded node tag.
5. The method according to claim 1, characterized in that The step of determining the virtual core value includes at least one of the following: In a case where the computing resources include CPU resources, determining the number of virtual cores of the CPU resources based on the number of physical cores of the CPU resources; In the case where the computing resources include the GPU resources, the number of virtual cores of the GPU resources is determined based on the number of graphics cards of the GPU resources.
6. The method according to claim 1, characterized in that Before scheduling the computing resources corresponding to the target core to execute the task to be executed, the method further includes: The node label of the target device is modified to a preset label; wherein the node device with the preset label is executing a task.
7. The method according to claim 1, characterized in that After the to-be-executed task is completed, the method further includes: The target core is released, and computing resources corresponding to the target core are released.
8. A resource scheduling device, characterized in that: include: A label acquisition module, used to acquire a node label of the node device based on the type of computing resources possessed by the node device; wherein the node device is provided with resource parameters, the resource parameters reflect the available quantity of various computing resources of the node device, the resource parameters include virtual core values of various computing resources, and the virtual core value of each computing resource is determined based on the available quantity of computing resources of the corresponding type; A mapping and binding module, used for mapping and binding each of the node devices to at least one of the plurality of task queues based on the node label of each of the node devices; A selection module, configured to select the node device as a target device based on the task information of the task to be executed and the resource parameters of the node device, and select the task queue mapped and bound to the target device as the target queue; wherein the task information includes whether the task to be executed requires GPU resources, and the required quantity of various computing resources required for the task to be executed; A scheduling module, used for scheduling the computing resources of the target device in the target queue to execute the task to be executed; The step of scheduling the computing resources of the target device in the target queue to execute the task to be executed includes: Based on the required quantity, specifying a number of the virtual cores of the target device as target cores; Scheduling the computing resources corresponding to the target core to execute the task to be executed, wherein the task to be executed is executed in either a first mode or a second mode. In the first mode, the task to be executed is submitted to the target queue as a flink task and is executed by the computing resources corresponding to the target core. In the second mode, a plurality of scheduling sessions are pre-started in the target queue, wherein the plurality of scheduling sessions include a first scheduling session and a second scheduling session, the GPU resources occupied by the first scheduling session are more than the CPU resources occupied, the CPU resources occupied by the second scheduling session are more than the GPU resources occupied, and based on the task information of the task to be executed, the task to be executed is submitted to the first scheduling session or the second scheduling session as the flink task and is executed by the computing resources corresponding to the target core.
9. A resource scheduling device, characterized in that: It includes a communication circuit, a memory and a processor, wherein the communication circuit and the memory are coupled to the processor, the memory stores program instructions, and the processor is used to execute the program instructions to implement the resource scheduling method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the resource scheduling method described in any one of claims 1 to 7.
