CN116266132A - Method, system, device, equipment and storage medium for executing timing task - Google Patents

Method, system, device, equipment and storage medium for executing timing task Download PDF

Info

Publication number
CN116266132A
CN116266132A CN202111545013.3A CN202111545013A CN116266132A CN 116266132 A CN116266132 A CN 116266132A CN 202111545013 A CN202111545013 A CN 202111545013A CN 116266132 A CN116266132 A CN 116266132A
Authority
CN
China
Prior art keywords
task
execution
scheduling system
timing
timing task
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
CN202111545013.3A
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.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN202111545013.3A priority Critical patent/CN116266132A/en
Publication of CN116266132A publication Critical patent/CN116266132A/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
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • G06F9/4887Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues involving deadlines, e.g. rate based, periodic
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/079Root cause analysis, i.e. error or fault diagnosis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0793Remedial or corrective actions
    • 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

Abstract

The application discloses a method, a device, equipment and a storage medium for executing a timing task, and belongs to the technical field of computers. According to the method and the device, the latest execution time of the timing task is acquired, so that the execution condition of the timing task in the task scheduling system is obtained, whether the task scheduling system is abnormal or not can be automatically determined, and when the task scheduling system is abnormal, the timing task is directly executed based on the execution interval of the timing task, so that the purpose of keeping normal execution of the timing task is achieved.

Description

Method, system, device, equipment and storage medium for executing timing task
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, a system, an apparatus, a device, and a storage medium for executing a timing task.
Background
Currently, many functions of applications are implemented based on a timed task, such as, for example, an e-commerce program, which cleans up data of invalid orders every 5 minutes. The plurality of timing tasks are often scheduled and executed through a cluster system, wherein the cluster system comprises a task scheduling system and a plurality of executing nodes, and in the executing process, the task scheduling system can distribute the plurality of timing tasks to the plurality of executing nodes based on the executing intervals of the plurality of timing tasks so as to execute the plurality of timing tasks, thereby realizing a plurality of functions of the application program. If the task scheduling system cannot normally provide the scheduling function, the timing task cannot be executed. In the related art, when a system administrator finds that an abnormality occurs in a task scheduling system, a plurality of executing nodes can execute a plurality of timing tasks without scheduling by manually modifying system configuration information, so as to resume execution of the timing tasks.
In the above technology, if the system administrator does not find out that the task scheduling system is abnormal in time, the system configuration information cannot be modified in time, and normal execution of the timing task is affected.
Disclosure of Invention
The embodiment of the application provides a method, a system, a device, equipment and a storage medium for executing a timing task. The technical scheme is as follows:
in one aspect, a method for executing a timing task is provided, the method comprising:
acquiring the latest execution time of a timing task in a task scheduling system;
determining whether the task scheduling system is abnormal based on the latest execution time of the timing task, wherein the task scheduling system is used for distributing the timing task to a plurality of execution nodes corresponding to the task scheduling system so as to execute the timing task;
and if the task scheduling system is determined to be abnormal, executing the timing task based on the execution interval of the timing task.
In some embodiments, the determining whether an exception occurred in the task scheduling system based on the last execution time of the timed task includes:
Acquiring a target interval duration between the latest execution time and the current time of the timing task;
if the target interval time length of the timing task is larger than a preset threshold, determining that the task scheduling system is abnormal, wherein the preset threshold is the sum of N execution intervals of the timing task, and N is an integer larger than 0.
In some embodiments, the executing the timed task based on the execution interval of the timed task includes:
acquiring locking information of the timing task based on the execution interval of the timing task;
if the locking information indicates that the timing task is in an unlocking state, executing the timing task and setting the locking information in a locking state;
the locking information is used for indicating that the timing task is in a locking state or an unlocking state, the locking state indicates that the timing task is currently being executed, and the unlocking state indicates that the timing task is not currently executed.
In some embodiments, if it is determined that the task scheduling system is abnormal, based on the execution interval of the timing task, the method further includes, before executing the timing task:
if the task scheduling system is determined to be abnormal, a first message is sent to configuration management equipment of the task scheduling system, the first message is used for indicating that state information of the task scheduling system is set to be in an abnormal state, and a second message is sent to other executing nodes except for a target executing node, wherein the target executing node is the executing node for sending the first message, and the second message is used for indicating that the timing task is executed based on an execution interval of the timing task.
In some embodiments, if it is determined that the task scheduling system is abnormal, sending the first message to the configuration management device of the task scheduling system includes:
and if the task scheduling system is determined to be abnormal, the first message is sent to the configuration management equipment at intervals of preset waiting time.
In some embodiments, the method further comprises:
acquiring execution state information of at least one timing task in the task scheduling system, wherein the execution state information is used for indicating that the corresponding timing task is in an executed state or an unexecuted state;
determining at least one executed task from the at least one timed task based on the execution status information of the at least one timed task;
correspondingly, the step of obtaining the latest execution time of the timing task in the task scheduling system comprises the following steps:
the last execution time of the at least one executed task is obtained.
In some embodiments, the method further comprises:
if the execution state information of at least one timing task cannot be acquired, determining whether the task scheduling system is abnormal based on the abnormal type of the acquired information, wherein the abnormal type of the acquired information is used for indicating the reason that the execution state information of at least one timing task cannot be acquired.
In one aspect, a cluster system is provided, the cluster system comprising: the system comprises a task scheduling system, a plurality of execution nodes and configuration management equipment;
the task scheduling system is used for distributing the timing task to the plurality of executing nodes so as to execute the timing task;
any executing node is used for acquiring the latest executing time of the timing task in the task scheduling system; determining whether the task scheduling system is abnormal or not based on the latest execution time of the timing task; if the task scheduling system is determined to be abnormal, a first message is sent to the configuration management equipment, the first message is used for indicating that the state information of the task scheduling system is set to be in an abnormal state, and a second message is sent to other execution nodes except for a target execution node, wherein the target execution node is the execution node for sending the first message, and the second message is used for indicating that the timing task is executed based on the execution interval of the timing task; executing the timed task based on the execution interval of the timed task;
the configuration management device is configured to receive the first message of any execution node, set state information of the task scheduling system to an abnormal state, and send the second message to other execution nodes except the target execution node.
In some embodiments, the executing node is configured to obtain a target interval duration between a last execution time of the timing task and a current time; if the target interval time length of the timing task is larger than a preset threshold, determining that the task scheduling system is abnormal, wherein the preset threshold is the sum of N execution intervals of the timing task, and N is an integer larger than 0.
In some embodiments, the executing node is configured to send, if it is determined that the task scheduling system is abnormal, a first message to a configuration management device of the task scheduling system, where the first message is used to instruct setting state information of the task scheduling system to an abnormal state, and instruct sending a second message to other executing nodes except for a target executing node, where the target executing node is an executing node that sends the first message, and the second message is used to instruct executing the timing task based on an execution interval of the timing task.
In some embodiments, the executing node is configured to send the first message to the configuration management device if it is determined that the task scheduling system is abnormal, with a preset waiting duration.
In some embodiments, the executing node is further configured to obtain executing state information of at least one of the timing tasks in the task scheduling system, where the executing state information is used to indicate that the corresponding timing task is in an executed state or an unexecuted state; determining at least one executed task from the at least one timed task based on the execution status information of the at least one timed task; the last execution time of the at least one executed task is obtained.
In some embodiments, the execution node is further configured to determine whether the task scheduling system is abnormal based on an abnormality type of the acquired information if the execution state information of the at least one timing task cannot be acquired, where the abnormality type of the acquired information is used to indicate a reason why the execution state information of the at least one timing task cannot be acquired.
In one aspect, there is provided an apparatus for performing a timed task, the apparatus comprising:
the first acquisition module is used for acquiring the latest execution time of the timing task in the task scheduling system;
the task scheduling system is used for distributing the timing task to a plurality of execution nodes corresponding to the task scheduling system so as to execute the timing task;
and the execution module is used for executing the timing task based on the execution interval of the timing task if the task scheduling system is determined to be abnormal.
In some embodiments, the determining module is configured to obtain a target interval duration between a last execution time of the timing task and a current time; if the target interval time length of the timing task is larger than a preset threshold, determining that the task scheduling system is abnormal, wherein the preset threshold is the sum of N execution intervals of the timing task, and N is an integer larger than 0.
In some embodiments, the execution module is configured to obtain lock information of the timing task based on an execution interval of the timing task; if the locking information indicates that the timing task is in an unlocking state, executing the timing task and setting the locking information in a locking state; the locking information is used for indicating that the timing task is in a locking state or an unlocking state, the locking state indicates that the timing task is currently being executed, and the unlocking state indicates that the timing task is not currently executed.
In some embodiments, the apparatus further comprises:
the sending module is configured to send a first message to a configuration management device of the task scheduling system if it is determined that the task scheduling system is abnormal, where the first message is used to instruct setting state information of the task scheduling system to an abnormal state, and instruct sending a second message to other executing nodes except for a target executing node, where the target executing node is the executing node that sends the first message, and the second message is used to instruct executing the timing task based on an execution interval of the timing task.
In some embodiments, the sending module is configured to send the first message to the configuration management device at intervals of a preset waiting duration if it is determined that the task scheduling system is abnormal.
In some embodiments, the apparatus further comprises: the second acquisition module is used for acquiring the execution state information of at least one timing task in the task scheduling system, wherein the execution state information is used for indicating that the corresponding timing task is in an executed state or an unexecuted state;
the determining module is further used for determining at least one executed task from at least one timing task based on the execution state information of the at least one timing task;
correspondingly, the first obtaining module is configured to obtain the last execution time of the at least one executed task.
In some embodiments, the determining module is further configured to determine whether an abnormality occurs in the task scheduling system based on an abnormality type of the acquired information if the execution status information of the at least one timing task cannot be acquired, where the abnormality type of the acquired information is used to indicate a reason why the execution status information of the at least one timing task cannot be acquired.
In one aspect, a computer device is provided that includes one or more processors and one or more memories having stored therein at least one computer program loaded and executed by the one or more processors to perform operations performed by a method of performing the timed task.
In one aspect, a computer-readable storage medium having stored therein at least one computer program loaded and executed by a processor to perform operations performed by a method of performing the timed task is provided.
In one aspect, a computer program product is provided that includes at least one computer program stored in a computer readable storage medium. The processor of the computer device reads the at least one computer program from the computer-readable storage medium, and the processor executes the at least one computer program such that the computer device performs the operations performed by the method of performing the timed task.
According to the technical scheme provided by the embodiment of the application, the execution condition of the timing task in the task scheduling system is obtained by obtaining the latest execution time of the timing task, so that whether the task scheduling system is abnormal or not can be automatically determined, and when the task scheduling system is abnormal, the timing task is directly executed based on the execution interval of the timing task, thereby achieving the purpose of keeping normal execution of the timing task.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of an implementation environment of a method for executing a timing task according to an embodiment of the present application;
FIG. 2 is a flowchart of a method for executing a timing task according to an embodiment of the present application;
FIG. 3 is a flowchart of a method for executing a timing task according to an embodiment of the present application;
FIG. 4 is a flowchart of a method for executing a timing task according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a timing task execution device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
For the purposes of making the objects, technical solutions and advantages of the present application more apparent, the embodiments of the present application will be described in further detail below with reference to the accompanying drawings, and it is apparent that the described embodiments are some, but not all, embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The terms "first," "second," and the like in this application are used to distinguish between identical or similar items that have substantially the same function and function, and it should be understood that there is no logical or chronological dependency between the "first," "second," and "nth" terms, nor is it limited to the number or order of execution.
In the following description of the implementation environment of the present application, fig. 1 is a schematic diagram of the implementation environment of a method for executing a timing task provided in an embodiment of the present application, and referring to fig. 1, the implementation environment includes: the terminal 101 and the cluster system 102 are connected to each other via a wired network or a wireless network.
The terminal 101 may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., which is not limited in this embodiment. The terminal 101 is running different types of applications, such as e-commerce applications or social applications, etc.
The cluster system 102 may be a server cluster or a distributed system formed by a plurality of servers, or may be a cloud computing service center. The cluster system 102 includes a task scheduling system for distributing a timed task of any one application in the terminal 101 to a plurality of execution nodes to execute the timed task, a plurality of execution nodes, and a configuration management device for storing configuration information of the task scheduling system. Optionally, the cluster system 102 is associated with a database for storing information related to timing tasks.
Alternatively, the number of the terminals 101 may be greater, which is not limited in the embodiment of the present application.
Based on the implementation environment shown in fig. 1, fig. 2 is a flowchart of a method for executing a timing task according to an embodiment of the present application, where the method is executed by any executing node in the cluster system 102, and as shown in fig. 2, the method includes the following steps 201 to 203.
201. The executing node obtains the last executing time of the timing task in the task scheduling system.
The timing task is a task executed by the target application program at every other preset execution interval, for example, the target application program is an e-commerce application program, the timing task sends coupons to users every other month, or cleans data of invalid orders every other 5 minutes, and the like.
In the embodiment of the present application, a task scheduling system of a cluster system is preset with a plurality of timing tasks of a target application program, and the task scheduling system can allocate the plurality of timing tasks to a plurality of execution nodes based on execution intervals of the plurality of timing tasks, where each execution node executes the allocated timing task.
The execution condition of the timing task in the task scheduling system is obtained by obtaining the latest execution time of the timing task, so that whether the task scheduling system is abnormal or not can be automatically determined under the condition that manual monitoring is not needed.
202. The execution node determines whether the task scheduling system is abnormal or not based on the latest execution time of the timing task.
By determining whether the task scheduling system is abnormal, the execution of the timing task can be timely and intelligently recovered when the task scheduling system cannot normally provide the scheduling function.
203. If the execution node determines that the task scheduling system is abnormal, the timing task is executed based on the execution interval of the timing task.
By executing the timing task based on the execution interval, the execution node keeps the normal execution of the timing task when the scheduling system is abnormal.
According to the technical scheme provided by the embodiment of the application, the execution condition of the timing task in the task scheduling system is obtained by obtaining the latest execution time of the timing task, so that whether the task scheduling system is abnormal or not can be automatically determined, and when the task scheduling system is abnormal, the timing task is directly executed based on the execution interval of the timing task, thereby achieving the purpose of keeping normal execution of the timing task.
The foregoing embodiment of fig. 2 is a basic flow of the method for executing a timing task according to the present application, and the method for executing a timing task is further described with reference to fig. 3 and fig. 4, and fig. 3 and fig. 4 are flowcharts of a method for executing a timing task according to the embodiment of the present application, where the method is executed by any executing node in the cluster system 102, and referring to fig. 3, and the method includes the following steps 301 to 305.
301. The execution node acquires the execution state information of at least one timing task in the task scheduling system, wherein the execution state information is used for indicating that the corresponding timing task is in an executed state or an unexecuted state.
In some embodiments, the execution node first determines whether to turn on a patrol tool for determining whether an abnormality occurs in the task scheduling system and whether the task scheduling system is in a normal state, and then obtains execution state information of the timed task. Optionally, the inspection tool is implemented based on a Spring-schedule framework. Optionally, any executing node can periodically patrol the task scheduling system based on the patrol tool, for example, patrol every 1 minute.
The above-described process is explained below by way of processes 1 to 3.
And 1, determining whether to start the inspection tool.
In some embodiments, as shown in step 401 of fig. 4, the configuration management device records the working state information of the inspection tool, where the working state information indicates that the inspection tool is in an on state or an off state, and the execution node queries the working state information of the inspection tool by sending a first query request to the configuration management device, if the inspection tool is queried to be in the on state, then executing the process 2, and if the inspection tool is queried to be in the off state, then ending the process of determining whether the task scheduling system is abnormal or not. Optionally, the working state information of the inspection tool is an inspection mark (drade. Mcc. Config. Switch), the inspection mark is 1, which indicates that the inspection tool is in an on state, and the inspection mark is 0, which indicates that the inspection tool is in an off state.
In the implementation of the application, the execution node defaults to not open the inspection tool, and a system manager can set the working state of the inspection tool based on requirements.
And 2, determining whether the task scheduling system is in a normal state.
In some embodiments, as shown in step 402 of fig. 4, the configuration management device records state information of the task scheduling system, where the state information is used to indicate that the task scheduling system is in a normal state or an abnormal state, and the execution node queries the state information of the task scheduling system by sending a second query request to the configuration management device, if the task scheduling system is queried to be in a normal state, then executing the process 3, and if the task scheduling system is queried to be in an abnormal state, then ending the process of determining whether the task scheduling system is abnormal or not. Optionally, the state information of the task scheduling system is a degradation identifier (drade.mcc.config.is.close.drade), the degradation identifier is 1 indicating that the task scheduling system is in a normal state, and the degradation identifier is 0 indicating that the task scheduling system is in an abnormal state.
And 3, acquiring execution state information of at least one timing task.
In some embodiments, as shown in step 403 of FIG. 4, the executing node obtains the execution status information of all timing tasks of the target application or obtains the execution status information of at least one target timing task of the target application. The following describes both ways.
In one implementation, an executing node invokes a task query interface to obtain execution state information for all timed tasks of the target application from a database. Wherein the task query interface is a hypertext transfer protocol interface (cr-http-api).
In another implementation manner, the configuration management device records the plurality of preset identifiers, the execution node firstly obtains the at least one preset identifier from the configuration management device, and then invokes the task query interface based on the at least one preset identifier to obtain the execution state information of the target timing task corresponding to the at least one preset identifier from the database. Optionally, the preset identifier is the name of the timing task, and the system manager specifies the target timing task needing to acquire the execution state information by setting a preset identifier (drade.mcc.config.monitor.jobs.name) in the system configuration information, so that the execution node does not need to acquire the execution state information of all the timing tasks, and system resources are saved. Optionally, the system administrator may be further capable of specifying at least one target timing task for which execution state information needs to be obtained by configuring an extensible markup language (Extensible Markup Language, XML) file, which is not limited by the embodiments of the present application.
Optionally, the execution node obtains the execution status information of the at least one timing task from a storage list or a cache of the task scheduling system, which is not limited in the embodiment of the present application.
Optionally, the execution node further obtains other attribute information of at least one timing task, such as a task execution mode or a task longest waiting time, which is not limited in the embodiment of the present application.
302. The execution node determines at least one executed task from the at least one timed task based on the execution state information of the at least one timed task.
In some embodiments, as shown in step 404 of fig. 4, the executing node determines the executing state information of the at least one timed task as the timed task of the executed state as the executed task.
By determining the executed task according to the execution state information, the last execution time of all tasks is not required to be acquired in the subsequent steps, but only the last execution time of the executed task is acquired, and system resources are saved.
303. The executing node obtains the last executing time of at least one executed task.
In some embodiments, as shown in step 405 of fig. 4, the execution node invokes the historical execution time query interface to obtain the last execution time of each executed task from the database based on the identity of each executed task. Wherein the history execution time inquiry interface is a hypertext transfer protocol interface.
Optionally, the execution node obtains the last execution time of at least one executed task from a storage list of the task scheduling system, which is not limited in the embodiment of the present application.
304. The execution node determines whether the task scheduling system is abnormal based on the last execution time of at least one executed task.
In some embodiments, as shown in step 406 of fig. 4, the executing node first obtains a target interval duration between a last execution time and a current time of at least one executed task, then compares the target interval duration of each executed task with a corresponding preset threshold, determines that the task scheduling system is abnormal if the target interval duration of any executed task is greater than the preset threshold of the executed task, and determines that the task scheduling system is not abnormal if the target interval duration of each executed task is not greater than the corresponding preset threshold.
The preset threshold value of any executed task is the sum of N execution intervals of the executed task, and N is an integer greater than 0. For example, if the executed task is to clear the data of the invalid order every 5 minutes, and N is 4, the execution interval of the executed task is 5 minutes, and the preset threshold of the executed task is 20 minutes. Alternatively, the execution interval is derived based on a time expression (clone) corresponding to the executed task.
N represents the maximum number of times of allowing the timing task not to be executed, and when the target interval time length of the timing task is larger than the preset threshold value, the timing task can be determined to be not executed for more than N times by comparing the target interval time length of the timing task with the preset threshold value, so that the abnormality of the task scheduling system can be automatically determined. Alternatively, the system administrator sets the value of N by setting a parameter (drade.mcc.config.max.tolearate.threshold) stored in the configuration management apparatus that allows the maximum number of times the timing task is not performed. In the embodiment of the present application, the default value of N is 5.
It should be noted that, in the foregoing steps 301 to 304, the execution node is taken as an example to describe that the execution node can obtain the execution state information of at least one timing task, and in some embodiments, the execution node cannot obtain the execution state information of at least one timing task. Accordingly, as shown in steps 407 to 408 of fig. 4, the above steps 301 to 304 can be replaced with: if the execution node cannot acquire the execution state information of at least one timing task, determining whether the task scheduling system is abnormal based on the abnormal type of the acquired information, and sending an alarm message to a system monitoring device of a system manager, wherein the abnormal type of the acquired information is used for indicating the reason that the execution state information of the at least one timing task cannot be acquired. By acquiring the abnormal type of the information, whether the task scheduling system is abnormal or not can be automatically determined under the condition that the execution state information of the timing task cannot be acquired, and then the normal execution of the timing task can be ensured when the task scheduling system is abnormal.
Optionally, if the execution node tries for a preset number of times, the execution state information cannot be obtained, and based on the abnormality type of the obtained information, determining whether the task scheduling system is abnormal. For example, the preset number of times is 3.
Illustratively, a description will be given of a process of determining whether or not an abnormality occurs in the task scheduling system based on the type of abnormality of the acquired information. If the abnormal type of the acquired information is network failure, which means that the execution node cannot acquire the execution state information due to the fact that the database cannot be connected due to the network failure, determining that the task scheduling system is not abnormal; if the abnormal type of the acquired information is data errors, which indicates that the execution process of the timing task is abnormal, and the execution state information is null or error data exists in the execution state information, determining that the task scheduling system is abnormal.
Illustratively, a process of transmitting an alarm message is described. The executing node obtains an account number (credit. Auto. Overdrady. Quor. Monitor. Receiver) of a system manager from the configuration management device, and sends an alarm message to a system monitoring device corresponding to the account number based on the account number of the manager, so that the system manager can process an abnormal situation based on the alarm message received by the system monitoring device.
305. And if the execution node determines that the task scheduling system is abnormal, executing the timing task based on the execution interval of the timing task.
In some embodiments, if the executing node determines that the scheduling system is abnormal, first a first message is sent to the configuration management device, and then the timing task is executed based on the execution interval of the timing task. The first message is used for indicating that the state information of the task scheduling system is set to be in an abnormal state, and indicating that a second message is sent to other execution nodes except for a target execution node, wherein the target execution node is the execution node for sending the first message, and the second message is used for indicating that the timing task is executed based on the execution interval of the timing task. The above process is explained by process 1 and process 2.
Process 1, send a first message.
In some embodiments, if the executing node determines that the task scheduling system is abnormal, a first message is sent to the configuration management device, the configuration management device receives the first message, sets state information of the task scheduling system to an abnormal state, and sends a second message to other executing nodes except for the target executing node, so that a plurality of executing nodes in the cluster system can execute timing tasks without scheduling. Optionally, the configuration management device sets the degradation flag to 0 to set the state information of the task scheduling system to an abnormal state.
By sending the first message to the configuration management device, when the task scheduling system is determined to be abnormal, the task scheduling system can be set to be in an abnormal state, and other execution nodes are informed of the abnormal condition of the task scheduling system, so that the other execution nodes are instructed to execute the timing task based on the execution interval, and normal execution of the timing task is maintained.
In some embodiments, if the executing node determines that the task scheduling system is abnormal, a first message is sent to the configuration management device at a preset waiting time (addrade. Mcc. Config. Sleep. Second. To. Addrade). Optionally, the preset time period is 60 seconds.
Optionally, if the executing node determines that the task scheduling system is abnormal for multiple times, a first message is sent to the configuration management device, where the first message is a maximum waiting duration (addrade. Mcc. Config. Max. Sleep. Second). Optionally, the maximum waiting period is 300 seconds.
The first message is sent again through the preset waiting time interval, so that each executing node in the cluster system can firstly complete the timing task currently being executed, and then the timing task is executed based on the executing interval, and therefore, when the task scheduling system is abnormal, the conflict of the execution of the timing task can be avoided, and the purpose of keeping the normal execution of the timing task is achieved.
It should be understood that, the system administrator can set the preset waiting duration and the maximum waiting duration based on the specific application scenario, which is not limited in this embodiment of the present application.
And 2, executing timing tasks based on the time intervals.
In some embodiments, a timer of a plurality of timing tasks of the target application program is preset in the execution node, the execution node starts the timers of the plurality of timing tasks in response to completion of sending the first message to the configuration management device or receiving the second message, and if the timer of any timing task reaches an execution interval of the timing task, locking information of the timing task is obtained. If the locking information indicates that the timing task is in an unlocking state, executing the timing task, and setting the locking information of the timing task in a locking state; if the locking information indicates that the timing task is in a locking state, the timing task is not executed, and the locking information of the timing task is set in an unlocking state in response to the execution node completing the timing task. Wherein the locked state indicates that the timed task is currently being executed and the unlocked state indicates that the timed task is not currently being executed.
It should be noted that, the above manner of executing the timing tasks based on the locking information is also referred to as a distributed locking mechanism, and by using the locking information, it can be ensured that one timing task is executed by only one executing node at the same time, so that when the timing task cannot normally provide the scheduling function, normal execution of the timing task can be maintained.
According to the technical scheme provided by the embodiment of the application, the execution condition of the timing task in the task scheduling system is obtained by obtaining the latest execution time of the timing task, so that whether the task scheduling system is abnormal or not can be automatically determined, and when the task scheduling system is abnormal, the timing task is directly executed based on the execution interval of the timing task, thereby achieving the purpose of keeping normal execution of the timing task.
Fig. 5 is a schematic structural diagram of a timing task execution device provided in an embodiment of the present application, referring to fig. 5, the device includes: a first acquisition module 501, a determination module 502 and an execution module 503.
A first obtaining module 501, configured to obtain a last execution time of a timed task in a task scheduling system;
a determining module 502, configured to determine, based on a last execution time of the timed task, whether an abnormality occurs in the task scheduling system, where the task scheduling system is configured to allocate the timed task to a plurality of execution nodes corresponding to the task scheduling system, so as to execute the timed task;
and an execution module 503, configured to execute the timing task based on the execution interval of the timing task if it is determined that the task scheduling system is abnormal.
In some embodiments, the determining module 502 is configured to obtain a target interval duration between a last execution time of the timing task and a current time; if the target interval time length of the timing task is larger than a preset threshold, determining that the task scheduling system is abnormal, wherein the preset threshold is the sum of N execution intervals of the timing task, and N is an integer larger than 0.
In some embodiments, the executing module 503 is configured to obtain the locking information of the timing task based on the execution interval of the timing task; if the locking information indicates that the timing task is in an unlocking state, executing the timing task and setting the locking information in a locking state; the locking information is used for indicating that the timing task is in a locking state or an unlocking state, the locking state indicates that the timing task is currently being executed, and the unlocking state indicates that the timing task is not currently executed.
In some embodiments, the apparatus further comprises:
the sending module is configured to send a first message to a configuration management device of the task scheduling system if it is determined that the task scheduling system is abnormal, where the first message is used to instruct setting state information of the task scheduling system to an abnormal state, and instruct sending a second message to other executing nodes except for a target executing node, where the target executing node is the executing node that sends the first message, and the second message is used to instruct executing the timing task based on an execution interval of the timing task.
In some embodiments, the sending module is configured to send the first message to the configuration management device at intervals of a preset waiting duration if it is determined that the task scheduling system is abnormal.
In some embodiments, the apparatus further comprises: the second acquisition module is used for acquiring the execution state information of at least one timing task in the task scheduling system, wherein the execution state information represents that the corresponding timing task is in an executed state or an unexecuted state;
the determining module 502 is further configured to determine at least one executed task from at least one of the timed tasks based on execution status information of the at least one of the timed tasks;
accordingly, the first obtaining module 501 is configured to obtain the last execution time of the at least one executed task.
In some embodiments, the determining module 502 is further configured to determine whether the task scheduling system is abnormal based on an abnormality type of the obtained information if the execution status information of at least one of the timing tasks cannot be obtained, where the abnormality type of the obtained information is used to indicate a reason why the execution status information of at least one of the timing tasks cannot be obtained.
It should be noted that: the timing task execution device provided in the above embodiment is only exemplified by the division of the above functional modules when executing the timing task, and in practical application, the above functional allocation may be completed by different functional modules according to needs, i.e. the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device for executing the timing task provided in the above embodiment and the method embodiment for executing the timing task belong to the same concept, and the specific implementation process is detailed in the method embodiment, which is not repeated here.
The embodiment of the application also provides a computer device, which comprises a processor and a memory, wherein the memory is used for storing at least one computer program, and the at least one computer program is loaded and executed by the processor to realize the operations executed in the execution method of the timing task in the embodiment of the application.
Fig. 6 is a schematic structural diagram of a computer device provided according to an embodiment of the present application, where the computer device can be configured as any one of the task scheduling system, the execution node, or the configuration management device in the clustered system, and the computer device 600 may generate a relatively large difference due to configuration or performance, and may include one or more processors (Central Processing Units, CPU) 601 and one or more memories 602, where at least one computer program is stored in the memory 602, and the at least one computer program is loaded and executed by the processor 601 to implement the method for executing the timing task provided in each method embodiment. Of course, the computer device can also have a wired or wireless network interface, a keyboard, an input/output interface, and other components for implementing the functions of the device, which are not described herein.
In an exemplary embodiment, a computer readable storage medium, such as a memory, comprising at least one program code executable by a processor to perform the method of performing the timing tasks in the above embodiments is also provided. For example, the computer readable storage medium may be Read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), compact disc Read-Only Memory (CD-ROM), magnetic tape, floppy disk, optical data storage device, and the like.
In an exemplary embodiment, a computer program product is also provided, the computer program product comprising at least one computer program, the at least one computer program being stored in a computer readable storage medium. The processor of the computer device reads the at least one computer program from the computer-readable storage medium, and the processor executes the at least one computer program such that the computer device performs the operations performed by the method of performing the timing tasks described above.
In some embodiments, the computer program related to the embodiments of the present application may be deployed to be executed on one computer device or on multiple computer devices located at one site, or on multiple computer devices distributed across multiple sites and interconnected by a communication network, where the multiple computer devices distributed across multiple sites and interconnected by a communication network may constitute a blockchain system.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the above storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The foregoing description of the preferred embodiments is merely exemplary in nature and is not intended to limit the invention, but is intended to cover various modifications, substitutions, improvements, and alternatives falling within the spirit and principles of the invention.

Claims (15)

1. A method of timing execution of tasks, the method comprising:
acquiring the latest execution time of a timing task in a task scheduling system;
determining whether the task scheduling system is abnormal or not based on the latest execution time of the timing task, wherein the task scheduling system is used for distributing the timing task to a plurality of execution nodes corresponding to the task scheduling system so as to execute the timing task;
and if the task scheduling system is determined to be abnormal, executing the timing task based on the execution interval of the timing task.
2. The method of claim 1, wherein determining whether an exception occurred in the task scheduling system based on a last execution time of the timed task comprises:
acquiring a target interval duration between the latest execution time of the timing task and the current time;
if the target interval time length of the timing task is larger than a preset threshold, determining that the task scheduling system is abnormal, wherein the preset threshold is the sum of N execution intervals of the timing task, and N is an integer larger than 0.
3. The method of claim 1, wherein the performing the timed task based on the execution interval of the timed task comprises:
acquiring locking information of the timing task based on the execution interval of the timing task;
if the locking information indicates that the timing task is in an unlocking state, executing the timing task, and setting the locking information in a locking state;
the locking information is used for indicating that the timing task is in a locking state or an unlocking state, the locking state indicates that the timing task is currently being executed, and the unlocking state indicates that the timing task is not currently being executed.
4. The method according to claim 1, wherein if it is determined that the task scheduling system is abnormal, based on an execution interval of the timed task, before executing the timed task, the method further comprises:
if the task scheduling system is determined to be abnormal, a first message is sent to configuration management equipment of the task scheduling system, the first message is used for indicating that state information of the task scheduling system is set to be in an abnormal state, and a second message is sent to other executing nodes except for a target executing node, the target executing node is the executing node which sends the first message, and the second message is used for indicating that the timing task is executed based on an executing interval of the timing task.
5. The method of claim 4, wherein if it is determined that the task scheduling system is abnormal, sending a first message to a configuration management device of the task scheduling system comprises:
and if the task scheduling system is determined to be abnormal, the first message is sent to the configuration management equipment at intervals of preset waiting time.
6. The method according to claim 1, wherein the method further comprises:
Acquiring execution state information of at least one timing task in the task scheduling system, wherein the execution state information is used for indicating that the corresponding timing task is in an executed state or an unexecuted state;
determining at least one executed task from at least one of the timed tasks based on execution status information of the at least one timed task;
correspondingly, the step of obtaining the last execution time of the timing task in the task scheduling system comprises the following steps:
and acquiring the last execution time of the at least one executed task.
7. The method of claim 6, wherein the method further comprises:
if the execution state information of at least one timing task cannot be acquired, determining whether the task scheduling system is abnormal or not based on the abnormal type of the acquired information, wherein the abnormal type of the acquired information is used for indicating the reason that the execution state information of at least one timing task cannot be acquired.
8. A cluster system, the cluster system comprising: the system comprises a task scheduling system, a plurality of execution nodes and configuration management equipment;
the task scheduling system is used for distributing timing tasks to the plurality of execution nodes so as to execute the timing tasks;
Any executing node is used for acquiring the latest executing time of the timing task in the task scheduling system; determining whether the task scheduling system is abnormal or not based on the latest execution time of the timing task; if the task scheduling system is determined to be abnormal, a first message is sent to the configuration management equipment, wherein the first message is used for indicating that the state information of the task scheduling system is set to be in an abnormal state, and a second message is sent to other executing nodes except for a target executing node, the target executing node is the executing node for sending the first message, and the second message is used for indicating that the timing task is executed based on the execution interval of the timing task; executing the timing task based on the execution interval of the timing task;
the configuration management device is configured to receive the first message of any execution node, set state information of the task scheduling system to an abnormal state, and send the second message to other execution nodes except the target execution node.
9. An apparatus for performing timed tasks, the apparatus comprising:
The acquisition module is used for acquiring the latest execution time of the timing task in the task scheduling system;
the task scheduling system is used for distributing the timing task to a plurality of execution nodes corresponding to the task scheduling system so as to execute the timing task;
and the execution module is used for executing the timing task based on the execution interval of the timing task if the task scheduling system is determined to be abnormal.
10. The apparatus of claim 9, wherein the determining module is configured to obtain a target interval duration between a last execution time of the timing task and a current time; if the target interval time length of the timing task is larger than a preset threshold, determining that the task scheduling system is abnormal, wherein the preset threshold is the sum of N execution intervals of the timing task, and N is an integer larger than 0.
11. The apparatus of claim 9, wherein the execution module is configured to obtain lock information of the timing task based on an execution interval of the timing task; if the locking information indicates that the timing task is in an unlocking state, executing the timing task, and setting the locking information in a locking state; the locking information is used for indicating that the timing task is in a locking state or an unlocking state, the locking state indicates that the timing task is currently being executed, and the unlocking state indicates that the timing task is not currently being executed.
12. The apparatus of claim 9, wherein the apparatus further comprises:
the sending module is used for sending a first message to configuration management equipment of the task scheduling system if the task scheduling system is determined to be abnormal, wherein the first message is used for indicating that the state information of the task scheduling system is set to be in an abnormal state, and sending a second message to other executing nodes except for a target executing node, the target executing node is the executing node for sending the first message, and the second message is used for indicating that the timing task is executed based on the execution interval of the timing task.
13. The apparatus of claim 12, wherein the sending module is configured to send the first message to the configuration management device at intervals of a preset waiting duration if it is determined that the task scheduling system is abnormal.
14. A computer device comprising one or more processors and one or more memories, the one or more memories having stored therein at least one computer program loaded and executed by the one or more processors to perform the operations performed by the method of performing a timed task according to any of claims 1-7.
15. A computer readable storage medium having stored therein at least one computer program loaded and executed by a processor to perform the operations performed by the method of performing timed tasks according to any one of claims 1 to 7.
CN202111545013.3A 2021-12-16 2021-12-16 Method, system, device, equipment and storage medium for executing timing task Pending CN116266132A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111545013.3A CN116266132A (en) 2021-12-16 2021-12-16 Method, system, device, equipment and storage medium for executing timing task

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111545013.3A CN116266132A (en) 2021-12-16 2021-12-16 Method, system, device, equipment and storage medium for executing timing task

Publications (1)

Publication Number Publication Date
CN116266132A true CN116266132A (en) 2023-06-20

Family

ID=86743275

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111545013.3A Pending CN116266132A (en) 2021-12-16 2021-12-16 Method, system, device, equipment and storage medium for executing timing task

Country Status (1)

Country Link
CN (1) CN116266132A (en)

Similar Documents

Publication Publication Date Title
US7873719B2 (en) Enterprise management system
US8191068B2 (en) Resource management system, resource information providing method and program
CN108563502B (en) Task scheduling method and device
CN106406993A (en) Timed task management method and system
US20040215590A1 (en) System for assigning and monitoring grid jobs on a computing grid
WO2016184175A1 (en) Database processing method and apparatus
KR20110040934A (en) Intelligent mobile device management client
CN112416581B (en) Distributed calling system for timed tasks
US20090070425A1 (en) Data processing system, method of updating a configuration file and computer program product
CN111026602A (en) Health inspection scheduling management method and device of cloud platform and electronic equipment
US11327794B2 (en) Periodic task execution in an automated context
CN111580990A (en) Task scheduling method, scheduling node, centralized configuration server and system
US20040205167A1 (en) Automatic configuration of performance management tools
CN112751847A (en) Interface call request processing method and device, electronic equipment and storage medium
CN113590433B (en) Data management method, data management system, and computer-readable storage medium
CN114020572A (en) Distributed alarm method and device
CN112564980B (en) Service monitoring method and system based on micro-service architecture
CN113765690A (en) Cluster switching method, system, device, terminal, server and storage medium
CN112631756A (en) Distributed regulation and control method and device applied to space flight measurement and control software
CN116266132A (en) Method, system, device, equipment and storage medium for executing timing task
CN116346834A (en) Session synchronization method, device, computing equipment and computer storage medium
CN115766715A (en) High-availability super-fusion cluster monitoring method and system
CN114356625A (en) Distributed system redundancy diagnosis method, device, electronic device and storage medium
CN114020368A (en) Information processing method and device based on state machine and storage medium
Cardoso et al. Dynamic checkpoint architecture for reliability improvement on distributed frameworks

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