Task scheduling method, device, electronic device, and readable storage medium

By introducing the execution queue resource ratio and task polling mechanism in task scheduling, the problem of low-priority tasks being difficult to execute is solved, the fairness and efficiency of task scheduling are achieved, and the user experience is improved.

CN114265699BActive Publication Date: 2025-09-26CITY CLOUD TECH HANGZHOU CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111676892.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-09-26
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

In existing task scheduling methods, tasks in low-priority message queues are difficult to execute, resulting in low execution efficiency and poor user experience.

Method used

The priority is determined by the resource ratio of each execution queue, and a task polling mechanism is introduced to select tasks from different execution queues for execution each time, ensuring that low-priority queues also have the opportunity to be executed first.

Benefits of technology

Improves the fairness and execution efficiency of task scheduling, ensures that all tasks are executed in order of priority, and at the same time guarantees that low-priority tasks have the opportunity to be processed first, improving user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114265699B_ABST
    Figure CN114265699B_ABST
Patent Text Reader

Abstract

The present application proposes a task scheduling method, including: obtaining at least one computing resource, creating at least one execution queue corresponding to each computing resource, and allocating the resource ratio of the corresponding computing resource to each execution queue; obtaining at least one task instance and the task information of each task instance, and allocating each task instance to the designated execution queue of the designated computing resource according to the task information; obtaining the probability of being selected for each candidate task instance according to the resource ratio of all available execution queues in the same computing resource; and selecting a candidate task instance from all available execution queues corresponding to the same computing resource according to the probability of being selected for each candidate task instance. This method determines the priority by the resource ratio of the execution queue, and adopts a polling mechanism to select tasks from different execution queues for execution each time, ensuring that all task instances are classified and executed in order according to the established priority, while taking into account that low-priority tasks still have the opportunity to be executed first.
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 task scheduling method, device, electronic device, and readable storage medium. Background Art

[0002] With the rapid development of computer and internet technologies, users can easily access the internet and submit tasks to servers on the internet. These servers then provide corresponding services by executing the tasks submitted by users. However, when a server is accessed and used by a large number of users at the same time, it continuously receives task requests. Typically, the server stores all these task requests in a message queue, piling up the tasks. Then, using some scheduling strategy, it continuously selects tasks from the message queue for execution.

[0003] The patent application document with the publication number "CN107423120A" discloses a task scheduling method and device, which specifically sets a selection probability for each message queue, and randomly selects a message queue according to the set selection probability to execute all the tasks therein in sequence, wherein the selection probability of the message queue is positively correlated with the priority of the message queue and the number of tasks currently contained, and the priority of the message queue is determined by the priority of the tasks contained. In other words, the higher the priority of the tasks contained in a message queue and the more tasks it contains, the higher the probability of this message queue being selected. The drawback of this is that the tasks in the message queues with lower priorities are difficult to be executed, and the tasks at the end of the message queues with lower priorities are even more difficult to be executed. Therefore, this task scheduling method not only considers a single factor and has low execution efficiency, but also easily ignores tasks in low-priority message queues, reducing user experience. Summary of the Invention

[0004] An embodiment of the present application provides a task scheduling method, which determines the priority by the resource ratio of each execution queue and introduces a task polling mechanism to select tasks from different execution queues for execution each time.

[0005] In a first aspect, an embodiment of the present application provides a task scheduling method, comprising the following steps:

[0006] Acquire at least one computing resource, create at least one execution queue corresponding to each computing resource, and allocate a resource ratio of the corresponding computing resource to each execution queue;

[0007] Obtain at least one task instance and task information of each task instance, and assign each task instance to a designated execution queue of a designated computing resource according to the task information;

[0008] Obtaining a probability of selection for each candidate task instance based on a resource ratio of all available execution queues in the same computing resource, wherein the candidate task instance is a task instance that is at the top of each of the available execution queues, and the available execution queues are execution queues that are in an enabled state;

[0009] According to the selection probability of each candidate task instance, a candidate task instance is selected from all the available execution queues corresponding to the same computing resource to run.

[0010] In some application embodiments, "obtaining the probability of each candidate task instance being selected based on the resource proportions of all available execution queues in the same computing resource" includes: obtaining the first resource proportion of the available execution queue where each candidate task instance is located, and obtaining the sum of the resource proportions of all available execution queues of the specified computing resource corresponding to each of the candidate task instances to obtain the second resource proportion, and obtaining the probability of the candidate task being selected based on the ratio of the first resource proportion to the second resource proportion corresponding to the same candidate task instance.

[0011] In some application embodiments, the task information of each of the task instances includes: a unique identifier of the task instance, submission time, a unique identifier of the submitter, specified computing resource information, and specified execution queue information; after "obtaining at least one computing resource", it includes: setting at least one restriction parameter for each of the computing resources, and the restriction parameter is any one of the time period allowed for task submission, the task termination time point, the concurrency upper limit value, the upper limit value for the number of single-person task queues, and the upper limit value for the number of single-person task runs.

[0012] In some application embodiments, "assigning each of the task instances to the designated execution queue corresponding to the designated computing resource according to the task information" includes: determining whether the task instance meets the queuing conditions based on the task information of each task instance, and assigning each task instance that meets the queuing conditions to the designated execution queue in the designated computing resource of the task instance, and placing it at the end of the designated execution queue of the task instance.

[0013] In some application embodiments, the method of “determining whether the task instance meets the queuing condition” includes:

[0014] Obtaining a first number of queued task instances corresponding to a unique identifier of a submitter of the task instance in a designated computing resource of the task instance, wherein the queued task instance is a task instance queued in any of the execution queues;

[0015] If the first number has not reached the upper limit of the number of single-person task queues set for the specified computing resource of the task instance, the task instance does not meet the queuing conditions;

[0016] When the first number is less than the upper limit of the single-person task queue number set for the designated computing resource of the task instance, obtain a second number of all running task instances uniquely identified by the submitter of the task instance and a third number of all running instance tasks in the designated computing resource of the task instance, wherein the running task instance is a task instance currently running in the designated computing resource of the task instance;

[0017] If the second number does not reach the upper limit of the number of single-person task runs set by the specified computing resources of the task instance, and the third number does not reach the upper limit of the concurrency set by the specified computing resources of the task instance, the task instance meets the queuing conditions.

[0018] In some application embodiments, before "obtaining the first number of queued task instances corresponding to the unique identifier of the submitter of the task instance", it includes: if the submission time of the task instance does not meet the time period allowed for task submission set by the specified computing resource of the task instance, the task instance does not meet the queuing conditions and the task instance is terminated.

[0019] In some application embodiments, after "polling and selecting a candidate task instance to run from all available execution queues corresponding to the same computing resource", it includes: if any task instance in any of the available execution queues has not been run before the task termination time point set by the computing resource corresponding to the available execution queue, all task instances in the available execution queue are terminated.

[0020] In a second aspect, an embodiment of the present application provides a task scheduling device for implementing the task scheduling method described in the first aspect, the device comprising the following modules:

[0021] An initialization module, configured to obtain at least one computing resource, create at least one execution queue corresponding to each computing resource, and allocate a resource ratio of the corresponding computing resource to each execution queue;

[0022] A task allocation module is configured to obtain at least one task instance and task information of each task instance, and allocate each task instance to a designated execution queue of a designated computing resource according to the task information;

[0023] a priority adjustment module, configured to obtain a probability of selection for each candidate task instance based on a resource ratio of all available execution queues in the same computing resource, wherein the candidate task instance is a task instance that is at the top of each of the available execution queues, and the available execution queues are execution queues in an enabled state;

[0024] The task scheduling module is used to select a candidate task instance to run from all the available execution queues corresponding to the same computing resource according to the selection probability of each candidate task instance.

[0025] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the task scheduling method as described in any of the above application embodiments.

[0026] In a fourth aspect, an embodiment of the present application provides a computer program product, which includes a software code portion. When the computer program product is run on a computer, the software code portion is used to execute the task scheduling method described in any of the above application embodiments.

[0027] In a fifth aspect, an embodiment of the present application provides a readable storage medium, in which a computer program is stored. The computer program includes a program code for controlling a process to execute a process, and the process includes a task scheduling method according to any of the above application embodiments.

[0028] The main contributions and innovations of the embodiments of the present application are as follows: The task scheduling method provided by the embodiments of the present application determines the priority by the resource ratio of each execution queue, and introduces a task polling mechanism, selecting tasks from different execution queues for execution each time. That is to say, the higher the resource ratio of the execution queue, the higher the priority. The higher the priority of the task, the greater the probability of it being selected for execution. It also ensures that tasks in low-priority execution queues still have a probability of being executed first when there is a higher-priority execution queue, ensuring that all task instances are classified and executed in sequence according to the established priority, while taking into account that low-priority tasks still have the opportunity to be executed first.

[0029] In some application embodiments, in addition to the influence of the resource ratio of the execution queue, multiple restriction parameters are introduced to affect whether a task instance has the right to be executed first. The restriction parameters include public parameters and user parameters, avoiding the unfairness caused by a single factor.

[0030] In some application embodiments, the influence of relevant parameters of the submitter is introduced to prevent tasks submitted by a single person from occupying too many computing resources, ensure the fairness of computing resource occupation, and thus improve the user experience of the task scheduling platform.

[0031] In some application embodiments, a task waiting area is set up to ensure that a single person does not occupy too many computing resources while avoiding the tedious operation of users having to repeatedly submit tasks.

[0032] The details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0034] Figure 1 is a flowchart of a task scheduling method according to an embodiment of the present application;

[0035] Figure 2 is a structural block diagram of a task scheduling device according to an embodiment of the present application;

[0036] Figure 3 Schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0037] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The implementations described in the following exemplary embodiments are not intended to represent all implementations consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with certain aspects of one or more embodiments of this specification, as detailed in the appended claims.

[0038] It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, the method may include more or fewer steps than those described in this specification. In addition, a single step described in this specification may be broken down into multiple steps for description in other embodiments, and multiple steps described in this specification may be combined into a single step for description in other embodiments.

[0039] Example 1

[0040] This embodiment provides a task scheduling method, which determines the priority by the resource ratio of each execution queue and introduces a task polling mechanism, selecting tasks from different execution queues for execution each time. That is to say, the higher the resource ratio of the execution queue, the higher the priority. The higher the priority of the task, the greater the probability of it being selected for execution. It also ensures that tasks in low-priority execution queues still have a probability of being executed first when there is a higher-priority execution queue. It not only ensures that the priority definition of the execution queue is valid, but also takes into account the low-priority execution queue, and ensures that the task instances are executed in an orderly and effective manner.

[0041] Specific reference Figure 1 , the task scheduling method includes steps S1-S4:

[0042] Step S1: Acquire at least one computing resource, create at least one execution queue corresponding to each computing resource, and allocate a resource ratio of the corresponding computing resource to each execution queue;

[0043] Step S2: obtaining at least one task instance and task information of each task instance, and assigning each task instance to a designated execution queue of a designated computing resource according to the task information;

[0044] Step S3: Obtaining a probability of selection for each candidate task instance based on the resource proportions of all available execution queues in the same computing resource, wherein the candidate task instance is the task instance that is at the top of each available execution queue, and the available execution queue is an execution queue in an enabled state;

[0045] Step S4: selecting a candidate task instance from all the available execution queues corresponding to the same computing resource to run according to the selection probability of each candidate task instance.

[0046] It should be noted that this embodiment constructs a task scheduling platform based on the task scheduling method, and the task scheduling platform is used to provide task scheduling strategies for various users.

[0047] In step S1, a resource ratio is set for the execution queue corresponding to each computing resource.

[0048] First, various types of computing resources are registered to the task scheduling platform, such as big data computing libraries and various servers. In other words, different computing resources may come from different big data computing libraries or servers, so corresponding execution queues need to be created for each computing resource.

[0049] Specifically, when creating an execution queue, you need to generate a unique identifier for each execution queue and set its resource share. The sum of the resource shares of all execution queues for the same computing resource cannot be 100%, and the resource share of each execution queue must be greater than 0% and less than 100%. For example, if you create three execution queues for a computing resource, set them to receive 25%, 30%, and 45% of the computing resource's resource share, respectively.

[0050] In step S2, the acquired task instance is assigned to the corresponding execution queue.

[0051] First, at least one task instance and task information of each task instance are obtained.

[0052] Specifically, task instances primarily originate from two sources: task instances generated by task planning cycle scheduling, and single task instances initiated immediately by users or submitters. The task scheduling platform provided in this embodiment can determine whether to generate instance tasks based on the periodic configuration of the task planning cycle. If a new task instance is created, the task information for that task instance is obtained, and then, based on the task information for each task instance, the task instance is assigned to a designated execution queue of a designated computing resource.

[0053] Since the task information already includes the designated computing resource information and the designated execution queue information, the designated computing resource of the task instance can be determined according to the designated computing resource information, and the designated execution queue of the task instance can be determined according to the designated execution queue information.

[0054] Specifically, whether the task instance meets the queuing conditions is determined based on the task information of each task instance, and each task instance that meets the queuing conditions is assigned to the designated execution queue in the designated computing resources of the task instance, and is located at the end of the designated execution queue of the task instance.

[0055] In particular, in some embodiments, certain restriction parameters are set for the use of each computing resource. This has the advantage of being able to adjust the task scheduling strategy based on the task information of the task instance. Specifically, the task information of the task instance mainly includes the unique identifier of the task instance, the submission time, the unique identifier of the submitter, the designated computing resource information, the designated execution queue information, etc.; after "obtaining at least one computing resource", it includes: setting at least one restriction parameter for each of the computing resources, wherein the restriction parameter is any one of the following: the time period allowed for task submission, the task termination time point, the concurrency limit, the upper limit for the number of queued tasks for a single person, and the upper limit for the number of running tasks for a single person.

[0056] The time period allowed for task submission is the time period during which the task scheduling platform receives new task instances. If the task instance is not within this time period, the newly created task instance cannot enter its designated execution queue.

[0057] The task termination time point is when a task instance enters the specified execution queue but is not executed for a long time. This indicates that there may be too many task instances accumulated in the execution queue. Setting a time point to terminate all queued task instances in the execution queue is mainly to prevent too many queued task instances from affecting the normal operation of subsequent computing resources.

[0058] The concurrency limit is the maximum number of concurrent tasks in the computing resource, which is mainly used to prevent the computing resource from being overloaded and causing resource failure.

[0059] The upper limit on the number of queued tasks and the upper limit on the number of running tasks for a single user are both designed for the same user or submitter to prevent a user or submitter from excessively occupying computing resources and thereby reducing the user experience of other users or submitters. The upper limit on the number of queued tasks for a single submitter refers to the maximum number of queued task instances allowed for the same submitter in the same computing resource. The upper limit on the number of running tasks for a single submitter refers to the maximum number of running task instances allowed for the same submitter in the same computing resource.

[0060] The task instance is judged based on the task information of each task instance and the restriction parameters set by the specified computing resources of the task instance to determine whether the task instance meets the queuing conditions for entering the specified execution queue.

[0061] In some embodiments, the method for determining whether a task instance meets the queuing condition includes steps S21-S25:

[0062] Step S21: obtaining a first number of queued task instances corresponding to a unique identifier of a submitter of the task instance in a designated computing resource of the task instance, wherein the queued task instance is a task instance queued in any of the execution queues;

[0063] Step S22: If the first number has not reached the upper limit of the single-person task queue number set for the designated computing resource of the task instance, the task instance does not meet the queuing conditions, and the task instance is placed in the task waiting area;

[0064] Step S23: When the first number is less than the upper limit of the number of single-person task queues set for the designated computing resource of the task instance, obtain a second number of all running task instances uniquely identified by the submitter of the task instance and a third number of all running instance tasks in the designated computing resource of the task instance, wherein the running task instances are task instances currently running in the designated computing resource of the task instance;

[0065] Step S24: If the second number does not reach the upper limit of the number of single-person task runs set by the specified computing resources of the task instance, and the third number does not reach the upper limit of the concurrency set by the specified computing resources of the task instance, the task instance meets the queuing conditions.

[0066] Steps S21 and S22 are designed to limit the maximum number of queued task instances that a single submitter can have within the designated computing resources for that task instance. The designated computing resources for that task instance set an upper limit for the number of queued tasks for a single person. In other words, if the first number has reached the upper limit, the task instance submitted by that submitter can no longer enter the designated execution queue and must instead be sent to a task waiting area. The task waiting area ensures that a single person does not over-occupy computing resources while also avoiding the tedious task of repeatedly submitting tasks.

[0067] Before step S21, the time for submitting the task instance may also be restricted. For example, the designated computing resource of the task instance is set with a time period that allows task submission. The task instance can only be assigned if the submission time of the task instance is within the time period that allows task submission. Otherwise, the task instance is directly terminated. Therefore, in some embodiments, before "obtaining the first number of queued task instances corresponding to the unique identifier of the submitter of the task instance", the following is included: if the submission time of the task instance does not meet the time period that allows task submission set by the designated computing resource of the task instance, the task instance does not meet the queuing condition and the task instance is terminated.

[0068] Steps S23 and S24 set an upper limit on the number of tasks that can be run by a single user to prevent the same submitter from running too many task instances, and set a concurrency limit to prevent the designated computing resources for the task instance from being exhausted. That is, only if the second number does not reach the upper limit on the number of tasks that can be run by a single user, and the third number does not reach the concurrency limit for the designated computing resources for the task instance, will the task instance meet the queuing conditions and enter the designated queue for queuing, and be placed at the end of the designated execution queue for the task instance.

[0069] In step S3, the probability of each candidate task instance being selected is obtained according to the resource proportions of all available execution queues in the same computing resource.

[0070] A candidate task instance is the task instance that ranks first in an available execution queue. An available execution queue is an enabled execution queue. Inactive execution queues cannot be assigned task instances, and the computing resources they occupy cannot be used or released. For example, a computing resource corresponds to execution queues A, B, and C. Execution queue A accounts for 25% of the resources, execution queue B accounts for 30%, and execution queue C accounts for 45%. However, only execution queues B and C are enabled. In this case, the probability of selecting a candidate task instance in execution queue B is 30% / (30% + 45%) = 0.4, and the probability of selecting a candidate task instance in execution queue C is 45% / (30% + 45%) = 0.6.

[0071] Therefore, "obtaining the probability of each candidate task instance being selected based on the resource proportions of all available execution queues in the same computing resource" includes: obtaining the first resource proportion of the available execution queue where each candidate task instance is located, and obtaining the second resource proportion by summing up the resource proportions of all available execution queues of the specified computing resource corresponding to each of the candidate task instances, and obtaining the probability of the candidate task being selected based on the ratio of the first resource proportion to the second resource proportion corresponding to the same candidate task instance.

[0072] In step S4, according to the selection probability of each candidate task instance, a candidate task instance is selected from all the available execution queues corresponding to the same computing resource to run.

[0073] In other words, a candidate task instance is randomly selected from all executable queues corresponding to the same computing resource, and the candidate task instance with a high probability of being selected is more likely to be executed first. After the first selected candidate task instance is executed, it is removed from the execution queue, and the task instance after the designated candidate task instance continues to be the candidate task instance for the next round.

[0074] In addition, in some embodiments, in order to prevent an execution queue from having too many queued task instances, which would affect the normal use of computing resources, the computer resources set a task termination time point. After "polling and selecting a candidate task instance to run from all available execution queues corresponding to the same computing resource", it includes: if any of the task instances in any of the available execution queues has not been run before the task termination time point set by the computing resource corresponding to the available execution queue, all task instances in the available execution queue will be terminated.

[0075] Example 2

[0076] Based on the same concept, this embodiment also provides a task scheduling device for implementing the task scheduling method described in the first embodiment. Figure 2 , the device includes the following modules:

[0077] An initialization module, configured to obtain at least one computing resource, create at least one execution queue corresponding to each computing resource, and allocate a resource ratio of the corresponding computing resource to each execution queue;

[0078] A task allocation module is configured to obtain at least one task instance and task information of each task instance, and allocate each task instance to a designated execution queue of a designated computing resource according to the task information;

[0079] a priority adjustment module, configured to obtain a probability of selection for each candidate task instance based on a resource ratio of all available execution queues in the same computing resource, wherein the candidate task instance is a task instance that is at the top of each of the available execution queues, and the available execution queues are execution queues in an enabled state;

[0080] The task scheduling module is used to select a candidate task instance to run from all the available execution queues corresponding to the same computing resource according to the selection probability of each candidate task instance.

[0081] Example 3

[0082] This embodiment also provides an electronic device, referring to Figure 3 , including a memory 404 and a processor 402, wherein the memory 404 stores a computer program, and the processor 402 is configured to run the computer program to execute the steps of any one of the task scheduling methods in the above embodiments.

[0083] Specifically, the processor 402 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0084] The memory 404 may include a large-capacity memory 404 for data or instructions. By way of example and not limitation, the memory 404 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 404 may be internal or external to the data processing device. In a specific embodiment, the memory 404 is a non-volatile memory. In a specific embodiment, the memory 404 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM) or a flash memory (FLASH), or a combination of two or more of these. In appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), where the DRAM can be a fast page mode dynamic random access memory 404 (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.

[0085] The memory 404 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 402 .

[0086] The processor 402 implements any one of the task scheduling methods in the above embodiments by reading and executing computer program instructions stored in the memory 404 .

[0087] Optionally, the electronic device may further include a transmission device 406 and an input / output device 408 , wherein the transmission device 406 is connected to the processor 402 , and the input / output device 408 is connected to the processor 402 .

[0088] Transmission device 406 can be used to receive or send data via a network. Specific examples of the aforementioned network may include a wired or wireless network provided by a communications provider of the electronic device. In one embodiment, the transmission device includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In one embodiment, transmission device 406 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0089] Input / output devices 408 are used to input or output information. In this embodiment, the input information can be a current data table such as an epidemic flow investigation document, feature data, template table, etc., and the output information can be a feature fingerprint, fingerprint template, text classification recommendation information, file template configuration mapping table, file template configuration information table, etc.

[0090] Optionally, in this embodiment, the processor 402 may be configured to execute the following steps through a computer program:

[0091] Acquire at least one computing resource, create at least one execution queue corresponding to each computing resource, and allocate a resource ratio of the corresponding computing resource to each execution queue;

[0092] Obtain at least one task instance and task information of each task instance, and assign each task instance to a designated execution queue of a designated computing resource according to the task information;

[0093] Obtaining a probability of selection for each candidate task instance based on a resource ratio of all available execution queues in the same computing resource, wherein the candidate task instance is a task instance that is at the top of each of the available execution queues, and the available execution queues are execution queues that are in an enabled state;

[0094] According to the selection probability of each candidate task instance, a candidate task instance is selected from all the available execution queues corresponding to the same computing resource to run.

[0095] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be repeated here.

[0096] In addition, in combination with any of the task scheduling methods in the first embodiment above, the present embodiment can be implemented as a computer program product. The computer program product includes a software code portion, and when the computer program product is run on a computer, the software code portion is used to implement any of the task scheduling methods in the first embodiment above.

[0097] Furthermore, in combination with any of the task scheduling methods in the first embodiment, the present application embodiment may provide a readable storage medium for implementation. The readable storage medium stores a computer program; when the computer program is executed by a processor, any of the task scheduling methods in the first embodiment is implemented.

[0098] In general, various embodiments may be implemented in hardware or dedicated circuitry, software, logic, or any combination thereof. Some aspects of the invention may be implemented in hardware, while other aspects may be implemented in firmware or software that may be executed by a controller, microprocessor, or other computing device, but the invention is not limited thereto. Although various aspects of the invention may be shown and described as block diagrams, flow charts, or using some other graphical representation, it should be understood that, as non-limiting examples, the blocks, devices, systems, techniques, or methods described herein may be implemented in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or a controller or other computing device, or some combination thereof.

[0099] Embodiments of the present invention can be implemented by computer software, which is executable by the data processor of the mobile device, such as in the processor entity, or is implemented by hardware, or is implemented by a combination of software and hardware. Computer software or programs (also referred to as program products) including software routines, applets and / or macros can be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. The computer program product can include one or more computer executable components configured to perform the embodiment when the program is running. One or more computer executable components can be at least one software code or a part thereof. In addition, at this point, it should be noted that any box of the logic flow in the figure can represent a program step, or interconnected logical circuits, boxes and functions, or a combination of program steps and logical circuits, boxes and functions. The software can be stored in physical media such as memory chips or storage blocks implemented in the processor, magnetic media such as hard disks or floppy disks, and optical media such as, for example, DVDs and their data variants, CDs. Physical media is non-transient media.

[0100] Those skilled in the art should understand that the technical features of the above embodiments can be combined arbitrarily. In order 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.

[0101] The above embodiments merely illustrate several embodiments of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present application. It should be noted that a person of ordinary skill in the art may make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present application shall be determined by the appended claims.

Claims

1. A task scheduling method, characterized in that: The following steps are involved: Acquire at least one computing resource, create at least one execution queue corresponding to each computing resource, and allocate a resource ratio of the corresponding computing resource to each execution queue; Obtain at least one task instance and task information of each task instance, wherein the task information of each task instance includes: a unique identifier of the task instance, a submission time, a unique identifier of a submitter, information about designated computing resources, and information about designated execution queues, and assign each task instance to a designated execution queue of a designated computing resource according to the task information; Obtaining a first resource ratio of the available execution queue where each candidate task instance is located, and obtaining a second resource ratio by summing the resource ratios of all available execution queues corresponding to the specified computing resources of each candidate task instance, and obtaining a probability of selection of the candidate task instance according to the ratio of the first resource ratio to the second resource ratio corresponding to the same candidate task instance, wherein the candidate task instance is the task instance that is at the top of each of the available execution queues, and the available execution queues are execution queues that are in an enabled state; Selecting, according to the selection probability of each candidate task instance, a candidate task instance to be executed from all the available execution queues corresponding to the same computing resource; Wherein, “assigning each of the task instances to a designated execution queue corresponding to the designated computing resource according to the task information” includes: Determining whether each task instance meets a queuing condition based on the task information of each task instance, and allocating each task instance that meets the queuing condition to a designated execution queue in the designated computing resource of the task instance, and placing it at the end of the designated execution queue of the task instance; The method of "determining whether the task instance meets the queuing conditions" includes: Obtaining a first number of queued task instances corresponding to a unique identifier of a submitter of the task instance in a designated computing resource of the task instance, wherein the queued task instance is a task instance queued in any of the execution queues; If the first number has reached the upper limit of the number of single-person task queues set for the specified computing resource of the task instance, the task instance does not meet the queuing conditions; When the first number is less than the upper limit of the single-person task queue number set for the designated computing resource of the task instance, obtain a second number of all running task instances uniquely identified by the submitter of the task instance and a third number of all running instance tasks in the designated computing resource of the task instance, wherein the running task instance is a task instance currently running in the designated computing resource of the task instance; If the second number does not reach the upper limit of the number of single-person task runs set by the specified computing resources of the task instance, and the third number does not reach the upper limit of the concurrency set by the specified computing resources of the task instance, the task instance meets the queuing conditions.

2. The task scheduling method according to claim 1, characterized in that: After "obtaining at least one computing resource", it includes: setting at least one restriction parameter for each of the computing resources, and the restriction parameter is any one of the time period allowed for task submission, task termination time point, concurrency upper limit value, single-person task queue number upper limit value, and single-person task running number upper limit value.

3. The task scheduling method according to claim 1, wherein: Before "obtaining the first number of queued task instances corresponding to the unique identifier of the submitter of the task instance", it includes: if the submission time of the task instance does not meet the allowed task submission time period set by the specified computing resource of the task instance, the task instance does not meet the queuing conditions and the task instance is terminated.

4. The task scheduling method according to claim 1, wherein: After "selecting a candidate task instance to run from all the available execution queues corresponding to the same computing resource", it includes: if any task instance in any of the available execution queues has not been run before the task termination time point set for the computing resource corresponding to the available execution queue, terminate all task instances in the available execution queue.

5. Task scheduling device, characterized in that: Includes the following modules: An initialization module, configured to obtain at least one computing resource, create at least one execution queue corresponding to each computing resource, and allocate a resource ratio of the corresponding computing resource to each execution queue; A task assignment module is configured to obtain at least one task instance and task information of each task instance, wherein the task information of each task instance includes: a unique identifier of the task instance, a submission time, a unique identifier of the submitter, information about designated computing resources, and information about designated execution queues, and assign each task instance to a designated execution queue of a designated computing resource according to the task information; A priority adjustment module is used to obtain the probability of each candidate task instance being selected based on the resource proportion of all available execution queues in the same computing resource, wherein the candidate task instance is the task instance that is at the first place in each of the available execution queues, and the available execution queue is an execution queue in an enabled state, obtain the first resource proportion of the available execution queue where each candidate task instance is located, and obtain the sum of the resource proportions of all available execution queues of the designated computing resource corresponding to each candidate task instance to obtain a second resource proportion, and obtain the probability of the candidate task being selected based on the ratio of the first resource proportion to the second resource proportion corresponding to the same candidate task instance, wherein the candidate task instance is the task instance that is at the first place in each of the available execution queues, and the available execution queue is an execution queue in an enabled state; A task scheduling module, configured to select a candidate task instance to run from all the available execution queues corresponding to the same computing resource according to the probability of selection of each candidate task instance; Wherein, “assigning each of the task instances to a designated execution queue corresponding to the designated computing resource according to the task information” includes: Determining whether each task instance meets a queuing condition based on the task information of each task instance, and allocating each task instance that meets the queuing condition to a designated execution queue in the designated computing resource of the task instance, and placing it at the end of the designated execution queue of the task instance; The method of "determining whether the task instance meets the queuing conditions" includes: Obtaining a first number of queued task instances corresponding to a unique identifier of a submitter of the task instance in a designated computing resource of the task instance, wherein the queued task instance is a task instance queued in any of the execution queues; If the first number has reached the upper limit of the number of single-person task queues set for the specified computing resource of the task instance, the task instance does not meet the queuing conditions; When the first number is less than the upper limit of the single-person task queue number set for the designated computing resource of the task instance, obtain a second number of all running task instances uniquely identified by the submitter of the task instance and a third number of all running instance tasks in the designated computing resource of the task instance, wherein the running task instance is a task instance currently running in the designated computing resource of the task instance; If the second number does not reach the upper limit of the number of single-person task runs set by the specified computing resources of the task instance, and the third number does not reach the upper limit of the concurrency set by the specified computing resources of the task instance, the task instance meets the queuing conditions.

6. An electronic device comprising a memory and a processor, characterized in that: The memory stores a computer program, and the processor is configured to run the computer program to execute the task scheduling method according to any one of claims 1 to 4.

7. A readable storage medium, characterized in that: The readable storage medium stores a computer program, wherein the computer program includes a program code for controlling a process to execute a process, wherein the process includes the task scheduling method according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Task scheduling method and apparatus

    CN107423120A

  • Deep learning task scheduling method and system, terminal and storage medium

    CN111488206A