Resource scheduling strategy determination method, scheduler and electronic equipment
By introducing temporary resource interfaces and setting interfaces, task resource requirements are dynamically met, which solves the problems of complex operations and insufficient flexibility in the cluster scheduling method, and achieves flexible and efficient resource scheduling.
Patent Information
- Application Number
- CN202410724641.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-05
- Publication Date
- 2024-09-10
AI Technical Summary
The cluster scheduling method in the existing technology is complex and inflexible in operation, and needs to change the internal structure of the scheduler to perform different task scheduling, resulting in low flexibility and efficiency.
The temporary resource interface and the temporary resource setting interface are introduced to dynamically create, modify and destroy logical resources to meet the resource requirements of the task and achieve the flexibility and efficiency of the scheduling strategy.
There is no need to change the scheduler structure, and resources are allocated to target tasks through the temporary resource interface, which improves the flexibility and efficiency of scheduling and solves the problems of complex operations and insufficient flexibility.
Smart Images

Figure CN118626257A
Abstract
Description
Technical Field
[0001] The present application relates to the field of big data technology, and in particular to a method for determining a resource scheduling strategy, a scheduler, a computer-readable storage medium, and an electronic device. Background Art
[0002] As distributed applications become more complex, their scheduling requirements are also becoming more complex, such as the affinity requirement of co-locating computation with data to avoid expensive data transfer, the non-affinity requirement of scheduling tasks on different machines to avoid interference, and the joint requirement of scheduling a set of interdependent tasks simultaneously. This diversity brings challenges to the design of distributed framework scheduling.
[0003] Generally, cluster scheduling management strategies make a trade-off between simplicity and flexibility. Monolithic cluster managers like Kubernetes (a distributed structure solution based on container technology, referred to as K8s) provide several ready-made strategies for applications, which simplifies the tasks of applications but also reduces flexibility. Each time a new strategy is added, the scheduler and cluster manager itself need to be changed. Schedulers like Omega can directly allocate resources and implement their own scheduling logic, but they greatly increase the complexity of applications. Not only do they need to allocate resources, but they also need to track resource availability when various failures occur and new nodes join the system.
[0004] Applications express their policies using the API (Application Programming Interface) selected by the framework scheduler. Although some schedulers support combination, it is often difficult to design a scheduler API that captures all possible use cases. Taking Kubernetes as an example, applications combine several policies to set a scheduling policy with static weights, but the complexity of policy combinations is exponential. At the same time, the implementation of the scheduler must be extended to new policies, and it must be ensured that each new policy is correctly connected to all existing policies, which takes a lot of time and effort. In addition, to implement cluster schedulers to support distributed training, the following scheduling policies are generally required: anti-affinity policies that evenly distribute training jobs in the cluster to ensure high throughput, affinity policies that put all tasks of the same training job on the same machine to avoid unnecessary data transfer, group scheduling policies that schedule multiple jobs at the same time to avoid starvation, and binning policies that monitor job utilization and merge jobs to reduce resource fragmentation. Currently popular schedulers implement at least one of these policies, but few support all four policies.
[0005] Therefore, a more flexible scheduling strategy is needed to achieve distributed training of cluster schedulers. Summary of the invention
[0006] The main purpose of the present application is to provide a method for determining a resource scheduling strategy, a scheduler, a computer-readable storage medium and an electronic device, so as to at least solve the problem that the resource scheduling method in the prior art requires changing the scheduler itself and the operation is complicated and not flexible enough.
[0007] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a method for determining a resource scheduling strategy is provided, which is applied to a scheduler, and the scheduler includes a temporary resource interface, including: receiving a scheduling strategy request and obtaining constraints of a target task, wherein the scheduling strategy request is a request to the scheduler for resources to execute the target task, and the constraints are conditions that must be met to execute the target task; generating a call request according to the constraints, and inputting the call request into the temporary resource interface so that the temporary resource interface obtains the status of a task node and generates a temporary resource according to the status of the task node, wherein the temporary resource is an abstract physical resource, and the physical resource is a hardware resource that actually exists in the scheduler and includes at least the task node; determining a resource scheduling strategy according to the temporary resource, wherein the resource scheduling strategy represents a strategy for calling the temporary resource to execute the target task.
[0008] Optionally, a call request is generated according to the constraint condition, and the call request is input into the temporary resource interface so that the temporary resource interface obtains the status of the task node and generates temporary resources according to the status of the task node, including: generating a label call request, a capacity call request and an optional node call request according to the constraint condition, wherein the label call request is a request for characterizing a resource label, the capacity call request is a request for characterizing the size of the required capacity, and the optional node call request is a request for characterizing the number of required nodes; inputting the label call request, the capacity call request and the optional node call request into the temporary resource setting interface so that the temporary resource setting interface obtains the status of the task node, and generates the temporary resources when the status of the task node satisfies the label call request, the capacity call request and the optional node call request.
[0009] Optionally, the temporary resource interface includes a temporary resource setting interface and a temporary resource request interface, and the method further includes: in the event that the task node fails, obtaining the faulty task node through the temporary resource request interface, and determining the faulty target task corresponding to the faulty task node; in the event that a candidate node exists, regenerating the temporary resources of the faulty target task through the temporary resource setting interface, and executing the faulty target task in the regenerated temporary resources; in the event that the candidate node does not exist, waiting for the faulty task node to recover, and executing the faulty target task after the faulty task node recovers.
[0010] Optionally, a resource scheduling strategy is determined based on the temporary resources, including: when there are multiple target tasks, sending the multiple target tasks to the same task node for scheduling; determining target data corresponding to the target task, and sending the target data and the target task to the same task node for scheduling, wherein the target data is data used in the process of executing the target task.
[0011] Optionally, determining a resource scheduling strategy based on the temporary resources also includes: when there is a dependency relationship between other target tasks and the target task, the temporary resource setting interface generates other temporary resources corresponding to the other target tasks according to the state of the task node of the target task, wherein the other target tasks are tasks with an execution time different from that of the target task; when there are multiple target tasks, the temporary resources are simultaneously allocated to multiple target tasks so that the multiple target tasks are executed simultaneously, or no temporary resource is allocated to any target task so that the multiple target tasks are not executed at the same time.
[0012] Optionally, determining a resource scheduling strategy based on the temporary resources also includes: when there are multiple target tasks, obtaining the current capacity and required capacity of the temporary resources, and when the required capacity is greater than the current capacity, increasing the current capacity; obtaining the generation time of the temporary resources corresponding to the multiple target tasks, and executing the target tasks in the order of the generation time.
[0013] Optionally, determining a resource scheduling strategy based on the temporary resources also includes: combining the task nodes corresponding to the temporary resources to obtain a temporary resource combination; in the presence of other target tasks, executing the other target tasks through the temporary resource combination, wherein the other target tasks are tasks with an execution time different from that of the target task.
[0014] According to another aspect of the present application, a scheduler is provided, the scheduler includes a temporary resource interface, the scheduler includes: an acquisition unit, used to receive a scheduling policy request, and obtain the constraints of the target task, wherein the scheduling policy request is a request to the scheduler for resources to execute the target task, and the constraints are conditions that need to be met to execute the target task; an input unit, used to generate a call request according to the constraints, and input the call request into the temporary resource interface, so that the temporary resource interface obtains the status of the task node, and generates a temporary resource according to the status of the task node, wherein the temporary resource is an abstract physical resource, and the physical resource is a hardware resource that actually exists in the scheduler and includes at least the task node; a first determination unit, used to determine a resource scheduling policy according to the temporary resource, wherein the resource scheduling policy represents a policy for calling the temporary resource to execute the target task.
[0015] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the methods for determining resource scheduling strategies.
[0016] According to another aspect of the present application, an electronic device is provided, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a determination method for executing any one of the resource scheduling strategies described.
[0017] The technical solution of the present application is applied, a scheduling strategy request is received, and the constraint conditions of the target task are obtained. The scheduling strategy request is a statement for requesting the resource for executing the target task from the scheduler, and the constraint conditions are the conditions that need to be met for executing the target task; a call request is generated according to the constraint conditions, and the call request is input into the temporary resource setting interface so that the temporary resource setting interface obtains the state of the task node, and generates temporary resources according to the state of the task node, and the temporary resources are abstract physical resources, and the physical resources are hardware resources that actually exist in the scheduler and at least include the task node; a resource scheduling strategy is determined according to the temporary resources, wherein the resource scheduling strategy represents a strategy for calling temporary resources to execute the target task. Compared with the method in the prior art that requires changing the internal structure of the scheduler when executing different task scheduling, the present application allocates temporary resources to the target task by introducing the addition of temporary resources and the temporary resource setting interface, without changing the structure of the scheduler, so that the scheduling is more flexible and efficient. Therefore, it is possible to solve the problem that the cluster scheduling method in the prior art is complex and inflexible, and achieve the effect of flexible resource scheduling. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] The drawings constituting part of the present application are used to provide a further understanding of the present application. The exemplary embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0019] Figure 1 A hardware structure block diagram of a mobile terminal for executing a method for determining a resource scheduling strategy provided in an embodiment of the present application is shown;
[0020] Figure 2 A schematic diagram of a process for determining a resource scheduling strategy provided by an embodiment of the present application is shown;
[0021] Figure 3 A flowchart of a specific method for determining a resource scheduling strategy provided by an embodiment of the present application is shown;
[0022] Figure 4 A schematic diagram showing a comparison between a specific resource scheduling strategy determination method provided in an embodiment of the present application and a scheduler strategy in the prior art;
[0023] Figure 5 A structural block diagram of a device for determining a resource scheduling strategy provided in an embodiment of the present application is shown.
[0024] The above drawings include the following reference numerals:
[0025] 102, processor; 104, memory; 106, transmission device; 108, input and output devices. DETAILED DESCRIPTION
[0026] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings 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 should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0029] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:
[0030] Scheduling constraints: are defined by a set of temporal and spatial dependencies between tasks and nodes, which are called scheduling constraints;
[0031] Temporary resources: are logical resource attributes that applications can dynamically associate with nodes. Like physical resources, they are acquired and released by tasks and can be created, modified, and destroyed by applications at runtime.
[0032] As introduced in the background technology, in the prior art, it is necessary to change the internal structure of the scheduler when executing different cluster call tasks, which makes the operation complex and inflexible. In order to solve the problem that the existing resource scheduling method is complex and inflexible, the embodiments of the present application provide a method for determining a resource scheduling strategy, a scheduler, a computer-readable storage medium and an electronic device.
[0033] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0034] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure diagram of a mobile terminal of a method for determining a resource scheduling strategy according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0035] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for determining the resource scheduling strategy in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The transmission device 106 is used to receive or send data via a network. The above-mentioned specific example of the network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0036] In this embodiment, a method for determining a resource scheduling strategy running on a mobile terminal, a computer terminal or a similar computing device is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0037] Figure 2 is a flow chart of a method for determining a resource scheduling strategy according to an embodiment of the present application. The method is applied to a scheduler, and the above scheduler includes a temporary resource interface, such as Figure 2 As shown, the method comprises the following steps:
[0038] Step S201, receiving a scheduling strategy request and obtaining constraints of a target task, wherein the scheduling strategy request is a request to the scheduler for resources to execute the target task, and the constraints are conditions that must be met to execute the target task;
[0039] Specifically, a temporary resource is introduced to map scheduling constraints to resource requirements, and an interface for dynamically creating, modifying, and destroying logical resources is provided to implement scheduling policies, freeing applications from executing admission control and tracking availability. Applications express custom policies through temporary resources, and the cluster scheduler provides a service to meet the resource constraints of each task. The scheduling policy is defined by a set of temporal and spatial dependencies between tasks and nodes. These dependencies are called scheduling constraints. The key idea of this embodiment is to map scheduling constraints to resource requirements by introducing a temporary resource. A temporary resource is a logical resource attribute that applications can dynamically associate with nodes. Like physical resources, applications can create, modify, and destroy them at runtime through task acquisition and release. By leveraging the functions of the cluster scheduler, temporary resources are used to implement scheduling constraints, matching the resource requirements specified by the application with the resource availability of the cluster. For example, if an application task requires two GPUs, the scheduler should schedule the task on a node with at least two available GPUs. When the resources match, the scheduler treats the temporary resources as physical resources. The implementation of the above scheduling strategy follows a two-step model: First, the application creates temporary resources or updates the capacity of existing temporary resources, which is done programmatically through the temporary resource API (Application Programmimg Interface, API for short). Second, the application associates temporary resource requirements with tasks, allowing the application to make targeted decisions to meet the scheduling constraints of the strategy. The scheduler receives the request corresponding to the scheduling strategy, that is, the scheduling strategy request, and then obtains the constraints of the target task.
[0040] Step S202, generating a call request according to the constraint condition, and inputting the call request into the temporary resource interface, so that the temporary resource interface obtains the state of the task node, and generates temporary resources according to the state of the task node, wherein the temporary resource is an abstract physical resource, and the physical resource is a hardware resource actually existing in the scheduler and at least includes the task node;
[0041] Specifically, the overall design is divided into applications and resource management frameworks. The framework performs resource matching and accounting on a set of underlying physical resources. Applications will specify and compose policies through the call library interface. The interface uses the temporary resource API to encapsulate common policies, namely the call library. When using the call library, the interaction with the system usually starts with the application requesting the call library for scheduling policies. The call library can interact with the resource manager, such as implementing policies by reading the cluster status and creating appropriate temporary resources. Then the application receives the resource specification R and submits it to the resource manager for scheduling. Currently, the resource management framework provides two API calls to manage temporary resources, namely set_resource and get_cluster_status. Generate a call request based on the constraints. After generating the call request, enter the temporary resource setting interface, namely set_resource in the above API. The set_resource interface is responsible for resource settings. The temporary resource setting interface obtains the status of each node in the physical resource, such as whether it is idle, and then generates temporary resources. Call the API of the resource management framework to create or update resources. The specific implementation depends on the underlying resource management framework, such as Kubernetes or Ray. Physical resources refer to the hardware resources that actually exist in the cluster. Temporary resources are logical resources that are dynamically created, modified, and destroyed by applications at runtime. Temporary resources are abstractions of physical resources and do not correspond to any actual hardware.
[0042] Step S203: determining a resource scheduling strategy according to the temporary resources, wherein the resource scheduling strategy represents a strategy for calling the temporary resources to execute the target task.
[0043] Specifically, in order to reduce the complexity of the application, a call library is also proposed, which can describe the scheduling policy from the mechanism of implementing the policy. It can generate a set of temporary resource requirements given a set of tasks and apply them to the tasks that meet the required scheduling policy. It implements domain-specific scheduling policies by encapsulating temporary resources and providing a unified API. In the implementation, the call library is designed as a daemon process that can provide services for scheduling requests issued by a single or multiple applications. The resource scheduling policy is determined based on the allocated temporary resources. The resource scheduling policy includes the node location where the task is executed, etc. The specific policy will be described in detail below.
[0044] Through this embodiment, a scheduling strategy request is received, and the constraint conditions of the target task are obtained. The scheduling strategy request is a statement for requesting the scheduler to execute the resource of the target task, and the constraint conditions are the conditions that need to be met to execute the target task; a call request is generated according to the constraint conditions, and the call request is input into the temporary resource setting interface so that the temporary resource setting interface obtains the state of the task node, and generates temporary resources according to the state of the task node. The temporary resource is an abstract physical resource, and the physical resource is a hardware resource that actually exists in the scheduler and includes at least the task node; the resource scheduling strategy is determined according to the temporary resource, wherein the resource scheduling strategy represents the strategy of calling temporary resources to execute the target task. Compared with the method in the prior art that needs to change the internal structure of the scheduler when executing different task scheduling, the present application allocates temporary resources to the target task by introducing the addition of temporary resources and the temporary resource setting interface, without changing the structure of the scheduler, so that the scheduling is more flexible and efficient. Therefore, it can solve the problem that the cluster scheduling method in the prior art is complex and inflexible, and achieve the effect of flexible resource scheduling.
[0045] In the specific implementation process, the above step S202 generates a call request according to the above constraint conditions, and inputs the above call request into the above temporary resource interface, so that the above temporary resource interface obtains the state of the task node, and generates temporary resources according to the state of the above task node, which can be achieved by the following steps: Generate a label call request, a capacity call request and an optional node call request according to the above constraint conditions, wherein the above label call request is a request to characterize the resource label, the above capacity call request is a request to characterize the size of the required capacity, and the above optional node call request is a request to characterize the number of required nodes; Input the above label call request, the above capacity call request and the above optional node call request into the above temporary resource setting interface, so that the above temporary resource setting interface obtains the state of the above task node, and generates the above temporary resources when the state of the above task node satisfies the above label call request, the above capacity call request and the above optional node call request. The method generates requests and temporary resources through the above steps, so that resources can be scheduled according to relevant requests and temporary resources.
[0046] In the specific implementation process, label call requests, capacity call requests and optional node call requests can be defined through a function def set_resource(name,capacity,node_spec), specifying the resource's label (label call request), capacity (capacity call request) and optional node constraints (optional node call request). node_spec is understood as a parameter containing additional requirements. For example, if multiple nodes meet the resource capacity conditions, node_spec can be used to specify how many nodes set_resource needs to be executed on. Targeted calls are also implemented by passing in a unique node identifier through node_spec. The above request is input into the temporary resource setting interface, which determines the status of the node based on the above request and generates the node that meets the above request as a temporary resource. The temporary resource interface is divided into two interfaces, set_resource and get_cluster_status. The behavior of temporary resources is the same as that of regular physical resources. They can be acquired and released by tasks. set_resource allows the constraint node_spec for creating resources to be specified. For example, node_spec can contain a unique node identifier for targeted calls. The get_cluster_status call returns a mapping of nodes to local resource capacity and availability.
[0047] In some optional implementations, the temporary resource interface includes a temporary resource setting interface and a temporary resource request interface, and the method further includes the following steps: in the event that the task node fails, the faulty task node is obtained through the temporary resource request interface, and the faulty target task corresponding to the faulty task node is determined; in the event that a candidate node exists, the temporary resource of the faulty target task is regenerated through the temporary resource setting interface, and the faulty target task is executed in the regenerated temporary resource; in the event that the candidate node does not exist, the faulty task node is waited for to be restored, and after the faulty task node is restored, the faulty target task is executed. Through the above steps, the method re-determines the task node or waits for recovery through the two interfaces respectively in the event of a node failure, which can ensure the smooth execution of the task.
[0048] Specifically, in the event of a task node failure, most frameworks simply re-execute the task with the same resource requirements. However, these requests include temporary resources that no longer exist, making the re-executed tasks unschedulable. This solution relies on the cluster framework to report failed nodes through the get_cluster_status API (temporary resource request interface) interface. Once a failed node is detected, the call library recreates the temporary resource on the appropriate node by replaying the set_resource (temporary resource setting interface) call of the failed resource. If a candidate node is found, the resources are recreated, otherwise the task must wait for the failed node to recover before it can be rescheduled. When the node is recovered, its resources are also reinitialized, allowing any waiting tasks to be rescheduled.
[0049] In some optional implementations, the above step S203 determines the resource scheduling strategy based on the above temporary resources, which can be implemented by the following steps: when there are multiple target tasks, send the multiple target tasks to the same task node for scheduling; determine the target data corresponding to the target task, and send the target data and the target task to the same task node for scheduling, wherein the target data is the data used in the process of executing the target task. The method determines the position in the scheduling strategy through the above steps, so that the scheduling of resources can be guaranteed to meet the position requirements.
[0050] In the specific implementation, in order to express the constraints of time and space, the scheme proposes four scheduling primitives implemented using temporary resources. The first is location. Tasks must usually be co-scheduled on the same physical node as another task or must be co-located with data. The co-located target task creates a local temporary resource Er with unlimited capacity when the task starts or creates data to be co-located with it. Then, the constrained task requests 1 unit of Er and is therefore automatically scheduled on the same node.
[0051] In some optional implementations, the above step S203 determines the resource scheduling strategy based on the above temporary resources, and also includes the following steps: when there is a dependency relationship between other target tasks and the above target task, the above temporary resource setting interface is also used to generate other temporary resources corresponding to the above other target tasks according to the status of the above task node of the above target task, wherein the above other target tasks are tasks with an execution time different from that of the above target task; when there are multiple target tasks, the above temporary resources are simultaneously allocated to multiple target tasks so that multiple target tasks are executed simultaneously, or none of the above temporary resources are allocated to any of the above target tasks so that multiple target tasks are not executed simultaneously. The method creates temporary resources for tasks with dependencies through the above steps, which can save the creation time of temporary resources.
[0052] Specifically, distributed applications rely on RPC to coordinate the execution of tasks, where the ordering of tasks in a DAG is critical for correctness. These time constraints can be expressed by dynamically creating temporary resources, effectively using them as signals. For example, if task T2 has any "happens before" dependency on task T1, then T1 can create a temporary resource E T2 , T2 prior request E T2 As part of the resources required when it starts. All task requests are placed at the beginning in a declarative manner, and the task will only start executing when the newly created resources meet the temporary resource requirements of the task. From a global perspective, if Task 2 depends on Task 1, when Task 1 creates resources, the resources of Task 2 can be created in advance and can be used directly when Task 2 arrives.
[0053] In the specific implementation process, the resource scheduling strategy is determined based on the temporary resources, and the following steps are also included: when there are multiple target tasks, the current capacity and required capacity of the temporary resources are obtained, and when the required capacity is greater than the current capacity, the current capacity is increased; the generation time of the temporary resources corresponding to the multiple target tasks is obtained, and the target tasks are executed in the order of the generation time. Through the above steps, the method increases the capacity of temporary resources and enables the queues to be executed in sequence, which can speed up the execution efficiency of tasks.
[0054] Specifically, many strategies use one or more task queues as the basic structure in their implementation. The scheduler queues tasks until their resource requirements can be met, allowing applications to decide when to dequeue tasks by increasing the capacity of temporary resources. Creating a queue is to create a unique temporary resource Eq with an initial capacity of 0 on any node, join the task queue by starting tasks in a wrapper task that requests 1 unit, and set the queue's churn rate by changing the capacity of Eq. After obtaining resources, the wrapper submits the task and its physical resource requirements to the scheduler and exits. This can speed up the dequeueing process.
[0055] In some optional implementations, the above step S203 determines the resource scheduling strategy according to the above temporary resources, and further includes the following steps: combining the above task nodes corresponding to the above temporary resources to obtain a temporary resource combination; in the case of other target tasks, executing the above other target tasks through the above temporary resource combination, wherein the above other target tasks are tasks with different execution times from the above target tasks. The method locks resources through the above steps, which can provide convenience when an application needs a group of resources.
[0056] Specifically, this embodiment can also implement a new scheduling structure that can use temporary resources to acquire and lock one or more physical resources. This resource reservation is implemented through the underlying subtask, and this directional mode provides convenience when the application needs a group of resources, where the task requests temporary resources instead of physical resources for scheduling. Take the application-level group scheduling strategy and the cluster-level hierarchical fair sharing strategy as examples to illustrate the implementation process of the scheduling strategy. Application-level group scheduling strategy: Both distributed training and reinforcement learning require group scheduling, and all tasks should be started and run at the same time, that is, all resources requested by all tasks are granted at the same time, or no resources are granted. When implementing these two constraints, it is necessary to pre-check whether there are enough resources available to meet the strategy and reserve these resources if necessary. The system will use resource locking primitives to implement, for example, by starting an underlying subtask that requires 8 CPUs and creates 8 group scheduling resource units to group schedule 8 task pools. If all tasks are successful, each task in the pool can request 1 group scheduling resource and 1 CPU for scheduling. If any task fails, rollback will be performed in other tasks and the group scheduling resources will be deleted. Cluster-level hierarchical fair sharing strategy: Large organizations often have shared resource clusters between teams. Such clusters have three requirements: first, assign resource sharing weights to users; second, maximize resource utilization and achieve maximum-minimum fairness; and third, further divide resource shares between sub-teams. Hierarchical fair sharing is implemented as a call library using a variant of the queuing primitive, which is instantiated to operate on a specified node domain and provides a single call create_user(id, weight) that returns a resource name unique to the user id. Internally, a set_resource call is executed to create a unique resource with unlimited capacity for each user on the assigned node. When a user submits a task, its unique resource label is requested and the capacity is set to 1 to ensure that their tasks run only on the resources provided to them. Since temporary resources can be updated at runtime, the call library dynamically adjusts the size of user allocations by adding and removing temporary resources.
[0057] In order to enable those skilled in the art to more clearly understand the technical solution of the present application, the implementation process of the method for determining the resource scheduling strategy of the present application will be described in detail below in conjunction with specific embodiments.
[0058] This embodiment relates to a specific method for determining a resource scheduling strategy, such as Figure 3 As shown, the following steps are included:
[0059] Step S1: Request scheduling strategy: the application sends a call request to the call library;
[0060] Step S2: API call: the calling library sends the call request to the API interface (temporary resource interface) in the resource management framework. The API interface includes set_resource() (temporary resource setting interface) and get_cluster_state() (temporary resource request interface). The call request is sent to the set_resource() interface.
[0061] Step S3: The resource management framework queries the status of the task nodes in the physical resources, for example: Node1{CPU=8}, that is, Node 1 has 8 available CPUs; Node2{CPU=4}, that is, Node 2 has 4 available CPUs; Noden{CPU=0}, that is, Node n has 0 available CPUs, etc.;
[0062] Step S4: the resource management framework then returns the cluster state of the available nodes in the above physical resources to the calling library through the get_cluster_state() interface;
[0063] Step S5: The calling library determines the resource specification R, which is the temporary resource composed of the above cluster. The application receives the resource specification R and runs the target task on R. If there are multiple target tasks, they are sent to the same task node for execution, and the target task and the corresponding data are on the same node.
[0064] Figure 4 A schematic diagram showing a comparison between the scheduler of the present application and the single-chip scheduler and the custom scheduler in the prior art is shown. Figure 4 As shown, the scheduler is divided into two parts: application and framework for explanation. In a monolithic scheduler, the application responds to resource requirements, and the framework generates policies A, B, and C to form a scheduling framework; in a custom scheduler, policies A and B plus custom policies form scheduling constraints, and scheduling constraints and resource requirements together form a custom application scheduler, and physical resources are called; in the scheduler of this application, the scheduling library generates policies A and B, which together with custom policies form scheduling constraints, and temporary resources are generated according to scheduling constraints. Temporary resources are matched with resource requirements to match resource requirements, and available temporary resources are matched to execute tasks.
[0065] The embodiment of the present application also provides a scheduler. It should be noted that the scheduler of the embodiment of the present application can be used to execute the determination method for resource scheduling strategy provided by the embodiment of the present application. The device is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions thereof will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0066] The following is an introduction to the scheduler provided in the embodiments of the present application.
[0067] Figure 5 Schematic diagram of a scheduler according to an embodiment of the present application. Figure 5 As shown, the scheduler includes:
[0068] The acquisition unit 10 is used to receive a scheduling strategy request and acquire the constraint conditions of the target task, wherein the scheduling strategy request is a request to the scheduler for resources to execute the target task, and the constraint conditions are conditions that need to be met to execute the target task;
[0069] Specifically, a temporary resource is introduced to map scheduling constraints to resource requirements, and an interface for dynamically creating, modifying, and destroying logical resources is provided to implement scheduling policies, freeing applications from executing admission control and tracking availability. Applications express custom policies through temporary resources, and the cluster scheduler provides a service to meet the resource constraints of each task. The scheduling policy is defined by a set of temporal and spatial dependencies between tasks and nodes. These dependencies are called scheduling constraints. The key idea of this embodiment is to map scheduling constraints to resource requirements by introducing a temporary resource. A temporary resource is a logical resource attribute that applications can dynamically associate with nodes. Like physical resources, applications can create, modify, and destroy them at runtime through task acquisition and release. By leveraging the functions of the cluster scheduler, temporary resources are used to implement scheduling constraints, matching the resource requirements specified by the application with the resource availability of the cluster. For example, if an application task requires two GPUs, the scheduler should schedule the task on a node with at least two available GPUs. When the resources match, the scheduler treats the temporary resources as physical resources. The implementation of the above scheduling strategy follows a two-step model: First, the application creates temporary resources or updates the capacity of existing temporary resources, which is done programmatically through the temporary resource API (Application Programmimg Interface, API for short). Second, the application associates temporary resource requirements with tasks, allowing the application to make targeted decisions to meet the scheduling constraints of the strategy. The scheduler receives the request corresponding to the scheduling strategy, that is, the scheduling strategy request, and then obtains the constraints of the target task.
[0070] An input unit 20, configured to generate a call request according to the constraint conditions, and input the call request into the temporary resource interface, so that the temporary resource interface obtains the state of the task node, and generates temporary resources according to the state of the task node, wherein the temporary resource is an abstract physical resource, and the physical resource is a hardware resource actually existing in the scheduler and at least includes the task node;
[0071] Specifically, the overall design is divided into applications and resource management frameworks. The framework performs resource matching and accounting on a set of underlying physical resources. Applications will specify and compose policies through the call library interface. The interface uses the temporary resource API to encapsulate common policies, namely the call library. When using the call library, the interaction with the system usually starts with the application requesting the call library for scheduling policies. The call library can interact with the resource manager, such as implementing policies by reading the cluster status and creating appropriate temporary resources. Then the application receives the resource specification R and submits it to the resource manager for scheduling. Currently, the resource management framework provides two API calls to manage temporary resources, namely set_resource and get_cluster_status. Generate a call request based on the constraints. After generating the call request, enter the temporary resource setting interface, namely set_resource in the above API. The set_resource interface is responsible for resource settings. The temporary resource setting interface obtains the status of each node in the physical resource, such as whether it is idle, and then generates temporary resources. Call the API of the resource management framework to create or update resources. The specific implementation depends on the underlying resource management framework, such as Kubernetes or Ray. Physical resources refer to the hardware resources that actually exist in the cluster. Temporary resources are logical resources that are dynamically created, modified, and destroyed by applications at runtime. Temporary resources are abstractions of physical resources and do not correspond to any actual hardware.
[0072] The first determining unit 30 is configured to determine a resource scheduling strategy according to the temporary resources, wherein the resource scheduling strategy represents a strategy for calling the temporary resources to execute the target task.
[0073] Specifically, in order to reduce the complexity of the application, a call library is also proposed, which can describe the scheduling policy from the mechanism of implementing the policy. It can generate a set of temporary resource requirements given a set of tasks and apply them to the tasks that meet the required scheduling policy. It implements domain-specific scheduling policies by encapsulating temporary resources and providing a unified API. In the implementation, the call library is designed as a daemon process that can provide services for scheduling requests issued by a single or multiple applications. The resource scheduling policy is determined based on the allocated temporary resources. The resource scheduling policy includes the node location where the task is executed, etc. The specific policy will be described in detail below.
[0074] Through this embodiment, a scheduling strategy request is received, and the constraint conditions of the target task are obtained. The scheduling strategy request is a statement for requesting resources to execute the target task from the scheduler, and the constraint conditions are the conditions that need to be met to execute the target task; a call request is generated according to the constraint conditions, and the call request is input into the temporary resource setting interface so that the temporary resource setting interface obtains the state of the task node, and generates temporary resources according to the state of the task node. The temporary resource is an abstract physical resource, and the physical resource is a hardware resource that actually exists in the scheduler and includes at least the task node; the resource scheduling strategy is determined according to the temporary resource, wherein the resource scheduling strategy represents the strategy of calling temporary resources to execute the target task. Compared with the device in the prior art that needs to change the internal structure of the scheduler when executing different task scheduling, the present application allocates temporary resources to the target task by introducing the addition of temporary resources and the temporary resource setting interface, without changing the structure of the scheduler, so that the scheduling is more flexible and efficient. Therefore, it can solve the problem that the cluster scheduling device in the prior art is complex and inflexible, and achieve the effect of flexible resource scheduling.
[0075] In the specific implementation process, the input unit includes a first generation module and an input module, wherein the first generation module is used to generate a label call request, a capacity call request and an optional node call request according to the above constraint conditions, wherein the label call request is a request to characterize a resource label, the capacity call request is a request to characterize the size of the required capacity, and the optional node call request is a request to characterize the number of required nodes; the input module is used to input the label call request, the capacity call request and the optional node call request into the temporary resource setting interface, so that the temporary resource setting interface obtains the status of the task node, and generates the temporary resource when the status of the task node satisfies the label call request, the capacity call request and the optional node call request. The device generates requests and temporary resources through the above steps, so that resources can be scheduled according to relevant requests and temporary resources.
[0076] In the specific implementation process, label call requests, capacity call requests and optional node call requests can be defined through a function def set_resource(name,capacity,node_spec), specifying the resource's label (label call request), capacity (capacity call request) and optional node constraints (optional node call request). node_spec is understood as a parameter containing additional requirements. For example, if multiple nodes meet the resource capacity conditions, node_spec can be used to specify how many nodes set_resource needs to be executed on. Targeted calls are also implemented by passing in a unique node identifier through node_spec. The above request is input into the temporary resource setting interface, which determines the status of the node based on the above request and generates the node that meets the above request as a temporary resource. The temporary resource interface is divided into two interfaces, set_resource and get_cluster_status. The behavior of temporary resources is the same as that of regular physical resources. They can be acquired and released by tasks. set_resource allows the constraint node_spec for creating resources to be specified. For example, node_spec can contain a unique node identifier for targeted calls. The get_cluster_status call returns a mapping of nodes to local resource capacity and availability.
[0077] In some optional implementations, the temporary resource interface includes a temporary resource setting interface and a temporary resource request interface, and the scheduler also includes a second determination unit, a first execution unit, and a second execution unit. The second determination unit is used to obtain the faulty task node through the temporary resource request interface and determine the faulty target task corresponding to the faulty task node when the task node fails; the first execution unit is used to regenerate the temporary resources of the faulty target task through the temporary resource setting interface when a candidate node exists, and execute the faulty target task in the regenerated temporary resources; the second execution unit is used to wait for the faulty task node to recover when the candidate node does not exist, and execute the faulty target task after the faulty task node recovers. The device re-determines the task node or waits for recovery through the two interfaces respectively when a node fails through the above steps, so that the smooth execution of the task can be ensured.
[0078] Specifically, in the event of a task node failure, most frameworks simply re-execute the task with the same resource requirements. However, these requests include temporary resources that no longer exist, making the re-executed tasks unschedulable. This solution relies on the cluster framework to report failed nodes through the get_cluster_status API (temporary resource request interface) interface. Once a failed node is detected, the call library recreates the temporary resource on the appropriate node by replaying the set_resource (temporary resource setting interface) call of the failed resource. If a candidate node is found, the resources are recreated, otherwise the task must wait for the failed node to recover before it can be rescheduled. When the node is recovered, its resources are also reinitialized, allowing any waiting tasks to be rescheduled.
[0079] In some optional implementations, the first determination unit includes a first sending module and a second sending module, the first sending module is used to send the plurality of the target tasks to the same task node for scheduling when there are a plurality of the target tasks; the second sending module is used to determine the target data corresponding to the target task, and send the target data and the target task to the same task node for scheduling, wherein the target data is data applied during the execution of the target task. The device determines the position in the scheduling strategy through the above steps, so that the scheduling of resources can be ensured to meet the position requirements.
[0080] In the specific implementation, in order to express the constraints of time and space, the scheme proposes four scheduling primitives implemented using temporary resources. The first is location. Tasks must usually be co-scheduled on the same physical node as another task or must be co-located with data. The co-located target task creates a local temporary resource Er with unlimited capacity when the task starts or creates data to be co-located with it. Then, the constrained task requests 1 unit of Er and is therefore automatically scheduled on the same node.
[0081] In some optional implementations, the first determination unit further includes a second generation module and an allocation module. The second generation module is used to enable the temporary resource setting interface to generate other temporary resources corresponding to the other target tasks according to the status of the task node of the target task when there is a dependency relationship between the other target tasks and the target task, wherein the other target tasks are tasks with execution times different from those of the target task; the allocation module is used to simultaneously allocate the temporary resources to multiple target tasks when there are multiple target tasks, so that the multiple target tasks are executed simultaneously, or not allocate any of the temporary resources to any of the target tasks, so that the multiple target tasks are not executed simultaneously. The device creates temporary resources for tasks with dependencies through the above steps, which can save the creation time of temporary resources.
[0082] Specifically, distributed applications rely on RPC to coordinate the execution of tasks, where the ordering of tasks in a DAG is critical for correctness. These time constraints can be expressed by dynamically creating temporary resources, effectively using them as signals. For example, if task T2 has any "happens before" dependency on task T1, then T1 can create a temporary resource E T2 , T2 prior request E T2 As part of the resources required when it starts. All task requests are placed at the beginning in a declarative manner, and the task will only start executing when the newly created resources meet the temporary resource requirements of the task. From a global perspective, if Task 2 depends on Task 1, when Task 1 creates resources, the resources of Task 2 can be created in advance and can be used directly when Task 2 arrives.
[0083] In the specific implementation process, the first determination unit also includes an increase module and a first execution module, wherein the increase module is used to obtain the current capacity and required capacity of the temporary resources when there are multiple target tasks, and increase the current capacity when the required capacity is greater than the current capacity; the first execution module is used to obtain the generation time of the temporary resources corresponding to the multiple target tasks, and execute the target tasks in the order of the generation time. Through the above steps, the device increases the capacity of temporary resources and enables the queue to execute in sequence, which can speed up the execution efficiency of tasks.
[0084] Specifically, many strategies use one or more task queues as the basic structure in their implementation. The scheduler queues tasks until their resource requirements can be met, allowing applications to decide when to dequeue tasks by increasing the capacity of temporary resources. Creating a queue is to create a unique temporary resource Eq with an initial capacity of 0 on any node, join the task queue by starting tasks in a wrapper task that requests 1 unit, and set the queue's churn rate by changing the capacity of Eq. After obtaining resources, the wrapper submits the task and its physical resource requirements to the scheduler and exits. This can speed up the dequeueing process.
[0085] In some optional implementations, the first determination unit further includes a combination module and a second execution module, wherein the combination module is used to combine the task nodes corresponding to the temporary resources to obtain a temporary resource combination; the second execution module is used to execute the other target tasks through the temporary resource combination when there are other target tasks, wherein the other target tasks are tasks with different execution times from the target tasks. The device locks resources through the above steps, which can provide convenience when an application needs a group of resources.
[0086] Specifically, this embodiment can also implement a new scheduling structure that can use temporary resources to acquire and lock one or more physical resources. This resource reservation is implemented through the underlying subtask, and this directional mode provides convenience when the application needs a group of resources, where the task requests temporary resources instead of physical resources for scheduling. Take the application-level group scheduling strategy and the cluster-level hierarchical fair sharing strategy as examples to illustrate the implementation process of the scheduling strategy. Application-level group scheduling strategy: Both distributed training and reinforcement learning require group scheduling, and all tasks should be started and run at the same time, that is, all resources requested by all tasks are granted at the same time, or no resources are granted. When implementing these two constraints, it is necessary to pre-check whether there are enough resources available to meet the strategy and reserve these resources if necessary. The system will use resource locking primitives to implement, for example, by starting an underlying subtask that requires 8 CPUs and creates 8 group scheduling resource units to group schedule 8 task pools. If all tasks are successful, each task in the pool can request 1 group scheduling resource and 1 CPU for scheduling. If any task fails, rollback will be performed in other tasks and the group scheduling resources will be deleted. Cluster-level hierarchical fair sharing strategy: Large organizations often have shared resource clusters between teams. Such clusters have three requirements: first, assign resource sharing weights to users; second, maximize resource utilization and achieve maximum-minimum fairness; and third, further divide resource shares between sub-teams. Hierarchical fair sharing is implemented as a call library using a variant of the queuing primitive, which is instantiated to operate on a specified node domain and provides a single call create_user(id, weight) that returns a resource name unique to the user id. Internally, a set_resource call is executed to create a unique resource with unlimited capacity for each user on the assigned node. When a user submits a task, its unique resource label is requested and the capacity is set to 1 to ensure that their tasks run only on the resources provided to them. Since temporary resources can be updated at runtime, the call library dynamically adjusts the size of user allocations by adding and removing temporary resources.
[0087] The above-mentioned scheduler includes a processor and a memory, and the above-mentioned acquisition unit, input unit and first determination unit are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions. The above-mentioned modules are all located in the same processor; or, the above-mentioned modules are located in different processors in any combination.
[0088] The processor contains a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set to simplify the resource scheduling steps by adjusting the kernel parameters.
[0089] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0090] An embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for determining the resource scheduling strategy.
[0091] Specifically, the method for determining the resource scheduling strategy includes:
[0092] Step S201, receiving a scheduling strategy request and obtaining constraints of a target task, wherein the scheduling strategy request is a request to the scheduler for resources to execute the target task, and the constraints are conditions that must be met to execute the target task;
[0093] Specifically, a temporary resource is introduced to map scheduling constraints to resource requirements, and an interface for dynamically creating, modifying, and destroying logical resources is provided to implement scheduling policies, freeing applications from executing admission control and tracking availability. Applications express custom policies through temporary resources, and the cluster scheduler provides a service to meet the resource constraints of each task. The scheduling policy is defined by a set of temporal and spatial dependencies between tasks and nodes. These dependencies are called scheduling constraints. The key idea of this embodiment is to map scheduling constraints to resource requirements by introducing a temporary resource. A temporary resource is a logical resource attribute that applications can dynamically associate with nodes. Like physical resources, applications can create, modify, and destroy them at runtime through task acquisition and release. By leveraging the functions of the cluster scheduler, temporary resources are used to implement scheduling constraints, matching the resource requirements specified by the application with the resource availability of the cluster. For example, if an application task requires two GPUs, the scheduler should schedule the task on a node with at least two available GPUs. When the resources match, the scheduler treats the temporary resources as physical resources. The implementation of the above scheduling strategy follows a two-step model: First, the application creates temporary resources or updates the capacity of existing temporary resources, which is done programmatically through the temporary resource API (Application Programmimg Interface, API for short). Second, the application associates temporary resource requirements with tasks, allowing the application to make targeted decisions to meet the scheduling constraints of the strategy. The scheduler receives the request corresponding to the scheduling strategy, that is, the scheduling strategy request, and then obtains the constraints of the target task.
[0094] Step S202, generating a call request according to the constraint condition, and inputting the call request into the temporary resource interface, so that the temporary resource interface obtains the state of the task node, and generates temporary resources according to the state of the task node, wherein the temporary resource is an abstract physical resource, and the physical resource is a hardware resource actually existing in the scheduler and at least includes the task node;
[0095] Specifically, the overall design is divided into applications and resource management frameworks. The framework performs resource matching and accounting on a set of underlying physical resources. Applications will specify and compose policies through the call library interface. The interface uses the temporary resource API to encapsulate common policies, namely the call library. When using the call library, the interaction with the system usually starts with the application requesting the call library for scheduling policies. The call library can interact with the resource manager, such as implementing policies by reading the cluster status and creating appropriate temporary resources. Then the application receives the resource specification R and submits it to the resource manager for scheduling. Currently, the resource management framework provides two API calls to manage temporary resources, namely set_resource and get_cluster_status. Generate a call request based on the constraints. After generating the call request, enter the temporary resource setting interface, namely set_resource in the above API. The set_resource interface is responsible for resource settings. The temporary resource setting interface obtains the status of each node in the physical resource, such as whether it is idle, and then generates temporary resources. Call the API of the resource management framework to create or update resources. The specific implementation depends on the underlying resource management framework, such as Kubernetes or Ray. Physical resources refer to the hardware resources that actually exist in the cluster. Temporary resources are logical resources that are dynamically created, modified, and destroyed by applications at runtime. Temporary resources are abstractions of physical resources and do not correspond to any actual hardware.
[0096] Step S203: determining a resource scheduling strategy according to the temporary resources, wherein the resource scheduling strategy represents a strategy for calling the temporary resources to execute the target task.
[0097] Specifically, in order to reduce the complexity of the application, a call library is also proposed, which can describe the scheduling policy from the mechanism of implementing the policy. It can generate a set of temporary resource requirements given a set of tasks and apply them to the tasks that meet the required scheduling policy. It implements domain-specific scheduling policies by encapsulating temporary resources and providing a unified API. In the implementation, the call library is designed as a daemon process that can provide services for scheduling requests issued by a single or multiple applications. The resource scheduling policy is determined based on the allocated temporary resources. The resource scheduling policy includes the node location where the task is executed, etc. The specific policy will be described in detail below.
[0098] An embodiment of the present invention provides an electronic device, including a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the processor executes the program, at least the following steps are implemented:
[0099] Step S201, receiving a scheduling strategy request and obtaining constraints of a target task, wherein the scheduling strategy request is a request to the scheduler for resources to execute the target task, and the constraints are conditions that must be met to execute the target task;
[0100] Step S202, generating a call request according to the constraint condition, and inputting the call request into the temporary resource interface, so that the temporary resource interface obtains the state of the task node, and generates temporary resources according to the state of the task node, wherein the temporary resource is an abstract physical resource, and the physical resource is a hardware resource actually existing in the scheduler and at least includes the task node;
[0101] Step S203: determining a resource scheduling strategy according to the temporary resources, wherein the resource scheduling strategy represents a strategy for calling the temporary resources to execute the target task.
[0102] The devices in this article can be servers, PCs, PADs, mobile phones, etc.
[0103] The present application also provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the above method in each embodiment of the present application are implemented:
[0104] Step S201, receiving a scheduling strategy request and obtaining constraints of a target task, wherein the scheduling strategy request is a request to the scheduler for resources to execute the target task, and the constraints are conditions that must be met to execute the target task;
[0105] Step S202, generating a call request according to the constraint condition, and inputting the call request into the temporary resource interface, so that the temporary resource interface obtains the state of the task node, and generates temporary resources according to the state of the task node, wherein the temporary resource is an abstract physical resource, and the physical resource is a hardware resource actually existing in the scheduler and at least includes the task node;
[0106] Step S203: determining a resource scheduling strategy according to the temporary resources, wherein the resource scheduling strategy represents a strategy for calling the temporary resources to execute the target task.
[0107] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0108] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0109] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0110] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0111] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0112] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0113] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0114] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0115] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity 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, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0116] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
[0117] 1) In the method for determining the resource scheduling strategy of the present application, a scheduling strategy request is received, and the constraint conditions of the target task are obtained. The scheduling strategy request is a statement for requesting the resource for executing the target task from the scheduler, and the constraint conditions are the conditions that need to be met to execute the target task; a call request is generated according to the constraint conditions, and the call request is input into the temporary resource setting interface so that the temporary resource setting interface obtains the state of the task node, and generates temporary resources according to the state of the task node. The temporary resource is an abstract physical resource, and the physical resource is a hardware resource that actually exists in the scheduler and includes at least the task node; the resource scheduling strategy is determined according to the temporary resource, wherein the resource scheduling strategy represents the strategy of calling temporary resources to execute the target task. Compared with the method in the prior art that requires changing the internal structure of the scheduler when executing different task scheduling, the present application allocates temporary resources to the target task by introducing the addition of temporary resources and the temporary resource setting interface, without changing the structure of the scheduler, so that the scheduling is more flexible and efficient. Therefore, it can solve the problem that the cluster scheduling method in the prior art is complex and inflexible, and achieve the effect of flexible resource scheduling.
[0118] 2) The scheduler of the present application receives a scheduling strategy request and obtains the constraint conditions of the target task. The scheduling strategy request is a statement for requesting the scheduler to execute the resource of the target task, and the constraint conditions are the conditions that need to be met to execute the target task; a call request is generated according to the constraint conditions, and the call request is input into the temporary resource setting interface so that the temporary resource setting interface obtains the state of the task node, and generates temporary resources according to the state of the task node. The temporary resource is an abstract physical resource, and the physical resource is a hardware resource that actually exists in the scheduler and includes at least the task node; the resource scheduling strategy is determined according to the temporary resource, wherein the resource scheduling strategy represents the strategy of calling temporary resources to execute the target task. Compared with the device in the prior art that needs to change the internal structure of the scheduler when executing different task scheduling, the present application allocates temporary resources to the target task by introducing the addition of temporary resources and the temporary resource setting interface without changing the structure of the scheduler, so that the scheduling is more flexible and efficient. Therefore, it can solve the problem that the cluster scheduling operation in the prior art is complex and inflexible, and achieve the effect of flexible resource scheduling.
[0119] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for determining a resource scheduling strategy, It is characterized in that Applied to a scheduler, the scheduler includes a temporary resource interface, including: Receive a scheduling policy request and obtain constraints of a target task, wherein the scheduling policy request is a request to the scheduler for resources to execute the target task, and the constraints are conditions that must be met to execute the target task; Generate a call request according to the constraint condition, and input the call request into the temporary resource interface, so that the temporary resource interface obtains the state of the task node, and generates a temporary resource according to the state of the task node, wherein the temporary resource is an abstract physical resource, and the physical resource is a hardware resource actually existing in the scheduler and at least includes the task node; A resource scheduling strategy is determined according to the temporary resources, wherein the resource scheduling strategy represents a strategy for calling the temporary resources to execute the target task.
2. The determination method according to claim 1, It is characterized in that Generate a call request according to the constraint condition, and input the call request into the temporary resource interface, so that the temporary resource interface obtains the state of the task node, and generates a temporary resource according to the state of the task node, including: Generate a label call request, a capacity call request and an optional node call request according to the constraint condition, wherein the label call request is a request representing a resource label, the capacity call request is a request representing the size of the required capacity, and the optional node call request is a request representing the number of required nodes; The label call request, the capacity call request and the optional node call request are input into the temporary resource setting interface so that the temporary resource setting interface obtains the status of the task node, and generates the temporary resources when the status of the task node satisfies the label call request, the capacity call request and the optional node call request.
3. The determination method according to claim 1, It is characterized in that The temporary resource interface includes a temporary resource setting interface and a temporary resource request interface, and the method further includes: In the event that the task node fails, the failed task node is obtained through the temporary resource request interface, and the failed target task corresponding to the failed task node is determined; In the case where a candidate node exists, regenerating temporary resources of the faulty target task through the temporary resource setting interface, and executing the faulty target task in the regenerated temporary resources; In the case that the candidate node does not exist, wait for the faulty task node to recover, and after the faulty task node recovers, execute the faulty target task.
4. The determination method according to any one of claims 1 to 3, It is characterized in that Determining a resource scheduling strategy according to the temporary resources includes: In the case where there are multiple target tasks, sending the multiple target tasks to the same task node for scheduling; Determine the target data corresponding to the target task, and send the target data and the target task to the same task node for scheduling, wherein the target data is data used in the process of executing the target task.
5. The determination method according to any one of claims 1 to 3, It is characterized in that Determining a resource scheduling strategy according to the temporary resources also includes: In the case where there is a dependency relationship between other target tasks and the target task, the temporary resource setting interface is also enabled to generate other temporary resources corresponding to the other target tasks according to the state of the task node of the target task, wherein the other target tasks are tasks with different execution time from the target task; In the case where there are multiple target tasks, the temporary resources are allocated to the multiple target tasks at the same time so that the multiple target tasks are executed simultaneously, or no temporary resource is allocated to any of the target tasks so that the multiple target tasks are not executed simultaneously.
6. The determination method according to any one of claims 1 to 3, It is characterized in that Determining a resource scheduling strategy according to the temporary resources also includes: When there are multiple target tasks, obtaining the current capacity and the required capacity of the temporary resource, and when the required capacity is greater than the current capacity, increasing the current capacity; The generation time of the temporary resources corresponding to the plurality of target tasks is obtained, and the target tasks are executed in the order of the generation time.
7. The determination method according to any one of claims 1 to 3, It is characterized in that Determining a resource scheduling strategy according to the temporary resources also includes: Combining the task nodes corresponding to the temporary resources to obtain a temporary resource combination; In the case that other target tasks exist, the other target tasks are executed by the temporary resource combination, wherein the other target tasks are tasks with execution time different from that of the target task.
8. A scheduler, It is characterized in that The scheduler includes a temporary resource interface, and the scheduler includes: An acquisition unit, configured to receive a scheduling policy request and acquire a constraint condition of a target task, wherein the scheduling policy request is a request to the scheduler for resources to execute the target task, and the constraint condition is a condition that needs to be satisfied in order to execute the target task; An input unit, configured to generate a call request according to the constraint condition, and input the call request into the temporary resource interface, so that the temporary resource interface obtains the state of the task node, and generates a temporary resource according to the state of the task node, wherein the temporary resource is an abstract physical resource, and the physical resource is a hardware resource actually existing in the scheduler and at least includes the task node; The first determining unit is configured to determine a resource scheduling strategy according to the temporary resources, wherein the resource scheduling strategy represents a strategy for calling the temporary resources to execute the target task.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for determining the resource scheduling strategy according to any one of claims 1 to 7.
10. An electronic device, It is characterized in that include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for determining a resource scheduling strategy for executing any one of claims 1 to 7.
