CN112231092A - Timed task management method, device and equipment and readable storage medium - Google Patents

Timed task management method, device and equipment and readable storage medium Download PDF

Info

Publication number
CN112231092A
CN112231092A CN202011328343.2A CN202011328343A CN112231092A CN 112231092 A CN112231092 A CN 112231092A CN 202011328343 A CN202011328343 A CN 202011328343A CN 112231092 A CN112231092 A CN 112231092A
Authority
CN
China
Prior art keywords
task
timing task
executed
timing
execution
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011328343.2A
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.)
Zhengcaiyun Co ltd
Original Assignee
Zhengcaiyun 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 Zhengcaiyun Co ltd filed Critical Zhengcaiyun Co ltd
Priority to CN202011328343.2A priority Critical patent/CN112231092A/en
Publication of CN112231092A publication Critical patent/CN112231092A/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
    • 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/4812Task transfer initiation or dispatching by interrupt, e.g. masked
    • G06F9/4831Task transfer initiation or dispatching by interrupt, e.g. masked with variable priority
    • G06F9/4837Task transfer initiation or dispatching by interrupt, e.g. masked with variable priority time dependent
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a timed task management method, which abandons the dependence on a third-party database storage system, and transfers the storage of timed tasks to a local end, thereby reducing the complexity of the system and correspondingly improving the stability of the system; in addition, the method can ensure the stability of the storage of the timing task and avoid the condition of data loss of the power-down task by storing the timing task through the local file; and after the timing task reaches or is about to reach the execution time, called the timing task to be executed, the timing task is put into the timing task queue of the cache, and only the task to be executed is put into the memory, so that the occupation of the memory is small, the method can improve the stability of timing task management and the storage stability, and simultaneously reduce the occupation of the memory. The invention also discloses a timed task management device, equipment and a readable storage medium, and has corresponding technical effects.

Description

Timed task management method, device and equipment and readable storage medium
Technical Field
The present invention relates to the field of software technologies, and in particular, to a method, an apparatus, a device, and a readable storage medium for managing a timed task.
Background
Currently, scheduling a task at a fixed time refers to automatically executing a designated task based on a given time point, a given time interval or a given execution number, and in order to guarantee the on-time execution of the task at the fixed time, the task needs to be stored so as to be executed at a preset time point.
The storage of the timing scheduling task usually adopts a database storage or memory storage mode.
In a software system, the more external systems are relied on, the higher the system complexity is, the worse the relative stability is, the data is stored in a centralized manner, a third-party database system is required to be relied on, remote network IO is added on a network at least once, the stability of the architecture is reduced to half the minimum, and if a plurality of third-party database systems are relied on, the stability of the mechanism is more difficult to guarantee.
When the memory storage is adopted, although the data memory storage performance is high, a large number of timing tasks are stored in the memory, the memory consumption is large, 1 rule is used for occupying 10kb of memory for calculation, and 10w configuration needs to occupy the following memories: 10kb × 100000 ═ 1gb, it can be seen that the storage mode has a large memory consumption, and when the memory is occupied too much, the normal operation of other services will be affected; in addition, the memory storage cannot be persistent, and once the service is restarted, data loss and poor data storage stability can be caused.
In summary, how to improve the stability and storage stability of the timing task management and reduce the memory occupation is a technical problem that needs to be solved urgently by those skilled in the art at present.
Disclosure of Invention
The invention aims to provide a method, a device and equipment for managing a timing task and a readable storage medium, so as to improve the stability of timing task management and storage stability and reduce memory occupation.
In order to solve the technical problems, the invention provides the following technical scheme:
determining configuration information of a timing task to be managed; the configuration information comprises task rules and execution time;
storing the configuration information corresponding to the timing task into a local file;
determining a timing task to be executed in the local file at the current time according to the execution time;
writing the configuration information corresponding to the timing task to be executed into a cached timing task queue;
and acquiring the timing task to be executed from the timing task queue, and executing corresponding business logic.
Optionally, the storing the configuration information corresponding to the timing task in a local file includes:
determining a local file corresponding to the execution time as an attribution file;
storing the configuration information corresponding to the timing task into the attribution file;
correspondingly, the determining, according to the execution time, a timing task to be executed in the local file at the current time includes:
determining a local file matched with the current time according to the execution time range corresponding to each local file;
and taking each timing task stored in the local file matched with the current time as the timing task to be executed.
Optionally, the determining a local file corresponding to the execution time as an attribution file includes:
determining a local file which is adjacent to the execution time and has a timestamp earlier than the execution time as the attribution file; and the difference value of the corresponding time stamps of the adjacent local files is the local file reading time interval.
Optionally, the storing the configuration information corresponding to the timing task in the attribution file includes:
determining a time difference between the execution time and a timestamp of the attribution file;
storing the configuration information and the time difference into the attribution file according to a preset storage format; wherein the information items in the preset storage format include: the time difference, the expression corresponding to the task rule and the execution state; the execution state includes pending execution and executed execution.
Optionally, the acquiring a timing task to be executed from the timing task queue, and executing a corresponding service logic includes:
determining the time difference of each timing task to be executed;
giving high-to-low priority to the timing tasks to be executed according to the sequence of the time differences from small to large;
and executing the business logic corresponding to each timing task one by one in the timing task queue according to the sequence of the priority from high to low.
Optionally, after acquiring the timing task to be executed from the timing task queue and executing the corresponding service logic, the method further includes:
and after the timing task is executed, marking the timing task as executed.
Optionally, the timed task management method further includes:
and if the service is restarted, executing the step of determining the timing task to be executed in the local file at the current time according to the execution time.
The invention also provides a timed task management device, which comprises:
the information determining unit is used for determining the configuration information of the timing task to be managed; the configuration information comprises task rules and execution time;
the local writing unit is used for storing the configuration information corresponding to the timing task into a local file;
the task determining unit is used for determining a timing task to be executed in the local file at the current time according to the execution time;
a queue writing unit, configured to write configuration information corresponding to the timing task to be executed into a cached timing task queue;
and the task execution unit is used for acquiring the timing task to be executed from the timing task queue and executing corresponding business logic.
The invention also provides a timed task management device, which comprises:
a memory for storing a computer program;
and the processor is used for realizing the steps of the timing task management method when executing the computer program.
The invention also provides a readable storage medium, which stores a computer program, and the computer program realizes the steps of the timing task management method when being executed by a processor.
By applying the method provided by the embodiment of the invention, dependence on a third-party database storage system is abandoned, and the storage of the timing task is transferred to the local end, so that the system complexity is reduced, and the system stability is correspondingly improved; in addition, the method can ensure the stability of the storage of the timing task and avoid the condition of data loss of the power-down task by storing the timing task through the local file; and after the timing task reaches or is about to reach the execution time, called the timing task to be executed, the timing task is put into the timing task queue of the cache, and only the task to be executed is put into the memory, so that the occupation of the memory is small, the method can improve the stability of timing task management and the storage stability, and simultaneously reduce the occupation of the memory.
Accordingly, embodiments of the present invention further provide a timed task management apparatus, a device, and a readable storage medium corresponding to the timed task management method, which have the above technical effects and are not described herein again.
Drawings
In order to more clearly illustrate the embodiments of the present invention or technical solutions in related arts, the drawings used in the description of the embodiments or related arts will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a flowchart of an implementation of a method for managing a timed task according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a timing task according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of a timed task management apparatus according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a timed task management device in an embodiment of the present invention.
Detailed Description
The core of the invention is to provide a timed task management method to improve the stability of timed task management and storage stability and reduce the memory occupation.
In order that those skilled in the art will better understand the disclosure, the invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for managing a timed task according to an embodiment of the present invention, where the method includes the following steps:
s101, determining configuration information of a timing task to be managed; the configuration information comprises task rules and execution time;
the configuration information of the timing task mainly comprises a task rule and an execution time, wherein the task rule indicates a service execution logic, for example, certain data is written into a certain file; the execution time indicates the execution time of the task, which may be any time, and the selectable range of the execution time is not limited in this embodiment. It should be noted that, besides the task rule and the execution time, other information items may be further configured to meet the requirements of subsequent task management and task execution, for example, the configuration information may further include a task specified time, a task execution difficulty, and the like. In this embodiment, no limitation is made on the information items specifically included in the configuration information, and corresponding configuration may be performed according to actual use requirements, which is not limited herein.
S102, storing configuration information corresponding to the timing task into a local file;
the local file refers to a file stored at a local end of the equipment, and in the embodiment, the configuration information of the timing task is stored into the local end file of the equipment, so that the consumption of a memory can be avoided, the storage stability of the configuration information can be ensured, namely, the condition that the data of the timing task is lost due to power failure is avoided.
In this embodiment, the number of the local files is not limited, and may be set to only one, or may be set to a plurality of local files, so as to facilitate management of the timing tasks with different execution times, a plurality of local files may be set, and are respectively used for storing the timing tasks within each preset range.
The specific storage manner of the configuration information corresponding to the timing task in the local file may be set according to the actual task execution requirement, for example, the configuration information corresponding to each timing task is sequentially added to each local file according to a specified format. This is not limited in this embodiment.
S103, determining a timing task to be executed in the local file at the current time according to the execution time;
after the execution time of the timing task is prior, in order to ensure that the timing task is executed in sequence according to the preset execution time, the timing task to be executed at the current time needs to be determined under each time node. The specific implementation mode of the timing task to be executed is determined, which is not limited in the embodiment, and when the timing task is randomly stored in a pre-local file, each timing task can be traversed, and whether the execution time reaches or is about to reach is confirmed one by one; when the timing tasks are stored in the local file according to the sequence of the execution time, the tasks which reach or are about to reach the execution time can be directly determined one by one according to the storage sequence, and the traversal is stopped when the execution time is determined not to reach or is about to reach; when the local file has the corresponding execution time range, the timing task corresponding to the local file which does not reach or is about to reach the execution time can be directly determined to be used as the timing task to be executed and the like. In this embodiment, only the three implementation manners are described as an example, and the determination manners of other tasks to be executed can refer to the description of this embodiment, which is not described herein again.
S104, writing the configuration information corresponding to the timing task to be executed into a cached timing task queue;
since the local file stored locally cannot be directly executed, the timing task is written into the timing task queue after the timing task arrives or is about to arrive (namely, after the timing task is determined to be a task to be executed), and the timing task queue is cached in the memory.
It should be noted that, in this embodiment, a specific writing manner for writing the timing task into the timing task queue is not limited, and the specific writing manner may be written into the timing task queue according to the execution sequence of each timing task, or written in a random sequence, or written in a sequence from high to low according to the importance level, and the like, and corresponding setting may be performed according to the actual task execution need, which is not described herein again.
And S105, acquiring the timing task to be executed from the timing task queue, and executing corresponding business logic.
For a specific implementation process of the service logic of the timing task, reference may be made to the description of the related art, and details are not described herein.
According to the timed task management method provided by the embodiment, dependence on a third-party database storage system is abandoned, the storage of the timed task is transferred to the local end, the complexity of the system is reduced after dependence on an external system is reduced, and the stability of the system is correspondingly improved; in addition, the method can ensure the stability of the storage of the timing task and avoid the condition of data loss of the power-down task by storing the timing task through the local file; and after the timing task reaches or is about to reach the execution time, called the timing task to be executed, the timing task is put into the timing task queue of the cache, and only the task to be executed is put into the memory, so that the occupation of the memory is small, the method can improve the stability of timing task management and the storage stability, and simultaneously reduce the occupation of the memory.
In the above embodiment, the storage form of the timed task in the local file is not limited, and in this embodiment, a feasible scheme is mainly introduced for the storage form of the timed task at the local end.
Specifically, the step of storing the configuration information corresponding to the timing task in the local file may specifically include the following steps:
(1) determining a local file corresponding to the execution time as an attribution file;
each attribution file corresponds to a certain execution time range, and then the local file to which the current task belongs needs to be determined according to the execution time of the task and the time range set by each file.
(2) Storing configuration information corresponding to the timing task into an attribution file;
and storing the configuration information corresponding to each timing task into the corresponding attribution file so as to execute the task according to the configuration information in the following process.
In this embodiment, the storage form of the configuration information of the timing task is not limited, and the storage form can be configured from the viewpoints of convenience in searching and convenience in comparison.
Based on the storage manner, the step S103 in the above embodiment determines, according to the execution time, that the timing task to be executed in the local file at the current time correspondingly includes the following execution steps:
(1) determining local files matched with the current time according to the execution time range corresponding to each local file;
(2) and taking each timing task stored in the local file matched with the current time as a timing task to be executed.
The above steps determine a local file corresponding to the execution time, and a specific implementation manner of the local file as the attribution file is as follows: determining a local file which is adjacent to the execution time and has a timestamp earlier than the execution time as an attribution file; and the difference value of the corresponding time stamps of the adjacent local files is the local file reading time interval.
The method comprises the steps that a plurality of local files are arranged at a local end of the equipment, a timestamp is preset in each local file and indicates the initial execution time of the file, the timestamps can be used for bringing tasks into a timing task queue conveniently according to the execution time sequence, the execution time of each task does not need to be traversed one by one, and the management operation of the task execution time is simplified.
The timestamp may be directly used as a file name, or may be added to the file in a labeled form, where the storage form of the timestamp is not limited, and here, taking the timestamp as the file name is taken as an example, for example, the file name may be: yyyyMMddHHmm, where yyyy is year, MM is month, dd is day, and HH is hour, MM is point, for example, the local file name corresponding to 15 o 'clock at 11 month, 16 day, 2020 is 202011161500, and for example, the local file name corresponding to 15 o' clock at 11 month, 16 day, 2020 is 202011161530. The difference between the timestamps of the adjacent local files is the reading time interval of the local file, that is, the step S103 in the above embodiment of finding the local file to be executed according to the current task execution time is executed every reading time interval, for example, when the local file is read every half hour, the interval between mm (minutes) of each file is 30, and for example, 202011161500 and 202011161530 are two adjacent local files.
In the adding of the local file, the local file with the time stamp earlier than the execution time of the task is selected as the attribution file of the task, for example, when the execution time of a certain task is 15: 02/16/11/2020, the local file (for example, the local file with the time stamp of 202011161500) with the time stamp before 202011161502 is selected as the attribution file. Selecting the local file with the timestamp earlier than the execution time can ensure that all tasks are in a state to be executed when the local file is acquired at a reading time interval and added to the task execution queue, and meanwhile, the delay time of task execution generally does not exceed the reading time interval.
As shown in fig. 2, a timing task execution diagram is provided, when timing tasks with different execution times are managed, in this embodiment, execution times of the tasks are stored in local files with different execution times, a local file stores a plurality of timing tasks, and in a subsequent timing task execution process, loading of the tasks can be directly performed according to timestamps of the files, so that a situation that the tasks are not executed after being delayed for a long time can be avoided, a management flow can be simplified, and management efficiency of the timing tasks is improved.
One implementation manner of storing the configuration information corresponding to the timing task in the attribution file in the above steps is as follows:
(2.1) determining a time difference between the execution time and the timestamp of the home file;
for example, the time stamp of the attribution file is 202011161500, the execution time of the timing task is 202011161515, namely, 11/16/2020, 15/15, the time difference between the execution time and the time stamp is 15 minutes. In the task storage method provided by this embodiment, in each local file, storage of execution time is simplified (202011161515 is replaced by a time difference 15), occupation of storage space of the local end is reduced, comparison of the execution times is correspondingly simplified (comparison of the sizes of 15 and 20 is more efficient than comparison of the sizes of 202011161515 and 202011161520), execution of tasks is performed efficiently according to the sequence of execution times of the tasks, and management efficiency is improved.
(2.2) storing the configuration information and the time difference into an attribution file according to a preset storage format; wherein the information items in the preset storage format include: time difference, an expression corresponding to the task rule and an execution state; the execution state includes pending execution and executed execution.
In this embodiment, only the information items are included as an example for description, and other information items, such as task execution difficulty, may be added according to actual use requirements. In this embodiment, a specific storage format of each task is not limited, and for deepening understanding, a storage format is introduced as follows: the time difference L + the delimiter | + the timed task expression + the delimiter | + the execution state (N represents to be executed, Y represents executed), and one timed task stored according to the storage format is: 05| | | timing task expression | | | N. In this embodiment, only the above storage format is taken as an example for description, and the above description can be referred to for other storage formats, which is not described again in this embodiment.
Based on the above storage form, correspondingly, one implementation manner of the step S105 in the above embodiment of obtaining the to-be-executed timed task from the timed task queue and executing the corresponding service logic is as follows:
(1) determining the time difference of each timing task to be executed;
(2) giving high-to-low priority to the timing tasks to be executed according to the sequence of the time difference from small to large;
(3) and executing the business logic corresponding to each timing task one by one in the timing task queue according to the sequence of the priority from high to low.
The priorities of the tasks are set according to the time difference, all the timed tasks recorded in the file are put into a timed task queue according to the sequence of the priorities from high to low, the timed task with the higher priority is executed earlier, the average response speed of the timed task can be improved, and therefore user experience is improved.
Based on the above embodiment, after the timing task to be executed is obtained from the timing task queue and the corresponding business logic is executed, the following steps may be further performed: and when the execution of the timing task is completed, marking the timing task as executed. After the business logic is executed, the execution state of the timing task is modified into the executed state, so that the execution progress of the timing task is conveniently managed, the situation of repeated execution of the task can be avoided, and the task management efficiency is improved.
Of course, the above steps may not be executed, and this is not limited in this embodiment.
Further, on the basis of the above embodiment, the following steps may be further performed: and if the service is restarted, executing a step of determining a timing task to be executed in the local file at the current time according to the execution time.
In order to solve the problem of data loss of a timed task queue caused by service restart (such as abnormal service restart or first start), a timed task loading logic is executed once after the restart, and the service restart is used for searching data for loading.
Corresponding to the above method embodiments, embodiments of the present invention further provide a timed task management device, and the timed task management device described below and the timed task management method described above may be referred to in correspondence.
Referring to fig. 3, the apparatus includes the following modules:
the information determining unit 110 is mainly used for determining configuration information of a timing task to be managed; the configuration information comprises task rules and execution time;
the local writing unit 120 is mainly configured to store the configuration information corresponding to the timing task in a local file;
the task determining unit 130 is mainly configured to determine a timing task to be executed in the local file at the current time according to the execution time;
the queue writing unit 140 is mainly configured to write configuration information corresponding to a timing task to be executed into a buffered timing task queue;
the task execution unit 150 is mainly configured to obtain a timing task to be executed from the timing task queue, and execute a corresponding service logic.
In an embodiment of the present invention, the local writing unit 120 may specifically include:
the attribution determining subunit is used for determining a local file corresponding to the execution time as an attribution file;
the information storage subunit is used for storing the configuration information corresponding to the timing task into an attribution file;
accordingly, the task determining unit 130 connected to the local writing unit 120 may specifically include:
the file determining subunit is used for determining the local files matched with the current time according to the execution time ranges corresponding to the local files;
and the matching determination subunit is used for taking each timing task stored in the local file matched with the current time as the timing task to be executed.
In an embodiment of the present invention, the attribution determining subunit may specifically be a first determining subunit, and the first determining subunit is configured to: determining a local file which is adjacent to the execution time and has a timestamp earlier than the execution time as an attribution file; and the difference value of the corresponding time stamps of the adjacent local files is the local file reading time interval.
In an embodiment of the present invention, the information storage subunit may specifically include:
a time difference determining subunit, configured to determine a time difference between the execution time and the time stamp of the attribution file;
the format storage subunit is used for storing the configuration information and the time difference into an attribution file according to a preset storage format; wherein the information items in the preset storage format include: time difference, an expression corresponding to the task rule and an execution state; the execution state includes pending execution and executed execution.
In an embodiment of the present invention, the task execution unit 150 connected to the information storage subunit may specifically include:
a difference determining subunit, configured to determine a time difference between timing tasks to be executed;
the priority setting subunit is used for giving high-to-low priority to the timing tasks to be executed according to the sequence of the time difference from small to large;
and the sequence execution subunit is used for executing the service logic corresponding to each timing task one by one in the timing task queue according to the sequence from high priority to low priority.
In a specific embodiment of the present invention, the apparatus further includes a marking unit, configured to mark the timed task as executed after the timed task is completed after the timed task is obtained from the timed task queue and the corresponding business logic is executed.
In one embodiment of the present invention, the method further comprises: and the restarting unit is used for executing the step of determining the timing task to be executed in the local file at the current time according to the execution time if the service is restarted.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a timed task management device, and a timed task management device described below and a timed task management method described above may be referred to in a corresponding manner.
The timed task management device includes:
a memory for storing a computer program;
and the processor is used for realizing the steps of the timed task management method of the embodiment of the method when executing the computer program.
Specifically, referring to fig. 4, a specific structural diagram of a timed task management device provided in this embodiment is shown, where the timed task management device may generate a relatively large difference due to different configurations or performances, and may include one or more processors (CPUs) 322 (e.g., one or more processors) and a memory 332, where the memory 332 stores one or more computer applications 342 or data 344. Memory 332 may be, among other things, transient or persistent storage. The program stored in memory 332 may include one or more modules (not shown), each of which may include a sequence of instructions operating on a data processing device. Still further, the central processor 322 may be configured to communicate with the memory 332 to execute a series of instruction operations in the memory 332 on the timed task management device 301.
The timed task management apparatus 301 may also include one or more power supplies 326, one or more wired or wireless network interfaces 350, one or more input-output interfaces 358, and/or one or more operating systems 341.
The steps in the above-described timed task management method may be implemented by the structure of the timed task management apparatus.
Corresponding to the above method embodiment, an embodiment of the present invention further provides a readable storage medium, and a readable storage medium described below and a timed task management method described above may be referred to in correspondence with each other.
A readable storage medium, on which a computer program is stored, which, when executed by a processor, implements the steps of the timed task management method of the above-described method embodiments.
The readable storage medium may be a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and various other readable storage media capable of storing program codes.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.

Claims (10)

1. A timed task management method is characterized by comprising the following steps:
determining configuration information of a timing task to be managed; the configuration information comprises task rules and execution time;
storing the configuration information corresponding to the timing task into a local file;
determining a timing task to be executed in the local file at the current time according to the execution time;
writing the configuration information corresponding to the timing task to be executed into a cached timing task queue;
and acquiring the timing task to be executed from the timing task queue, and executing corresponding business logic.
2. The method according to claim 1, wherein the storing the configuration information corresponding to the timed task in a local file comprises:
determining a local file corresponding to the execution time as an attribution file;
storing the configuration information corresponding to the timing task into the attribution file;
correspondingly, the determining, according to the execution time, a timing task to be executed in the local file at the current time includes:
determining a local file matched with the current time according to the execution time range corresponding to each local file;
and taking each timing task stored in the local file matched with the current time as the timing task to be executed.
3. The timed task management method according to claim 2, wherein said determining a local file corresponding to said execution time as a home file includes:
determining a local file which is adjacent to the execution time and has a timestamp earlier than the execution time as the attribution file; and the difference value of the corresponding time stamps of the adjacent local files is the local file reading time interval.
4. The method according to claim 2, wherein the storing the configuration information corresponding to the timing task in the attribution file comprises:
determining a time difference between the execution time and a timestamp of the attribution file;
storing the configuration information and the time difference into the attribution file according to a preset storage format; wherein the information items in the preset storage format include: the time difference, the expression corresponding to the task rule and the execution state; the execution state includes pending execution and executed execution.
5. The timed task management method according to claim 4, wherein obtaining the timed task to be executed from the timed task queue and executing the corresponding service logic comprises:
determining the time difference of each timing task to be executed;
giving high-to-low priority to the timing tasks to be executed according to the sequence of the time differences from small to large;
and executing the business logic corresponding to each timing task one by one in the timing task queue according to the sequence of the priority from high to low.
6. The timed task management method according to claim 1, after acquiring the timed task to be executed from the timed task queue and executing the corresponding business logic, further comprising:
and after the timing task is executed, marking the timing task as executed.
7. The timed task management method according to claim 1, characterized in that it further comprises:
and if the service is restarted, executing the step of determining the timing task to be executed in the local file at the current time according to the execution time.
8. A timed task management apparatus, comprising:
the information determining unit is used for determining the configuration information of the timing task to be managed; the configuration information comprises task rules and execution time;
the local writing unit is used for storing the configuration information corresponding to the timing task into a local file;
the task determining unit is used for determining a timing task to be executed in the local file at the current time according to the execution time;
a queue writing unit, configured to write configuration information corresponding to the timing task to be executed into a cached timing task queue;
and the task execution unit is used for acquiring the timing task to be executed from the timing task queue and executing corresponding business logic.
9. A timed task management apparatus, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the timed task management method according to any one of claims 1 to 7 when executing said computer program.
10. A readable storage medium, having stored thereon a computer program which, when executed by a processor, carries out the steps of the timed task management method according to any one of claims 1 to 7.
CN202011328343.2A 2020-11-24 2020-11-24 Timed task management method, device and equipment and readable storage medium Pending CN112231092A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011328343.2A CN112231092A (en) 2020-11-24 2020-11-24 Timed task management method, device and equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011328343.2A CN112231092A (en) 2020-11-24 2020-11-24 Timed task management method, device and equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN112231092A true CN112231092A (en) 2021-01-15

Family

ID=74124447

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011328343.2A Pending CN112231092A (en) 2020-11-24 2020-11-24 Timed task management method, device and equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN112231092A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106227597A (en) * 2016-07-15 2016-12-14 乐视控股(北京)有限公司 Task priority treating method and apparatus
CN107748695A (en) * 2017-10-24 2018-03-02 平安科技(深圳)有限公司 Timed task processing method, device, storage medium and computer equipment
CN110096340A (en) * 2018-01-29 2019-08-06 北京世纪好未来教育科技有限公司 Timed task processing method and processing device
WO2019237593A1 (en) * 2018-06-13 2019-12-19 平安科技(深圳)有限公司 Task processing method and apparatus, and computer device and storage medium
CN111078305A (en) * 2019-12-11 2020-04-28 秒针信息技术有限公司 Information acquisition method and device, server and information management system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106227597A (en) * 2016-07-15 2016-12-14 乐视控股(北京)有限公司 Task priority treating method and apparatus
CN107748695A (en) * 2017-10-24 2018-03-02 平安科技(深圳)有限公司 Timed task processing method, device, storage medium and computer equipment
CN110096340A (en) * 2018-01-29 2019-08-06 北京世纪好未来教育科技有限公司 Timed task processing method and processing device
WO2019237593A1 (en) * 2018-06-13 2019-12-19 平安科技(深圳)有限公司 Task processing method and apparatus, and computer device and storage medium
CN111078305A (en) * 2019-12-11 2020-04-28 秒针信息技术有限公司 Information acquisition method and device, server and information management system

Similar Documents

Publication Publication Date Title
US11397648B2 (en) Virtual machine recovery method and virtual machine management device
CN111367984B (en) Method and system for loading high-timeliness data into data lake
CN111124277B (en) Deep learning data set caching method, system, terminal and storage medium
CN109376197B (en) Data synchronization method, server and computer storage medium
CN107402722B (en) Data migration method and storage device
CN103049317B (en) Based on the high concurrent data no write de-lay system and method for queue under cloud environment
CN112286905A (en) Data migration method and device, storage medium and electronic equipment
CN109271435A (en) A kind of data pick-up method and system for supporting breakpoint transmission
CN111708738B (en) Method and system for realizing interaction of hadoop file system hdfs and object storage s3 data
CN111881116A (en) Data migration method, data migration system, computer system, and storage medium
CN111177254B (en) Method and device for data synchronization between heterogeneous relational databases
CN106445409A (en) Distributed block storage data writing method and device
CN103856516A (en) Data storage and reading method and data storage and reading device
CN115291806A (en) Processing method, processing device, electronic equipment and storage medium
CN107277022B (en) Process marking method and device
CN105302489A (en) Heterogeneous multi-core remote embedded memory system and method
CN115146002A (en) Cross-data-center data synchronization method and device
CN110737504A (en) deep learning model training fault-tolerant method, system, terminal and storage medium
US10261718B1 (en) Adaptively controlling data copy operations that copy data in an electronic environment
CN106776153B (en) Job control method and server
CN110413689B (en) Multi-node data synchronization method and device for memory database
CN102520879B (en) Priority-based file information storage method, device and system
CN112231092A (en) Timed task management method, device and equipment and readable storage medium
CN111984198A (en) Message queue implementation method and device and electronic equipment
CN110866068A (en) Announcement data storage method and device based on HDFS

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