CN116149813A - Task scheduling method, device and system, electronic equipment and storage medium - Google Patents

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

Info

Publication number
CN116149813A
CN116149813A CN202211711143.4A CN202211711143A CN116149813A CN 116149813 A CN116149813 A CN 116149813A CN 202211711143 A CN202211711143 A CN 202211711143A CN 116149813 A CN116149813 A CN 116149813A
Authority
CN
China
Prior art keywords
target
task
executor
actuator
core
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
CN202211711143.4A
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.)
China United Network Communications Group Co Ltd
Original Assignee
China United Network Communications Group 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 China United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN202211711143.4A priority Critical patent/CN116149813A/en
Publication of CN116149813A publication Critical patent/CN116149813A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • 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

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a task scheduling method, a device, a system, electronic equipment and a storage medium, relates to the technical field of computers, and solves the problem of disordered task execution. The method comprises the following steps: acquiring target time information in real time; when the target time information is the target execution time of the target task, determining a target strategy corresponding to the target task from a strategy table, wherein the target execution time is determined by the first execution time and the execution interval of the target task, and the first execution time and the execution interval are stored in a timing task related table in advance; determining whether an actuator matched with a target strategy exists in the task scheduling system; and when the executor matched with the target strategy exists in the task scheduling system, determining the executor matched with the target strategy as a target executor, and controlling the target executor to execute the target task. According to the embodiment of the application, the execution speed of the task can be improved.

Description

Task scheduling method, device and system, electronic equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a task scheduling method, device, system, electronic device, and storage medium.
Background
With the continuous development of computer technology, users can package business logic into tasks, and send relevant data of the tasks to a task scheduling system through a client, wherein the task scheduling system is responsible for configuration, control and management of the tasks, monitoring of task execution states and the like. Generally, the task scheduling system may include a data server, a scheduling end and an executing end, where relevant data of each task uploaded by the client is stored in the data server, the scheduling end may acquire relevant data of the task from the data server, send the acquired relevant data of the task to the executing end, and the executing end executes the corresponding task according to the relevant data of the task.
The task scheduling method in the related art is suitable for the situations of small task amount and single task type, however, along with the increasing of the task amount, the task type becomes more complex, and if the task scheduling method is used for executing the corresponding task, the situation of disordered task execution can occur due to the fact that one execution end needs to execute different types of tasks, so that the task scheduling system management is not facilitated, and the task execution speed is finally influenced.
Disclosure of Invention
The invention provides a task scheduling method, a device, a system, electronic equipment and a storage medium, which are used for solving the problem of task execution confusion.
In order to achieve the above purpose, the invention adopts the following technical scheme:
in a first aspect, the present application provides a task scheduling method, including:
acquiring target time information in real time;
when the target time information is the target execution time of the target task, determining a target strategy corresponding to the target task from a strategy table, wherein the target execution time is determined by the first execution time and the execution interval of the target task, and the first execution time and the execution interval are stored in a timing task related table in advance;
determining whether an actuator matched with a target strategy exists in the task scheduling system;
and when the executor matched with the target strategy exists in the task scheduling system, determining the executor matched with the target strategy as a target executor, and controlling the target executor to execute the target task.
In this embodiment, after the execution time of the target task is reached, an actuator matched with the target policy in the task scheduling system is determined as the target actuator, and the target actuator is controlled to execute the target task, so that the target actuator is matched with the target task, that is, different actuators corresponding to different policies, so that each actuator can execute a corresponding task in a targeted manner, management of the task scheduling system is facilitated, occurrence of disordered task execution is reduced, and further task execution speed is improved.
In one possible implementation manner, the determining whether the executor matching the target policy exists in the task scheduling system includes:
acquiring an execution parameter corresponding to a target task in a policy table;
generating an encapsulation file based on the execution parameters and the target execution time, storing the encapsulation file in a task table, and setting the execution state of the target task as a queuing state;
acquiring all first tasks in a queuing state in a task table;
determining a first task with the forefront target execution time in a task table based on the target execution time of each first task in a queuing state;
and determining whether an actuator matched with the target strategy exists in the task scheduling system under the condition that the first task with the forefront target execution time in the task table is the target task.
In the embodiment, the target executor is preferentially selected for the task with the front target execution time, so that the task can be orderly executed, the occurrence of the condition that the task is not executed for a long time is reduced, and the timeliness of executing the task is improved.
In a possible implementation manner, in a case that an actuator matched with the target policy exists in the task scheduling system, determining the actuator matched with the target policy as the target actuator includes:
Determining whether the task quantity of the executor matched with the target strategy is smaller than a first preset quantity or not under the condition that the executor matched with the target strategy exists in the task scheduling system;
and determining the actuator matched with the target strategy as the target actuator under the condition that the task quantity of the actuator matched with the target strategy is smaller than the first preset quantity.
In this embodiment, after determining that an actuator matching with the target policy exists in the task scheduling system, it needs to further determine whether the task amount of the actuator is smaller than the preset amount, so that the occurrence of overload of the task amount of a certain actuator can be reduced, the execution task of the actuator can be conveniently and timely adjusted, and further the execution efficiency of the task is improved.
In one possible embodiment, the method further comprises:
and under the condition that the task quantity of the executor matched with the target strategy is not smaller than the first preset quantity, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain the target executor.
In this embodiment, if the task amount of the executor is not less than the first preset amount, it is indicated that the workload of the executor has reached a saturated state, so that the capacity of the task scheduling system needs to be expanded to obtain the target executor, and further the target executor is controlled to execute the target task, so that the execution task of the executor can be regulated in a balanced manner, the occurrence of the condition that the task amount of a certain executor is overloaded is reduced, and the execution efficiency of the task is improved.
In one possible implementation manner, in a case that the plurality of actuators matching the target policy is determined, the actuators are core actuators or non-core actuators, and in a case that there are actuators matching the target policy in the task scheduling system, the determining that the actuators matching the target policy are target actuators includes:
in the case that a plurality of actuators matched with a target strategy exist in the task scheduling system, determining a first core actuator with the minimum task quantity from the plurality of actuators matched with the target strategy;
determining whether the task amount of the first core executor is smaller than a first preset amount;
and determining the first core executor as a target executor under the condition that the task quantity of the first core executor is smaller than a first preset quantity.
In this embodiment, if there are multiple actuators matching with the target policy in the task scheduling system, it is necessary to determine a first core actuator with the least amount of tasks from the multiple actuators, determine whether the amount of tasks of the first core actuator is less than a first preset amount, and if the amount of tasks of the first core actuator is less than the first preset amount, determine the first core actuator as the target actuator, so that the target actuator can be determined efficiently by preferentially selecting the core actuator with the least amount of tasks, thereby improving the execution efficiency of the tasks.
In one possible embodiment, the method further comprises:
determining whether a plurality of actuators matched with the target strategy comprise non-core actuators or not under the condition that the task quantity of the first core actuator is not less than a first preset quantity;
in the case that the plurality of actuators matched with the target strategy comprise non-core actuators, determining a first non-core actuator with the minimum task amount from the plurality of actuators matched with the target strategy;
determining whether the task amount of the first non-core executor is smaller than a first preset amount;
and determining the first non-core executor as a target executor under the condition that the task quantity of the first non-core executor is smaller than a first preset quantity.
In this embodiment, after determining that the task amount of the first core executor is not less than the second preset amount, it is necessary to determine whether a first non-core executor with the minimum task amount is included in the plurality of task amounts, if the first non-core executor with the minimum task amount is included in the plurality of task amounts, it is necessary to further determine whether the task amount of the first non-core executor is less than the first preset amount, if the task amount of the first non-core executor is less than the first preset amount, it is possible to determine the first non-core executor as the target executor, so that the target executor can be determined efficiently, the situation that the task waiting time is too long due to saturation of the core executor is reduced, and the execution efficiency of the task is improved.
In one possible embodiment, the method further comprises:
determining a number of the plurality of actuators matching the target policy in the case that the non-core actuators are not included in the plurality of actuators matching the target policy;
and under the condition that the number of the plurality of executors matched with the target strategy is smaller than a second preset number, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain a core executor matched with the target strategy, and determining the core executor matched with the target strategy as the target executor.
In this embodiment, after determining that the plurality of actuators matched with the target policy do not include non-core actuators, determining the number of the plurality of actuators, and performing capacity expansion processing on the core actuators in the task scheduling system after determining that the number of the plurality of actuators is smaller than the second preset number, so that after the number of the core actuators in the plurality of actuators does not exceed the number of the core actuators configured in advance, the core actuators in the task scheduling system can be increased, the occurrence of the situation that the type configuration errors of the actuators are reduced, and the configuration accuracy of the actuators is improved.
In one possible embodiment, the method further comprises:
And under the condition that the number of the plurality of actuators matched with the target strategy is not smaller than a second preset number, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain non-core actuators matched with the target strategy, and determining the non-core actuators matched with the target strategy as target actuators.
In this embodiment, capacity expansion processing is performed on the non-core executors in the task scheduling system only when the number of the plurality of executors is not less than the second preset number, so that the occurrence of excessive registration of the non-core executors can be reduced, and the utilization rate of the executors is improved.
In one possible embodiment, the method further comprises:
and under the condition that the task quantity of the first non-core executor is not smaller than the first preset quantity, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain the non-core executor matched with the target strategy, and determining the non-core executor matched with the target strategy as the target executor.
In this embodiment, if the task amount of the first non-core executor is not less than the first preset amount, it is indicated that the core executor in the task scheduling system has reached the preset core executor amount, so that capacity expansion operation can be directly performed on the non-core executor in the task scheduling system, so that the target executor can be determined efficiently, and further, the execution efficiency of the task is improved.
In one possible embodiment, the method further comprises:
and under the condition that an actuator matched with the target strategy does not exist in the task scheduling system, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain a core actuator matched with the target strategy, and determining the core actuator matched with the target strategy as the target actuator.
In this embodiment, if there is no actuator matching with the target policy in the task scheduling system, capacity expansion processing may be directly performed on the core actuator in the task scheduling system, so that the efficiency of determining by the target actuator may be improved, and further, the execution efficiency of the task may be improved.
In one possible embodiment, the method further comprises:
acquiring a first task in a queuing state and a second task in a proceeding state;
outputting first prompt information under the condition that the queuing time of the first task in the queuing state exceeds a first preset time;
and outputting second prompt information under the condition that the running time of the second task in the running state exceeds a second preset time.
In this embodiment, if the queuing time of the first task in the queuing state exceeds the first preset time, the first prompt message is output, so that the situation that the queuing time of the task is too long can be reminded, the system can conveniently monitor the task in real time, and the capacity of the executor is expanded in time. If the running time of the second task in the running state exceeds the second preset time, outputting second prompt information, so that the situation that the running time of the task is overlong can be reminded, the system can conveniently monitor the task in real time, the working condition of the executor can be monitored in time, and the situation that the running time of the task is overlong due to the abnormality of the executor is reduced.
In one possible embodiment, the method further comprises:
determining the number of tasks of a first task in a queuing state;
and performing capacity expansion operation on the task scheduling system under the condition that the number of tasks of the first task exceeds a third preset number and the duration time when the number of tasks exceeds the third preset number exceeds a third preset time.
In this embodiment, if the number of tasks in the queuing state exceeds the third preset number, and the duration time when the number of tasks exceeds the third preset number exceeds the third preset time, it is indicated that the current task amount is larger, so that the capacity expansion operation needs to be performed on the task scheduling system, so that according to the actual situation of the executor in the task scheduling system, the capacity expansion process can be performed on the executor automatically, the situation that the waiting time is too long due to too many tasks is reduced, and the execution efficiency of the tasks is improved.
In one possible implementation manner, the capacity expansion operation on the task scheduling system includes:
determining whether an executing device or an abnormal executing device in starting exists in the task scheduling system;
and when the starting executor or abnormal executor does not exist in the task scheduling system, performing capacity expansion operation on the task scheduling system.
In this embodiment, the capacity expansion processing is performed on the task scheduling system only when there is no active or abnormal actuator in the task scheduling system, so that the occurrence of excessive capacity expansion of the actuator is reduced, and the capacity expansion accuracy of the actuator is improved.
In one possible embodiment, the method further comprises:
determining the starting duration of the starting actuator in the task scheduling system when the starting actuator exists in the task scheduling system;
under the condition that the starting duration exceeds a fourth preset time, starting detection is carried out on the starting actuator, and a first detection result is obtained;
in a case where the first detection result indicates that the starting actuator can be started normally, the execution state of the starting actuator is determined to be a normal state.
In this embodiment, if the starting time of the actuator is too long, the actuator needs to be detected to determine whether the actuator can be started normally, so that the actuator with too long starting time can be automatically detected, the situation that the actuator is directly deleted due to too long starting time is reduced, and the detection accuracy of the actuator is improved.
In one possible embodiment, the method further comprises:
in the case where the first detection result indicates that the starting actuator cannot be started normally, the execution state of the starting actuator is determined to be an abnormal state, and the deleting operation is performed on the actuator in the abnormal state.
In this embodiment, when it is determined that the actuator cannot be started normally, the abnormal state of the actuator is determined, and the actuator in the abnormal state is deleted, so that the abnormal actuator can be processed in time, and the influence on the subsequent task execution work due to the abnormal actuator can be reduced.
In one possible embodiment, the method further comprises:
under the condition that an abnormal executor exists in the task scheduling system, recovering and detecting the abnormal executor to obtain a second detection result;
and modifying the execution state of the abnormal executor to a normal state under the condition that the second detection result indicates that the abnormal executor can normally execute the task.
In this embodiment, if an abnormal executor exists in the task scheduling system, the abnormal executor needs to be detected to determine whether the abnormal executor can normally execute the task, so that the abnormal executor can be automatically detected, the occurrence of the condition that the executor is directly deleted is reduced, and the detection accuracy of the executor is improved.
In one possible embodiment, the method further comprises:
and in the case that the second detection result indicates that the abnormal executor can not normally execute the task, performing a deleting operation on the abnormal executor, and resetting the execution state of the task associated with the abnormal executor to be a queuing state.
In this embodiment, when it is determined that the abnormal executor cannot normally execute a task, the abnormal executor is deleted, and the execution state of the task associated with the abnormal executor is reset to the queuing state, so that the abnormal executor can be processed in time, and occurrence of a situation that the task cannot be executed in time due to the influence of the abnormal executor is reduced.
In one possible embodiment, the method further comprises:
determining whether a non-core executor in an idle state exists in a task scheduling system;
and under the condition that the idle state non-core executor exists in the task scheduling system and the idle time of the idle state non-core executor exceeds the fifth preset time, deleting the idle state non-core executor.
In the embodiment, the non-core executor with overlong idle time can be deleted, so that capacity reduction processing is performed on the task scheduling system, resource waste caused by small task quantity is reduced, and the configuration cost of the executor is saved.
In a second aspect, the present invention provides a task scheduling device, including:
the time acquisition module is used for acquiring the target time information in real time;
the first determining module is used for determining a target strategy corresponding to the target task from the strategy table under the condition that the target time information is the target execution time of the target task, wherein the target execution time is determined by the first execution time and the execution interval of the target task, and the first execution time and the execution interval are stored in the timing task related table in advance;
the second determining module is used for determining whether an actuator matched with the target strategy exists in the task scheduling system;
and the task execution module is used for determining the executor matched with the target strategy as a target executor and controlling the target executor to execute the target task under the condition that the executor matched with the target strategy exists in the task scheduling system.
In one possible implementation manner, the second determining module is specifically configured to:
acquiring an execution parameter corresponding to a target task in a policy table;
generating an encapsulation file based on the execution parameters and the target execution time, storing the encapsulation file in a task table, and setting the execution state of the target task as a queuing state;
Acquiring all tasks in a queuing state in a task table;
determining a first task with the forefront target execution time in a task table based on the target execution time of each first task in a queuing state;
and determining whether an actuator matched with the target strategy exists in the task scheduling system under the condition that the first task with the forefront target execution time in the task table is the target task.
In one possible implementation manner, the task execution module is specifically configured to:
determining whether the task quantity of the executor matched with the target strategy is smaller than a first preset quantity or not under the condition that the executor matched with the target strategy exists in the task scheduling system;
and determining the actuator matched with the target strategy as the target actuator under the condition that the task quantity of the actuator matched with the target strategy is smaller than the first preset quantity.
In one possible implementation manner, the task execution module is specifically configured to:
and under the condition that the task quantity of the executor matched with the target strategy is not smaller than the first preset quantity, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain the target executor.
In one possible implementation manner, in a case that it is determined that there are a plurality of actuators matching the target policy, the actuators are core actuators or non-core actuators, and the task execution module is specifically configured to:
In the case that a plurality of actuators matched with a target strategy exist in the task scheduling system, determining a first core actuator with the minimum task quantity from the plurality of actuators matched with the target strategy;
determining whether the task amount of the first core executor is smaller than a first preset amount;
and determining the first core executor as a target executor under the condition that the task quantity of the first core executor is smaller than a first preset quantity.
In one possible implementation manner, the task execution module is specifically configured to:
determining whether a plurality of actuators matched with the target strategy comprise non-core actuators or not under the condition that the task quantity of the first core actuator is not less than a first preset quantity;
in the case that the plurality of actuators matched with the target strategy comprise non-core actuators, determining a first non-core actuator with the minimum task amount from the plurality of actuators matched with the target strategy;
determining whether the task amount of the first non-core executor is smaller than a first preset amount;
and determining the first non-core executor as a target executor under the condition that the task quantity of the first non-core executor is smaller than a first preset quantity.
In one possible implementation manner, the task execution module is specifically configured to:
Determining a number of the plurality of actuators matching the target policy in the case that the non-core actuators are not included in the plurality of actuators matching the target policy;
and under the condition that the number of the plurality of executors matched with the target strategy is smaller than a second preset number, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain a core executor matched with the target strategy, and determining the core executor matched with the target strategy as the target executor.
In one possible implementation manner, the task execution module is specifically configured to:
and under the condition that the number of the plurality of actuators matched with the target strategy is not smaller than a second preset number, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain non-core actuators matched with the target strategy, and determining the non-core actuators matched with the target strategy as target actuators.
In one possible implementation manner, the task execution module is specifically configured to:
and under the condition that the task quantity of the first non-core executor is not smaller than the first preset quantity, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain the non-core executor matched with the target strategy, and determining the non-core executor matched with the target strategy as the target executor.
In a possible implementation manner, the task execution module is further configured to, in a case that there is no actuator matching the target policy in the task scheduling system, perform capacity expansion operation on the task scheduling system based on the target policy, obtain a core actuator matching the target policy, and determine the core actuator matching the target policy as the target actuator.
In one possible embodiment, the apparatus further comprises:
the information output module is used for acquiring a first task in a queuing state and a second task in a proceeding state;
outputting first prompt information under the condition that the queuing time of the first task in the queuing state exceeds a second preset time;
and outputting second prompt information under the condition that the running time of the second task in the running state exceeds a third preset time.
In one possible implementation manner, the information output module is specifically configured to:
determining the number of tasks of a first task in a queuing state;
and performing capacity expansion operation on the task scheduling system under the condition that the number of tasks of the first task exceeds a third preset number and the duration time when the number of tasks exceeds the third preset number exceeds a third preset time.
In one possible implementation manner, the task execution module is specifically configured to:
determining whether an executing device or an abnormal executing device in starting exists in the task scheduling system;
and when the starting executor or abnormal executor does not exist in the task scheduling system, performing capacity expansion operation on the task scheduling system.
In one possible implementation manner, the task execution module is specifically configured to:
determining the starting duration of the starting actuator in the task scheduling system when the starting actuator exists in the task scheduling system;
under the condition that the starting duration exceeds a fourth preset time, starting detection is carried out on the starting actuator, and a first detection result is obtained;
in a case where the first detection result indicates that the starting actuator can be started normally, the execution state of the starting actuator is determined to be a normal state.
In one possible implementation manner, the task execution module is specifically configured to:
in the case where the first detection result indicates that the starting actuator cannot be started normally, the execution state of the starting actuator is determined to be an abnormal state, and the deleting operation is performed on the actuator in the abnormal state.
In one possible implementation manner, the task execution module is specifically configured to:
under the condition that an abnormal executor exists in the task scheduling system, recovering and detecting the abnormal executor to obtain a second detection result;
and modifying the execution state of the abnormal executor to a normal state under the condition that the second detection result indicates that the abnormal executor can normally execute the task.
In one possible implementation manner, the task execution module is specifically configured to:
and in the case that the second detection result indicates that the abnormal executor can not normally execute the task, performing a deleting operation on the abnormal executor, and resetting the execution state of the task associated with the abnormal executor to be a queuing state.
In one possible implementation manner, the task execution module is specifically configured to:
determining whether a non-core executor in an idle state exists in a task scheduling system;
and under the condition that the idle state non-core executor exists in the task scheduling system and the idle time of the idle state non-core executor exceeds the fifth preset time, deleting the idle state non-core executor.
In a third aspect, the present application provides a task scheduling system, including: the system comprises an access module, a dispatching center and an execution module;
The access module is used for determining a target strategy corresponding to the target task from the strategy table under the condition that the target time information is the target execution time of the target task, wherein the target execution time is determined by the first execution time and the execution interval of the target task, and the first execution time and the execution interval are stored in the timing task related table in advance;
the scheduling center is used for determining whether an actuator matched with the target strategy exists in the execution module, and determining the actuator matched with the target strategy as a target actuator under the condition that the actuator matched with the target strategy exists in the execution module;
the execution module is used for controlling the target executor to execute the target task.
In one possible implementation, the scheduling center includes a scheduling module;
the access module is also used for acquiring the execution parameters corresponding to the target task in the policy table, generating an encapsulation file based on the execution parameters and the target execution time, storing the encapsulation file in the task table, and setting the execution state of the target task as a queuing state;
the scheduling module is used for acquiring all the first tasks in the queuing state in the task table, determining the first task with the forefront target execution time in the task table based on the target execution time of each first task in the queuing state, and determining whether an executor matched with the target strategy exists in the execution module under the condition that the first task with the forefront target execution time in the task table is the target task.
In one possible implementation manner, the scheduling module is further configured to determine, if there is an actuator matching the target policy in the executing module, whether a task amount of the actuator matching the target policy is less than a first preset number, and determine, if the task amount of the actuator matching the target policy is less than the first preset number, the actuator matching the target policy as the target actuator.
In one possible implementation, the dispatch center includes a capacity expansion module;
the capacity expansion module is used for carrying out capacity expansion operation on the execution module based on the target strategy under the condition that the task quantity of the executor matched with the target strategy is not less than the first preset quantity so as to obtain the target executor.
In one possible implementation manner, the scheduling module is further configured to determine, in a case where there are a plurality of actuators matching the target policy in the execution module, a first core actuator with a minimum task amount from the plurality of actuators matching the target policy, determine whether the task amount of the first core actuator is less than a first preset number, and determine the first core actuator as the target actuator in a case where the task amount of the first core actuator is less than the first preset number.
In one possible implementation manner, the scheduling module is further configured to determine whether a non-core actuator is included in the plurality of actuators matching the target policy if the task amount of the first core actuator is not less than a first preset number, and determine, if the non-core actuator is included in the plurality of actuators matching the target policy, a first non-core actuator with the minimum task amount from the plurality of actuators matching the target policy;
the scheduling module is also used for determining whether the task quantity of the first non-core executor is smaller than a first preset quantity; and determining the first non-core executor as a target executor under the condition that the task quantity of the first non-core executor is smaller than a first preset quantity.
In one possible implementation, the scheduling module is further configured to determine a number of the plurality of actuators matching the target policy if no non-core actuators are included in the plurality of actuators matching the target policy;
the capacity expansion module is further used for performing capacity expansion operation on the execution module based on the target strategy under the condition that the number of the plurality of actuators matched with the target strategy is smaller than a second preset number so as to obtain a core actuator matched with the target strategy;
The scheduling module is also used for determining the core executor matched with the target strategy as the target executor.
In a possible implementation manner, the capacity expansion module is further configured to perform capacity expansion operation on the execution module based on the target policy, so as to obtain a non-core executor matched with the target policy, where the number of the plurality of executors matched with the target policy is not less than a second preset number;
the scheduling module is also used for determining the non-core executor matched with the target strategy as the target executor.
In a possible implementation manner, the capacity expansion module is further configured to perform capacity expansion operation on the execution module based on the target policy, so as to obtain a non-core executor matched with the target policy, where the task amount of the first non-core executor is not less than the first preset number;
the scheduling module is also used for determining the non-core executor matched with the target strategy as the target executor.
In a possible implementation manner, the capacity expansion module is further configured to perform capacity expansion operation on the execution module based on the target policy, so as to obtain a core executor that matches the target policy;
the scheduling module is also used for determining the core executor matched with the target strategy as the target executor.
In one possible implementation, the scheduling center further includes an exception module;
the exception module is used for acquiring a first task in a queuing state and a second task in a proceeding state, outputting first prompt information when the queuing time of the first task in the queuing state exceeds a first preset time, and outputting second prompt information when the proceeding time of the second task in the proceeding state exceeds a second preset time.
In a possible implementation manner, the scheduling module is further configured to determine a task number of the first task in the queuing state;
the capacity expansion module is further configured to perform capacity expansion operation on the execution module when the number of tasks of the first task exceeds a third preset number and the duration time when the number of tasks exceeds the third preset number exceeds a third preset time.
In one possible implementation manner, the capacity expansion module is specifically configured to:
determining whether an executing module has an executing device or an abnormal executing device in starting;
and when the executing module does not have the starting actuator or the abnormal actuator, performing capacity expansion operation on the executing module.
In one possible embodiment, the exception module is further configured to determine a start duration of the active actuator in the execution module if the active actuator is present in the execution module;
The abnormal module is also used for performing starting detection on the starting executor under the condition that the starting duration exceeds a fourth preset time to obtain a first detection result;
the abnormality module is further configured to determine an execution state of the starting actuator as a normal state, in a case where the first detection result indicates that the starting actuator is able to be started normally.
In one possible implementation manner, the exception module is further configured to determine an execution state of the executing actuator in the starting state as an exception state and perform a delete operation on the executing actuator in the exception state, where the first detection result indicates that the executing actuator in the starting state cannot be started normally.
In a possible implementation manner, the exception module is further configured to perform recovery detection on the exception executor when the exception executor exists in the execution module, obtain a second detection result, and modify an execution state of the exception executor to a normal state when the second detection result indicates that the exception executor can normally execute the task.
In one possible implementation manner, the exception module is further configured to, in a case where the second detection result indicates that the exception executor cannot normally execute the task, perform a delete operation on the exception executor, and reset an execution state of the task associated with the exception executor to a queuing state.
In one possible implementation manner, the exception module is further configured to determine whether an idle non-core executor exists in the execution module, and delete the idle non-core executor when the idle non-core executor exists in the execution module and the idle time of the idle non-core executor exceeds a fifth preset time.
In one possible implementation, the task scheduling system further includes a storage module;
the access module is also used for calling an adding strategy interface and a timing task adding interface so as to configure strategy parameters and timing task parameters of the target task;
the storage module is used for storing the strategy parameters of the target task into a strategy table and storing the timing task parameters of the target task into a timing task related table;
the storage module is also used for storing a task table and an actuator table, and the actuator table is used for storing all actuators in the execution module.
In one possible implementation manner, the task scheduling system further comprises a registration module and a configuration module;
the registration module is used for registering the executor;
The configuration module is used for configuring the first preset quantity, the second preset quantity, the third preset quantity, the first preset time, the second preset time, the third preset time, the fourth preset time and the fifth preset time.
In a fourth aspect, embodiments of the present application further provide an electronic device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication via the bus when the electronic device is running, the machine-readable instructions when executed by the processor perform the task scheduling method described in any one of the possible embodiments above.
In a fifth aspect, embodiments of the present application further provide a computer readable storage medium having a computer program stored thereon, which when executed by a processor performs a task scheduling method as described in any one of the possible embodiments above.
For a detailed description of the second to fifth aspects and various implementations thereof in this application, reference may be made to the detailed description of the first aspect and various implementations thereof; moreover, the advantages of the second aspect and the various implementations thereof may be referred to as analyzing the advantages of the first aspect and the various implementations thereof, and will not be described herein.
These and other aspects of the present application will be more readily apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart of a task scheduling method according to an embodiment of the present application;
FIG. 2 is a flowchart of a method for determining whether an actuator matching a target policy exists in a task scheduling system according to an embodiment of the present application;
FIG. 3 is a flowchart of a method for determining a target actuator according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a registration executor according to an embodiment of the present application;
FIG. 5 is a flowchart of another method for determining a target actuator according to an embodiment of the present disclosure;
FIG. 6 is a flowchart of a method for detecting an actuator in a task scheduling system according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a task scheduling device according to an embodiment of the present application;
FIG. 8 is a schematic structural diagram of another task scheduling device according to an embodiment of the present disclosure;
fig. 9 is a schematic structural diagram of a task scheduling system according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a scheduling center in a task scheduling system according to an embodiment of the present application;
FIG. 11 is a schematic diagram of another task scheduling system according to an embodiment of the present disclosure;
fig. 12 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms "first," "second," and the like, are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present invention, unless otherwise indicated, the meaning of "a plurality" is two or more.
According to research, the existing task scheduling method is generally suitable for the conditions of small task quantity and single task type, however, along with the increasing of the task quantity, the task type becomes more complex, if the task scheduling method is used for executing corresponding tasks, the situation that the task execution is disordered due to the fact that one execution end needs to execute different types of tasks can occur, and therefore management of a task scheduling system is not facilitated, and finally the execution speed of the tasks is influenced.
In view of the above problems, an embodiment of the present application provides a task scheduling method, including: acquiring target time information in real time; when the target time information is the target execution time of the target task, determining a target strategy corresponding to the target task from a strategy table, wherein the target execution time is determined by the first execution time and the execution interval of the target task, and the first execution time and the execution interval are stored in a timing task related table in advance; determining whether an actuator matched with a target strategy exists in the task scheduling system; and when the executor matched with the target strategy exists in the task scheduling system, determining the executor matched with the target strategy as a target executor, and controlling the target executor to execute the target task.
In the embodiment of the application, after the execution time of the target task is reached, the executor matched with the target strategy in the task scheduling system is determined to be the target executor, and the target executor is controlled to execute the target task, so that the target executor is matched with the target task, that is, different strategies correspond to different executors, each executor can execute the corresponding task in a targeted manner, the task scheduling system is convenient to manage, the occurrence of disordered task execution is reduced, and the execution speed of the task is further improved.
The task scheduling method provided in the embodiment of the present application is described below.
Referring to fig. 1, a flowchart of a task scheduling method provided in an embodiment of the present application is shown, where the method includes steps S101 to S104:
s101, acquiring target time information in real time.
The target time information refers to the current time, and includes the year, month, date, hour, minute and second of the current time, for example, the target time information may be 2022-12-06 11:00:00.
S102, when the target time information is the target execution time of the target task, determining a target strategy corresponding to the target task from a strategy table, wherein the target execution time is determined by the first execution time and the execution interval of the target task, and the first execution time and the execution interval are stored in the timing task related table in advance.
Specifically, after the target time information is acquired, it is necessary to determine whether the target time information reaches the target execution time of the target task. The target execution time is determined by the first execution time and the execution interval of the target task, and the first execution time and the execution interval are stored in the timing task related table in advance. The timing task correlation table includes a start date (start date), a group name (group name), a task class (job c l ass), a task name (job name), a policy type (strategy type), a time interval (time i nterva l), and a time unit (time unit). The time units include minutes (f), hours (h), weeks (w), or months (m). For example, the parameter format of the timing task in the timing task correlation table may be set to { "startDate": "2022-09-2711:00:00", "groupName": "test", "jobC l ass": "Un l oad I ngC l ass", "jobName": "strategyId", "strategyType": "many", "t time I nterva l":15 "," t imeUn it ":" f "}. It will be appreciated that the timing task is executed for the first time 2022-09-27:11:00:00, and then executed every 15 minutes, that is, the target execution time may be 2022-09-2711:00:00, 2022-09-27:11:15:00, or the like.
In one possible implementation, if the target time information is the target execution time of the target task, a target policy corresponding to the target task is determined from the policy table. The policy table includes execution time (execution time t time), source file absolute path (source f i l e abso l ute path), source server I P (source server I p), source server password (source server password), source server port (source server port), source server type (source serves type), source server user name (source server username), policy name (strategyname), target file absolute path (target f i l e abso l ute path), target server I P (target server I p), target server password (target server password), target server port (target server port), target server type (target server type), target server user name (target server username), task type (task type), time interval (t time i nterva l), and time unit (t time unit). The time units include minutes (f), hours (h), weeks (w), or months (m). For example, the parameter format of the policies in the policy table may be set to { "exectyName": "2022-09-2711:00:00", "sourceFi l eAbso l utePath": "/test/", "sourceServerp": "127.0.0.1", "sourcePastword": "test", "sourceServerPort": "9090": "sour ceServerType": "ftp", "sourceServerUsername": "root", "strategyName": "ftp transfer test policy", "targetF I l eAbso l utePath": "/target", "targetServerp": "127.0.1", "targetServerPawoad": "test", "targetServerPort": "9091", "targetServe rType" "ftp", "targetServername": "zou", "tarkType": "ftware": 15 ": uf.
The contents of the timing task correlation table and the policy table are stored in advance by the manager. Specifically, uploading an execution logic mirror image of a timing task to a container center, configuring a mirror image name of the timing task, calling an adding strategy interface to configure strategy parameters corresponding to the timing task, and finally calling a job scheduling frame (Quartz) timing task adding interface to configure task parameters corresponding to the timing task. The execution logic mirror image is obtained by packaging source codes corresponding to a certain timing task, namely, the mirror image is in a file storage form. The container center may include a logical mirror of execution of a plurality of timed tasks. It will be appreciated that the timed task correlation table as well as the policy table are stored in a database. In this embodiment, the database is a relational database management system (MySQL).
S103, determining whether an actuator matched with the target strategy exists in the task scheduling system.
Specifically, after determining the target policy corresponding to the target task, it may be determined whether there is an actuator in the task scheduling system that matches the target policy. It will be appreciated that the executors may be used to execute different types of tasks, with the type of task being determined from parameters in the target policy, and thus, it is desirable to determine whether there is an executor in the task scheduling system that matches the target policy.
It should be noted that, there may be multiple manners of determining the executor matching with the target policy, for example, different types of timing tasks may be put in the same mirror image, and when executing the task, the class for executing the corresponding type of task may be obtained by using the factory model; different types of timed tasks can also be packaged into different images and configured in a configuration file for dynamic pulling by a scheduler.
In a possible implementation manner, referring to fig. 2, a flowchart of a method for determining whether an actuator matching a target policy exists in a task scheduling system according to an embodiment of the present application is shown, where the method includes the following S1031 to S1035:
s1031, obtaining the execution parameters corresponding to the target task in the policy table.
Specifically, after reaching the target execution time, the policy configured by the target task needs to be searched from the policy table to obtain the execution parameters corresponding to the policy.
S1032, generating an encapsulation file based on the execution parameters and the target execution time, storing the encapsulation file in the task table, and setting the execution state of the target task as a queuing state.
Specifically, after the execution parameters are acquired, the execution parameters need to be packaged, and after the timestamp of the target execution time is marked, the packaging file is stored in the task table, and meanwhile, the execution state of the target task is set to be a queuing state. It will be appreciated that the task table is stored in a database.
S1033, obtaining all the first tasks in the queuing state in the task list.
The first task refers to a task in a queuing state in a task table.
S1034, determining the first task with the forefront target execution time in the task list based on the target execution time of each first task in the queuing state.
Specifically, after all the first tasks in the queuing state in the task table are acquired, the first task with the forefront target execution time is determined from the task table according to the target execution time of each first task in the queuing state.
In one possible implementation manner, according to the target execution time of each first task in the queuing state, the first tasks in the queuing state in the task table are arranged according to a preset sequence to obtain a task list, and based on the task list, the first task with the forefront target execution time is determined. The preset sequence comprises a positive sequence arrangement or a reverse sequence arrangement. Thus, the first task with the forefront target execution time can be quickly determined.
S1035, determining whether an executor matched with the target strategy exists in the task scheduling system when the first task with the forefront target execution time in the task table is the target task.
For example, if the first task with the forefront target execution time is the target task, whether an actuator matched with the target strategy exists in the task scheduling system can be directly determined; if the first task with the forefront target execution time is not the target task, the target task is required to wait continuously, and whether an actuator matched with the target strategy exists in the task scheduling system is determined until the target task is the first task with the forefront target execution time in the task table. Therefore, the tasks can be orderly executed, the occurrence of the condition that the tasks are not executed for a long time is reduced, and the timeliness of task execution is improved.
S104, when the task scheduling system has the executor matched with the target strategy, determining the executor matched with the target strategy as the target executor, and controlling the target executor to execute the target task.
Specifically, if an actuator matched with the target strategy exists in the task scheduling system, determining the actuator matched with the target strategy as a target actuator, and controlling the target actuator to execute the target task. It will be appreciated that the number of actuators matching the target strategy is 1, and therefore, without selecting an actuator, an actuator matching the target strategy may be directly determined as the target actuator.
In a possible implementation manner, referring to fig. 3, a flowchart of a method for determining a target actuator provided in an embodiment of the present application includes the following steps S301 to S305:
s301, determining whether an actuator matched with a target strategy exists in a task scheduling system; if yes, go to step S302; if not, step S305 is performed.
For example, if there is an actuator matching the target policy in the task scheduling system, the task amount of the actuator matching the target policy needs to be further determined; if the task scheduling system does not have an actuator matched with the target strategy, the task scheduling system needs to be expanded according to the target strategy to obtain the target actuator. The task amount refers to the number of tasks currently being executed by the executor.
S302, determining whether the task quantity of the executor matched with the target strategy is smaller than a first preset quantity; if yes, go to step S303; if not, step S304 is performed.
Specifically, after determining that the task scheduling system has the actuators matched with the target strategy, further determining whether the task quantity of the actuators matched with the target strategy is smaller than a first preset quantity, and if the task quantity of the actuators matched with the target strategy is smaller than the first preset quantity, directly determining the actuators matched with the target strategy as target actuators; if the task quantity of the executor matched with the target strategy is not less than the first preset quantity, the capacity of the task scheduling system is required to be expanded according to the target strategy so as to obtain the target executor.
It can be appreciated that the first preset number is a task number threshold in progress under the actuator, and the first preset number can be set in a configuration module according to actual requirements, and the configuration module can perform hot deployment configuration through a configuration center (dynami c nami ng and configurat ion service, nacos). The hot deployment is that when the application is in an operating state, after the project source code is modified, compiled contents are deployed on a server without restarting the application, so that the modification is immediately effective.
S303, determining the actuator matched with the target strategy as a target actuator.
Specifically, after determining that the task amount of the actuator matched with the target strategy is smaller than the first preset amount, the actuator matched with the target strategy may be directly determined as the target actuator. Therefore, the occurrence of overload of the task amount of a certain executor can be reduced, the execution task of the executor can be conveniently and timely adjusted, and further the execution efficiency of the task is improved.
S304, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain a target executor.
Specifically, after determining that the task quantity of the executor matched with the target strategy is not less than the first preset quantity, the executor in the task scheduling system needs to be expanded according to the target strategy to obtain the target executor.
For example, the executor may be registered by calling an open source container orchestration system (Kubernetes, k8 s) to implement the capacity expansion operation of the task scheduling system. Therefore, the execution tasks of the executors can be regulated in a balanced manner, the occurrence of overload of the task amount of one executor is reduced, and the execution efficiency of the tasks is improved.
S305, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain a core executor matched with the target strategy, and determining the core executor matched with the target strategy as the target executor.
Specifically, after determining that an actuator matched with a target strategy does not exist in the task scheduling system, performing capacity expansion operation on the task scheduling system according to the target strategy to obtain a core actuator matched with the target strategy, and determining the core actuator matched with the target strategy as the target actuator. It can be understood that if there is no actuator matching with the target policy in the task scheduling system, it is indicated that the actuator matching with the target policy is not registered in the task scheduling system, and therefore, it can be determined that the expanded actuator is necessarily a core actuator. Therefore, the efficiency of determining the target executor can be improved, and the execution efficiency of the task is improved.
It should be noted that, the executor in the task scheduling system may be a core executor or a non-core executor. Specifically, the manager configures the number of core executors in advance through the configuration module, and the registered executors in the number are all core executors, but if the registered number of core executors reaches the number, the registration of the core executors cannot be continued, but in the embodiment, the dynamic expansion and contraction of the executors can be realized, so that even if the registered number of core executors reaches the preset number, the non-core executors can be registered, so that the execution efficiency of tasks is improved.
In one possible implementation, referring to fig. 4, a schematic diagram of a registration actuator provided in this embodiment of the present application, specifically, when registering the actuator through the Kubernetes interface, some necessary parameters, such as the actuator i d, are introduced, and the actuator is in an active state. After the executor is successfully started, the distributed application coordination service software (zookeeper) uploads some necessity information such as the executor id to finish the registration of the executor, so that the dispatching center can find out the registered executor and control the executor to execute corresponding tasks. Meanwhile, the dispatching center can monitor whether the executor can normally execute the task through the zookeeper, and can modify the state of the executor. It will be appreciated that the corresponding registration information for the actuator is stored in the actuator table.
In the embodiment of the application, after the execution time of the target task is reached, the executor matched with the target strategy in the task scheduling system is determined to be the target executor, and the target executor is controlled to execute the target task, so that the target executor is matched with the target task, that is, different strategies correspond to different executors, each executor can execute the corresponding task in a targeted manner, the task scheduling system is convenient to manage, the occurrence of disordered task execution is reduced, and the execution speed of the task is further improved.
In a possible implementation manner, there may be a plurality of actuators matching the target policy, so that a target actuator meeting the condition needs to be selected, specifically, referring to fig. 5, another flowchart of a method for determining a target actuator provided in the embodiment of the present application includes the following steps S501 to S510:
s501, in a case where there are a plurality of actuators matching the target policy in the task scheduling system, a first core actuator having the smallest task amount is determined from the plurality of actuators matching the target policy.
Specifically, after determining that the task scheduling system has the plurality of actuators as the actuators matching the target policy, the first core actuator with the least task amount needs to be determined from the plurality of actuators.
S502, determining whether the task quantity of the first core executor is smaller than a first preset quantity; if yes, go to step S503; if not, step S504 is performed.
Specifically, after determining the first core executor, one step is needed to determine whether the task amount of the first core executor is smaller than the first preset number, if the task amount of the first core executor is smaller than the first preset number, the first core executor can be directly determined as a target executor; if the task amount of the first core executor is not less than the first preset amount, it is further determined whether the plurality of executors matched with the target strategy include non-core executors.
S503, determining the first core executor as a target executor.
Specifically, after determining that the task amount of the first core executor is smaller than the first preset amount, the first core executor may be directly determined as the target executor. Therefore, the target executor can be determined efficiently by selecting the core executor with the minimum task quantity preferentially, and further the execution efficiency of the task is improved.
S504, determining whether a plurality of actuators matched with the target strategy comprise non-core actuators; if yes, go to step S505; if not, step S508 is performed.
Specifically, after determining that the task amount of the first core executor is not less than the first preset amount, further determining whether a plurality of executors matched with the target strategy include non-core executors or not is needed, if the plurality of executors include the non-core executors, determining the first non-core executor with the minimum task amount from the plurality of executors; if the plurality of actuators does not include non-core actuators, it is indicated that the plurality of actuators are core actuators, and therefore, it is necessary to determine the number of the plurality of actuators matching the target policy.
S505, determining a first non-core actuator with the minimum task amount from a plurality of actuators matched with the target strategy.
Specifically, after determining that the plurality of actuators includes the non-core actuator, a first non-core actuator having the smallest number of tasks needs to be determined from the plurality of actuators.
S506, determining whether the task quantity of the first non-core executor is smaller than a first preset quantity; if yes, go to step S507; if not, step S510 is performed.
Specifically, after determining the first non-core actuator with the minimum task amount from the plurality of actuators, further determining whether the task amount of the first non-core actuator is smaller than a first preset amount, if the task amount of the first non-core actuator is smaller than the first preset amount, determining the first non-core actuator as the target actuator directly; if the task quantity of the first non-core executor is not smaller than the first preset quantity, the capacity of the task scheduling system is required to be expanded according to the target strategy so as to obtain the non-core executor.
S507, determining the first uncore actuator as a target actuator.
Specifically, after determining that the task amount of the first non-core actuator is less than the first preset amount, the first non-core actuator may be directly determined as the target actuator. Therefore, the target executor can be determined efficiently, the condition that the waiting time of the task is too long due to the saturation of the core executor is reduced, and the execution efficiency of the task is improved.
S508, determining the number of core actuators in the plurality of actuators matched with the target strategy.
Specifically, after determining that the non-core actuators are not included in the plurality of actuators matching the target policy, it is necessary to determine the number of the plurality of actuators matching the target policy.
And S509, performing capacity expansion operation on the task scheduling system based on the target strategy under the condition that the number of the plurality of actuators matched with the target strategy is smaller than a second preset number, obtaining a core actuator matched with the target strategy, and determining the core actuator matched with the target strategy as the target actuator.
Specifically, after determining the number of the plurality of actuators matching the target strategy, it is necessary to further determine whether the number of the plurality of actuators matching the target strategy is smaller than the second preset number. The second preset number is a threshold number of core actuators matched with the target strategy. The second preset number can be set in the configuration module according to actual requirements. It will be appreciated that the preset number of core actuators corresponding to different task types may be different or the same, and is not specifically limited. For example, the preset number of the core actuators of the task type a is 3, and the preset number of the core actuators of the task type B is 4.
In a possible implementation manner, if the number of the plurality of actuators matched with the target policy is smaller than the second preset number, the capacity of the core actuators in the task scheduling system can be expanded according to the target policy to obtain the core actuators matched with the target policy, so that after the number of the core actuators in the plurality of actuators does not exceed the number of the core actuators configured in advance, the number of the core actuators in the task scheduling system can be increased, the occurrence of the situation of type configuration errors of the actuators is reduced, and the configuration accuracy of the actuators is improved.
In another possible implementation manner, if the number of the plurality of actuators matched with the target policy is not smaller than the second preset number, the capacity of the non-core actuator in the task scheduling system can be expanded according to the target policy to obtain the non-core actuator matched with the target policy, so that the occurrence of excessive registration of the non-core actuator can be reduced, and the utilization rate of the actuator is improved.
S510, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain a non-core executor matched with the target strategy, and determining the non-core executor matched with the target strategy as the target executor.
Specifically, after determining that the task amount of the first non-core executor is not less than the first preset amount, the non-core executor in the task scheduling system may be expanded according to the target policy, so as to obtain a non-core executor matched with the target policy. Therefore, the target executor can be determined efficiently, and the execution efficiency of the task is improved.
In one possible implementation, a first task in a queuing state and a second task in an ongoing state are acquired; outputting first prompt information when the queuing time of the first task in the queuing state exceeds a first preset time; and outputting second prompt information under the condition that the running time of the second task in the running state exceeds a second preset time. The first preset time is a task duration threshold in queuing. The second preset time is a task duration threshold in progress.
The first prompt message is used for prompting the situation that the task queuing time is too long. The second prompt information is used for reminding the situation that the task is carried out for too long. The first prompt information and the second prompt information include, but are not limited to, voice prompt information, sound (such as alarm sound) prompt information, graphic prompt information, light source prompt information and the like. Therefore, the system can remind the situation that the queuing time of the task is too long, is convenient for the system to monitor the task in real time, can timely expand capacity of the executor, can remind the situation that the task is too long, is convenient for the system to monitor the task in real time, can timely monitor the working condition of the executor, and can reduce the situation that the task is too long due to the abnormality of the executor.
Optionally, determining the number of tasks of the first task in the queuing state; and performing capacity expansion operation on the task scheduling system under the condition that the number of tasks of the first task exceeds a third preset number and the duration time when the number of tasks exceeds the third preset number exceeds a third preset time. Wherein the third preset number is a threshold number of tasks in the queue. The third preset time is a time threshold at which the number of tasks in the queue exceeds the threshold. The third preset number and the third preset time can be set in the configuration module according to actual requirements.
The example illustrates that the third preset number is 5 and the third preset time is 10 minutes, if the first tasks in the queuing state are 7 and the 7 first tasks are already queued for 12 minutes, it can be determined that the number of the tasks of the first tasks exceeds the third preset number, and the duration time of the number of the tasks exceeding the third preset number exceeds the third preset time, so that the current task number is larger, the capacity expansion operation needs to be performed on the task scheduling system, and therefore, according to the actual situation of the executor in the task scheduling system, capacity expansion processing can be performed on the executor automatically, the situation that waiting time is too long due to too many tasks is reduced, and the execution efficiency of the tasks is improved.
In one possible implementation manner, before performing the capacity expansion operation on the task scheduling system, it needs to determine whether an active actuator or an abnormal actuator exists in the task scheduling system, if the active actuator or the abnormal actuator exists in the task scheduling system, the capacity expansion operation cannot be performed on the task scheduling system, and it needs to detect the active actuator or the abnormal actuator to determine whether the active actuator or the abnormal actuator can be normally used; if the task scheduling system does not have an executing device or abnormal executing device in the starting process, the capacity expansion operation can be carried out on the task scheduling system. Specifically, referring to fig. 6, a flowchart of a method for detecting an actuator in a task scheduling system according to an embodiment of the present application includes the following steps S601 to S607:
s601, determining whether an executing device or an abnormal executing device in starting exists in a task scheduling system; if yes, executing step S603 or S606; if not, step S602 is performed.
Specifically, determining whether an active actuator or an abnormal actuator exists in the task scheduling system, and if the active actuator exists in the task scheduling system, determining the starting duration of the active actuator; if an abnormal executor exists in the task scheduling system, the abnormal executor needs to be recovered and detected; if the task scheduling system does not have an executing device or abnormal executing device in the starting process, the capacity expansion operation can be carried out on the task scheduling system.
S602, performing capacity expansion operation on the task scheduling system.
Specifically, after determining that there is no active or abnormal actuator in the task scheduling system, the task scheduling system may be subjected to a capacity expansion operation. Therefore, the occurrence of excessive capacity expansion of the actuator is reduced, and the capacity expansion precision of the actuator is improved.
S603, determining the starting duration of the starting executor in the task scheduling system.
Specifically, after determining that there is an executing machine in the process of starting in the task scheduling system, it is necessary to further determine the start-up duration of the executing machine in the process of starting. Wherein, the starting duration refers to the duration from the start of the actuator to the present.
And S604, performing starting detection on the starting actuator under the condition that the starting duration exceeds the fourth preset time to obtain a first detection result.
Specifically, after determining the activation duration of the actuator being activated, it is necessary to further determine whether the activation duration exceeds a fourth preset time; if the starting duration exceeds the fourth preset time, the group needs to perform starting detection on the starting executor so as to obtain a first detection result; if the starting duration time does not exceed the fourth preset time, the starting actuator does not need to be detected, and only the starting actuator needs to be waited. The fourth preset time is a timeout threshold of the starting actuator. The fourth preset time can be set in the configuration module according to actual requirements. The first detection result is used for indicating whether the starting actuator can be started normally.
S605 determines the execution state of the starting actuator as a normal state, in the case where the first detection result indicates that the starting actuator can be started normally.
Specifically, after it is determined that the first detection result indicates that the active actuator can be normally activated, the execution state of the active actuator may be determined as a normal state. Therefore, the executor with overlong starting time can be automatically detected, the situation that the executor is directly deleted due to overlong starting time is reduced, and the detection accuracy of the executor is improved.
Alternatively, after it is determined that the first detection result indicates that the active actuator cannot be normally activated, it is necessary to determine the execution state of the active actuator as an abnormal state and perform a deletion operation of the actuator in the abnormal state. For example, the abnormal state of the actuator can be deleted by calling the Kubernetes interface, and the information corresponding to the abnormal state of the actuator in the actuator table is deleted. Wherein the actuator table is stored in a database. Therefore, the abnormal executor can be processed in time, and the influence on the follow-up task execution work caused by the abnormal executor is reduced.
S606, performing recovery detection on the abnormal executor to obtain a second detection result.
Specifically, after determining that an abnormal actuator exists in the task scheduling system, recovery detection needs to be performed on the abnormal actuator to reach a second detection result. The second detection result is used for indicating whether the abnormal executor can normally execute the task.
S607, in the case where the second detection result indicates that the abnormal executor can normally execute the task, modifying the execution state of the abnormal executor to the normal state.
Specifically, after it is determined that the second detection result indicates that the abnormal actuator can normally execute the task, the execution state of the abnormal actuator may be modified to a normal state. Therefore, the abnormal actuator can be automatically detected, the occurrence of the condition of directly deleting the actuator is reduced, and the detection precision of the actuator is improved.
Optionally, after determining that the second detection result indicates that the abnormal executor cannot normally execute the task, the abnormal executor needs to perform a deletion operation, and resetting an execution state of the task associated with the abnormal executor to a queuing state. Therefore, the abnormal executor can be processed in time, and the situation that tasks cannot be executed in time due to the abnormal executor is reduced.
In one possible implementation, determining whether there is a non-core actuator in an idle state in the task scheduling system; and under the condition that the idle state non-core executor exists in the task scheduling system and the idle time of the idle state non-core executor exceeds the fifth preset time, deleting the idle state non-core executor. The idle state refers to a state that the executor does not execute a task currently. The fifth preset time is an idle time threshold of the non-core executor. The fifth preset time can be set in the configuration module according to actual requirements.
It can be understood that, because the non-core executor is an executor that expands when the task amount is large, in order to avoid resource waste, the non-core executor in an idle state can be deleted when the task amount is small, so as to realize capacity reduction processing on the task scheduling system, reduce the occurrence of resource waste caused by small task amount, and save the configuration cost of the executor.
It will be appreciated by those skilled in the art that in the above-described method of the specific embodiments, the written order of steps is not meant to imply a strict order of execution but rather should be construed according to the function and possibly inherent logic of the steps.
Based on the same inventive concept, the embodiment of the present application further provides a task scheduling device corresponding to the task scheduling method, and since the principle of solving the problem by the device in the embodiment of the present application is similar to that of the task scheduling method in the embodiment of the present application, the implementation of the device may refer to the implementation of the method, and the repetition is omitted.
Referring to fig. 7, a schematic structural diagram of a task scheduling device according to an embodiment of the present application is shown, where the device 700 includes:
a time acquisition module 701, configured to acquire target time information in real time;
a first determining module 702, configured to determine, when the target time information is a target execution time of the target task, a target policy corresponding to the target task from a policy table, where the target execution time is determined by a first execution time and an execution interval of the target task, and the first execution time and the execution interval are stored in a timing task correlation table in advance;
a second determining module 703, configured to determine whether an actuator matching the target policy exists in the task scheduling system;
and the task execution module 704 is used for determining the executor matched with the target strategy as the target executor and controlling the target executor to execute the target task when the executor matched with the target strategy exists in the task scheduling system.
In one possible implementation manner, the second determining module 703 is specifically configured to:
acquiring an execution parameter corresponding to a target task in a policy table;
generating an encapsulation file based on the execution parameters and the target execution time, storing the encapsulation file in a task table, and setting the execution state of the target task as a queuing state;
acquiring all tasks in a queuing state in a task table;
determining a first task with the forefront target execution time in a task table based on the target execution time of each first task in a queuing state;
and determining whether an actuator matched with the target strategy exists in the task scheduling system under the condition that the first task with the forefront target execution time in the task table is the target task.
In one possible implementation, the task execution module 704 is specifically configured to:
determining whether the task quantity of the executor matched with the target strategy is smaller than a first preset quantity or not under the condition that the executor matched with the target strategy exists in the task scheduling system;
and determining the actuator matched with the target strategy as the target actuator under the condition that the task quantity of the actuator matched with the target strategy is smaller than the first preset quantity.
In one possible implementation, the task execution module 704 is specifically configured to:
and under the condition that the task quantity of the executor matched with the target strategy is not smaller than the first preset quantity, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain the target executor.
In one possible implementation manner, in a case that it is determined that there are a plurality of actuators matching the target policy, the actuators are core actuators or non-core actuators, and the task execution module 704 is specifically configured to:
in the case that a plurality of actuators matched with a target strategy exist in the task scheduling system, determining a first core actuator with the minimum task quantity from the plurality of actuators matched with the target strategy;
determining whether the task amount of the first core executor is smaller than a first preset amount;
and determining the first core executor as a target executor under the condition that the task quantity of the first core executor is smaller than a first preset quantity.
In one possible implementation, the task execution module 704 is specifically configured to:
determining whether a plurality of actuators matched with the target strategy comprise non-core actuators or not under the condition that the task quantity of the first core actuator is not less than a first preset quantity;
In the case that the plurality of actuators matched with the target strategy comprise non-core actuators, determining a first non-core actuator with the minimum task amount from the plurality of actuators matched with the target strategy;
determining whether the task amount of the first non-core executor is smaller than a first preset amount;
and determining the first non-core executor as a target executor under the condition that the task quantity of the first non-core executor is smaller than a first preset quantity.
In one possible implementation, the task execution module 704 is specifically configured to:
determining a number of the plurality of actuators matching the target policy in the case that the non-core actuators are not included in the plurality of actuators matching the target policy;
and under the condition that the number of the plurality of executors matched with the target strategy is smaller than a second preset number, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain a core executor matched with the target strategy, and determining the core executor matched with the target strategy as the target executor.
In one possible implementation, the task execution module 704 is specifically configured to:
and under the condition that the number of the plurality of actuators matched with the target strategy is not smaller than a second preset number, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain non-core actuators matched with the target strategy, and determining the non-core actuators matched with the target strategy as target actuators.
In one possible implementation, the task execution module 704 is specifically configured to:
and under the condition that the task quantity of the first non-core executor is not smaller than the first preset quantity, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain the non-core executor matched with the target strategy, and determining the non-core executor matched with the target strategy as the target executor.
In a possible implementation manner, the task execution module 704 is further configured to, in a case where there is no actuator matching the target policy in the task scheduling system, perform a capacity expansion operation on the task scheduling system based on the target policy, obtain a core actuator matching the target policy, and determine the core actuator matching the target policy as the target actuator.
Referring to fig. 8, in one possible embodiment, the apparatus further includes:
the information output module 705 is configured to obtain a first task in a queuing state and a second task in a running state;
outputting first prompt information under the condition that the queuing time of the first task in the queuing state exceeds a second preset time;
And outputting second prompt information under the condition that the running time of the second task in the running state exceeds a third preset time.
In one possible implementation, the information output module 705 is specifically configured to:
determining the number of tasks of a first task in a queuing state;
and performing capacity expansion operation on the task scheduling system under the condition that the number of tasks of the first task exceeds a third preset number and the duration time when the number of tasks exceeds the third preset number exceeds a third preset time.
In one possible implementation, the task execution module 704 is specifically configured to:
determining whether an executing device or an abnormal executing device in starting exists in the task scheduling system;
and when the starting executor or abnormal executor does not exist in the task scheduling system, performing capacity expansion operation on the task scheduling system.
In one possible implementation, the task execution module 704 is specifically configured to:
determining the starting duration of the starting actuator in the task scheduling system when the starting actuator exists in the task scheduling system;
under the condition that the starting duration exceeds a fourth preset time, starting detection is carried out on the starting actuator, and a first detection result is obtained;
In a case where the first detection result indicates that the starting actuator can be started normally, the execution state of the starting actuator is determined to be a normal state.
In one possible implementation, the task execution module 704 is specifically configured to:
in the case where the first detection result indicates that the starting actuator cannot be started normally, the execution state of the starting actuator is determined to be an abnormal state, and the deleting operation is performed on the actuator in the abnormal state.
In one possible implementation, the task execution module 704 is specifically configured to:
under the condition that an abnormal executor exists in the task scheduling system, recovering and detecting the abnormal executor to obtain a second detection result;
and modifying the execution state of the abnormal executor to a normal state under the condition that the second detection result indicates that the abnormal executor can normally execute the task.
In one possible implementation, the task execution module 704 is specifically configured to:
and in the case that the second detection result indicates that the abnormal executor can not normally execute the task, performing a deleting operation on the abnormal executor, and resetting the execution state of the task associated with the abnormal executor to be a queuing state.
In one possible implementation, the task execution module 704 is specifically configured to:
determining whether a non-core executor in an idle state exists in a task scheduling system;
and under the condition that the idle state non-core executor exists in the task scheduling system and the idle time of the idle state non-core executor exceeds the fifth preset time, deleting the idle state non-core executor.
The process flow of each module in the apparatus and the interaction flow between the modules may be described with reference to the related descriptions in the above method embodiments, which are not described in detail herein.
Based on the same technical conception, the embodiment of the application also provides a task scheduling system. Referring to fig. 9, which is a schematic structural diagram of a task scheduling system according to an embodiment of the present application, the system 900 includes:
the access module 901 is configured to determine, when the target time information is a target execution time of the target task, a target policy corresponding to the target task from the policy table, where the target execution time is determined by a first execution time and an execution interval of the target task, and the first execution time and the execution interval are stored in the timing task related table in advance;
The scheduling center 902 is configured to determine whether an actuator matching the target policy exists in the task scheduling system, and determine, when the actuator matching the target policy exists in the task scheduling system, the actuator matching the target policy as a target actuator;
the execution module 903 is configured to control the target executor to execute the target task.
Referring to fig. 10, in one possible implementation, the scheduling center 902 includes a scheduling module 9021;
the access module 901 is further configured to obtain an execution parameter corresponding to the target task in the policy table, generate an encapsulation file based on the execution parameter and the target execution time, store the encapsulation file in the task table, and set an execution state of the target task to be a queuing state;
the scheduling module 9021 is configured to obtain all the first tasks in the queuing state in the task table, determine, based on the target execution time of each of the first tasks in the queuing state, a first task with a forefront target execution time in the task table, and determine, if an executor matching the target policy exists in the task scheduling system when the first task with the forefront target execution time in the task table is the target task.
In a possible implementation manner, the scheduling module 9021 is further configured to determine, in a case where there is an actuator matching the target policy in the task scheduling system, whether the task amount of the actuator matching the target policy is less than a first preset number, and determine, in a case where the task amount of the actuator matching the target policy is less than the first preset number, the actuator matching the target policy as the target actuator.
In one possible implementation, the dispatch center 902 includes a capacity expansion module 9022;
and the capacity expansion module 9022 is configured to perform capacity expansion operation on the task scheduling system based on the target policy to obtain the target executor when the task amount of the executor matched with the target policy is not less than the first preset number.
In a possible implementation manner, the scheduling module 9021 is further configured to, in a case where there are multiple actuators matching the target policy in the task scheduling system, determine, from the multiple actuators matching the target policy, a first core actuator with a minimum task amount, determine whether the task amount of the first core actuator is less than a first preset number, and determine, in a case where the task amount of the first core actuator is less than the first preset number, the first core actuator as the target actuator.
In a possible implementation manner, the scheduling module 9021 is further configured to determine, if the task number of the first core executor is not less than a first preset number, whether the plurality of executors matching the target policy include non-core executors, and if the plurality of executors matching the target policy include non-core executors, determine, from the plurality of executors matching the target policy, a first non-core executor with the minimum task number;
the scheduling module 9021 is further configured to determine whether the task amount of the first non-core executor is less than a first preset number, and determine the first non-core executor as a target executor if the task amount of the first non-core executor is less than the first preset number.
In one possible implementation, the scheduling module 9021 is further configured to determine, in a case that no non-core actuator is included in the plurality of actuators matching the target policy, a number of the plurality of actuators matching the target policy;
the capacity expansion module 9022 is further configured to perform capacity expansion operation on the task scheduling system based on the target policy, so as to obtain a core executor matched with the target policy, when the number of the plurality of executors matched with the target policy is less than a second preset number;
The scheduling module 9021 is further configured to determine a core actuator that matches the target policy as the target actuator.
In a possible implementation manner, the capacity expansion module 9022 is further configured to perform capacity expansion operation on the task scheduling system based on the target policy, so as to obtain a non-core executor matched with the target policy, where the number of the plurality of executors matched with the target policy is not less than a second preset number;
the scheduling module 9021 is further configured to determine a non-core actuator that matches the target policy as the target actuator.
In a possible implementation manner, the capacity expansion module 9022 is further configured to perform capacity expansion operation on the task scheduling system based on the target policy, so as to obtain a non-core executor that matches the target policy, where the task amount of the first non-core executor is not less than the first preset number;
the scheduling module 9021 is further configured to determine a non-core actuator that matches the target policy as the target actuator.
In a possible implementation manner, the capacity expansion module 9022 is further configured to perform capacity expansion operation on the task scheduling system based on the target policy, so as to obtain a core executor that matches the target policy;
the scheduling module 9021 is further configured to determine a core actuator that matches the target policy as the target actuator.
In one possible implementation, the dispatch center 902 further includes an exception module 9023;
the abnormality module 9023 is configured to obtain a first task in a queuing state and a second task in a running state, output first prompt information when a queuing time of the first task in the queuing state exceeds a first preset time, and output second prompt information when a running time of the second task in the running state exceeds a second preset time.
In a possible implementation manner, the scheduling module 9021 is further configured to determine a task number of the first task in the queuing state;
the capacity expansion module 9022 is further configured to perform capacity expansion operation on the task scheduling system when the number of tasks of the first task exceeds the third preset number, and the duration of time when the number of tasks exceeds the third preset number exceeds the third preset time.
In one possible embodiment, the capacity expansion module 9022 is specifically configured to:
determining whether an executing device or an abnormal executing device in starting exists in the task scheduling system;
and when the starting executor or abnormal executor does not exist in the task scheduling system, performing capacity expansion operation on the task scheduling system.
In one possible implementation, the exception module 9023 is further configured to determine, in the event that there is an active actuator in the task scheduling system, a duration of activation of the active actuator in the task scheduling system;
the anomaly module 9023 is further configured to perform start detection on the starting actuator to obtain a first detection result when the start duration exceeds a fourth preset time;
the anomaly module 9023 is further configured to determine, in a case where the first detection result indicates that the active actuator is able to be activated normally, an execution state of the active actuator as a normal state.
In one possible implementation manner, the exception module 9023 is further configured to, in a case where the first detection result indicates that the active actuator cannot be normally activated, determine an execution state of the active actuator as an exception state, and perform a delete operation on the active actuator in the exception state.
In a possible implementation manner, the exception module 9023 is further configured to, when an exception executor exists in the task scheduling system, perform recovery detection on the exception executor to obtain a second detection result, and modify an execution state of the exception executor to a normal state when the second detection result indicates that the exception executor can normally execute the task.
In one possible implementation manner, the exception module 9023 is further configured to, in a case where the second detection result indicates that the abnormal executor cannot normally execute the task, perform a delete operation on the abnormal executor, and reset an execution state of the task associated with the abnormal executor to a queuing state.
In a possible implementation manner, the exception module 9023 is further configured to determine whether an idle non-core executor exists in the task scheduling system, and delete the idle non-core executor when the idle non-core executor exists in the task scheduling system and the idle time of the idle non-core executor exceeds a fifth preset time.
Referring to fig. 11, in one possible implementation, the task scheduling system further includes a storage module 904;
the access module 901 is further configured to invoke an add policy interface and a timed task add interface to configure policy parameters and timed task parameters of the target task;
the storage module 904 is configured to store policy parameters of the target task into a policy table, and store timing task parameters of the target task into a timing task related table;
The storage module 904 is further configured to store a task table and an actuator table, where the actuator table is configured to store all actuators in the execution module.
In a possible implementation manner, the task scheduling system further comprises a registration module 905 and a configuration module 906;
a registration module 905, configured to register the actuator;
the configuration module 906 is configured to configure the first preset number, the second preset number, the third preset number, the first preset time, the second preset time, the third preset time, the fourth preset time, and the fifth preset time.
The process flow of each module in the system and the interaction flow between each module may be described with reference to the related description in the above method embodiment, which is not described in detail herein.
Based on the same technical concept, the embodiment of the application also provides electronic equipment. Referring to fig. 12, a schematic structural diagram of an electronic device 1200 according to an embodiment of the present application includes a processor 1201, a memory 1202 and a bus 1203. The memory 1202 is used for storing execution instructions, including a memory 12021 and an external memory 12022; the memory 12021 is also referred to as an internal memory, and is used for temporarily storing operation data in the processor 1201 and data exchanged with the external memory 12022 such as a hard disk, and the processor 1201 exchanges data with the external memory 12022 via the memory 12021.
In the embodiment of the present application, the memory 1202 is specifically configured to store application program codes for executing the solution of the present application, and the processor 1201 controls the execution. That is, when the electronic device 1200 is running, communication between the processor 1201 and the memory 1202 is through the bus 1203, causing the processor 1201 to execute the application code stored in the memory 1202, thereby performing the methods disclosed in any of the foregoing embodiments.
The Memory 1202 may be, but is not limited to, random access Memory (Random AccessMemory, RAM), read-only Memory (Read On l y Memory, ROM), programmable read-only Memory (Programmab l e Read-On l y Memory, PROM), erasable read-only Memory (Erasab l e Programmab l e Read-On l y Memory, EPROM), electrically erasable read-only Memory (E l ectr i c Erasab l e Programmab l e Read-On l y Memory, EEPROM), etc.
The processor 1201 may be an integrated circuit chip having signal processing capabilities. The processor may be a general-purpose processor, including a central processing unit (Centra l Process i ng Un it, CPU), a network processor (Network Processor, NP), etc.; but also digital signal processors (Di g ita lSi gna l Process I ng, DSP), application specific integrated circuits (App l I cat I on Spec I f I C I ntegrated Ci rcu it, AS ic), field programmable gate arrays (Fi e l d Programmab l e Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
It is to be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 1200. In other embodiments of the present application, electronic device 1200 may include more or fewer components than shown, or may combine certain components, or split certain components, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
The present application also provides a computer readable storage medium, on which a computer program is stored, which when executed by a processor performs the task scheduling method described in the above method embodiment. Wherein the storage medium may be a volatile or nonvolatile computer readable storage medium.
The embodiments of the present application further provide a computer program product, where the computer program product carries program code, and instructions included in the program code may be used to execute the task scheduling method described in the foregoing method embodiments, and specifically reference may be made to the foregoing method embodiments, which are not described herein again.
Wherein the above-mentioned computer program product may be realized in particular by means of hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied as a computer storage medium, and in another alternative embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Deve l opment Kit, SDK), or the like.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, for example, the division of the units is merely a logical function division, and there may be other manners of division in actual implementation, and for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some communication interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in essence or a part contributing to the prior art or a part of the technical solution, or in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk or an optical disk.
Finally, it should be noted that: the foregoing examples are merely specific embodiments of the present disclosure, and are not intended to limit the scope of the disclosure, but the present disclosure is not limited thereto, and those skilled in the art will appreciate that while the foregoing examples are described in detail, it is not limited to the disclosure: any person skilled in the art, within the technical scope of the disclosure of the present disclosure, may modify or easily conceive changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features thereof; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the disclosure, and are intended to be included within the scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.

Claims (22)

1. A method for task scheduling, comprising:
acquiring target time information in real time;
determining a target strategy corresponding to a target task from a strategy table under the condition that the target time information is the target execution time of the target task, wherein the target execution time is determined by the first execution time and the execution interval of the target task, and the first execution time and the execution interval are stored in a timing task related table in advance;
determining whether an actuator matched with the target strategy exists in the task scheduling system;
and under the condition that the actuator matched with the target strategy exists in the task scheduling system, determining the actuator matched with the target strategy as a target actuator, and controlling the target actuator to execute the target task.
2. The task scheduling method according to claim 1, wherein the determining whether there is an actuator matching the target policy in the task scheduling system includes:
acquiring execution parameters corresponding to the target task in the policy table;
generating an encapsulation file based on the execution parameters and the target execution time, storing the encapsulation file in a task table, and setting the execution state of the target task as a queuing state;
Acquiring all first tasks in a queuing state in the task table;
determining a first task with the forefront target execution time in the task table based on the target execution time of each first task in a queuing state;
and determining whether an executor matched with the target strategy exists in the task scheduling system under the condition that a first task with the forefront target execution time in the task table is the target task.
3. The task scheduling method according to claim 1, wherein the determining, in the case where there is an actuator matching the target policy in the task scheduling system, the actuator matching the target policy as a target actuator includes:
determining whether the task quantity of the executor matched with the target strategy is smaller than a first preset quantity or not under the condition that the executor matched with the target strategy exists in the task scheduling system;
and determining the actuator matched with the target strategy as the target actuator under the condition that the task quantity of the actuator matched with the target strategy is smaller than the first preset quantity.
4. A task scheduling method according to claim 3, wherein the method further comprises:
And under the condition that the task quantity of the executor matched with the target strategy is not smaller than the first preset quantity, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain the target executor.
5. The task scheduling method according to claim 1, wherein in a case where it is determined that there are a plurality of actuators matching the target policy, the actuator is a core actuator or a non-core actuator, and in a case where there is an actuator matching the target policy in the task scheduling system, it is determined that the actuator matching the target policy is a target actuator, comprising:
determining a first core actuator with the minimum task quantity from a plurality of actuators matched with the target strategy when the plurality of actuators matched with the target strategy exist in the task scheduling system;
determining whether the task amount of the first core executor is smaller than a first preset amount;
and determining the first core executor as the target executor under the condition that the task quantity of the first core executor is smaller than the first preset quantity.
6. The task scheduling method of claim 5, further comprising:
Determining whether the non-core executor is included in a plurality of executors matched with the target strategy under the condition that the task quantity of the first core executor is not less than the first preset quantity;
determining a first non-core actuator with the least task amount from the plurality of actuators matched with the target strategy under the condition that the plurality of actuators matched with the target strategy comprise the non-core actuator;
determining whether the task amount of the first non-core executor is smaller than the first preset amount;
and determining the first non-core executor as the target executor under the condition that the task quantity of the first non-core executor is smaller than the first preset quantity.
7. The task scheduling method of claim 6, further comprising:
determining a number of the plurality of actuators matching the target policy if the non-core actuator is not included in the plurality of actuators matching the target policy;
and under the condition that the number of the plurality of executors matched with the target strategy is smaller than a second preset number, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain a core executor matched with the target strategy, and determining the core executor matched with the target strategy as the target executor.
8. The task scheduling method of claim 7, further comprising:
and under the condition that the number of the plurality of executors matched with the target strategy is not smaller than the second preset number, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain non-core executors matched with the target strategy, and determining the non-core executors matched with the target strategy as the target executors.
9. The task scheduling method of claim 6, further comprising:
and under the condition that the task quantity of the first non-core executor is not smaller than the first preset quantity, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain a non-core executor matched with the target strategy, and determining the non-core executor matched with the target strategy as the target executor.
10. The task scheduling method according to claim 1, characterized in that the method further comprises:
and under the condition that an actuator matched with the target strategy does not exist in the task scheduling system, performing capacity expansion operation on the task scheduling system based on the target strategy to obtain a core actuator matched with the target strategy, and determining the core actuator matched with the target strategy as the target actuator.
11. The task scheduling method according to claim 1, characterized in that the method further comprises:
acquiring a first task in a queuing state and a second task in a proceeding state;
outputting first prompt information under the condition that the queuing time of the first task in the queuing state exceeds a first preset time;
and outputting second prompt information under the condition that the proceeding time of the second task in the proceeding state exceeds a second preset time.
12. The task scheduling method of claim 11, further comprising:
determining the task number of the first task in the queuing state;
and performing capacity expansion operation on the task scheduling system under the condition that the number of the tasks of the first task exceeds a third preset number and the duration time of the number of the tasks exceeding the third preset number exceeds a third preset time.
13. The task scheduling method according to any one of claims 4, 7-10, 12, wherein performing the capacity expansion operation on the task scheduling system includes:
determining whether an executing device or an abnormal executing device in starting exists in the task scheduling system;
And performing capacity expansion operation on the task scheduling system under the condition that the starting executor or abnormal executor does not exist in the task scheduling system.
14. The task scheduling method of claim 13, further comprising:
determining a start duration of the starting actuator in the presence of the starting actuator in the task scheduling system;
under the condition that the starting duration exceeds a fourth preset time, starting detection is carried out on the starting actuator, and a first detection result is obtained;
and determining the execution state of the starting actuator as a normal state under the condition that the first detection result indicates that the starting actuator can be started normally.
15. The task scheduling method of claim 14, further comprising:
and under the condition that the first detection result indicates that the starting actuator cannot be started normally, determining the execution state of the starting actuator as an abnormal state, and deleting the actuator in the abnormal state.
16. The task scheduling method of claim 13, further comprising:
under the condition that the abnormal executor exists in the task scheduling system, carrying out recovery detection on the abnormal executor to obtain a second detection result;
and modifying the execution state of the abnormal executor to a normal state under the condition that the second detection result indicates that the abnormal executor can normally execute the task.
17. The task scheduling method of claim 16, further comprising:
and under the condition that the second detection result indicates that the abnormal executor can not normally execute the task, the abnormal executor is subjected to deleting operation, and the execution state of the task associated with the abnormal executor is reset to be a queuing state.
18. A method of task scheduling according to any one of claims 1 to 12, wherein the method further comprises:
determining whether a non-core executor in an idle state exists in the task scheduling system;
and under the condition that the idle state non-core executor exists in the task scheduling system and the idle time of the idle state non-core executor exceeds a fifth preset time, deleting the idle state non-core executor.
19. A task scheduling device, comprising:
the time acquisition module is used for acquiring the target time information in real time;
the first determining module is used for determining a target strategy corresponding to the target task from a strategy table when the target time information is the target execution time of the target task, wherein the target execution time is determined by the first execution time and the execution interval of the target task, and the first execution time and the execution interval are stored in a timing task related table in advance;
the second determining module is used for determining whether an actuator matched with the target strategy exists in the task scheduling system;
and the task execution module is used for determining the executor matched with the target strategy as a target executor and controlling the target executor to execute the target task when the executor matched with the target strategy exists in the task scheduling system.
20. A task scheduling system, comprising: the system comprises an access module, a dispatching center and an execution module;
the access module is used for determining a target strategy corresponding to a target task from a strategy table under the condition that target time information is target execution time of the target task, wherein the target execution time is determined by first execution time and execution interval of the target task, and the first execution time and the execution interval are stored in a timing task related table in advance;
The dispatching center is used for determining whether an actuator matched with the target strategy exists in the execution module, and determining the actuator matched with the target strategy as a target actuator when the actuator matched with the target strategy exists in the execution module;
the execution module is used for controlling the target executor to execute the target task.
21. An electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory in communication via the bus when the electronic device is running, the machine-readable instructions when executed by the processor performing the task scheduling method of any one of claims 1 to 18.
22. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, performs the task scheduling method of any one of claims 1 to 18.
CN202211711143.4A 2022-12-29 2022-12-29 Task scheduling method, device and system, electronic equipment and storage medium Pending CN116149813A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211711143.4A CN116149813A (en) 2022-12-29 2022-12-29 Task scheduling method, device and system, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211711143.4A CN116149813A (en) 2022-12-29 2022-12-29 Task scheduling method, device and system, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116149813A true CN116149813A (en) 2023-05-23

Family

ID=86340050

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211711143.4A Pending CN116149813A (en) 2022-12-29 2022-12-29 Task scheduling method, device and system, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116149813A (en)

Similar Documents

Publication Publication Date Title
CN110297711B (en) Batch data processing method, device, computer equipment and storage medium
CN106802826B (en) Service processing method and device based on thread pool
US9990230B1 (en) Scheduling a notebook execution
US10558545B2 (en) Multiple modeling paradigm for predictive analytics
US11683396B2 (en) Efficient context monitoring
CN104360878B (en) A kind of method and device of application software deployment
CN109656782A (en) Visual scheduling monitoring method, device and server
WO2023115999A1 (en) Device state monitoring method, apparatus, and device, and computer-readable storage medium
US20220222266A1 (en) Monitoring and alerting platform for extract, transform, and load jobs
US9973306B2 (en) Freshness-sensitive message delivery
JP2007241872A (en) Program for monitoring change in computer resource on network
CN111694677A (en) Message queue management method, device, terminal and computer-readable storage medium
CN112667383A (en) Task execution and scheduling method, system, device, computing equipment and medium
CN111796954A (en) Watchdog control method, device, equipment and storage medium based on JVM
CN111580948A (en) Task scheduling method and device and computer equipment
CN112231073A (en) Distributed task scheduling method and device
US11068487B2 (en) Event-stream searching using compiled rule patterns
CN116149813A (en) Task scheduling method, device and system, electronic equipment and storage medium
US20200293370A1 (en) Usecase specification and runtime execution to serve on-demand queries and dynamically scale resources
CN109491771B (en) Task processing method based on system performance optimization and related equipment
JP2007241873A (en) Program for monitoring change in computer resource on network
CN110673976A (en) Anomaly detection method and anomaly detection device for multi-core system and electronic equipment
US9465621B2 (en) Priority activation of metrology driver in boot sequence
CN114237844A (en) Task scheduling method and device and electronic equipment
CN110096416B (en) Abnormity warning method and device, computer device and readable 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