WO2019080233A1 - 定时任务处理方法、装置、存储介质和计算机设备 - Google Patents

定时任务处理方法、装置、存储介质和计算机设备

Info

Publication number
WO2019080233A1
WO2019080233A1 PCT/CN2017/112552 CN2017112552W WO2019080233A1 WO 2019080233 A1 WO2019080233 A1 WO 2019080233A1 CN 2017112552 W CN2017112552 W CN 2017112552W WO 2019080233 A1 WO2019080233 A1 WO 2019080233A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
execution
executed
scheduled
timed
Prior art date
Application number
PCT/CN2017/112552
Other languages
English (en)
French (fr)
Inventor
刘洪晔
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019080233A1 publication Critical patent/WO2019080233A1/zh

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/466Transaction processing

Definitions

  • the present application relates to the field of information processing technologies, and in particular, to a timing task processing method, apparatus, storage medium, and computer device.
  • timing tasks are handled by each application to maintain its own scheduled tasks.
  • each application maintains its own timing tasks, and it is difficult to know the operational status of the application server or database storing the task data between the applications.
  • timing task processing method In accordance with various embodiments disclosed herein, a timing task processing method, apparatus, storage medium, and computer device are provided.
  • a method for processing a timing task comprising: acquiring a current time of the system; and extracting, from the preset first task queue, an execution time period that is the current time and is in a standby state The time task, the running state of the extracted timed task is modified to be running, as the current scheduled task to be executed; the execution file matching the current scheduled task to be executed is acquired; and the current waiting to be executed according to the execution file is started a command line of the executed timed task; the command line is executed as a process, and the command line is executed in the form of a process; and when the process is finished, detecting whether the first task queue still has a scheduled task If yes, returning to continue to perform the extraction of the execution time period from the first task queue to a timed task that includes the current time and is in a pending state.
  • a timing task processing device includes: a current time acquisition module, configured to acquire a current time of the system; and a timing task extraction module, configured to extract an execution time period from the preset first task queue to include the current time, And the timed task in the to-be-running state, the running state of the extracted timed task is modified to be in operation, as the current scheduled task to be executed; and the file obtaining module is configured to obtain the execution that matches the current scheduled task to be executed.
  • a command line building module configured to build a command line that starts the current scheduled task to be executed according to the execution file; and a timed task execution module, configured to use the command line as a process in the form of a process Executing the command line;
  • the timing task extraction module is further configured to: after the execution of the process ends, detecting whether there is still a timing task in the first task queue, and if yes, returning to perform the performing from the first task
  • the execution time period in the queue is a timed task that includes the current time and is in a standby state.
  • One or more non-volatile readable storage media storing computer readable instructions, when executed by one or more processors, cause one or more processors to perform the steps of: acquiring a current system Time: extracting an execution time period from the preset first task queue to a timed task including the current time and being in a running state, and modifying the running state of the extracted timed task to be running, as the current scheduled task to be executed Obtaining an execution file that matches the current scheduled task to be executed; constructing a command line that starts the current scheduled task to be executed according to the execution file; and executing the command line as a process in the form of a process The command line; and after the execution of the process ends, detecting whether there is still a timing task in the first task queue, and if yes, returning to continue execution, extracting the execution time period from the first task queue to include Description The current time, and the timed task in the pending state.
  • a computer device comprising a memory and a processor, wherein the memory stores computer readable instructions, the computer readable instructions being executed by the processor, such that the processor performs the step of: acquiring a current time of the system; Extracting the execution time period from the preset first task queue to the timed task including the current time and in the to-be-running state, and modifying the running state of the extracted timed task to be running, as the current scheduled task to be executed; An execution file matching the current scheduled task to be executed; constructing a command line for starting the current scheduled task to be executed according to the execution file; and executing the command line as a process in a process a command line; and when the execution of the process ends, detecting whether there is still a scheduled task in the first task queue, and if yes, returning to continue execution, extracting an execution time period from the first task queue to include the current Time, and a timed task that is in a running state.
  • FIG. 1 is an application environment diagram of a timing task processing method in an embodiment
  • FIG. 2 is a flow chart of a method for processing a timing task in an embodiment
  • FIG. 3 is a flow diagram of a process of adding a timing task to a first task queue in one embodiment
  • FIG. 4 is a flowchart of obtaining an execution file that matches a current scheduled task to be executed in one embodiment
  • FIG. 5 is a structural block diagram of a timing task processing apparatus in an embodiment
  • FIG. 6 is a structural block diagram of a timing task processing apparatus in another embodiment.
  • Figure 7 is a diagram showing the internal structure of a computer device in one embodiment.
  • first the terms “first”, “second” and the like, as used herein, may be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish one element from another.
  • the first task queue may be referred to as a second task queue without departing from the scope of the present application, and similarly, the second task queue may be referred to as a first task queue. Both the first task queue and the second task queue are task queues, but they are not the same task queue.
  • the method for processing a timing task provided by the embodiment of the present application can be applied to an application environment as shown in FIG. 1 .
  • computer device 120 may aggregate the timing tasks provided by other computer devices 110 (eg, terminal 110A, terminal 110B, server 110C) and store the scheduled tasks in database 130.
  • the computer device can obtain the current time of the database 130 and extract each scheduled task that can be executed at the current time. For each extracted scheduled task, the execution file of the scheduled task is obtained, a command line is generated, and the command line is executed in the form of a process.
  • a timing task processing method comprising:
  • Step S202 Acquire a current time of the system.
  • the current time of the system can be the current time of the local system, and can also be the current time of the database connected to the computer device. Wherein, when the computer device is connected to the database, the current time of acquiring the database may be selected.
  • the computer device stores a plurality of scheduled tasks to be processed in the local machine and/or the database. After the computer device is started, it can automatically connect to the database and obtain the current time of the database. The computer device can also connect to the database to obtain its current time after receiving the instruction to perform task processing.
  • step S204 the time-scheduled task whose execution time period is the current time and is in the running state is extracted from the first task queue, and the running state of the extracted timed task is modified to be running as the current scheduled task to be executed.
  • the first task queue is a queue for storing task information of a scheduled task to be processed, and the timing task in the task queue may include multiple.
  • the first task queue can be local to the computer device and can also be located in the database. When it is local, it can obtain the scheduled task in the local first task queue. When it is on the database, it can access the first task queue located on the database.
  • the task information of each timed task includes a task identifier, a task state, and a task execution time period for uniquely identifying the corresponding task.
  • the task execution time period may include a task start execution time and a termination execution time. When the execution execution time is set to be set, it indicates that the task execution time period includes any time period from the execution start time of the task.
  • the computer device may sequentially extract a timed task from the first task queue, such as a timed task that may be extracted from the head of the first task queue.
  • a timed task that may be extracted from the head of the first task queue.
  • the computer device may modify, from the task information of the scheduled task, field information indicating the status of the task, and modify the field to be used to indicate the status of the running. For example, if “ready” and “running” are preset to indicate the to-be-running state and the running state, respectively, the computer device can change the field information from “ready” to "running”.
  • Step S206 Acquire an execution file that matches the current scheduled task to be executed.
  • the execution file is the relevant file needed to perform the scheduled task.
  • the execution file may be a jar file related to the scheduled task, and the jar file includes information such as a configuration file related to the timed task.
  • the computer device presets a correspondence between the task identifier of each timed task and the related execution file, and according to the correspondence, the execution file matching the timed task can be acquired.
  • the computer device can obtain an execution file that matches the scheduled task from the preset storage path.
  • the preset storage path is preset for storing a storage path related to the scheduled task, and the preset storage path may be located
  • the memory local to the computer device can also be located in memory on the database.
  • Step S208 constructing a command line for starting a current scheduled task to be executed according to the execution file.
  • This command action is used to initiate a start command for the corresponding scheduled task.
  • a command line can be built from the timed task and the configuration files in the execution file.
  • the configuration items in the configuration file are different, and the command lines constructed are not necessarily the same.
  • the command line may include one or more of the task identifier of the scheduled task, the file identifier of the execution file, the directory location information of the task release, and whether the password in the configuration file is encrypted.
  • step S210 the command line is used as a process, and the command line is executed in the form of a process.
  • the computer device can execute the command line as a process in the form of a process task.
  • the process task can be performed by the computer device itself, and can also be performed by other external devices for performing scheduled tasks.
  • the command line When executed for an external device, the command line also includes port information for communicating with the external device, and the size of the temporary file to be written after the communication is disconnected.
  • the socket communication may be used to communicate with the external device, and the unit for writing the temporary file may be byte.
  • each command line By executing each command line as a process task in the form of a process, isolation between different timed tasks can be achieved, coupling performance of each task can be reduced, and a certain timing task can be prevented from being abnormal or occupying too many resources. , affecting the execution of other timed tasks.
  • the external device may include a plurality of, the computer device may predetermine a device identifier of the external device for performing the timing task, and port information for communicating with the device identifier, and writing the device identifier and the port information The command line is entered so that the timing task is executed by the corresponding determined external device.
  • Step S212 after the execution of the process ends, it is detected whether there is still a scheduled task in the first task queue, and if yes, returning to continue to perform the extraction of the execution time period from the first task queue to the timed task including the current time and in a standby state.
  • the computer device can detect whether there is still a scheduled task in the first task queue. Optionally, it is detected whether there are still unprocessed timing tasks in the first task queue.
  • the first task queue is determined. The time task is reduced by one. If there is still a timed task, the process returns to the above step S204, and continues to extract a timed task from the first task queue.
  • the timed task that continues to be extracted is also a timed task that includes the current time and is in a running state.
  • the re-extracted timing task is used as the current scheduled task to be executed, and steps S206 to S210 are repeated until the timing tasks included in the first task queue are all extracted.
  • the timed task processing method provided in this embodiment is configured to store a timed task in a first task queue, and extract a timed task whose execution time period is a current time and is in a running state from the first task queue, and then The extracted timing tasks are processed by a generated process task, which can achieve isolation between different timing tasks, reduce the coupling of each task execution, and prevent a certain timing task from being abnormal or occupying too many resources, affecting other timings.
  • the execution of tasks improves the processing efficiency of timed tasks.
  • a process of adding a timing task to the first task queue is further included.
  • the process includes: periodically acquiring a scheduled task in the preset second task queue; detecting whether the acquired execution time period of the scheduled task includes the current time, and if yes, modifying the acquired task state of the scheduled task to the pending state; The running timed task moves to the first task queue until the timed task in the second task queue is acquired.
  • the process includes:
  • Step S302 Acquire a timing task in the second task queue.
  • a plurality of initial timing tasks are stored in the second task queue.
  • the computer device receives the timed task sent by the other device, or creates a timed task according to the information sent by the other device, the task information of the timed task may be stored in the first task queue. After receiving the processing instruction for the timing task information, the timing task can be obtained from the first task queue.
  • the computer device can sequentially extract a scheduled task from the second task queue, such as a timing task that can be extracted from the head of the second task queue.
  • Step S304 detecting whether the execution time period of the acquired timed task includes the current time, and if yes, executing step S306, otherwise, performing step S308,
  • the computer device can obtain the task information of the timed task, and detect whether the task execution time information is included in the task information. If not included or the time information is empty, the decision is no. If included, the time expression in the execution time information can be parsed. The computer device can further detect whether the form of the time expression matches the form of the preset expression, and if so, extract the task start execution time and/or the end execution time in the time expression. It is detected whether the start execution time is less than the current time, and whether the termination execution time is greater than the current time. If yes, it is determined that the execution time period includes the current time, otherwise, the determination execution time period does not include the current time.
  • step S306 the task state of the acquired timed task is modified to be in a running state, and the timed task in the to-be-run state is moved to the first task queue.
  • the task status of the scheduled task may include an initialization state, an invalid state, a to-be-run state, a running state, and an execution completion state.
  • the timed task extracted from the second task queue is in an initialized state, moved to a timed task in the first task queue, and its state is processed to be in a running state.
  • the timed task determines the execution time period including the current time, it means that the timed task can be started now, and its task state can be changed to the pending state and transferred to the first task queue.
  • the scheduled tasks stored in the first task queue are all ready to execute the scheduled task.
  • Step S308 recording information that the execution time period of the timed task does not belong to the current execution time.
  • the execution time period does not include the current time
  • the information that the execution time period of the corresponding timed task does not belong to the current execution time is recorded.
  • the status of the corresponding timing task is changed to an invalid state, indicating that it is invalid at the current time and does not need to be processed.
  • the specific information that does not belong to the current execution time may be recorded. For example, if the time expression cannot be parsed, the time expression defined by the timed task may be recorded as an illegal expression, and the publication is prohibited. If the next execution time cannot be calculated in the time expression, you can record "This time expression [XXX] has been unable to calculate the next execution time and stop the job". If the termination execution time is less than the current time, "this scheduled task has reached the stop time, stop this job" can be recorded.
  • Step S310 detecting whether there is a timing task in the second task queue, and if yes, returning to step S302, otherwise, executing step S312.
  • the execution time period of the one or more timed tasks After detecting whether the execution time period of the one or more timed tasks includes the current time, it may return to continue to detect whether the timed task still exists in the second task queue, and if yes, return to perform the above step S302, from the second task The queue continues to extract the next scheduled task, and detects whether the execution time period contains the current time, and performs corresponding processing according to the execution result.
  • step S312 the execution time period is extracted from the first task queue as a timed task including the current time and in a standby state.
  • the time period in which the execution time period is the current time and is in the running state may be extracted from the first task queue.
  • the method further includes: acquiring execution feedback information of the process, where the execution feedback state includes an execution state of the timed task; and when the execution state is an execution exception, modifying the state of the timed task to the to-be-run state And re-enter the first task queue.
  • the execution state includes the status of execution, execution completion, and execution of an exception.
  • the computer device can obtain execution feedback information of each process according to a preset frequency.
  • the preset frequency can be a preset fixed frequency or a custom frequency set according to a user's modification instruction. For example, it can be obtained once per second, or once every 5 seconds.
  • the execution state of the corresponding process may be detected in real time according to a preset frequency. If the process is executed by an external device, the execution feedback information sent by the corresponding external device may be received in real time according to the set frequency through the preset port, and the execution state thereof may be obtained.
  • the computer device ends the operation of the process to prevent the process from continuing to execute while occupying resources.
  • the timed task corresponding to the process can be obtained, put into the first task queue again, and the task state of the timed task is changed to the to-be-run state again, so that the subsequent timed task is processed again, and the timing is improved. The probability that a task will be successfully processed.
  • the computer device may calculate the running time of the process when the acquired execution state is the executed state. If the running time is less than the second preset running time, it is determined that the corresponding process is actually an execution abnormality. If the preset running time is exceeded, it is determined that the corresponding process is successfully completed, that is, the corresponding timing task is successfully executed. Similarly, when it is determined that the abnormality is actually performed, the timed task corresponding to the process may be acquired, put into the first task queue again, and the task state of the timed task is re-modified to the pending state.
  • the second preset duration may be any preset duration.
  • the second preset duration may be determined according to a minimum duration required for historical execution of the timing task, and the second preset duration may be set to any suitable duration less than the minimum duration. For example, if the minimum duration is 5 minutes, the second preset duration can be set to 2 minutes. If the execution status acquired within two minutes is the execution completion, it can be determined that the corresponding timing task is actually an execution exception.
  • the method further includes: calculating an execution duration of the process; when the execution duration reaches the first preset execution duration, terminating the execution process; modifying the state of the scheduled task to the pending state, and Reload into the first task queue.
  • the first preset duration can be any suitable length of time.
  • the first preset duration may be determined according to a maximum duration required for historical execution of the timing task, and the first preset duration may be set to any suitable duration longer than the maximum duration. For example, if the maximum duration is 30 minutes, the first preset duration can be set to 60 minutes.
  • the computer device may start a timer corresponding to the process, and acquire an execution state of the process according to the preset frequency, and reach a first preset execution when the timer expires.
  • the process can be terminated, and the state of the scheduled task is changed to the pending state and re-entered into the first task queue.
  • an instruction to terminate the execution of the timing task may be sent to the corresponding external device to instruct the external device to terminate execution of the corresponding timing task.
  • step S206 includes:
  • Step S402 querying whether the execution file corresponding to the timing task exists locally on the computer device, If yes, step S404 is performed. Otherwise, step S408 is performed.
  • the computer device may first query the local memory for the presence of an execution file corresponding to the timing task.
  • the corresponding execution file may be queried from a preset path of the execution file for storing the scheduled task, and if yes, step S404 is performed; otherwise, step S408 is performed.
  • An execution file corresponding to the scheduled task is a file that can be used to execute the scheduled task using the execution file.
  • step S404 it is detected whether the execution file matches the scheduled task. If yes, step S406 is performed; otherwise, step S408 is performed.
  • the computer device can further detect whether the file identification of the execution file matches the task identification of the scheduled task.
  • the corresponding file version number is obtained from the configuration file in the execution file, and the file version number is compared with the task version number in the task information. If the same, the execution file is determined to be related to the timed task. match.
  • step S406 an execution file is acquired.
  • the computer device may obtain the execution file queried from the local to perform a corresponding timing task through the execution file subsequently.
  • Step S408 obtaining an execution file corresponding to the extracted timing task from the database.
  • the execution file corresponding to the timed task may be obtained from the database, and the corresponding scheduled task is subsequently executed by the execution file obtained from the database.
  • the method further includes: detecting whether the execution file has been saved into the database, and saving the execution file to the database when not saved in the database, so that other devices can be subsequently The executable file is obtained in the database.
  • executing the command line in the form of a process includes: invoking a preset delay algorithm to generate a delay duration, and executing the command line in the form of a process according to the delay duration.
  • the computer device presets a corresponding delay algorithm for generating a delay duration. After the computer device generates the process, the corresponding timer is started, and a preset delay algorithm is called to generate a delay duration. After the timer duration reaches the delay duration, the process is executed. Task, thereby delaying the execution of the process. The process may be delayed by the computer device itself, and other devices may be instructed to execute the process according to the delay duration.
  • the delay interval is set in the delay algorithm such that the generated delay duration is within the delay interval.
  • the delay interval can be from 500ms to 3500ms.
  • the preset delay algorithm is used to generate the delay duration, which includes: obtaining the number of times the current scheduled task is failed to be executed; and generating the delay duration according to the number of times and the preset delay algorithm.
  • the computer device When the computer device re-storing the scheduled task to the first task queue, it indicates that the corresponding scheduled task is failed to be executed, and needs to be re-executed, and the number of times the execution of the scheduled task fails to be performed, and the number of failed executions before the statistics is counted. Add 1 to it.
  • the computer device may query, according to the task identifier of the timed task, the number of times the latest scheduled statistics task is failed to be executed.
  • the computer device can adjust the delay interval in the delay algorithm according to the number of times. When the number of times is larger, the range of the interval included in the delay interval is also larger.
  • the re-executed timing task can be delayedly executed according to the number of execution failures to generate a longer delay time to improve the execution efficiency of the timing task in the entire system.
  • the preset number of times can be any suitable number of settings, such as 10 times.
  • Random() represents a randomly generated arbitrary coefficient between 0 and 1.
  • the delay interval of the delay time is [a, b]; when the preset number of times is not exceeded, the delay interval of the delay duration is [a, x * c].
  • a, b, c can be any suitable value set.
  • the device identifier of the device that performs the scheduled task may be acquired, and the device identifier is recorded in the task information of the task, so that the subsequent device may acquire which device performs the scheduled task.
  • the device can be the computer device itself, and can also be assigned to other external devices that perform the timing task for the computer device.
  • executing the command line in the form of a process includes: querying, from the task information of the timed task, a device identifier indicating a device that failed to perform, and assigning the process to execution by another device different from the device identifier. .
  • the device may be instructed to delay execution of the process according to the delay method described above.
  • a timing task processing apparatus comprising:
  • the current time acquisition module 502 is configured to acquire the current time of the system.
  • the timed task extraction module 504 is configured to extract, from the preset first task queue, a timed task whose execution time period is the current time and is in a to-be-run state, and modify the running state of the extracted timed task to be in operation, as the current waiting Scheduled tasks performed.
  • the execution file obtaining module 506 is configured to acquire an execution file that matches the current scheduled task to be executed.
  • the command line construction module 508 is configured to build a command line for starting a current scheduled task to be executed according to the execution file.
  • the timed task execution module 510 is configured to execute the command line in the form of a process by using the command line as a process.
  • the timing task extraction module 504 is further configured to: when the process execution ends, detecting whether there is still a timing task in the first task queue, and if yes, returning to continue execution, extracting the execution time from the first task queue, the segment includes the current time, and is in operation Timed tasks for the state.
  • the timing task extraction module 504 is further configured to cyclically acquire a scheduled task in the preset second task queue; and detect whether the acquired execution time period of the scheduled task includes the current time, and if yes, the acquired timed task The task status is changed to the pending state; the pending state is The scheduled task moves to the first task queue until the scheduled task in the second task queue is acquired.
  • another timing task processing apparatus is provided, the apparatus further comprising:
  • the feedback information processing device 512 is configured to acquire the execution feedback information of the process, and the execution feedback state includes the execution state of the timed task; when the execution state is the execution exception, the state of the timed task is modified to the pending state, and the In a task queue.
  • the timing task execution module 510 is further configured to calculate a execution duration of the process; when the execution duration reaches the first preset execution duration, the execution process is terminated; the state of the scheduled task is modified to be in a running state, and is re-released. Into the first task queue.
  • the execution file obtaining module 506 is further configured to query whether the execution file corresponding to the timing task exists locally on the computer device, and if yes, detecting whether the execution file matches the timing task, and if yes, acquiring the execution file; If there is no or no match, the execution file corresponding to the extracted timing task is obtained from the database.
  • the timing task execution module 510 is further configured to invoke a preset delay algorithm to generate a delay duration, and execute the command line in the form of a process according to the delay duration.
  • the timing task execution module 510 is further configured to acquire the number of times that the current scheduled task to be executed is failed to be executed; and generate the delay duration according to the number of times and the preset delay algorithm.
  • Each of the above-described devices may be implemented in whole or in part by software, hardware, and combinations thereof.
  • Each of the above modules may be embedded in or independent of the processor in the computer device, or may be stored in a memory in the computer device in a software form, so that the processor invokes the operations corresponding to the above modules.
  • the processor can be a central processing unit (CPU), a microprocessor, a microcontroller, or the like.
  • a computer readable storage medium having stored thereon computer readable instructions that, when executed by a processor, implement any of the above described timing task processing methods step.
  • the computer readable instructions are executed by the processor to: acquire a current time of the system; and extract an execution time period from the preset first task queue to include the current time, And the timed task in the to-be-running state, the running state of the extracted timed task is modified to be running, as the current scheduled task to be executed; the execution file matching the current scheduled task to be executed is acquired; The command line of the scheduled task; the command line is used as a process, and the command line is executed in the form of a process; when the process is finished, it is detected whether there is still a scheduled task in the first task queue, and if so, the return continues from the first
  • the execution time period in the task queue is a timed task that includes the current time and is in a pending state.
  • the following steps are further performed: cyclically acquiring a scheduled task in the preset second task queue; detecting whether the acquired execution time period of the scheduled task includes the current time, and if so, Then, the task state of the obtained timed task is changed to the to-be-run state; the timed task of the to-be-run state is moved to the first task queue until the timed task in the second task queue is obtained.
  • the following steps are further performed: acquiring execution feedback information of the process, including execution status of the timing task in the execution feedback information; and timing task when the execution state is performing an abnormality The status is changed to the pending state and re-entered into the first task queue.
  • the following steps are further performed: calculating an execution duration of the process; when the execution duration reaches a first preset execution duration, terminating the execution process; modifying the status of the timing task to Pending state and re-inserting into the first task queue.
  • the computer readable instructions are further executed by the processor to: query whether the execution file corresponding to the timing task exists locally on the computer device, and if yes, detect whether the execution file matches the timing task, if If it matches, the execution file is obtained; if it does not exist or does not match, the execution file corresponding to the extracted timing task is obtained from the database.
  • the following steps are further implemented: invoking a preset delay algorithm to generate a delay duration, and executing the command line in the form of a process according to the delay duration.
  • the following steps are further performed: acquiring the number of times the currently scheduled timing task is failed to be executed; according to the number of times and the preset delay algorithm The delay time is generated.
  • a computer apparatus comprising a memory, a processor, and computer readable instructions stored on the memory and operative on the processor, the processor implementing the computer readable instructions to implement the various embodiments described above Any of the steps of the timing task processing method.
  • the computer device can include, but is not limited to, a terminal such as a cell phone, tablet, portable notebook, or smart wearable device.
  • FIG. 7 it is a schematic diagram of the internal structure of a computer device in one embodiment.
  • the computer device includes a processor, memory, and network interface coupled by a system bus.
  • the processor is used to provide computing and control capabilities to support the operation of the entire computer device.
  • the memory is used to store data, programs, and/or instruction code, etc., and the memory stores at least one computer readable instruction executable by the processor to implement the computer device for use in the embodiments of the present application. Timing task processing method.
  • the memory may include a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or the like.
  • the memory includes a non-volatile storage medium and an internal memory.
  • Non-volatile storage media stores operating systems, databases, and computer readable instructions.
  • the database stores data related to a timing task processing method provided by the above various embodiments, such as task information that can store a timed task and device identification information of a database or other external device.
  • the computer readable instructions are executable by a processor for implementing a timing task processing method provided by the various embodiments above.
  • the internal memory provides a cached operating environment for operating systems, databases, and computer readable instructions in a non-volatile storage medium.
  • the network interface may be an Ethernet card or a wireless network card or the like for communicating with an external computer device. It will be understood by those skilled in the art that the structure shown in FIG.
  • FIG. 7 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device to which the solution of the present application is applied.
  • the specific computer device may It includes more or fewer components than those shown in the figures, or some components are combined, or have different component arrangements.
  • the processor executes the computer readable instructions
  • the following steps are performed: acquiring a current time of the system; and extracting, from the preset first task queue, the execution time period is a timed task including the current time and being in a running state, Modifying the running state of the extracted timed task to be running, as the current scheduled task to be executed; acquiring an execution file that matches the current scheduled task to be executed;
  • the command line for starting the current scheduled task to be executed is constructed according to the execution file; the command line is used as a process, and the command line is executed in the form of a process; when the process is finished, it is detected whether there is still a scheduled task in the first task queue, if Returning to the execution of the scheduled task from the first task queue to extract the execution time period to include the current time and in the pending state.
  • the method further comprises: cyclically acquiring a scheduled task in the preset second task queue; detecting whether the acquired execution time period of the scheduled task includes the current time, and if so, The task state of the obtained timed task is modified to be in a running state; the timed task of the to-be-running state is moved to the first task queue until the timed task in the second task queue is obtained.
  • the processor when the processor executes the computer readable instructions, the following steps are further performed: acquiring execution feedback information of the process, including execution status of the timing task in the execution feedback information; and performing the timed task when the execution state is an execution exception The state is changed to the pending state and re-entered into the first task queue.
  • the processor when the processor executes the computer readable instructions, the following steps are further performed: calculating the execution duration of the process; when the execution duration reaches the first preset execution duration, terminating the execution process; modifying the state of the scheduled task to be Run the status and re-enter the first task queue.
  • the method when the processor executes the computer readable instructions, the method further includes: querying whether the execution file corresponding to the timing task exists locally on the computer device, and if yes, detecting whether the execution file matches the timing task, if the matching , the execution file is obtained; if it does not exist or does not match, the execution file corresponding to the extracted timing task is obtained from the database.
  • the processor when executing the computer readable instructions, further implements the steps of: invoking a preset delay algorithm to generate a delay duration, and executing the command line in the form of a process according to the delay duration.
  • the processor executes the computer readable instructions, the following steps are further performed: acquiring the number of times the current scheduled task to be executed is failed to be executed; and generating the delay duration according to the number of times and the preset delay algorithm.
  • Non-volatile memory Any reference to a memory, storage, database, or other medium used herein may include non-volatile memory. Suitable non-volatile memories can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • ROM read only memory
  • PROM programmable ROM
  • EPROM electrically programmable ROM
  • EEPROM electrically erasable programmable ROM
  • flash memory any reference to a memory, storage, database, or other medium used herein may include non-volatile memory.
  • ROM read only memory
  • PROM programmable ROM
  • EPROM electrically programmable ROM
  • EEPROM electrically erasable programmable ROM

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

一种定时任务处理方法,所述方法包括:获取系统当前时间;从预设第一任务队列中提取执行时间段为包含当前时间,且处于待运行状态的定时任务,将提取的定时任务的运行状态修改为运行中,作为当前待执行的定时任务;获取与当前待执行的定时任务匹配的执行文件;根据执行文件构建启动当前待执行的定时任务的命令行;以一个进程的形式执行命令行;当进程执行结束后,检测第一任务队列中是否还存在定时任务,若是,返回继续执行从第一任务队列中提取执行时间段为包含当前时间,且处于待运行状态的定时任务。

Description

定时任务处理方法、装置、存储介质和计算机设备
本申请要求于2017年10月24日提交中国专利局,申请号为2017110014536,发明名称为“定时任务处理方法、装置、存储介质和计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及信息处理技术领域,特别是涉及一种定时任务处理方法、装置、存储介质和计算机设备。
背景技术
随着企业规模的扩大,其内部使用的应用系统也必然会大量增加,而在这些应用系统内部和之间会存在着大量的定时任务。这些任务的操作复杂类型多样,既有数据库间的交互,也有数据库和应用、应用和应用之间的交互。
传统的对这些定时任务的处理方法,通常都是由每个应用自行维护自身的定时任务。然而由每个应用各自维护自身的定时任务,各个应用之间难以知晓存储任务数据的应用服务器或数据库的运行状态。当存在大量的定时任务需要处理时,容易导致对某一个或多个应用服务器或数据库的资源占用巨大,甚至在拉取对应任务信息时,各个应用之间会出现竞争情况,导致整个应用系统的运行效率不高。
发明内容
根据本申请公开的各种实施例,提供一种定时任务处理方法、装置、存储介质和计算机设备。
一种定时任务处理方法,所述方法包括:获取系统当前时间;从预设第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定 时任务,将提取的定时任务的运行状态修改为运行中,作为当前待执行的定时任务;获取与所述当前待执行的定时任务匹配的执行文件;根据所述执行文件构建启动所述当前待执行的定时任务的命令行;将所述命令行作为一个进程,以一个进程的形式执行所述命令行;及当所述进程执行结束后,检测所述第一任务队列中是否还存在定时任务,若是,返回继续执行所述从所述第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务。
一种定时任务处理装置,所述装置包括:当前时间获取模块,用于获取系统当前时间;定时任务提取模块,用于从预设第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务,将提取的定时任务的运行状态修改为运行中,作为当前待执行的定时任务;执行文件获取模块,用于获取与所述当前待执行的定时任务匹配的执行文件;命令行构建模块,用于根据所述执行文件构建启动所述当前待执行的定时任务的命令行;及定时任务执行模块,用于将所述命令行作为一个进程,以一个进程的形式执行所述命令行;所述定时任务提取模块还用于当所述进程执行结束后,检测所述第一任务队列中是否还存在定时任务,若是,返回继续执行所述从所述第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务。
一个或多个存储有计算机可读指令的非易失性可读存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行如下步骤:获取系统当前时间;从预设第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务,将提取的定时任务的运行状态修改为运行中,作为当前待执行的定时任务;获取与所述当前待执行的定时任务匹配的执行文件;根据所述执行文件构建启动所述当前待执行的定时任务的命令行;将所述命令行作为一个进程,以一个进程的形式执行所述命令行;及当所述进程执行结束后,检测所述第一任务队列中是否还存在定时任务,若是,返回继续执行所述从所述第一任务队列中提取执行时间段为包含所述 当前时间,且处于待运行状态的定时任务。
一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行如下步骤:获取系统当前时间;从预设第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务,将提取的定时任务的运行状态修改为运行中,作为当前待执行的定时任务;获取与所述当前待执行的定时任务匹配的执行文件;根据所述执行文件构建启动所述当前待执行的定时任务的命令行;将所述命令行作为一个进程,以一个进程的形式执行所述命令行;及当所述进程执行结束后,检测所述第一任务队列中是否还存在定时任务,若是,返回继续执行所述从所述第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征、目的和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为一个实施例中定时任务处理方法的应用环境图;
图2为一个实施例中定时任务处理方法流程图;
图3为一个实施例中将定时任务添加至第一任务队列中的过程的流程图;
图4为一个实施例中获取与当前待执行的定时任务匹配的执行文件的流程图;
图5为一个实施例中定时任务处理装置的结构框图;
图6为另一个实施例中定时任务处理装置的结构框图;及
图7为一个实施例中计算机设备的内部结构图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制。这些术语仅用于将第一个元件与另一个元件区分。举例来说,在不脱离本申请的范围的情况下,可以将第一任务队列称为第二任务队列,且类似地,可将第二任务队列称为第一任务队列。第一任务队列和第二任务队列两者都是任务队列,但其不是同一任务队列。
本申请实施例所提供的定时任务处理方法,可应用于如图1所示的应用环境中。参考图1所示,计算机设备120可汇总其它计算机设备110(如终端110A、终端110B、服务器110C)提供的定时任务,将该定时任务存储到数据库130中。计算机设备可获取该数据库130的当前时间,提取每个被设置在当前时间可被执行的定时任务。针对每个提取的定时任务,获取该定时任务的执行文件,生成命令行,并以一个进程的形式执行该命令行。
在一个实施例中,如图2所示,提供了一种定时任务处理方法,该方法包括:
步骤S202,获取系统当前时间。
系统当前时间可为本机系统的当前时间,还可为与计算机设备相连的数据库的当前时间。其中,当计算机设备连接到数据库时,可选择获取该数据库的当前时间。计算机设备本机和/或数据库中存储了多个待处理的定时任务。计算机设备在被启动后,可自动连接数据库,并获取数据库的当前时间。计算机设备还可在接收到进行任务处理的指令后,连接数据库,获取其当前时间。
步骤S204,从第一任务队列中提取执行时间段为包含当前时间,且处于待运行状态的定时任务,将提取的定时任务的运行状态修改为运行中,作为当前待执行的定时任务。
第一任务队列为用于存储待处理的定时任务的任务信息的队列,该任务队列中的定时任务可包括多个。第一任务队列可位于计算机设备本地,还可位于数据库中。当处于本地时,可获取本地的第一任务队列中的定时任务,当处于数据库上时,可访问位于该数据库上的第一任务队列。其中,每个定时任务的任务信息包含用于唯一标识对应任务的任务标识、任务状态和任务执行时间段。其中,任务执行时间段可为包括任务开始执行时间和终止执行时间。当为设置终止执行时间时,表示该任务执行时间段包括从任务开始执行时间之后的任意时段。
计算机设备可依次从该第一任务队列中提取一个定时任务,比如可提取位于该第一任务队列的队首的定时任务。当提取出的定时任务的执行时间段包含当前时间、且该定时任务的任务状态为待运行状态时,判定可执行该定时任务,并将该定时任务的任务状态修改为运行中,将该定时任务作为当前待执行的定时任务,以开始执行该定时任务。
在一个实施例中,计算机设备可从该定时任务的任务信息中,用于表示任务状态的字段信息进行修改,修改为预设用于表示运行中的状态的字段。比如预设了“ready”和“running”分别表示待运行状态和运行中状态,则计算机设备可将该字段信息由“ready”修改为“running”。
步骤S206,获取与当前待执行的定时任务匹配的执行文件。
执行文件为需要执行该定时任务所需的相关文件。执行文件可为与该定时任务相关的jar文件,该jar文件中包含与该定时任务相关的配置文件等信息。计算机设备预先设置了每个定时任务的任务标识与相关执行文件之间的对应关系,根据该对应关系,可获取该与该定时任务匹配的执行文件。计算机设备可从预设存储路径下,获取与该定时任务匹配的执行文件。该预设存储路径为预设的用于存储与定时任务相关的存储路径,预设存储路径可位于 计算机设备本地的存储器中,还可位于数据库上的存储器中。
步骤S208,根据执行文件构建启动当前待执行的定时任务的命令行。
该命令行为用于启动对应定时任务的启动指令。可选地,可根据该定时任务以及执行文件中的配置文件来构建命令行。配置文件中的配置项不同,所构建的命令行也不一定相同。命令行可包含该定时任务的任务标识、执行文件的文件标识、任务发布的目录位置信息、配置文件中的密码是否加密等信息等其中的一种或多种。
步骤S210,将该命令行作为一个进程,以一个进程的形式执行命令行。
计算机设备可将该命令行作为一个进程,以一个进程任务的形式来执行。该进程任务可由计算机设备自身来执行,还可为有其它预设的用于执行定时任务的外部设备来执行。当为外部设备执行时,该命令行中还包括用于与该外部设备进行通讯的端口信息,以及在通讯断开后,写临时文件的大小。其中,可采用socket通讯的方式与该外部设备进行通讯,写临时文件的单位可为byte。
通过将每个命令行以进程的形式,作为一个进程任务来执行,可实现不同定时任务之间的隔离,降低各个任务执行的耦合性,可防止某个定时任务出现异常或者占用过多资源时,影响其他定时任务的执行。
在一个实施例中,外部设备可包括多个,计算机设备可预先确定用于执行该定时任务的外部设备的设备标识,以及与该设备标识进行通讯的端口信息,将该设备标识和端口信息写入命令行中,以使得由对应确定的外部设备执行该定时任务。
步骤S212,当进程执行结束后,检测第一任务队列中是否还存在定时任务,若是,返回继续执行从第一任务队列中提取执行时间段为包含当前时间,且处于待运行状态的定时任务。
计算机设备在获取到该进程执行结束后,可检测该第一任务队列中是否还存在定时任务。可选地,检测第一任务队列中是否还存在未被处理的定时任务。在上述步骤S204中,在提取出一个定时任务后,第一任务队列中的定 时任务则减少一个。若还存在定时任务时,则返回上述步骤S204,继续从第一任务队列中提取一个定时任务,继续提取的定时任务同样也为执行时间段包含当前时间,且处于待运行状态的定时任务。将重新提取的定时任务作为当前待执行的定时任务,在重复步骤S206~步骤S210,直至第一任务队列中包含的定时任务均提取完毕。
本实施例提供的定时任务处理方法,通过将定时任务存储在第一任务队列中,并从该第一任务队列中提取执行时间段为包含当前时间,且处于待运行状态的定时任务,然后将提取的定时任务以所生成的一个进程任务来处理,可实现不同定时任务之间的隔离,降低各个任务执行的耦合性,可防止某个定时任务出现异常或者占用过多资源时,影响其他定时任务的执行,提高了定时任务的处理效率。
在一个实施例中,在步骤S202之后,还包括将定时任务添加至第一任务队列中的过程。该过程包括:循环获取预设第二任务队列中的定时任务;检测获取的定时任务的执行时间段是否包含当前时间,若是,则将获取的定时任务的任务状态修改为待运行状态;将待运行状态的定时任务移至第一任务队列中,直至第二任务队列中的定时任务获取完毕。
可选地,如图3所示,该过程包括:
步骤S302,获取第二任务队列中的定时任务。
第二任务队列中存储了多个初始的定时任务。计算机设备在接收到其它设备发送的定时任务时,或者根据其它设备发送的信息创建了定时任务时,可将该定时任务的任务信息存储至第一任务队列中。当接收到对定时任务信息的处理指令后,可从的第一任务队列中获取定时任务。
同样地,计算机设备可依次从该第二任务队列中提取一个定时任务,比如可提取位于该第二任务队列的队首的定时任务。
步骤S304,检测获取的定时任务的执行时间段是否包含当前时间,若是,则执行步骤S306,否则,执行步骤S308,
计算机设备可获取该定时任务的任务信息,检测该任务信息中是否包含任务执行时间信息。若不包含或者时间信息为空,则判定为否。若包含,则可解析出该执行时间信息中的时间表达式。计算机设备可进一步检测其中的时间表达式的形式是否与预设表达式的形式相匹配,若匹配,则提取该时间表达式中,所表示的任务开始执行时间和/或终止执行时间。检测该开始执行时间是否小于当前时间,且终止执行时间是否大于当前时间,若是,则判定执行时间段包含当前时间,否则,判定执行时间段不包含当前时间。
步骤S306,将获取的定时任务的任务状态修改为待运行状态,将待运行状态的定时任务移至第一任务队列中。
定时任务的任务状态可包括初始化状态、无效状态、待运行状态、运行中状态以及执行完毕状态。从第二任务队列中提取出的定时任务,其状态处于初始化状态,移至第一任务队列中的定时任务,其状态处理待运行状态。
针对判定执行时间段包含当前时间的定时任务,则表示现在即可开始执行该定时任务,可将其任务状态更改为待运行状态,并移送至第一任务队列中。其中,第一任务队列中存储的定时任务均为现在即可开始执行该定时任务。
步骤S308,记录定时任务的执行时间段不属于当前执行时间的信息。
若判定执行时间段不包含当前时间,则记录对应定时任务的执行时间段不属于当前执行时间的信息。同时,将对应定时任务的状态更改为无效状态,表示其在当前时间下无效,无需被处理。其中,可记录具体的不属于当前执行时间的具体信息,比如若无法解析出时间表达式,则可记录“此定时任务定义的时间表达式为非法表达式,已被禁止发布”;若从解析出的时间表达式中无法计算出下次执行时间,则可记录“此时间表达式[XXX]已无法计算出下一次执行时间,停止作业”。若该终止执行时间小于当前时间,则可记录“此定时任务已到停止时间,停止此作业”。
步骤S310,检测第二任务队列中是否存在定时任务,若是,则返回继续执行步骤S302,否则,执行步骤S312。
在检测完毕一个或多个定时任务的执行时间段是否包含当前时间后,可返回继续检测该第二任务队列中是否还存在定时任务,若是,则返回继续执行上述步骤S302,从该第二任务队列中继续提取下一个定时任务,并检测其执行时间段是否包含当前时间,并根据执行结果做出相应的处理。
步骤S312,从第一任务队列中提取执行时间段为包含当前时间,且处于待运行状态的定时任务。
当检测到第二任务队列中的定时任务均检测完毕后,可从第一任务队列中提取执行时间段为包含当前时间,且处于待运行状态的定时任务。
通过设置第二任务队列,检测第二任务队列中的定时任务是否可在当前时间执行,将可在当前时间执行的定时任务移至第一任务队列中,使得后续只需从第一任务队列中提取定时任务,并进行分配执行,可提高定时任务执行的效率。
在一个实施例中,在步骤S210之后,还包括:获取进程的执行反馈信息,执行反馈信息中包括定时任务的执行状态;当执行状态为执行异常时,将定时任务的状态修改为待运行状态,并重新放入第一任务队列中。
执行状态包括正在执行、执行完毕以及执行异常的状态。计算机设备可按照预设的频率获取每个进程的执行反馈信息。预设频率可为预先设置的固定频率,或根据用户的修改指令设置的自定义的频率。比如可为每秒获取1次,或每5秒获取一次等。
在一个实施例中,当进程由计算机设备自身执行时,可按照预设频率实时侦测对应进程的执行状态。若进程由外部设备执行时,可通过预设的端口,按照设置的频率实时接收相应外部设备发送的执行反馈信息,获取其中的执行状态。
当该执行状态为执行异常时,计算机设备结束对该进程的运行,以防止该进程持续执行而占用资源。同时,可获取该进程对应的定时任务,将其再次放入第一任务队列中,并重新将该定时任务的任务状态修改为待运行状态,使得后续重新对该定时任务进行处理,提高该定时任务被成功处理的概率。
在一个实施例中,计算机设备在获取的执行状态为执行完毕的状态时,可计算该进程的运行时长。若该运行时长小于第二预设运行时长,则判定对应进程实际为执行异常,若超过该预设运行时长,则判定对应进程成功运行完毕,即成功执行完了对应定时任务。同样地,在判定实际为执行异常时,可获取该进程对应的定时任务,将其再次放入第一任务队列中,并重新将该定时任务的任务状态修改为待运行状态。其中,该第二预设时长可为预设的任意时长。可选地,第二预设时长可根据历史执行定时任务所需花费的最小时长所确定,第二预设时长可设置为小于该最小时长的任意合适的时长。比如,若最小时长为5分钟,则可设置第二预设时长为2分钟。若在两分钟之内获取到的执行状态为执行完毕时,可判定对应定时任务实际为执行异常。
在一个实施例中,在步骤S210之后,上述方法还包括:计算进程的执行时长;当执行时长达到第一预设执行时长时,终止执行进程;将定时任务的状态修改为待运行状态,并重新放入第一任务队列中。
第一预设时长可为任意设置的合适时长。可选地,第一预设时长可根据历史执行定时任务所需花费的最大时长所确定,第一预设时长可设置为大于该最大时长的任意合适的时长。比如,若最大时长为30分钟,则可设置第一预设时长为60分钟。
计算机设备可在检测到对应进程已经开始执行时,可启动一个与该进程对应的计时器,并按照预设频率获取该进程的执行状态,当在计时器计时到的时长达到第一预设执行时长,且还未获取到执行完毕的执行状态时,可终止执行该进程,并将该定时任务的状态重新更改为待运行状态,重新放入第一任务队列中。其中,若该进程由外部设备执行时,可向对应外部设备发送终止执行该定时任务的指令,以指示该外部设备终止执行对应定时任务。
通过终止执行超过第一预设时长的进程,可防止由于该进程出现故障而被一直执行下去,占用过多资源。
在一个实施例中,如图4所示,步骤S206包括:
步骤S402,查询计算机设备本地是否存在与定时任务对应的执行文件, 若是,则执行步骤S404。否则,执行步骤S408。
计算机设备可首先从本地的存储器中查询是否存在与该定时任务对应的执行文件。可选地,可从预设的用于存储定时任务的执行文件的路径下,查询是否存在对应的执行文件,若是,则执行步骤S404,否则执行步骤S408。与该定时任务对应的执行文件,为可用于使用该执行文件来执行该定时任务的文件。
步骤S404,检测执行文件是否与定时任务相匹配,若匹配,则执行步骤S406,否则,执行步骤S408。
计算机设备可进一步检测该执行文件的文件标识是否与定时任务的任务标识相匹配。可选地,可从该执行文件中的配置文件中,获取对应的文件版本号,并比较该文件版本号与任务信息中的任务版本号是否相同,若相同,则判定执行文件与定时任务相匹配。
步骤S406,获取执行文件。
计算机设备可获取从本地查询到的该执行文件,以在后续通过该执行文件执行对应定时任务。
步骤S408,从数据库中获取与提取的定时任务对应的执行文件。
若本地不存在对应的执行文件,或该执行文件与定时任务不匹配,则可从数据库中获取与该定时任务对应的执行文件,在后续通过从数据库中获取的该执行文件执行对应定时任务。
在一个实施例中,在步骤S406之后,还包括:检测该执行文件是否已被保存到数据库中,当未保存到数据库中时,可将该执行文件保存到数据库中,使得其它设备后续可从数据库中获取该执行文件。
在一个实施例中,以一个进程的形式执行命令行包括:调用预设的延时算法生成延时时长,根据延时时长以一个进程的形式执行命令行。
计算机设备预设了相应的延时算法,该延时算法用于生成一个延时时长。计算机设备在生成该进程后,启动对应的计时器,并同时调用预设的延时算法来生成一个延时时长,在该计时器时长达到该延时时长后,再执行该进程 任务,从而延时执行该进程。其中,该进程可被计算机设备自身延时执行,还可指令其它设备,按照该延时时长来执行该进程。
在一个实施例中,延时算法中设置了延时区间,使得生成的延时时长处于该延时区间内。比如,该延时区间可为500ms至3500ms。
由于第一任务队列中存在多个待执行的定时任务,通过设置延时时长,可减少多个进程被同时开始执行的情况,以进一步避免多个进程被同时执行,造成对相同的资源进行争抢的状态,可进一步提高整个系统的运行效率。
在一个实施例中,调用预设的延时算法生成延时时长,包括:获取当前待执行的定时任务被执行失败的次数;根据次数和预设的延时算法生成延时时长。
计算机设备在将定时任务重新存放至该第一任务队列中时,即表示对应定时任务被执行失败,需要重新执行,可更新该定时任务的执行失败的次数,在之前统计的被执行失败的次数上加1。计算机设备可根据该定时任务的任务标识,查询最新统计到的该定时任务被执行失败的次数。
在一个实施例中,计算机设备可根据该次数,调整延时算法中的延时区间,当次数越大时,延时区间包含的区间范围也越大。使得被重新执行的定时任务,根据执行失败的次数,可被生成更长的延时时长来延时执行,以提高整个系统中的定时任务的执行效率。
在一个实施例中,当该次数x大于预设次数时,延时算法生成的延时时长Y的公式可为:Y=a+b·random();当该次数x小于或等于预设次数时,延时算法生成的延时时长Y的公式可为:Y=a+c·x·random()。预设次数可为设置的任意合适的次数,比如可为10次。random()表示随机生成的处于0到1之间的任意系数。当超过预设次数,其延时时长的延时区间为[a,b];当不超过预设次数时,其延时时长的延时区间为[a,x*c]。其中,a、b、c可为设置的任意合适的数值。
举例来说,以预设次数为10,a、b、c均以毫秒为单位,设a=500,b=3000,c=2500,则超过10次时,生成的延时时长Y=500+3000·random(); 处于10次以内,生成的延时时长Y=500+2500·x·random()。
在一个实施例中,在判定执行失败时,可获取执行该定时任务的设备的设备标识,将该设备标识记录到该任务的任务信息中,使得后续可获取是哪一个设备执行该定时任务出现执行失败的情况。可以理解地,该设备可为计算机设备自身,还可为计算机设备的分配执行该定时任务的其它外部设备。
在一个实施例中,以一个进程的形式执行命令行包括:从该定时任务的任务信息中查询用于表示执行失败的设备的设备标识,将该进程分配至与该设备标识不同的其它设备执行。其中,可按照上述的延时方法,指令该设备延时执行该进程。
在一个实施例中,如图5所示,提供了一种定时任务处理装置,该装置包括:
当前时间获取模块502,用于获取系统当前时间。
定时任务提取模块504,用于从预设第一任务队列中提取执行时间段为包含当前时间,且处于待运行状态的定时任务,将提取的定时任务的运行状态修改为运行中,作为当前待执行的定时任务。
执行文件获取模块506,用于获取与当前待执行的定时任务匹配的执行文件。
命令行构建模块508,用于根据执行文件构建启动当前待执行的定时任务的命令行。
定时任务执行模块510,用于将命令行作为一个进程,以一个进程的形式执行命令行。
定时任务提取模块504还用于当进程执行结束后,检测第一任务队列中是否还存在定时任务,若是,返回继续执行从第一任务队列中提取执行时间为段包含当前时间,且处于待运行状态的定时任务。
在一个实施例中,定时任务提取模块504还用于循环获取预设第二任务队列中的定时任务;检测获取的定时任务的执行时间段是否包含当前时间,若是,则将获取的定时任务的任务状态修改为待运行状态;将待运行状态的 定时任务移至第一任务队列中,直至第二任务队列中的定时任务获取完毕。
在一个实施例中,如图6所示,提供了另一种定时任务处理装置,该装置还包括:
反馈信息处理装置512,用于获取进程的执行反馈信息,执行反馈信息中包括定时任务的执行状态;当执行状态为执行异常时,将定时任务的状态修改为待运行状态,并重新放入第一任务队列中。
在一个实施例中,定时任务执行模块510还用于计算进程的执行时长;当执行时长达到第一预设执行时长时,终止执行进程;将定时任务的状态修改为待运行状态,并重新放入第一任务队列中。
在一个实施例中,执行文件获取模块506还用于查询计算机设备本地是否存在与定时任务对应的执行文件,若存在,则检测执行文件是否与定时任务相匹配,若匹配,则获取执行文件;若不存在或不匹配,则从数据库中获取与提取的定时任务对应的执行文件。
在一个实施例中,定时任务执行模块510还用于调用预设的延时算法生成延时时长,根据延时时长以一个进程的形式执行命令行。
在一个实施例中,定时任务执行模块510还用于获取当前待执行的定时任务被执行失败的次数;根据次数和预设的延时算法生成延时时长。
上述装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。该处理器可以为中央处理单元(CPU)、微处理器、单片机等。
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机可读指令,该计算机可读指令被处理器执行时实现上述各实施例中的任一种定时任务处理方法的步骤。
在一个实施例中,该计算机可读指令被处理器执行时实现以下步骤:获取系统当前时间;从预设第一任务队列中提取执行时间段为包含当前时间, 且处于待运行状态的定时任务,将提取的定时任务的运行状态修改为运行中,作为当前待执行的定时任务;获取与当前待执行的定时任务匹配的执行文件;根据执行文件构建启动当前待执行的定时任务的命令行;将命令行作为一个进程,以一个进程的形式执行命令行;当进程执行结束后,检测第一任务队列中是否还存在定时任务,若是,返回继续执行从第一任务队列中提取执行时间段为包含当前时间,且处于待运行状态的定时任务。
在一个实施例中,该计算机可读指令被处理器执行时还实现以下步骤:循环获取预设第二任务队列中的定时任务;检测获取的定时任务的执行时间段是否包含当前时间,若是,则将获取的定时任务的任务状态修改为待运行状态;将待运行状态的定时任务移至第一任务队列中,直至第二任务队列中的定时任务获取完毕。
在一个实施例中,该计算机可读指令被处理器执行时还实现以下步骤:获取进程的执行反馈信息,执行反馈信息中包括定时任务的执行状态;当执行状态为执行异常时,将定时任务的状态修改为待运行状态,并重新放入第一任务队列中。
在一个实施例中,该计算机可读指令被处理器执行时还实现以下步骤:计算进程的执行时长;当执行时长达到第一预设执行时长时,终止执行进程;将定时任务的状态修改为待运行状态,并重新放入第一任务队列中。
在一个实施例中,该计算机可读指令被处理器执行时还实现以下步骤:查询计算机设备本地是否存在与定时任务对应的执行文件,若存在,则检测执行文件是否与定时任务相匹配,若匹配,则获取执行文件;若不存在或不匹配,则从数据库中获取与提取的定时任务对应的执行文件。
在一个实施例中,该计算机可读指令被处理器执行时还实现以下步骤:调用预设的延时算法生成延时时长,根据延时时长以一个进程的形式执行命令行。
在一个实施例中,该计算机可读指令被处理器执行时还实现以下步骤:获取当前待执行的定时任务被执行失败的次数;根据次数和预设的延时算法 生成延时时长。
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,该处理器执行计算机可读指令时实现上述各实施例中的任一种定时任务处理方法的步骤。
该计算机设备可包括但不限于手机、平板电脑、便携式笔记本或智能穿戴设备等终端。如图7所示,为一个实施例中计算机设备的内部结构示意图。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该处理器用于提供计算和控制能力,支撑整个计算机设备的运行。存储器用于存储数据、程序、和/或指令代码等,存储器上存储至少一个计算机可读指令,该计算机可读指令可被处理器执行,以实现本申请实施例中提供的适用于计算机设备的定时任务处理方法。存储器可包括磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质等。例如,在一个实施例中,存储器包括非易失性存储介质及内存储器。非易失性存储介质存储有操作系统、数据库和计算机可读指令。该数据库中存储有用于实现以上各个实施例所提供的一种定时任务处理方法相关的数据,比如可存储有定时任务的任务信息以及数据库或其它外部设备的设备标识信息等。该计算机可读指令可被处理器所执行,以用于实现以上各个实施例所提供的一种定时任务处理方法。内存储器为非易失性存储介质中的操作系统、数据库和计算机可读指令提供高速缓存的运行环境。网络接口可以是以太网卡或无线网卡等,用于与外部的计算机设备进行通信。本领域技术人员可以理解,图7中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在一个实施例中,该处理器执行计算机可读指令时实现以下步骤:获取系统当前时间;从预设第一任务队列中提取执行时间段为包含当前时间,且处于待运行状态的定时任务,将提取的定时任务的运行状态修改为运行中,作为当前待执行的定时任务;获取与当前待执行的定时任务匹配的执行文件; 根据执行文件构建启动当前待执行的定时任务的命令行;将命令行作为一个进程,以一个进程的形式执行命令行;当进程执行结束后,检测第一任务队列中是否还存在定时任务,若是,返回继续执行从第一任务队列中提取执行时间段为包含当前时间,且处于待运行状态的定时任务。
在一个实施例中,该处理器执行计算机可读指令时还实现以下步骤:循环获取预设第二任务队列中的定时任务;检测获取的定时任务的执行时间段是否包含当前时间,若是,则将获取的定时任务的任务状态修改为待运行状态;将待运行状态的定时任务移至第一任务队列中,直至第二任务队列中的定时任务获取完毕。
在一个实施例中,该处理器执行计算机可读指令时还实现以下步骤:获取进程的执行反馈信息,执行反馈信息中包括定时任务的执行状态;当执行状态为执行异常时,将定时任务的状态修改为待运行状态,并重新放入第一任务队列中。
在一个实施例中,该处理器执行计算机可读指令时还实现以下步骤:计算进程的执行时长;当执行时长达到第一预设执行时长时,终止执行进程;将定时任务的状态修改为待运行状态,并重新放入第一任务队列中。
在一个实施例中,该处理器执行计算机可读指令时还实现以下步骤:查询计算机设备本地是否存在与定时任务对应的执行文件,若存在,则检测执行文件是否与定时任务相匹配,若匹配,则获取执行文件;若不存在或不匹配,则从数据库中获取与提取的定时任务对应的执行文件。
在一个实施例中,该处理器执行计算机可读指令时还实现以下步骤:调用预设的延时算法生成延时时长,根据延时时长以一个进程的形式执行命令行。
在一个实施例中,该处理器执行计算机可读指令时还实现以下步骤:获取当前待执行的定时任务被执行失败的次数;根据次数和预设的延时算法生成延时时长。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流 程,是可以通过计算机可读指令来指令相关的硬件来完成。该计算机可读指令可存储在存储器上,比如存储于一非易失性计算机可读取存储介质中。该程序被执行时,可实现包括如上述各方法的实施例的流程。
本申请所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性存储器。合适的非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。
上述各实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
上述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。

Claims (20)

  1. 一种定时任务处理方法,其特征在于,所述方法包括:
    获取系统当前时间;
    从预设第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务,将提取的定时任务的运行状态修改为运行中,作为当前待执行的定时任务;
    获取与所述当前待执行的定时任务匹配的执行文件;
    根据所述执行文件构建启动所述当前待执行的定时任务的命令行;
    将所述命令行作为一个进程,以一个进程的形式执行所述命令行;及
    当所述进程执行结束后,检测所述第一任务队列中是否还存在定时任务,若是,返回继续执行所述从所述第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务。
  2. 根据权利要求1所述的方法,其特征在于,在所述获取系统当前时间之后,还包括:
    循环获取预设第二任务队列中的定时任务;检测获取的定时任务的执行时间段是否包含所述当前时间,若是,则将所述获取的定时任务的任务状态修改为待运行状态;将所述待运行状态的定时任务移至第一任务队列中,直至所述第二任务队列中的定时任务获取完毕。
  3. 根据权利要求1所述的方法,其特征在于,在所述以一个进程的形式执行所述命令行之后,还包括:
    获取所述进程的执行反馈信息,所述执行反馈信息中包括定时任务的执行状态;及
    当所述执行状态为执行异常时,将所述定时任务的状态修改为待运行状态,并重新放入所述第一任务队列中。
  4. 根据权利要求1所述的方法,其特征在于,在所述以一个进程的形式执行所述命令行之后,还包括:
    计算所述进程的执行时长;
    当所述执行时长达到第一预设执行时长时,终止执行所述进程;及
    将所述定时任务的状态修改为待运行状态,并重新放入所述第一任务队列中。
  5. 根据权利要求1所述的方法,其特征在于,所述获取与所述提取的定时任务匹配的执行文件,包括:
    查询计算机设备本地是否存在与所述定时任务对应的执行文件,若存在,则
    检测所述执行文件是否与所述定时任务相匹配,若匹配,则获取所述执行文件;
    若不存在或不匹配,则从数据库中获取与所述提取的定时任务对应的执行文件。
  6. 根据权利要求1所述的方法,其特征在于,所述以一个进程的形式执行所述命令行,包括:
    调用预设的延时算法生成延时时长,根据所述延时时长以一个进程的形式执行所述命令行。
  7. 根据权利要求6所述的方法,其特征在于,所述调用预设的延时算法生成延时时长,包括:
    获取所述当前待执行的定时任务被执行失败的次数;及
    根据所述次数和预设的延时算法生成延时时长。
  8. 一种定时任务处理装置,其特征在于,所述装置包括:
    当前时间获取模块,用于获取系统当前时间;
    定时任务提取模块,用于从预设第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务,将提取的定时任务的运行状态修改为运行中,作为当前待执行的定时任务;
    执行文件获取模块,用于获取与所述当前待执行的定时任务匹配的执行文件;
    命令行构建模块,用于根据所述执行文件构建启动所述当前待执行的定 时任务的命令行;
    定时任务执行模块,用于将所述命令行作为一个进程,以一个进程的形式执行所述命令行;
    所述定时任务提取模块还用于当所述进程执行结束后,检测所述第一任务队列中是否还存在定时任务,若是,返回继续执行所述从所述第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务。
  9. 一个或多个存储有计算机可读指令的非易失性存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行如下步骤:
    获取系统当前时间;
    从预设第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务,将提取的定时任务的运行状态修改为运行中,作为当前待执行的定时任务;
    获取与所述当前待执行的定时任务匹配的执行文件;
    根据所述执行文件构建启动所述当前待执行的定时任务的命令行;
    将所述命令行作为一个进程,以一个进程的形式执行所述命令行;及
    当所述进程执行结束后,检测所述第一任务队列中是否还存在定时任务,若是,返回继续执行所述从所述第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务。
  10. 根据权利要求9所述的存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行如下步骤:
    循环获取预设第二任务队列中的定时任务;检测获取的定时任务的执行时间段是否包含所述当前时间,若是,则将所述获取的定时任务的任务状态修改为待运行状态;将所述待运行状态的定时任务移至第一任务队列中,直至所述第二任务队列中的定时任务获取完毕。
  11. 根据权利要求9所述的存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行如下步骤:
    获取所述进程的执行反馈信息,所述执行反馈信息中包括定时任务的执 行状态;及
    当所述执行状态为执行异常时,将所述定时任务的状态修改为待运行状态,并重新放入所述第一任务队列中。
  12. 根据权利要求9所述的存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行如下步骤:
    计算所述进程的执行时长;
    当所述执行时长达到第一预设执行时长时,终止执行所述进程;及
    将所述定时任务的状态修改为待运行状态,并重新放入所述第一任务队列中。
  13. 根据权利要求9所述的存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行如下步骤:
    查询计算机设备本地是否存在与所述定时任务对应的执行文件,若存在,则
    检测所述执行文件是否与所述定时任务相匹配,若匹配,则获取所述执行文件;
    若不存在或不匹配,则从数据库中获取与所述提取的定时任务对应的执行文件。
  14. 根据权利要求9所述的存储介质,其特征在于,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行如下步骤:
    调用预设的延时算法生成延时时长,根据所述延时时长以一个进程的形式执行所述命令行。
  15. 一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行如下步骤:
    获取系统当前时间;
    从预设第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务,将提取的定时任务的运行状态修改为运行中,作为当 前待执行的定时任务;
    获取与所述当前待执行的定时任务匹配的执行文件;
    根据所述执行文件构建启动所述当前待执行的定时任务的命令行;
    将所述命令行作为一个进程,以一个进程的形式执行所述命令行;及
    当所述进程执行结束后,检测所述第一任务队列中是否还存在定时任务,若是,返回继续执行所述从所述第一任务队列中提取执行时间段为包含所述当前时间,且处于待运行状态的定时任务。
  16. 根据权利要求15所述的计算机设备,其特征在于,所述计算机可读指令被所述处理器执行时,使得所述处理器执行如下步骤:
    循环获取预设第二任务队列中的定时任务;检测获取的定时任务的执行时间段是否包含所述当前时间,若是,则将所述获取的定时任务的任务状态修改为待运行状态;将所述待运行状态的定时任务移至第一任务队列中,直至所述第二任务队列中的定时任务获取完毕。
  17. 根据权利要求15所述的计算机设备,其特征在于,所述计算机可读指令被所述处理器执行时,使得所述处理器执行如下步骤:
    获取所述进程的执行反馈信息,所述执行反馈信息中包括定时任务的执行状态;及
    当所述执行状态为执行异常时,将所述定时任务的状态修改为待运行状态,并重新放入所述第一任务队列中。
  18. 根据权利要求15所述的计算机设备,其特征在于,所述计算机可读指令被所述处理器执行时,使得所述处理器执行如下步骤:
    计算所述进程的执行时长;
    当所述执行时长达到第一预设执行时长时,终止执行所述进程;及
    将所述定时任务的状态修改为待运行状态,并重新放入所述第一任务队列中。
  19. 根据权利要求15所述的计算机设备,其特征在于,所述计算机可读指令被所述处理器执行时,使得所述处理器执行如下步骤:
    查询计算机设备本地是否存在与所述定时任务对应的执行文件,若存在,则
    检测所述执行文件是否与所述定时任务相匹配,若匹配,则获取所述执行文件;
    若不存在或不匹配,则从数据库中获取与所述提取的定时任务对应的执行文件。
  20. 根据权利要求15所述的计算机设备,其特征在于,所述计算机可读指令被所述处理器执行时,使得所述处理器执行如下步骤:
    调用预设的延时算法生成延时时长,根据所述延时时长以一个进程的形式执行所述命令行。
PCT/CN2017/112552 2017-10-24 2017-11-23 定时任务处理方法、装置、存储介质和计算机设备 WO2019080233A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201711001453.6A CN107748695B (zh) 2017-10-24 2017-10-24 定时任务处理方法、装置、存储介质和计算机设备
CN201711001453.6 2017-10-24

Publications (1)

Publication Number Publication Date
WO2019080233A1 true WO2019080233A1 (zh) 2019-05-02

Family

ID=61254025

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/112552 WO2019080233A1 (zh) 2017-10-24 2017-11-23 定时任务处理方法、装置、存储介质和计算机设备

Country Status (2)

Country Link
CN (1) CN107748695B (zh)
WO (1) WO2019080233A1 (zh)

Families Citing this family (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108710537A (zh) * 2018-04-09 2018-10-26 平安科技(深圳)有限公司 一种任务处理方法、存储介质和服务器
CN108920357A (zh) * 2018-06-01 2018-11-30 平安普惠企业管理有限公司 业务系统检测方法、装置、计算机设备和存储介质
CN108762911A (zh) * 2018-06-13 2018-11-06 平安科技(深圳)有限公司 定时任务管理方法、装置、计算机设备及存储介质
CN108829521B (zh) * 2018-06-13 2022-05-13 平安科技(深圳)有限公司 任务处理方法、装置、计算机设备及存储介质
CN109298951A (zh) * 2018-08-21 2019-02-01 平安科技(深圳)有限公司 Celery任务的执行方法及终端设备
CN109254765B (zh) * 2018-08-22 2023-08-25 平安科技(深圳)有限公司 定时任务管理方法、装置、计算机设备及存储介质
CN110941479B (zh) * 2018-09-25 2023-04-07 广州虎牙信息科技有限公司 任务数据执行方法、服务器以及计算机存储介质
CN109298924B (zh) * 2018-09-26 2024-04-02 中国平安人寿保险股份有限公司 定时任务的管理方法、计算机可读存储介质和终端设备
CN109597681B (zh) * 2018-10-22 2024-05-07 平安科技(深圳)有限公司 云端控制方法、装置、计算机设备及存储介质
CN109634733A (zh) * 2018-12-13 2019-04-16 成都四方伟业软件股份有限公司 任务调度管理方法、装置及运维管理服务器
CN109741153B (zh) * 2019-01-18 2021-02-12 网联清算有限公司 超时交易处理方法、装置、计算机设备及存储介质
CN109785077A (zh) * 2019-01-30 2019-05-21 北京互金新融科技有限公司 订单的处理方法和装置
CN110262878B (zh) * 2019-05-06 2024-03-08 平安科技(深圳)有限公司 定时任务处理方法、装置、设备及计算机可读存储介质
CN110333915A (zh) * 2019-05-31 2019-10-15 深圳壹账通智能科技有限公司 定时执行任务的方法、装置、计算机设备及存储介质
CN111198758B (zh) * 2020-01-08 2024-02-13 深圳忆联信息系统有限公司 基于SSH的Windows软件启动方法、装置和计算机设备
CN111290755B (zh) * 2020-02-04 2023-07-07 北京字节跳动网络技术有限公司 呈现数据的方法、装置、电子设备及存储介质
CN111614519A (zh) * 2020-05-20 2020-09-01 深圳忆联信息系统有限公司 基于ssh通道的批量启动并发测试方法和装置
CN111694645B (zh) * 2020-05-26 2022-05-24 平安普惠企业管理有限公司 分布式任务调度系统中任务处理方法及相关装置
CN112214336B (zh) * 2020-10-14 2022-11-22 苏宁云计算有限公司 数据队列推送方法、装置、计算机设备和存储介质
CN112231092A (zh) * 2020-11-24 2021-01-15 政采云有限公司 一种定时任务管理方法、装置、设备及可读存储介质
CN112819600A (zh) * 2021-02-25 2021-05-18 深圳前海微众银行股份有限公司 定时任务的执行方法、装置、设备及计算机存储介质
CN113419876A (zh) * 2021-06-30 2021-09-21 广州华多网络科技有限公司 远程接口代理调用方法、装置以及计算机设备、存储介质
CN113641521A (zh) * 2021-10-18 2021-11-12 深圳美云集网络科技有限责任公司 数据处理方法、装置、存储介质及电子设备
CN117519950B (zh) * 2024-01-02 2024-04-05 河北红星汽车制造有限公司 一种cae任务管理方法及系统

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010042090A1 (en) * 1998-05-28 2001-11-15 Roy H. Williams Thread based governor for time scheduled process application
CN1828541A (zh) * 2006-04-07 2006-09-06 浙江大学 Java操作系统中定时任务的实现方法
CN1862575A (zh) * 2005-08-19 2006-11-15 华为技术有限公司 计划调度定时任务的方法
CN102542379A (zh) * 2010-12-20 2012-07-04 中国移动通信集团公司 一种计划任务处理方法、系统及装置
CN103197969A (zh) * 2013-03-27 2013-07-10 百度在线网络技术(北京)有限公司 一种分布式定时任务控制装置及方法
CN105045602A (zh) * 2015-08-24 2015-11-11 北京金山安全软件有限公司 一种构建Hadoop应用开发框架的方法、装置及电子装置

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001337847A (ja) * 2000-03-24 2001-12-07 Alps Electric Co Ltd プロセッサ回路
CN102331950B (zh) * 2011-09-15 2017-02-22 北京安天电子设备有限公司 基于Linux操作系统定时任务的守护进程实现方法和系统
JP5972094B2 (ja) * 2012-08-06 2016-08-17 キヤノン株式会社 情報処理装置、情報処理方法及びプログラム
CN103530179A (zh) * 2013-09-30 2014-01-22 大唐移动通信设备有限公司 一种定时任务的处理方法及装置
CN104951361B (zh) * 2014-03-27 2018-10-09 阿里巴巴集团控股有限公司 一种定时任务的触发方法和装置
CN106406993B (zh) * 2016-09-06 2019-11-15 努比亚技术有限公司 一种定时任务管理方法和系统
CN107247648B (zh) * 2016-09-30 2020-07-17 北京赢点科技有限公司 基于Docker实现远程项目系统监管的方法、装置及系统
CN106775965B (zh) * 2016-11-17 2021-03-23 腾讯科技(深圳)有限公司 一种定时任务的处理方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010042090A1 (en) * 1998-05-28 2001-11-15 Roy H. Williams Thread based governor for time scheduled process application
CN1862575A (zh) * 2005-08-19 2006-11-15 华为技术有限公司 计划调度定时任务的方法
CN1828541A (zh) * 2006-04-07 2006-09-06 浙江大学 Java操作系统中定时任务的实现方法
CN102542379A (zh) * 2010-12-20 2012-07-04 中国移动通信集团公司 一种计划任务处理方法、系统及装置
CN103197969A (zh) * 2013-03-27 2013-07-10 百度在线网络技术(北京)有限公司 一种分布式定时任务控制装置及方法
CN105045602A (zh) * 2015-08-24 2015-11-11 北京金山安全软件有限公司 一种构建Hadoop应用开发框架的方法、装置及电子装置

Also Published As

Publication number Publication date
CN107748695A (zh) 2018-03-02
CN107748695B (zh) 2020-11-24

Similar Documents

Publication Publication Date Title
WO2019080233A1 (zh) 定时任务处理方法、装置、存储介质和计算机设备
WO2019179027A1 (zh) 电子装置、防火墙开通验证方法、系统及存储介质
EP2832051B1 (en) Method, device, and system for delaying packets during a network-triggered wake of a computing device
WO2019075774A1 (zh) 设备参数配置方法、装置、计算机设备和存储介质
TWI509515B (zh) 電腦系統及基本輸入輸出系統之設定方法
CN111488181B (zh) 任务调度方法、装置、存储介质及服务器
CN107656705B (zh) 一种计算机存储介质和一种数据迁移方法、装置及系统
WO2017193964A1 (zh) 一种组件升级方法、装置和系统
CN107577798B (zh) 一种快照创建方法、装置及计算机可读存储介质
CN111770030A (zh) 消息持久化处理方法、装置和存储介质
EP3499373B1 (en) Method and apparatus for processing process
US10402260B2 (en) Method and apparatus for handling errors in a storage system utilizing a hardware-environment-based platform or a virtual-environment-based platform
CN115080128A (zh) 一种硬盘启动顺序管理方法、系统、装置及存储介质
US10268521B2 (en) Electronic system with data exchange mechanism and method of operation thereof
US20200034212A1 (en) Synchronization object prioritization systems and methods
US9424273B2 (en) System and method for asynchronous use of a network-based file system
CN111353150B (zh) 一种可信启动方法、装置、电子设备及可读存储介质
EP3843361A1 (en) Resource configuration method and apparatus, and storage medium
EP3722955B1 (en) Unblocking processes in interprocess messaging passing
CN111736851B (zh) 提高用于linux系统的软件的兼容性的方法及系统
CN110865877B (zh) 一种任务请求的响应方法及设备
CN114024745A (zh) 安全传输层协议检测方法、装置、计算机设备和存储介质
CN111045787B (zh) 一种快速继续实验方法及系统
CN112286911A (zh) 数据库管理方法及装置、设备、存储介质
CN109271347B (zh) 一种分布式文件系统存储单元的启动方法、装置及设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17929700

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 24.09.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17929700

Country of ref document: EP

Kind code of ref document: A1