A method, device, computer equipment and storage medium for job scheduling

By allocating jobs to different queues based on the number and duration of resource requests, and calculating the running cost to determine the scheduling order, the problem of low job scheduling efficiency in cloud computing is solved and more effective utilization of resources is achieved.

CN115033358BActive Publication Date: 2024-10-15INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202210552607.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-19
Publication Date
2024-10-15
Estimated Expiration
2042-05-19

AI Technical Summary

Technical Problem

The existing job scheduling strategies in cloud computing are inefficient in resource allocation, leading to resource fragmentation and job congestion, and unable to effectively utilize the idle resources of the cloud platform.

Method used

By allocating the jobs to be scheduled to two queues according to the number of their resource requests, calculating their positions based on the jobs' queuing time and estimated running time, and comparing the running costs to determine the scheduling order, the job scheduling strategy is optimized.

Benefits of technology

It improves the efficiency of job scheduling, avoids resource fragmentation and congestion, and makes more reasonable use of cloud platform resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115033358B_ABST
    Figure CN115033358B_ABST
Patent Text Reader

Abstract

The present application relates to a method, apparatus, computer equipment and storage medium for job scheduling. The method for job scheduling includes: obtaining jobs to be scheduled and the corresponding resource request quantity, and respectively allocating the jobs to a first job queue and a second job queue according to the resource request quantity of the jobs, wherein the resource request quantity of the jobs in the first job queue is less than the resource request quantity of the jobs in the second job queue; obtaining the queuing time and estimated running time of the jobs, obtaining the first queue position of the jobs in the first job queue according to the estimated running time, and obtaining the second queue position of the jobs in the second job queue according to the queuing time; scheduling the jobs according to the first queue position and the second queue position. The use of this method can improve the efficiency of job scheduling.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer equipment and storage medium for job scheduling. Background Art

[0002] Cloud computing is a model that shares software and hardware resources and information based on the Internet, and can provide computers and other devices on demand. In order to reasonably allocate shared resources in cloud computing, the jobs submitted by users must be scheduled accordingly. In the current scheduling strategy, the scheduling algorithm generally considers the resource level. If jobs with large resource requirements are scheduled first, the small amount of idle resources on the cloud platform cannot be effectively utilized. If jobs with small resource requirements are scheduled first, the cloud platform may not be able to release more idle resources, and thus it is difficult to support the use of jobs with large resource requirements. It may also cause serious resource fragmentation and blockage of jobs with large resource requirements, resulting in poor job scheduling efficiency. Summary of the invention

[0003] Based on this, a method, apparatus, computer device and storage medium for job scheduling are provided to improve the problem of poor job scheduling efficiency in the prior art.

[0004] In one aspect, a method for job scheduling is provided, the method comprising:

[0005] Obtaining jobs to be scheduled and corresponding resource request quantities, and respectively allocating the jobs to a first job queue and a second job queue according to the resource request quantities of the jobs, wherein the resource request quantity of the jobs in the first job queue is less than the resource request quantity of the jobs in the second job queue;

[0006] Obtaining a queuing time and an estimated running time of the job, obtaining a first queue position of the job in the first job queue according to the estimated running time, and obtaining a second queue position of the job in the second job queue according to the queuing time;

[0007] The job is scheduled according to the first queue position and the second queue position.

[0008] In one embodiment, the job is scheduled according to the first queue position and the second queue position, including: according to the first queue position, obtaining the first job at the first queue position, and obtaining a first running cost according to the first job; according to the second queue position, obtaining the second job at the second queue position, and obtaining a second running cost according to the second job; comparing the first running cost and the second running cost, if the first running cost is less than the second running cost, scheduling the first job; if the first running cost is greater than the first running cost, scheduling the second job.

[0009] In one embodiment, the mathematical expression of the first running cost is:

[0010] Cost1=U1*Tasks1*Rt1+V2*Wt2

[0011] Among them, Cost1 represents the first running cost, U1 represents the first running coefficient weight value, Tasks1 represents the number of subtasks of the first job, Rt1 represents the estimated running time of the second job, V2 represents the second queuing coefficient weight value, and Wt2 represents the queuing time of the second job.

[0012] In one embodiment, the mathematical expression of the first running cost is:

[0013] Cost2=U2*Tasks2*Rt2+V1*Wt1

[0014] Among them, Cost2 represents the second running cost, U2 represents the second running coefficient weight value, Tasks2 represents the number of subtasks of the second job, Rt2 represents the estimated running time of the second job, V1 represents the first queuing coefficient weight value, and Wt1 represents the queuing time of the first job.

[0015] In one of the embodiments, the queuing time and the estimated running time of the job are obtained, the first queue position of the job in the first job queue is obtained according to the estimated running time, and the second queue position of the job in the second job queue is obtained according to the queuing time, including: obtaining the static priority of the job, summing the static priority, the estimated running time, and the number of resource requests to obtain the first sequence identifier of the job in the first job queue; summing the static priority, the queuing time, and the number of resource requests to obtain the second sequence identifier of the job in the second job queue; arranging the jobs in ascending order according to the first sequence identifier to obtain the first queue position, and arranging the jobs in descending order according to the second sequence identifier to obtain the second queue position.

[0016] In one of the embodiments, obtaining the estimated running time includes: obtaining a sampling value, and sampling the actual running time of the job after each completion of the operation according to the sampling value to obtain the sampled running time; and calculating the average of the sampled running time according to the sampling value to obtain the estimated running time.

[0017] In one of the embodiments, a job to be scheduled and the corresponding resource request quantity are obtained, and the job is allocated to a first job queue and a second job queue according to the resource request quantity of the job, including: comparing the resource request quantity with a resource request quantity threshold; if the resource request quantity is less than the resource request quantity threshold, the job is allocated to the first job queue; if the resource request quantity is greater than or equal to the resource request quantity threshold, the job is divided into the second job queue.

[0018] In another aspect, a device for job scheduling is provided, the device comprising:

[0019] A job allocation module, used to obtain jobs to be scheduled and corresponding resource request quantities, and allocate the jobs to a first job queue and a second job queue according to the resource request quantities of the jobs, wherein the resource request quantity of the jobs in the first job queue is less than the resource request quantity of the jobs in the second job queue;

[0020] a job time management module, configured to obtain a queuing time and an estimated running time of the job, obtain a first queue position of the job in the first job queue according to the estimated running time, and obtain a second queue position of the job in the second job queue according to the queuing time;

[0021] A job scheduling module is used to schedule the job according to the first queue position and the second queue position.

[0022] In another aspect, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the following steps are implemented:

[0023] Obtaining jobs to be scheduled and corresponding resource request quantities, and respectively allocating the jobs to a first job queue and a second job queue according to the resource request quantities of the jobs, wherein the resource request quantity of the jobs in the first job queue is less than the resource request quantity of the jobs in the second job queue;

[0024] Obtaining a queuing time and an estimated running time of the job, obtaining a first queue position of the job in the first job queue according to the estimated running time, and obtaining a second queue position of the job in the second job queue according to the queuing time;

[0025] The job is scheduled according to the first queue position and the second queue position.

[0026] In another aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0027] Obtaining jobs to be scheduled and corresponding resource request quantities, and respectively allocating the jobs to a first job queue and a second job queue according to the resource request quantities of the jobs, wherein the resource request quantity of the jobs in the first job queue is less than the resource request quantity of the jobs in the second job queue;

[0028] Obtaining a queuing time and an estimated running time of the job, obtaining a first queue position of the job in the first job queue according to the estimated running time, and obtaining a second queue position of the job in the second job queue according to the queuing time;

[0029] The job is scheduled according to the first queue position and the second queue position.

[0030] The above-mentioned job scheduling method, device, computer equipment and storage medium can be used in a cloud computing scenario where multiple users share cluster resources. Jobs are allocated to a first job queue and a second job queue according to the number of resource requests corresponding to the jobs to be scheduled, and then the first queue position is calculated by the estimated running time based on the obtained queuing time and estimated running time of the jobs, and the second queue position is calculated by the queuing time. Then, the jobs are scheduled based on the first queue position and the second queue position, thereby further improving the efficiency of job scheduling. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] Figure 1 An application environment diagram of a method for job scheduling in one embodiment;

[0032] Figure 2 A schematic diagram of a flow chart of a method for job scheduling in one embodiment;

[0033] Figure 3 A schematic flow chart of the steps of job scheduling in one embodiment;

[0034] Figure 4 A schematic diagram of a process of obtaining a first queue position and a second queue position in one embodiment;

[0035] Figure 5 A schematic diagram of a process for obtaining an estimated running time in one embodiment;

[0036] Figure 6 A schematic diagram of a process flow of job allocation in one embodiment;

[0037] Figure 7 is a structural block diagram of a device for job scheduling in one embodiment;

[0038] Figure 8 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0039] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. In the various embodiments of the present application, "first", "second", "third", "fourth", etc. are only used to refer to different objects and do not mean that there are other limitations on the objects referred to.

[0040] Since the embodiments of the present application involve a large number of professional terms, in order to facilitate understanding, the relevant terms and concepts that may be involved in the embodiments of the present application are first introduced below.

[0041] 1. Homework

[0042] A job is a collection of program instances that need to be executed to complete a specific computing business, usually corresponding to a set of processes, containers, or other runtime entities on one or more computers. A job can contain multiple subtasks.

[0043] 2. Subtasks

[0044] A subtask can be an instance of a set of program instances within a job, which usually corresponds to a set of processes, containers, or other runtime entities on one or more computers.

[0045] 3. Number of resource requests

[0046] The resource request quantity may be the number of central processing units (CPUs) required to run the job.

[0047] 4. First queue position

[0048] The first queue position refers to the position of the first job to be scheduled after the jobs in the first job queue are sorted according to their priorities.

[0049] 5. Second queue position

[0050] The first queue position refers to the position of the first job to be scheduled after the jobs in the second job queue are sorted according to their priorities.

[0051] 6. Static Priority

[0052] The static priority is determined when the job process is created and its value remains unchanged throughout the entire running period of the process.

[0053] 7. Dynamic Priority

[0054] Dynamic priority means that a static priority is assigned to a job at the beginning of job creation, and then its value changes as the process progresses or the waiting time increases.

[0055] The job scheduling method provided in this application can be applied to Figure 1 In the application environment shown. Among them, the terminal 102 communicates with the server 104 through the network. The server 104 allocates the job to the first job queue and the second job queue according to the number of resource requests corresponding to the job to be scheduled, and obtains the average value after sampling the actual running time of each completed job as the estimated running time of the job, and obtains the first queue position through the estimated running time of the job, obtains the second queue position of the job through the queuing time of the job, determines the job in the first queue position and the job in the second queue position, calculates the corresponding running cost, and determines the job to be scheduled according to the running cost, thereby realizing job scheduling and further improving the efficiency of job scheduling. Among them, the terminal 102 can be but not limited to various personal computers, laptops, smart phones, tablet computers and portable wearable devices, and the server 104 can be implemented by an independent server or a server cluster composed of multiple servers.

[0056] In one embodiment, Figure 2 As shown, a method for job scheduling is provided, which is applied to Figure 1 The server in the example is used to illustrate the following steps:

[0057] Step 201, obtaining jobs to be scheduled and corresponding resource request quantities, and respectively allocating the jobs to a first job queue and a second job queue according to the resource request quantities of the jobs, wherein the resource request quantity of the jobs in the first job queue is less than the resource request quantity of the jobs in the second job queue;

[0058] Step 202, obtaining the queuing time and the estimated running time of the job, obtaining a first queue position of the job in the first job queue according to the estimated running time, and obtaining a second queue position of the job in the second job queue according to the queuing time;

[0059] Step 203: Schedule the job according to the first queue position and the second queue position.

[0060] In some implementation processes, when a job is scheduled for execution, that is, only one job is serially scheduled each time, in order to avoid the cloud computing platform calling a job with a large number of resource requests for a long time, resulting in a small amount of idle resources not being effectively utilized, or calling a job with a small number of resource requests for a long time, and the queue blocking time of an important job with a large number of resource requests is long, the jobs can be classified according to the number of resource requests. Specifically, in step 201, it is exemplarily explained that the job to be scheduled and the corresponding number of resource requests are obtained, and the job is allocated to the first job queue and the second job queue respectively according to the number of resource requests of the job, wherein the number of resource requests of the job in the first job queue is less than the number of resource requests of the job in the second job queue. For example, the job to be scheduled and the corresponding number of resource requests can be obtained from the cluster cloud platform, and a resource request number threshold is set through the job allocation module, and the resource request number is compared with the resource request number threshold. When the number of resource requests required by the job is less than the resource request number threshold, the job is allocated to the first job queue, and when the number of resource requests required by the job is greater than or equal to the resource request number, the job is allocated to the second job queue, and the jobs in the first job queue and the second job queue are processed respectively.

[0061] It should be noted that the higher the priority of a job, the higher the priority of the job to be scheduled. The dynamic priorities of the jobs in the first job queue and the second job queue are calculated respectively, so as to determine the dynamic scheduling order of the jobs in the first job queue and the second job queue at each scheduling. Specifically, in step 202, it is exemplarily described that the queuing time and the estimated running time of the job are obtained, the first queue position of the job in the first job queue is obtained according to the estimated running time, and the second queue position of the job in the second job queue is obtained according to the queuing time. For example, the queuing time of the jobs in the first job queue and the second job queue can be cumulatively updated at the beginning of each scheduling, so as to obtain The queuing time of the job can be obtained. At the same time, the estimated running time of the job can be obtained by sampling the actual running time of the completed jobs and taking the average value. In some implementation processes, the actual completed running time of each completed job can be saved in a list format. The saved content includes: algorithm-data source-resource type-quantity. The saved actual completed running time is used as the sample point in the list. The sampling value is determined by customizing the list length. For example, the list length can be set to 5, then the sampling value is 5. The actual completed running time in the list is sampled according to 5 sampling values ​​and the average value is calculated. The average value is used as the estimated running time of the job. At the same time, the jobs to be scheduled have an initial arrangement order, which can be preset by the user, that is, the static priority. Each time scheduling is performed, the dynamic arrangement order of the jobs in the first job queue is updated after summing the static priority, estimated running time, and resource request quantity. Among them, the estimated running time is variable. For example, if the static priority of the job is 100, the number of resource requests is 1, and the estimated running time is 100, then in this scheduling, the dynamic priority of the job is 201. In the next scheduling, the dynamic priority of the job is updated again. In each scheduling, the position of the job in the first arrangement order is the first job queue position. The dynamic priority of the job in the second job queue is updated after summing the static priority, queue time, and resource request number. Among them, the queue time is variable. For example, if the static priority of the job is 100, the number of resource requests is 3, and the queue time is 200, then in this scheduling, the dynamic arrangement order of the job is 303. In the next scheduling, the dynamic priority of the job is updated again. In each scheduling, the position of the job in the first arrangement order is the second job queue position.

[0062] In step 203, it is exemplarily explained that jobs are scheduled according to the first queue position and the second queue position. For example, the first job at the first queue position and the second job at the second queue position can be taken out by the scheduler respectively, and the parameters of the first job and the second job are used as parameters for executing the scheduling. The first running cost when running the first job and the second running cost when running the second job are calculated respectively. By comparing the first running cost and the second running cost, it is determined whether the job to be scheduled is the first job or the second job. In some implementation processes, the minimum value of the first running cost and the second running cost can be obtained, and the job corresponding to the minimum value can be scheduled.

[0063] In another embodiment, several jobs may be scheduled for execution, that is, multiple jobs are scheduled in parallel each time. For example, the jobs 1 and 2 have the highest dynamic priority in the first job queue, and the jobs 3 and 4 have the highest dynamic priority in the second job queue. Then, the first running cost of job 1 and job 2 and the second running cost of job 3 and job 4 are calculated respectively. If the first running cost is less than the second running cost, job 1 and job 2 are scheduled.

[0064] In one embodiment, Figure 3 As shown, scheduling the job according to the first queue position and the second queue position includes the following steps:

[0065] Step 301, according to the first queue position, obtain the first job at the first queue position, and obtain the first running cost according to the first job;

[0066] Step 302, acquiring a second job at the second queue position according to the second queue position, and obtaining a second running cost according to the second job;

[0067] Step 303, comparing the first running cost with the second running cost, if the first running cost is less than the second running cost, scheduling the first job;

[0068] Step 304: If the first running cost is greater than the second running cost, the second job is scheduled.

[0069] In step 301, it is exemplarily explained that according to the first queue position, the first job at the first queue position is obtained, and the first operation cost is obtained according to the first job. For example, the first operation cost can be obtained according to the first operation coefficient weight value of the first job, the number of subtasks of the first job, the estimated operation time of the second job, the second queuing coefficient weight value of the second job, and the queuing time of the second job. The first operation coefficient weight value and the second queuing coefficient weight value can be preset by the job scheduling module. Specifically, the mathematical expression of the first operation cost is:

[0070] Cost1=U1*Tasks1*Rt1+V2*Wt2

[0071] Among them, Cost1 represents the first running cost, U1 represents the first running coefficient weight value, Tasks1 represents the number of subtasks of the first job, Rt1 represents the estimated running time of the second job, V2 represents the second queuing coefficient weight value, and Wt2 represents the queuing time of the second job.

[0072] In step 302, it is exemplarily explained that according to the second queue position, the second job at the second queue position is obtained, and the second operation cost is obtained according to the second job. For example, the second operation cost can be obtained according to the second operation coefficient weight value, the number of subtasks of the second job, the estimated operation time of the second job, the first queuing coefficient weight value, and the queuing time of the first job. The second operation coefficient weight value and the first queuing coefficient weight value can be preset by the job scheduling module. Specifically, the mathematical expression of the second operation cost is:

[0073] Cost2=U2*Tasks2*Rt2+V1*Wt1

[0074] Among them, Cost2 represents the second running cost, U2 represents the second running coefficient weight value, Tasks2 represents the number of subtasks of the second job, Rt2 represents the estimated running time of the second job, V1 represents the first queuing coefficient weight value, and Wt1 represents the queuing time of the first job.

[0075] In steps 303 to 304, it is exemplarily explained that the first running cost and the second running cost are compared. If the first running cost is less than the second running cost, the first job is scheduled. If the first running cost is greater than the second running cost, the second job is scheduled. For example, the minimum value of the first running cost and the second running cost can be determined, and the job corresponding to the minimum value is the job to be scheduled this time, and the remaining unscheduled jobs are reallocated to the first job queue or the second job queue according to the above method. At the next scheduling, the dynamic priority of the unscheduled jobs is re-updated.

[0076] In one embodiment, Figure 4 As shown, obtaining the queuing time and the estimated running time of a job, obtaining the first queue position of the job in the first job queue according to the estimated running time, and obtaining the second queue position of the job in the second job queue according to the queuing time, includes the following steps:

[0077] Step 401, obtaining the static priority of the job, summing the static priority, the estimated running time, and the number of resource requests, and obtaining the first sequence identifier of the job in the first job queue;

[0078] Step 402, summing up the static priority, the queuing time, and the number of resource requests to obtain a second sequence identifier of the job in the second job queue;

[0079] Step 403: Arrange the jobs in ascending order according to the first sequence identifier to obtain a first queue position, and arrange the jobs in descending order according to the second sequence identifier to obtain a second queue position.

[0080] In step 401, it is exemplified that the static priority of the job is obtained, the static priority, estimated running time, and the number of resource requests are summed to obtain the first sequence identifier of the job in the first job queue. For example, each time scheduling is performed, the static priority, estimated running time, and the number of resource requests of the jobs in the first job queue can be summed to obtain the first sequence identifier corresponding to the job, and the jobs can be arranged in ascending order to obtain the dynamic priority of the jobs in the first job queue. For example, the first sequence identifiers of job 1, job 2, and job 3 are 1, 2, and 3 respectively, then the arrangement order of the jobs in the first queue is job 1, job 2, and job 3.

[0081] In step 402, it is exemplified that the static priority, queuing time, and number of resource requests are summed to obtain the second sequence identifier of the job in the second job queue. For example, each time scheduling is performed, the static priority, queuing time, and number of resource requests of the jobs in the second job queue can be summed to obtain the second sequence identifier corresponding to the job, and the jobs can be arranged in descending order to obtain the dynamic priority in the second job queue. For example, the first sequence identifiers of job 1, job 2, and job 3 are 1, 2, and 3 respectively, then the arrangement order of the jobs in the first queue is job 3, job 2, and job 1.

[0082] In step 403, it is exemplarily explained that the jobs are arranged in ascending order according to the first sequence identifier to obtain the first queue position, and the jobs are arranged in descending order according to the second sequence identifier to obtain the second queue position. For example, in the first job queue, because the jobs are arranged in ascending order according to the first sequence identifier, the smaller the value of the first sequence identifier is, the closer the job is arranged in the first job queue. When the value of the first sequence identifier is the smallest, the corresponding job is in the front position, that is, the first queue position. Conversely, in the second job queue, because the jobs are arranged in descending order according to the second sequence identifier, the larger the value of the second sequence identifier is, the closer the job is arranged in the second job queue. When the value of the second sequence identifier is the largest, the corresponding job is in the front position, that is, the second queue position.

[0083] In one embodiment, Figure 5 As shown, obtaining the estimated running time includes the following steps:

[0084] Step 501, obtaining a sampling value, and sampling the actual running time of each completed job according to the sampling value to obtain the sampled running time;

[0085] Step 502: Calculate the average of the sampled running time according to the sampled values ​​to obtain the estimated running time.

[0086] In step 501 to step 502, it is exemplified that a sampling value is obtained, and the actual running time of each completed job is sampled according to the sampling value to obtain the sampled running time, and the sampled running time is averaged according to the sampling value to obtain the estimated running time. For example, the actual completed running time of each completed job can be saved according to the dimensions of algorithm-data source-resource type-quantity, and the saving format can be a list. The saved actual completed running time can be used as a sample point in the list, and the sampling value is determined by customizing the list length. For example, the list length can be set to 5, then the sampling value is 5, and the actual completed running time in the list is sampled according to 5 sampling values ​​to obtain the sampled running time, and then the sampled running time is summed and the average value of the actual running time is calculated according to the sampling value. The average value is used as the estimated running time of the job. In some implementation processes, when the cloud computing platform is run for the first time, the initial estimated running time can be obtained by presetting.

[0087] In one embodiment, Figure 6 As shown, obtaining the job to be scheduled and the corresponding resource request quantity, and allocating the job to the first job queue and the second job queue according to the resource request quantity of the job, includes the following steps:

[0088] Step 601, compare the resource request quantity with the resource request quantity threshold, if the resource request quantity is less than the resource request quantity threshold, assign the job to the first job queue;

[0089] Step 602: If the number of resource requests is greater than or equal to the resource request number threshold, the job is assigned to a second job queue.

[0090] In step 601 to step 602, it is exemplarily explained that the number of resource requests is compared with the resource request number threshold. If the number of resource requests is less than the resource request number threshold, the job is assigned to the first job queue. If the number of resource requests is greater than or equal to the resource request number threshold, the job is divided into the second job queue. For example, in jobs related to deep learning, there are characteristics of a large number of subtasks, a large number of resource requests, and a long running time, while the task characteristics of jobs such as preprocessing, data segmentation and conversion, and test verification in the cloud computing platform have the characteristics of a small number of subtasks, a small number of resource requests, and a short running time. Considering the job business characteristics of the cloud computing platform, the job to be scheduled and the corresponding number of resource requests can be obtained from the cluster cloud platform, and the resource request number threshold is set through the job allocation module. The resource request number is compared with the resource request number threshold. When the number of resource requests required by the job is less than the resource request number threshold, the job is assigned to the first job queue. When the number of resource requests required by the job is greater than or equal to the resource request number, the job is assigned to the second job queue. The resource request number threshold can be 3 or 4, which is not specifically limited here.

[0091] It should be understood that although Figure 2-6 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-6 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0092] In one embodiment, Figure 7 As shown, a device for job scheduling is provided, including: a job allocation module, a job time management module and a job scheduling module, wherein:

[0093] A job allocation module, used to obtain jobs to be scheduled and corresponding resource request quantities, and allocate the jobs to a first job queue and a second job queue according to the resource request quantities of the jobs, wherein the resource request quantity of the jobs in the first job queue is less than the resource request quantity of the jobs in the second job queue;

[0094] A job time management module is used to obtain the queuing time and estimated running time of the job, obtain the first queue position of the job in the first job queue according to the estimated running time, and obtain the second queue position of the job in the second job queue according to the queuing time;

[0095] The job scheduling module is used to schedule jobs according to the first queue position and the second queue position.

[0096] Optionally, the job scheduling module is also used to obtain the first job at the first queue position according to the first queue position, and obtain the first running cost according to the first job; obtain the second job at the second queue position according to the second queue position, and obtain the second running cost according to the second job; compare the first running cost and the second running cost, if the first running cost is less than the second running cost, schedule the first job; if the first running cost is greater than the first running cost, schedule the second job.

[0097] Optionally, the job scheduling module is further used to obtain a first running cost, and the mathematical expression of the first running cost is:

[0098] Cost1=U1*Tasks1*Rt1+V2*Wt2

[0099] Among them, Cost1 represents the first running cost, U1 represents the first running coefficient weight value, Tasks1 represents the number of subtasks of the first job, Rt1 represents the estimated running time of the second job, V2 represents the second queuing coefficient weight value, and Wt2 represents the queuing time of the second job.

[0100] Optionally, the job scheduling module is further used to obtain a second running cost, and the mathematical expression of the second running cost is:

[0101] Cost2=U2*Tasks2*Rt2+V1*Wt1

[0102] Among them, Cost2 represents the second running cost, U2 represents the second running coefficient weight value, Tasks2 represents the number of subtasks of the second job, Rt2 represents the estimated running time of the second job, V1 represents the first queuing coefficient weight value, and Wt1 represents the queuing time of the first job.

[0103] Optionally, the job time management module is also used to obtain the static priority of the job, sum the static priority, estimated running time, and the number of resource requests to obtain a first sequence identifier for the job in the first job queue; sum the static priority, queuing time, and the number of resource requests to obtain a second sequence identifier for the job in the second job queue; arrange the jobs in ascending order according to the first sequence identifier to obtain a first queue position, and arrange the jobs in descending order according to the second sequence identifier to obtain a second queue position.

[0104] Optionally, the job time management module is also used to obtain sampling values, and sample the actual running time of each completed job according to the sampling values ​​to obtain the sampled running time; calculate the average of the sampled running time according to the sampling values ​​to obtain the estimated running time.

[0105] Optionally, the job allocation module is also used to compare the number of resource requests with the resource request number threshold. If the number of resource requests is less than the resource request number threshold, the job is allocated to the first job queue; if the number of resource requests is greater than or equal to the resource request number threshold, the job is divided into the second job queue.

[0106] The specific definition of the job scheduling device can be found in the definition of the job scheduling method above, which will not be repeated here. Each module in the above-mentioned job scheduling device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0107] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 8 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store job scheduling data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a job scheduling method is implemented.

[0108] Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0109] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

[0110] Obtaining jobs to be scheduled and corresponding resource request quantities, and respectively allocating the jobs to a first job queue and a second job queue according to the resource request quantities of the jobs, wherein the resource request quantity of the jobs in the first job queue is less than the resource request quantity of the jobs in the second job queue;

[0111] Obtaining the queuing time and the estimated running time of the job, obtaining the first queue position of the job in the first job queue according to the estimated running time, and obtaining the second queue position of the job in the second job queue according to the queuing time;

[0112] The jobs are scheduled according to the first queue position and the second queue position.

[0113] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0114] According to the first queue position, a first job at the first queue position is acquired, and a first running cost is obtained according to the first job;

[0115] According to the second queue position, obtain the second job at the second queue position, and obtain the second running cost according to the second job;

[0116] Compare the first running cost with the second running cost, and if the first running cost is less than the second running cost, schedule the first job;

[0117] If the first running cost is greater than the second running cost, the second job is scheduled.

[0118] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0119] The mathematical expression of the first running cost is:

[0120] Cost1=U1*Tasks1*Rt1+V2*Wt2

[0121] Among them, Cost1 represents the first running cost, U1 represents the first running coefficient weight value, Tasks1 represents the number of subtasks of the first job, Rt1 represents the estimated running time of the second job, V2 represents the second queuing coefficient weight value, and Wt2 represents the queuing time of the second job.

[0122] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0123] The mathematical expression of the second operation cost is:

[0124] Cost2=U2*Tasks2*Rt2+V1*Wt1

[0125] Among them, Cost2 represents the second running cost, U2 represents the second running coefficient weight value, Tasks2 represents the number of subtasks of the second job, Rt2 represents the estimated running time of the second job, V1 represents the first queuing coefficient weight value, and Wt1 represents the queuing time of the first job.

[0126] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0127] Obtaining a static priority of the job, summing the static priority, the estimated running time, and the number of resource requests, and obtaining a first sequence identifier of the job in the first job queue;

[0128] Sum the static priority, the queuing time, and the number of resource requests to obtain a second sequence identifier of the job in the second job queue;

[0129] The jobs are arranged in ascending order according to the first sequence identifier to obtain a first queue position, and the jobs are arranged in descending order according to the second sequence identifier to obtain a second queue position.

[0130] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0131] Obtain a sampling value, and sample the actual running time of each completed job according to the sampling value to obtain the sampled running time;

[0132] The sampled runtime is averaged based on the sampled values ​​to obtain the estimated runtime.

[0133] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:

[0134] Compare the resource request quantity with the resource request quantity threshold, and if the resource request quantity is less than the resource request quantity threshold, assign the job to the first job queue;

[0135] If the resource request quantity is greater than or equal to the resource request quantity threshold, the job is allocated to the second job queue.

[0136] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:

[0137] Obtaining jobs to be scheduled and corresponding resource request quantities, and respectively allocating the jobs to a first job queue and a second job queue according to the resource request quantities of the jobs, wherein the resource request quantity of the jobs in the first job queue is less than the resource request quantity of the jobs in the second job queue;

[0138] Obtaining the queuing time and the estimated running time of the job, obtaining the first queue position of the job in the first job queue according to the estimated running time, and obtaining the second queue position of the job in the second job queue according to the queuing time;

[0139] The jobs are scheduled according to the first queue position and the second queue position.

[0140] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0141] According to the first queue position, a first job at the first queue position is acquired, and a first running cost is obtained according to the first job;

[0142] According to the second queue position, obtain the second job at the second queue position, and obtain the second running cost according to the second job;

[0143] Compare the first running cost with the second running cost, and if the first running cost is less than the second running cost, schedule the first job;

[0144] If the first running cost is greater than the second running cost, the second job is scheduled.

[0145] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0146] The mathematical expression of the first running cost is:

[0147] Cost1=U1*Tasks1*Rt1+V2*Wt2

[0148] Among them, Cost1 represents the first running cost, U1 represents the first running coefficient weight value, Tasks1 represents the number of subtasks of the first job, Rt1 represents the estimated running time of the second job, V2 represents the second queuing coefficient weight value, and Wt2 represents the queuing time of the second job.

[0149] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0150] The mathematical expression of the second operation cost is:

[0151] Cost2=U2*Tasks2*Rt2+V1*Wt1

[0152] Among them, Cost2 represents the second running cost, U2 represents the second running coefficient weight value, Tasks2 represents the number of subtasks of the second job, Rt2 represents the estimated running time of the second job, V1 represents the first queuing coefficient weight value, and Wt1 represents the queuing time of the first job.

[0153] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0154] Obtaining a static priority of the job, summing the static priority, the estimated running time, and the number of resource requests, and obtaining a first sequence identifier of the job in the first job queue;

[0155] Sum the static priority, the queuing time, and the number of resource requests to obtain a second sequence identifier of the job in the second job queue;

[0156] The jobs are arranged in ascending order according to the first sequence identifier to obtain a first queue position, and the jobs are arranged in descending order according to the second sequence identifier to obtain a second queue position.

[0157] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0158] Obtain a sampling value, and sample the actual running time of each completed job according to the sampling value to obtain the sampled running time;

[0159] The sampled runtime is averaged based on the sampled values ​​to obtain the estimated runtime.

[0160] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:

[0161] Compare the resource request quantity with the resource request quantity threshold, and if the resource request quantity is less than the resource request quantity threshold, assign the job to the first job queue;

[0162] If the resource request quantity is greater than or equal to the resource request quantity threshold, the job is allocated to the second job queue.

[0163] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0164] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0165] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. A method for job scheduling, characterized in that: include: Obtaining jobs to be scheduled and corresponding resource request quantities, and respectively allocating the jobs to a first job queue and a second job queue according to the resource request quantities of the jobs, wherein the resource request quantity of the jobs in the first job queue is less than the resource request quantity of the jobs in the second job queue; Obtaining a queuing time and an estimated running time of the job, obtaining a first queue position of the job in the first job queue according to the estimated running time, and obtaining a second queue position of the job in the second job queue according to the queuing time; Scheduling the job according to the first queue position and the second queue position; Scheduling the job according to the first queue position and the second queue position includes: acquiring the first job at the first queue position according to the first queue position, and obtaining a first running cost according to the first job; acquiring the second job at the second queue position according to the second queue position, and obtaining a second running cost according to the second job; comparing the first running cost with the second running cost, and if the first running cost is less than the second running cost, scheduling the first job; if the first running cost is greater than the first running cost, scheduling the second job; The mathematical expression of the first running cost is: Cost1=U1*Tasks1*Rt1+V2*Wt2 Wherein, Cost1 represents the first operation cost, U1 represents the first operation coefficient weight value, Tasks1 represents the number of subtasks of the first job, Rt1 represents the estimated operation time of the second job, V2 represents the second queuing coefficient weight value, and Wt2 represents the queuing time of the second job; The mathematical expression of the second running cost is: Cost2=U2*Tasks2*Rt2+V1*Wt1 Wherein, Cost2 represents the second operation cost, U2 represents the second operation coefficient weight value, Tasks2 represents the number of subtasks of the second job, Rt2 represents the estimated operation time of the second job, V1 represents the first queuing coefficient weight value, and Wt1 represents the queuing time of the first job; Obtain the queuing time and estimated running time of the job, obtain the first queue position of the job in the first job queue according to the estimated running time, and obtain the second queue position of the job in the second job queue according to the queuing time, including: obtaining the static priority of the job, summing the static priority, the estimated running time, and the number of resource requests to obtain the first sequence identifier of the job in the first job queue; summing the static priority, the queuing time, and the number of resource requests to obtain the second sequence identifier of the job in the second job queue; arranging the jobs in ascending order according to the first sequence identifier to obtain the first queue position, and arranging the jobs in descending order according to the second sequence identifier to obtain the second queue position.

2. The method for job scheduling according to claim 1, characterized in that: Obtaining the estimated running time includes: obtaining a sampling value, and sampling the actual running time of the job that has been completed each time according to the sampling value to obtain the sampled running time; The sampled running time is averaged according to the sampled values ​​to obtain the estimated running time.

3. The method for job scheduling according to claim 1, characterized in that: Obtaining a job to be scheduled and a corresponding resource request quantity, and allocating the job to a first job queue and a second job queue according to the resource request quantity of the job, including: Comparing the resource request quantity with a resource request quantity threshold, and if the resource request quantity is less than the resource request quantity threshold, allocating the job to the first job queue; If the resource request quantity is greater than or equal to the resource request quantity threshold, the job is allocated to the second job queue.

4. A job scheduling device, characterized in that: include: A job allocation module, used to obtain the job to be scheduled and the corresponding resource request quantity, and allocate the job to the first job queue and the second job queue according to the resource request quantity of the job, wherein the resource request quantity of the job in the first job queue is less than the resource request quantity of the job in the second job queue; a job time management module, used to obtain the queuing time and estimated running time of the job, obtain the first queue position of the job in the first job queue according to the estimated running time, and obtain the second queue position of the job in the second job queue according to the queuing time; A job scheduling module, configured to schedule the job according to the first queue position and the second queue position; Scheduling the job according to the first queue position and the second queue position includes: acquiring the first job at the first queue position according to the first queue position, and obtaining a first running cost according to the first job; acquiring the second job at the second queue position according to the second queue position, and obtaining a second running cost according to the second job; comparing the first running cost with the second running cost, and if the first running cost is less than the second running cost, scheduling the first job; if the first running cost is greater than the first running cost, scheduling the second job; The mathematical expression of the first running cost is: Cost1=U1*Tasks1*Rt1+V2*Wt2 Wherein, Cost1 represents the first operation cost, U1 represents the first operation coefficient weight value, Tasks1 represents the number of subtasks of the first job, Rt1 represents the estimated operation time of the second job, V2 represents the second queuing coefficient weight value, and Wt2 represents the queuing time of the second job; The mathematical expression of the second running cost is: Cost2=U2*Tasks2*Rt2+V1*Wt1 Wherein, Cost2 represents the second operation cost, U2 represents the second operation coefficient weight value, Tasks2 represents the number of subtasks of the second job, Rt2 represents the estimated operation time of the second job, V1 represents the first queuing coefficient weight value, and Wt1 represents the queuing time of the first job; Obtain the queuing time and estimated running time of the job, obtain the first queue position of the job in the first job queue according to the estimated running time, and obtain the second queue position of the job in the second job queue according to the queuing time, including: obtaining the static priority of the job, summing the static priority, the estimated running time, and the number of resource requests to obtain the first sequence identifier of the job in the first job queue; summing the static priority, the queuing time, and the number of resource requests to obtain the second sequence identifier of the job in the second job queue; arranging the jobs in ascending order according to the first sequence identifier to obtain the first queue position, and arranging the jobs in descending order according to the second sequence identifier to obtain the second queue position.

5. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 3 are implemented.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 3 are implemented.

Citation Information

Patent Citations

  • Resource allocation method and device

    CN109491798A

  • Big data resource scheduling method and device, server and storage medium

    CN111352736A

  • Task scheduling method and device

    WO2016197716A1

  • Resource allocation method and resource manager

    WO2017133351A1