CN115951983A - Task scheduling method, device and system and electronic equipment - Google Patents

Task scheduling method, device and system and electronic equipment Download PDF

Info

Publication number
CN115951983A
CN115951983A CN202211707737.8A CN202211707737A CN115951983A CN 115951983 A CN115951983 A CN 115951983A CN 202211707737 A CN202211707737 A CN 202211707737A CN 115951983 A CN115951983 A CN 115951983A
Authority
CN
China
Prior art keywords
task
executed
node
tasks
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211707737.8A
Other languages
Chinese (zh)
Inventor
孙丽川
李军
吴迪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xiamen Youwei Technology Co ltd
Original Assignee
Xiamen Youwei Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Xiamen Youwei Technology Co ltd filed Critical Xiamen Youwei Technology Co ltd
Priority to CN202211707737.8A priority Critical patent/CN115951983A/en
Publication of CN115951983A publication Critical patent/CN115951983A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The disclosure relates to a task scheduling method, a task scheduling device, a task scheduling system and electronic equipment, and relates to the technical field of computers. The method of the present disclosure comprises: acquiring a task to be executed; determining time wheel data corresponding to the task to be executed according to the execution time information of the task to be executed; and distributing the tasks to be executed to the task nodes for execution according to the time wheel data corresponding to the tasks to be executed and the task information mounted on the time wheel of each task node.

Description

Task scheduling method, device and system and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a task scheduling method, apparatus, system, and electronic device.
Background
A timed task is a task that is common in systems, such as user reach, task order timeout close, etc.
In the related art, for scheduling of the timed tasks, the timed tasks are put into a queue according to a time sequence and executed according to the execution time of the timed tasks.
Disclosure of Invention
The inventor finds that: the conventional scheduling method for the timing tasks cannot ensure that each timing task is processed timely and efficiently under the condition of large task quantity.
One technical problem to be solved by the present disclosure is: how to improve the execution efficiency and punctuality of the timing task.
According to some embodiments of the present disclosure, a task scheduling method is provided, including: acquiring a task to be executed; determining time wheel data corresponding to the task to be executed according to the execution time information of the task to be executed; and distributing the tasks to be executed to the task nodes for execution according to the time wheel data corresponding to the tasks to be executed and the task information mounted on the time wheel of each task node.
In some embodiments, determining, according to the execution time information of the task to be executed, time wheel data corresponding to the task to be executed includes: determining the type of a task to be executed, wherein the type comprises the following steps: aperiodic and periodic timing tasks; and under the condition that the task to be executed is an aperiodic timing task, determining time wheel data corresponding to the task to be executed according to the difference between the execution time of the task to be executed and the current time.
In some embodiments, determining time round data corresponding to the task to be executed according to the execution time information of the task to be executed further includes: under the condition that the tasks to be executed are periodic timing tasks, converting the tasks to be executed into a preset number of non-periodic timing tasks according to the period of the tasks to be executed; and determining time wheel data corresponding to the converted aperiodic timing task as time wheel data corresponding to the task to be executed according to the difference between the execution time of the converted aperiodic timing task and the current time.
In some embodiments, the time round data corresponding to the task to be executed includes: and data corresponding to multiple layers of time wheels with different time granularities.
In some embodiments, the task information mounted on the time wheel of each task node includes: the step of allocating the tasks to be executed to the task nodes for execution according to the number of the tasks to be executed mounted on the time wheel of each task node and the corresponding time wheel data of the tasks to be executed and the task information mounted on the time wheel of each task node comprises the following steps: selecting a task node with the least number of tasks to be executed mounted on the time wheel according to the number of the tasks to be executed mounted on the time wheel of each task node; and sending the time wheel data corresponding to the task to be executed to the selected task node so as to mount the task to be executed to the time wheel of the selected task node.
In some embodiments, obtaining the task to be performed comprises: receiving a task adding request, wherein the task adding request comprises parameters of a task; determining whether the parameters of the task are complete; under the condition that the parameters of the task are complete, checking whether the task already exists; and in the case that the task does not exist, determining the task as the task to be executed.
In some embodiments, the parameters of the task include: at least one of the identification of the task, the indication information of whether the task is a periodic timing task, the system to which the task belongs, the execution time information of the task and the serial number of the task.
In some embodiments, the method further comprises: and monitoring the task state and the task quantity on each task node.
In some embodiments, monitoring the task status and the number of tasks on each task node comprises at least one of: for each task node, in response to monitoring that the data of the task node newly increases the task to be executed in the storage system, updating the number of the tasks to be executed under the task node, wherein the task node reports to the storage system under the condition that the task to be executed is newly increased; in response to monitoring that data for starting to execute the task is newly added to the task node in the storage system, updating the number of the tasks to be executed and the number of the tasks in execution of the task node, wherein the task node reports to the storage system when starting to execute the task; and updating the number of the tasks in execution of the task node in response to monitoring the data of the task node in the storage system after the task is completely executed, wherein the task node reports to the storage system after the task is completely executed.
In some embodiments, the method further comprises: responding to the task execution failure, and reallocating the task failed to be executed to the task nodes to be executed according to the time wheel data corresponding to the task failed to be executed and the task information mounted on the time wheel of each task node.
In some embodiments, the method further comprises: responding to the beginning of execution of any converted aperiodic timing task, and converting to obtain a converted aperiodic timing task of the next period of the current last converted aperiodic timing task according to the period of the task to be executed; and determining time wheel data corresponding to the converted aperiodic timing task of the next period according to the difference between the execution time of the converted aperiodic timing task of the next period and the current time.
In some embodiments, the method further comprises: a task node receives a task to be executed; the task node mounts the task to be executed on the time wheel; and the task node responds to the time turn to the position corresponding to the task to be executed, calls the task to be executed from the system corresponding to the task to be executed and executes the task.
In some embodiments, the method further comprises at least one of: the task node responds to the received task to be executed, adds a thread, and reports the task to be executed to the storage system; the task node responds to the start of execution of the task to be executed, adds a thread, and reports the task which starts to be executed to the storage system; and the task node responds to the completion of the execution of the task to be executed, adds a thread and reports the executed task to the storage system.
In some embodiments, the method further comprises: and under the condition that the task to be executed is the periodic timing task, the task node responds to the converted aperiodic timing task to start execution and sends a task adding request to generate the converted aperiodic timing task of the next period of the current last converted aperiodic timing task.
According to other embodiments of the present disclosure, there is provided a task scheduling apparatus including: the acquisition module is used for acquiring a task to be executed; the determining module is used for determining time wheel data corresponding to the task to be executed according to the execution time information of the task to be executed; and the distribution module is used for distributing the tasks to be executed to the task nodes for execution according to the time wheel data corresponding to the tasks to be executed and the task information mounted on the time wheel of each task node.
According to still further embodiments of the present disclosure, there is provided an electronic device including: a processor; and a memory coupled to the processor for storing instructions that, when executed by the processor, cause the processor to perform a method of task scheduling as in any of the preceding embodiments.
According to still further embodiments of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon a computer program, wherein the program, when executed by a processor, implements the task scheduling method of any of the preceding embodiments.
According to still other embodiments of the present disclosure, a task scheduling system is provided, including: the task scheduling apparatus of any of the preceding embodiments; and the task node is used for receiving the task to be executed, mounting the task to be executed on the time wheel, responding to the time wheel and turning to the position corresponding to the task to be executed, and calling and executing the task to be executed from the system corresponding to the task to be executed.
In some embodiments, the task node is further configured to perform at least one of: in response to receiving the task to be executed, adding a thread newly, and reporting the task to be executed to a storage system; responding to the start of executing the task to be executed, adding a thread, and reporting the task which starts to be executed to a storage system; and responding to the completion of the execution of the task to be executed, newly adding a thread, and reporting the task which is completed in execution to the storage system.
In some embodiments, in case that the task to be executed is a periodic timed task, the task to be executed is converted into a preset number of aperiodic timed tasks, and the task node is further configured to send a task addition request in response to the converted aperiodic timed task starting execution, to generate a converted aperiodic timed task of a next period of a current last converted aperiodic timed task.
According to the method and the device, corresponding time wheel data are determined for the tasks to be executed, and the tasks to be executed are distributed to the task nodes to be executed according to the time wheel data corresponding to the tasks to be executed and the task information mounted on the time wheels of the task nodes. The method is suitable for scheduling the timed tasks, can efficiently schedule and process the tasks through a plurality of task nodes under the condition that a large number of tasks are concurrent, improves the execution efficiency of the tasks, and can improve the accuracy of task execution through the application of the time wheel.
Other features of the present disclosure and advantages thereof will become apparent from the following detailed description of exemplary embodiments thereof, which proceeds with reference to the accompanying drawings.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative efforts.
Fig. 1 illustrates a flow diagram of a task scheduling method of some embodiments of the present disclosure.
FIG. 2 shows a flowchart illustration of a task scheduling method of further embodiments of the disclosure.
Fig. 3A illustrates a flowchart of a task scheduling method according to further embodiments of the disclosure.
Fig. 3B illustrates a schematic diagram of a time wheel of some embodiments of the present disclosure.
Fig. 3C illustrates a flowchart of a task scheduling method of yet other embodiments of the present disclosure.
Fig. 4 shows a schematic structural diagram of a task scheduling device according to some embodiments of the present disclosure.
Fig. 5 illustrates a schematic structural diagram of a task scheduling system of some embodiments of the present disclosure.
FIG. 6 shows a schematic structural diagram of a task scheduling system of further embodiments of the present disclosure.
Fig. 7 shows a schematic structural diagram of an electronic device of some embodiments of the present disclosure.
Fig. 8 shows a schematic structural diagram of an electronic device of further embodiments of the disclosure.
Detailed Description
The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are only a part of the embodiments of the present disclosure, and not all of the embodiments. The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
The present disclosure proposes a task scheduling method, which is described below with reference to fig. 1 to 3C.
FIG. 1 is a flow diagram of some embodiments of a task scheduling method of the present disclosure. As shown in fig. 1, the method of this embodiment includes: steps S102 to S106. The method of the present embodiment may be performed by a dispatch center.
In step S102, a task to be executed is acquired.
In some embodiments, a task addition request is received, wherein the task addition request includes parameters of a task; determining whether the parameters of the task are complete; under the condition that the parameters of the task are complete, checking whether the task already exists; and in the case that the task does not exist, determining the task as the task to be executed.
In some embodiments, the parameters of the task include: at least one item of identification of the task, indication information whether the task is a periodic timing task, a system to which the task belongs, execution time information of the task and a serial number of the task. The parameters of the task may be stored in various known storage media including databases, file services, and the like.
The identification of the task is, for example, a unique identification of the task in the system to which the task belongs, and the number of the task is, for example, a unique number assigned to the task by the scheduling center. The tasks may include: aperiodic timing tasks and periodic timing tasks. A periodically timed task is a task that is repeatedly executed at fixed intervals. For example, the execution time information of the aperiodic timing task includes: the execution time information of the periodic timing task comprises the following execution time information: cycle and execution time. The dispatching center can record whether the task is added as the task to be executed in the form of log or database. And if the task does not exist, determining the task as the task to be executed.
In step S104, time wheel data corresponding to the task to be executed is determined according to the execution time information of the task to be executed.
In some embodiments, the type of the task to be executed is determined, and when the task to be executed is an aperiodic timing task, time round data corresponding to the task to be executed is determined according to the difference between the execution time of the task to be executed and the current time.
In some embodiments, the time wheel data corresponding to the task to be executed includes: and data corresponding to multiple layers of time wheels with different time granularities. For example, the time wheel is layered and divided into a time wheel (step 1 hour, period 24 hours), a minute wheel (step 1 minute, period 60 minutes), and a second wheel (step 1 second, period 60 seconds), and the time wheel data corresponding to the task to be executed may include hour, minute, and second. The granularity of a particular time wheel may be determined based on the accuracy of the execution time of the task, and is not limited to the illustrated example.
The multi-layer time wheel is adopted, so that the accuracy and the punctuality of task execution can be improved compared with the single-layer time wheel.
In other embodiments, when the task to be executed is a periodic timing task, the task to be executed is converted into a preset number of aperiodic timing tasks according to the period of the task to be executed; and determining time wheel data corresponding to the converted aperiodic timing task as time wheel data corresponding to the task to be executed according to the difference between the execution time of the converted aperiodic timing task and the current time. The preset number is 1, 10 and the like, and can be set according to actual requirements. For example, the task executed for the next 10 times is generated during the initial scheduling, which can play a certain buffering role and improve the accuracy of the execution of the periodic timing task.
Further, in some embodiments, in response to any converted aperiodic timing task starting execution, a converted aperiodic timing task of a next period of a current last converted aperiodic timing task is converted according to a period of a task to be executed; and determining time wheel data corresponding to the converted aperiodic timing task of the next period according to the difference between the execution time of the converted aperiodic timing task of the next period and the current time. And repeatedly executing the processes until the execution is finished.
In step S106, the task to be executed is allocated to the task node for execution according to the time wheel data corresponding to the task to be executed and the task information mounted on the time wheel of each task node.
In some embodiments, the task information mounted on the time wheel of each task node includes: selecting the task node with the least number of the tasks to be executed mounted on the time wheel according to the number of the tasks to be executed mounted on the time wheel of each task node; and sending the time wheel data corresponding to the task to be executed to the selected task node so as to mount the task to be executed to the time wheel of the selected task node.
Task nodes can be distributed for the tasks to be executed according to a load balancing algorithm, a fairness algorithm and the like, so that the phenomenon that a certain task node is overloaded under the condition of a large number of tasks to be executed can be avoided, and the execution efficiency of the tasks to be executed is improved. The task to be executed may also be directly assigned to the specified task node, and is not limited to the illustrated example.
In some embodiments, in response to a task execution failure, the task execution failure is redistributed to task nodes for execution according to the time wheel data corresponding to the task execution failure and the task information mounted on the time wheel of each task node. The timing tasks can not be executed successfully, and are placed at the tail of the task queue relative to the re-execution of the failed tasks, so that the tasks are out of date when being scheduled, the tasks can be re-executed at the precise re-designated time, and the punctuality of the task execution can be improved.
In the above embodiment, for the task to be executed, the corresponding time wheel data is determined, and the task to be executed is allocated to the task node for execution according to the time wheel data corresponding to the task to be executed and the task information mounted on the time wheel of each task node. The method of the embodiment is suitable for scheduling of the timing tasks, the tasks can be efficiently scheduled and processed through the multiple task nodes under the condition that a large number of tasks are concurrent, the execution efficiency of the tasks is improved, and the accuracy of task execution can be improved through the application of the time wheel.
Further embodiments of the task scheduling method of the present disclosure are described below in conjunction with fig. 2.
FIG. 2 is a flow diagram of other embodiments of a task scheduling method of the present disclosure. As shown in fig. 2, the method of this embodiment includes: steps S202 to S216. The method of the present embodiment may be performed by a dispatch center.
In step S202, a task addition request is received.
For example, the task addition request includes parameters of the task, and the parameters may be described in the foregoing embodiments, which are not described herein again.
In step S204, it is determined whether the parameters of the task are complete, if yes, step S206 is performed, otherwise, information of addition failure is returned.
In step S206, it is checked whether a task already exists, and if so, step S207 is performed, otherwise, step S208 is performed.
In step S207, it is determined whether the task is a periodically timed task, and if so, step S212 is performed, otherwise, step S209 is performed.
If the task already exists and the task is a periodic task, and the condition is that the task still has an unexecuted period, the task can be converted into a corresponding non-periodic timing task according to the unexecuted period to be distributed. Reference may be made to the foregoing embodiments, which are not described in detail herein.
In step S208, it is determined whether the task is a periodically timed task, and if so, step S210 is performed, otherwise, step S212 is performed.
In step S209, information that the task has been registered is returned.
In step S210, the tasks are converted into a preset number of aperiodic timed tasks according to the period of the tasks.
In step S212, time wheel data corresponding to the task is determined.
In step S214, a task node corresponding to the task is determined according to a preset scheduling algorithm.
In step S216, the task is sent to the corresponding task node.
The method of the embodiment can distinguish different types of timing tasks, carry out different processing, distribute the sub tasks to different task nodes for execution, and improve the efficiency and the punctuality of task execution.
In some embodiments, the task state and the number of tasks on each task node are monitored, and the monitored information may be used to determine the part of the task node corresponding to the task to be executed in the foregoing embodiments. Further, the task state and the task number of each monitored task node can be displayed.
Further, in some embodiments, monitoring the task status and the number of tasks on each task node includes at least one of: for each task node, in response to monitoring that the data of the task node newly increases the task to be executed in the storage system, updating the number of the tasks to be executed under the task node, wherein the task node reports to the storage system under the condition that the task to be executed is newly increased; in response to monitoring that the task node newly adds data for starting to execute the task in the storage system, updating the number of the tasks to be executed and the number of the tasks in execution under the task node, wherein the task node reports to the storage system when starting to execute the task; and in response to monitoring the data of the task node in the storage system, which is executed completely, updating the number of the tasks in the execution of the task node, wherein the task node reports to the storage system when the task node is executed completely.
Still other embodiments of the task scheduling method of the present disclosure are described below in conjunction with fig. 3A-3C.
FIG. 3A is a flow chart of yet further embodiments of the disclosed task scheduling method. As shown in fig. 3A, the method of this embodiment includes: steps S302 to S316.
In step S302, the task node receives a task to be executed.
In step S304, the task node mounts the task to be executed on the time wheel.
And the task node receives the task to be executed and acquires time wheel data (such as time, minute and second data) of the task to be executed. As shown in fig. 3B, the task to be executed is mounted on the hour wheel, and if the hour wheel is finished, the task to be executed is mounted on the minute wheel; and the minute wheel finishes walking and is hung on the second wheel. And executing the task to be executed after the second round is finished.
In step S306, the task node adds a new thread and reports the task to be executed to the storage system.
After receiving the task to be executed, the task node (task executor) adds the task to a corresponding time wheel task, and simultaneously reports another thread to a storage system: and newly adding a task to be executed. The storage system is, for example, an ETCD system, a zk system, or the like, and is not limited to the illustrated example. The ETCD system has better performance and can improve the execution efficiency of tasks. The storage system can store information such as the number of the task to be executed under each task node.
In some embodiments, the monitoring center monitors data change in the storage system, and updates the number of tasks to be executed at the task node in response to monitoring that data of the task node newly adds to be executed in the storage system. The monitoring center can be combined with the dispatching center or separated from the dispatching center. For example, as shown in fig. 3C, the task node reports the tasks to be executed to the ETCD system, and the monitoring center monitors data change of the ETCD system and updates the number of the tasks to be executed under the corresponding task node in real time.
In step S308, the task node responds to the time turn to the position corresponding to the task to be executed, and acquires the number of the task to be executed.
In step S309, the task node determines that the task to be executed is a periodic timing task, and sends a task addition request to the scheduling center so that the scheduling center generates a converted aperiodic timing task of a next period of the current last converted aperiodic timing task.
In some embodiments, in the case that the task to be executed is a periodic timing task, the task node may also send a task addition request in response to the converted aperiodic timing task starting to execute, so that the scheduling center generates a converted aperiodic timing task of a next period of the current last converted aperiodic timing task.
And the scheduling center receives the task adding request, judges that the task to be executed already exists, belongs to the periodic execution property, directly obtains the time wheel parameter corresponding to the converted aperiodic timing task in the next period of the current last converted aperiodic timing task, and distributes a task executor.
Reference may be made to the foregoing embodiments, and details are not repeated herein.
In step S310, the task node calls the task to be executed from the system corresponding to the task to be executed according to the serial number of the task to be executed, and starts executing the task.
And the task node responds to the time turn to the position corresponding to the task to be executed, calls the task to be executed from the system corresponding to the task to be executed and executes the task. In some embodiments, the task node determines the identifier of the task to be executed according to the correspondence between the number and the identifier of the task to be executed and the number of the task to be executed, and calls the task to be executed in the corresponding system (service system) according to the identifier of the task to be executed. The task nodes are decoupled from the service system, independently deployed and operated, and compared with the task execution configuration in the service system, the task nodes can reduce the pressure of the service system and improve the execution efficiency of the tasks.
In step S312, the task node adds a new thread, and reports the task to be executed to the storage system.
After the time wheel schedules the corresponding task, starting a timing task, and simultaneously reporting another thread to the storage system: a new task begins execution.
In some embodiments, the monitoring center updates the number of the tasks to be executed and the number of the tasks in execution of the task node in response to monitoring that the data of starting to execute the task is newly added to the task node in the storage system. For example, as shown in fig. 3C, a task node starts to execute a new task on the ETCD system, and the monitoring center monitors the change of the ETCD data and updates the number of tasks in execution on the corresponding task node.
In some embodiments, in the case where the task to be executed is a periodically timed task, the monitoring center sends a task addition request in response to the converted aperiodic timed task starting execution, so that the scheduling center generates a converted aperiodic timed task of the next cycle of the current last converted aperiodic timed task. That is, for the periodic timing task, when the task in one period starts to be executed, the task node or the monitoring center may send a task addition request to the scheduling center, so as to trigger the scheduling center to generate the task in the next period of the last period among the generated tasks in each period, and allocate the corresponding task node.
In step S314, the task node finishes executing the task to be executed, and obtains an execution result of the task to be executed.
In step S316, in response to the task to be executed being completed, the task node adds a new thread and reports the completed task to the storage system.
After the task node finishes executing the task to be executed, updating the task state, and simultaneously reporting the ETCD by another thread: and completing the task execution.
In some embodiments, the monitoring center updates the number of the tasks in execution under the task node in response to monitoring the data of the task node in the storage system that the task node completes the execution of the tasks. For example, as shown in fig. 3C, the task node reports completion of the task to the ETCD system, and the monitoring center monitors data change of the ETCD system, and updates the number of the tasks during execution and the number of the tasks after execution.
In some embodiments, the number of task nodes is increased in response to the number of tasks to be performed being greater than a threshold. Capacity expansion can be configured through manual, automatic policies to cope with mission peaks.
Based on the above embodiments, the scheme of the present disclosure can implement efficient scheduling and processing of a large number of tasks concurrently, and improve the efficiency and punctuality of task execution. The method can monitor the execution condition of the tasks in real time, and can expand the scale of the task nodes to deal with the flow flood peak under the condition of high task concurrency. Tasks with smaller time granularity can be processed through the layered time wheel. When the task fails to execute, the task can be executed again at a precise and appointed time. The task node is decoupled from the business system. And the task nodes are independently deployed and operated, so that the pressure of a service system is reduced, and the stability of the system is enhanced.
The present disclosure also provides a task scheduling device, which is described below with reference to fig. 4.
FIG. 4 is a block diagram of some embodiments of a task scheduler of the disclosure. As shown in fig. 4, the apparatus 40 of this embodiment includes: an acquisition module 410, a determination module 420, and an assignment module 430.
The obtaining module 410 is used for obtaining the task to be executed.
In some embodiments, the obtaining module 410 is configured to receive a task adding request, where the task adding request includes a parameter of a task; determining whether the parameters of the task are complete; under the condition that the parameters of the task are complete, checking whether the task already exists; and in the case that the task does not exist, determining the task as the task to be executed.
In some embodiments, the parameters of the task include: at least one item of identification of the task, indication information whether the task is a periodic timing task, a system to which the task belongs, execution time information of the task and a serial number of the task.
The determining module 420 is configured to determine time round data corresponding to the task to be executed according to the execution time information of the task to be executed.
In some embodiments, the determining module 420 is configured to determine a type of the task to be performed, wherein the type includes: aperiodic and periodic timing tasks; and under the condition that the task to be executed is an aperiodic timing task, determining time wheel data corresponding to the task to be executed according to the difference between the execution time of the task to be executed and the current time.
In some embodiments, the determining module 420 is configured to, if the task to be executed is a periodic timing task, convert the task to be executed into a preset number of non-periodic timing tasks according to a period of the task to be executed; and determining time wheel data corresponding to the converted aperiodic timing task as time wheel data corresponding to the task to be executed according to the difference between the execution time of the converted aperiodic timing task and the current time.
In some embodiments, the determining module 420 is configured to, in response to any one of the converted aperiodic timing tasks starting to execute, convert the converted aperiodic timing task into a converted aperiodic timing task of a next period of the current last converted aperiodic timing task according to the period of the task to be executed; and determining time wheel data corresponding to the converted aperiodic timing task of the next period according to the difference between the execution time of the converted aperiodic timing task of the next period and the current time.
The allocating module 430 is configured to allocate the task to be executed to the task node for execution according to the time wheel data corresponding to the task to be executed and the task information mounted on the time wheel of each task node.
In some embodiments, the time wheel data corresponding to the task to be executed includes: and data corresponding to multiple layers of time wheels with different time granularities.
In some embodiments, the task information mounted on the time wheel of each task node includes: the distribution module 430 is configured to select a task node with the least number of tasks to be executed according to the number of tasks to be executed mounted on the time wheel of each task node; and sending the time wheel data corresponding to the task to be executed to the selected task node so as to mount the task to be executed to the time wheel of the selected task node.
In some embodiments, the allocating module 430 is further configured to, in response to a task execution failure, reallocate the task that has failed to be executed to the task node for execution according to the time round data corresponding to the task that has failed to be executed and the task information mounted on the time round of each task node.
In some embodiments, the task scheduler 40 further comprises: and the monitoring module 440 is configured to monitor task states and task numbers on the task nodes.
In some embodiments, the monitoring module 440 is configured to perform at least one of: for each task node, in response to monitoring that the data of the task node newly increases the task to be executed in the storage system, updating the number of the tasks to be executed under the task node, wherein the task node reports to the storage system under the condition that the task to be executed is newly increased; in response to monitoring that data for starting to execute the task is newly added to the task node in the storage system, updating the number of the tasks to be executed and the number of the tasks in execution of the task node, wherein the task node reports to the storage system when starting to execute the task; and updating the number of the tasks in execution of the task node in response to monitoring the data of the task node in the storage system after the task is completely executed, wherein the task node reports to the storage system after the task is completely executed.
The present disclosure also provides a task scheduling system, which is described below in conjunction with fig. 5-6.
FIG. 5 is a block diagram of some embodiments of the disclosed task scheduling system. As shown in fig. 5, the system 5 of this embodiment includes: the task scheduling device 40 of any of the foregoing embodiments; and a plurality of task nodes 52.
And the task node 52 is configured to receive the task to be executed, mount the task to be executed on the time wheel, respond to the time wheel and turn to the position corresponding to the task to be executed, and invoke and execute the task to be executed from the system corresponding to the task to be executed.
In some embodiments, the task node 52 is further configured to perform at least one of: in response to receiving the task to be executed, adding a thread newly, and reporting the task to be executed to a storage system; responding to the start of executing the task to be executed, adding a thread, and reporting the task which starts to be executed to a storage system; and responding to the completion of the execution of the task to be executed, newly adding a thread, and reporting the task which is completed in execution to the storage system.
In some embodiments, in the case that the task to be executed is a periodically timed task, the task to be executed is converted into a preset number of non-periodically timed tasks, and the task node 52 is further configured to send a task addition request in response to the converted non-periodically timed task starting to execute, so as to generate a converted non-periodically timed task of a next period of the current last converted non-periodically timed task.
As shown in fig. 6, the task scheduling device 40 may include a scheduling center 41 and a monitoring center 42. Each task node is configured with a time wheel. The task scheduling system 5 may also include a storage system 54. For the specific functions of each device, reference may be made to the foregoing embodiments, which are not described herein again.
The electronic devices (e.g., task scheduler, task node, etc.) in embodiments of the present disclosure may each be implemented by various computing devices or computer systems, which are described below in conjunction with fig. 7 and 8.
Fig. 7 is a block diagram of some embodiments of an electronic device arrangement of the present disclosure. As shown in fig. 7, the electronic apparatus 70 of this embodiment includes: a memory 710 and a processor 720 coupled to the memory 710, the processor 720 configured to perform a task scheduling method in any of the embodiments of the present disclosure based on instructions stored in the memory 710.
Memory 710 may include, for example, system memory, fixed non-volatile storage media, and the like. The system memory stores, for example, an operating system, an application program, a Boot Loader (Boot Loader), a database, and other programs.
Fig. 8 is a block diagram of further embodiments of an electronic device of the present disclosure. As shown in fig. 8, the electronic apparatus 80 of this embodiment includes: memory 810 and processor 820 are similar to memory 710 and processor 720, respectively. An input output interface 830, a network interface 840, a storage interface 850, and the like may also be included. These interfaces 830, 840, 850, as well as the memory 810 and the processor 820, may be connected via a bus 860, for example. The input/output interface 830 provides a connection interface for input/output devices such as a display, a mouse, a keyboard, and a touch screen. The network interface 840 provides a connection interface for various networking devices, such as a database server or a cloud storage server. The storage interface 850 provides a connection interface for external storage devices such as an SD card and a usb disk.
As will be appreciated by one skilled in the art, embodiments of the present disclosure may be provided as a method, system, or computer program product. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable non-transitory storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present disclosure is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the disclosure. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only exemplary of the present disclosure and is not intended to limit the present disclosure, so that any modification, equivalent replacement, or improvement made within the spirit and principle of the present disclosure should be included in the scope of the present disclosure.

Claims (20)

1. A task scheduling method comprises the following steps:
acquiring a task to be executed;
determining time wheel data corresponding to the task to be executed according to the execution time information of the task to be executed;
and distributing the tasks to be executed to the task nodes for execution according to the time wheel data corresponding to the tasks to be executed and the task information mounted on the time wheel of each task node.
2. The task scheduling method according to claim 1, wherein the determining, according to the execution time information of the task to be executed, time wheel data corresponding to the task to be executed comprises:
determining the type of the task to be executed, wherein the type comprises: aperiodic and periodic timing tasks;
and under the condition that the task to be executed is a non-periodic timing task, determining time wheel data corresponding to the task to be executed according to the difference between the execution time of the task to be executed and the current time.
3. The task scheduling method according to claim 2, wherein the determining, according to the execution time information of the task to be executed, time round data corresponding to the task to be executed further comprises:
under the condition that the tasks to be executed are periodic timing tasks, converting the tasks to be executed into a preset number of non-periodic timing tasks according to the period of the tasks to be executed;
and determining time wheel data corresponding to the converted aperiodic timing task as the time wheel data corresponding to the task to be executed according to the difference between the execution time of the converted aperiodic timing task and the current time.
4. The task scheduling method according to claim 1, wherein the time wheel data corresponding to the task to be executed includes: and data corresponding to multiple layers of time wheels with different time granularities.
5. The task scheduling method according to claim 1, wherein the task information mounted on the time wheel of each task node includes: the step of allocating the to-be-executed tasks to the task nodes for execution according to the time round data corresponding to the to-be-executed tasks and the task information mounted on the time round of each task node includes:
selecting the task node with the least number of tasks to be executed mounted on the time wheel according to the number of the tasks to be executed mounted on the time wheel of each task node;
and sending the time wheel data corresponding to the task to be executed to the selected task node so as to mount the task to be executed to the time wheel of the selected task node.
6. The task scheduling method according to claim 1, wherein the acquiring the task to be executed comprises:
receiving a task adding request, wherein the task adding request comprises parameters of a task;
determining whether parameters of the task are complete;
checking whether the task already exists or not under the condition that the parameters of the task are complete;
and determining the task as the task to be executed under the condition that the task does not exist.
7. The task scheduling method of claim 6, wherein the parameters of the task include: at least one of the identification of the task, the indication information whether the task is a periodic timing task, the system to which the task belongs, the execution time information of the task, and the serial number of the task.
8. The task scheduling method of claim 1, further comprising:
and monitoring the task state and the task quantity on each task node.
9. The task scheduling method according to claim 8, wherein the monitoring of the task status and the number of tasks on each task node comprises at least one of: for each of the task nodes, a task node,
in response to monitoring that data of tasks to be executed are newly added to the task node in the storage system, updating the number of the tasks to be executed under the task node, wherein the data are reported to the storage system under the condition that the tasks to be executed are newly added to the task node;
in response to monitoring that the task node newly adds data for starting to execute the task in the storage system, updating the number of the tasks to be executed and the number of the tasks in execution under the task node, wherein the task node reports to the storage system when starting to execute the task;
and updating the number of the tasks in execution under the task node in response to monitoring the data of the task node in the storage system after the task is completely executed, wherein the data is reported to the storage system when the task node completes the task execution.
10. The task scheduling method of claim 1, further comprising:
responding to the task execution failure, and reallocating the task failed to be executed to the task nodes for execution according to the time wheel data corresponding to the task failed to be executed and the task information mounted on the time wheel of each task node.
11. The task scheduling method of claim 3, further comprising:
responding to the beginning of execution of any converted non-periodic timing task, and converting to obtain a converted non-periodic timing task of the next period of the current last converted non-periodic timing task according to the period of the task to be executed;
and determining time wheel data corresponding to the converted aperiodic timing task of the next period according to the difference between the execution time of the converted aperiodic timing task of the next period and the current time.
12. A task scheduling method according to any one of claims 1 to 11, further comprising:
the task node receives the task to be executed;
the task node mounts the task to be executed on a time wheel;
and the task node responds to the time wheel and turns to the position corresponding to the task to be executed, and the task to be executed is called from the system corresponding to the task to be executed and executed.
13. The task scheduling method of claim 12, further comprising at least one of:
the task node responds to the received task to be executed, a thread is newly added, and the task to be executed is reported to a storage system;
the task node responds to the task to be executed to start executing, adds a thread, and reports the task to be executed to a storage system;
and the task node responds to the completion of the execution of the task to be executed, newly adds a thread and reports the executed task to the storage system.
14. The task scheduling method of claim 3, further comprising:
and under the condition that the task to be executed is a periodic timing task, the task node responds to the converted aperiodic timing task to start execution and sends a task adding request so as to generate the converted aperiodic timing task of the next period of the current last converted aperiodic timing task.
15. A task scheduling apparatus comprising:
the acquisition module is used for acquiring a task to be executed;
the determining module is used for determining time wheel data corresponding to the task to be executed according to the execution time information of the task to be executed;
and the distribution module is used for distributing the tasks to be executed to the task nodes for execution according to the time wheel data corresponding to the tasks to be executed and the task information mounted on the time wheel of each task node.
16. An electronic device, comprising:
a processor; and
a memory coupled to the processor for storing instructions that, when executed by the processor, cause the processor to perform the task scheduling method of any of claims 1-14.
17. A non-transitory computer readable storage medium having stored thereon a computer program, wherein the program when executed by a processor implements the steps of the method of any one of claims 1-14.
18. A task scheduling system comprising: a task scheduler as claimed in claim 15; and
and the task node is used for receiving the task to be executed, mounting the task to be executed on a time wheel, responding to the time wheel and turning to a position corresponding to the task to be executed, and calling and executing the task to be executed from a system corresponding to the task to be executed.
19. The task scheduling system of claim 18 wherein,
the task node is further configured to perform at least one of: responding to the received task to be executed, adding a thread newly, and reporting the task to be executed to a storage system; responding to the start of execution of the task to be executed, adding a thread, and reporting the task to be executed to a storage system; and responding to the completion of the execution of the task to be executed, newly adding a thread, and reporting the executed task to a storage system.
20. The task scheduling system of claim 18 wherein in the event that the task to be executed is a periodic timed task, the task to be executed is converted to a preset number of aperiodic timed tasks, the task node further for sending a task addition request to generate a converted aperiodic timed task for the next period of the current last converted aperiodic timed task in response to the converted aperiodic timed task starting execution.
CN202211707737.8A 2022-12-28 2022-12-28 Task scheduling method, device and system and electronic equipment Pending CN115951983A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211707737.8A CN115951983A (en) 2022-12-28 2022-12-28 Task scheduling method, device and system and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211707737.8A CN115951983A (en) 2022-12-28 2022-12-28 Task scheduling method, device and system and electronic equipment

Publications (1)

Publication Number Publication Date
CN115951983A true CN115951983A (en) 2023-04-11

Family

ID=87288846

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211707737.8A Pending CN115951983A (en) 2022-12-28 2022-12-28 Task scheduling method, device and system and electronic equipment

Country Status (1)

Country Link
CN (1) CN115951983A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116302455A (en) * 2023-05-23 2023-06-23 深圳前海环融联易信息科技服务有限公司 Timing task processing method and device, storage medium and computer equipment
CN116302577A (en) * 2023-05-25 2023-06-23 煤炭科学研究总院有限公司 Algorithm unloading task executing method for multi-access edge computing system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116302455A (en) * 2023-05-23 2023-06-23 深圳前海环融联易信息科技服务有限公司 Timing task processing method and device, storage medium and computer equipment
CN116302455B (en) * 2023-05-23 2023-09-01 深圳前海环融联易信息科技服务有限公司 Timing task processing method and device, storage medium and computer equipment
CN116302577A (en) * 2023-05-25 2023-06-23 煤炭科学研究总院有限公司 Algorithm unloading task executing method for multi-access edge computing system
CN116302577B (en) * 2023-05-25 2023-08-29 煤炭科学研究总院有限公司 Algorithm unloading task executing method for multi-access edge computing system

Similar Documents

Publication Publication Date Title
CN115951983A (en) Task scheduling method, device and system and electronic equipment
CN112379995B (en) DAG-based unitized distributed scheduling system and method
CN107665144B (en) Balanced scheduling center, method, system and device for distributed tasks
CN112162865A (en) Server scheduling method and device and server
JP2010503074A5 (en)
CN111459641B (en) Method and device for task scheduling and task processing across machine room
CN111970148A (en) Distributed task scheduling method and system
CN111861412A (en) Completion time optimization-oriented scientific workflow scheduling method and system
CN103377101A (en) Testing system and testing method
CN103500119A (en) Task allocation method based on pre-dispatch
CN112905297A (en) Container cluster resource scheduling method and device
CN111767145A (en) Container scheduling system, method, device and equipment
CN112463395A (en) Resource allocation method, device, equipment and readable storage medium
CN112685160A (en) Scheduling method and device of timing task, terminal equipment and computer storage medium
CN113590281B (en) Distributed parallel fuzzy test method and system based on dynamic centralized scheduling
CN112910952B (en) Distributed task scheduling method and device, storage medium and electronic device
US20020010732A1 (en) Parallel processes run scheduling method and device and computer readable medium having a parallel processes run scheduling program recorded thereon
CN110780869A (en) Distributed batch scheduling
CN113051063B (en) Task scheduling method and device for distributed tasks and electronic equipment
CN113419836B (en) Task processing method and device, electronic equipment and computer readable storage medium
CN112286631B (en) Kubernetes resource scheduling method and device and electronic equipment
CN113225269B (en) Container-based workflow scheduling method, device and system and storage medium
CN114995971A (en) Method and system for realizing pod batch scheduling in kubernets
CN109032809A (en) Heterogeneous parallel scheduling system based on remote sensing image storage position
CN111556126B (en) Model management method, system, computer device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination