CN114201284A - Timed task management method and system - Google Patents

Timed task management method and system Download PDF

Info

Publication number
CN114201284A
CN114201284A CN202111542539.6A CN202111542539A CN114201284A CN 114201284 A CN114201284 A CN 114201284A CN 202111542539 A CN202111542539 A CN 202111542539A CN 114201284 A CN114201284 A CN 114201284A
Authority
CN
China
Prior art keywords
timing task
task
execution
current
weight
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
CN202111542539.6A
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.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech 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 CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202111542539.6A priority Critical patent/CN114201284A/en
Publication of CN114201284A publication Critical patent/CN114201284A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • G06F9/4887Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues involving deadlines, e.g. rate based, periodic

Abstract

The embodiment of the application provides a method and a system for managing a timing task. The method comprises the following steps: establishing a current timing task based on a preset timing task information rule, and acquiring the weight of the current timing task based on the established timing task information of the timing task; comparing the weight of the current timing task with the weight of each timing task in the real-time execution queue, and determining the execution rule of the current timing task; the execution rule comprises the execution time of the current timing task and the distributed thread; and executing the current timing task based on the execution rule, and recording a process log in real time in the execution process of the current timing task. The invention ensures the prior execution of important timing tasks, improves the satisfaction degree of users, and manages the timing tasks through the logs, thereby realizing the controllability of the execution process of the timing tasks.

Description

Timed task management method and system
Technical Field
The present application relates to the field of computer technologies, and in particular, to a timed task management method and a timed task management system.
Background
Timing tasks are particularly common in actual development, for example, unpaid orders are automatically cancelled after 30 minutes of an e-commerce platform, and data summarization and backup in the early morning and the like are all realized by means of the timing tasks. The existing timing Task execution mainly comprises several commonly used algorithms such as a Timer algorithm, a scheduled executorservice algorithm and a Spring Task algorithm, but all of the algorithms have certain disadvantages, for example, other tasks are affected when the Task is abnormal, the response time is long, and the like. However, in any algorithm, the problems of incapability of intervening and uncontrollable in the execution process of the timing task exist, which is also a common fault in the execution process of the existing timing task.
In the existing timing task execution process, only two feedback results of starting execution and completing execution can be received, the process parameters of the timing task cannot be controlled and modified, and the execution process information of the timing task is difficult to execute. In the actual use process, there is often a situation that, under the condition of limited resources, when a timing task which needs to be processed urgently occurs, the execution queue is full at this time and the urgent timing task cannot be executed immediately, which greatly affects the user experience when the user has an urgent need. Aiming at the defects of the existing timing task management method, a new timing task management method needs to be created.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method and a system for managing a timed task, so as to solve the above problems in the prior art.
In order to achieve the above object, a first aspect of the present application provides a timed task management method, including: establishing a current timing task based on a preset timing task information rule, and acquiring the weight of the current timing task based on the established timing task information of the timing task; comparing the weight of the current timing task with the weight of each timing task in the real-time execution queue, and determining the execution rule of the current timing task; the execution rule comprises the execution time of the current timing task and the distributed thread; and executing the current timing task based on the execution rule, and recording a process log in real time in the execution process of the current timing task.
In an embodiment of the present application, the preset timing task information rule includes: configuring information of a timing task and resource object configuration entity information; wherein the timing task configuration information includes: timing ID, Cron expression, task name, start time, end condition, execution times, weight, creation time and modification time of the task; the resource object configuration entity information includes: configuration ID, task association ID, configuration name, resource acquisition mode, route, resource object identification, creation time and modification time of the resource object.
In an embodiment of the present application, the method further includes: determining whether a created timing task exists; and if the established timing task exists, initializing the established timing task based on the timing task configuration information and the resource object configuration entity information, and taking the initialized timing task as the current timing task.
In this embodiment of the present application, the comparing the weight of the current timing task with the weight of each timing task in the real-time execution queue to determine the execution rule of the current timing task includes: if the idle thread exists, ignoring the comparison result, directly adding the current timing task into the execution queue, and immediately executing the current timing task based on the timing task information; if no free thread exists, but no timing task with weight smaller than that of the current timing task exists in the execution queue, adding the current timing task into the preparation queue; if no free thread exists, but a timing task with the weight smaller than that of the current timing task exists in the execution queue, the timing task with the lowest weight in the execution queue is immediately stopped, the timing task with the lowest weight is added into the preparation queue, and meanwhile, the thread of the timing task with the lowest weight is distributed to the current timing task.
In the embodiment of the present application, the timing tasks in the preparation queue are sorted based on the weight, and the larger the weight is, the earlier the execution sequence is.
In an embodiment of the present application, the method further includes: and when the execution queue is full, adding the first unexecuted timing task in the sequence into the execution queue based on the sequence of the timing tasks in the preparation queue when the execution queue completes one timing task.
In an embodiment of the present application, the method further includes: responding to a query request of a user, and calling log information corresponding to a query target; wherein the query target is a corresponding timing task; and the log information is the execution process information recorded in the execution process of the corresponding timing task.
A second aspect of the present application provides a timed task management system, including: the acquisition unit is used for acquiring timing task information and acquiring the weight of the current timing task based on the timing task information; a processing unit to: comparing the weight of the current timing task with the weight of each timing task in the real-time execution queue, and determining the execution rule of the current timing task; the execution rule comprises the execution time of the current timing task and the distributed thread; and executing the current timing task based on the execution rule, and recording a process log in real time in the execution process of the current timing task.
In an embodiment of the present application, the system further includes: and the creating unit is used for creating the current timing task or initializing the created timing task based on a preset timing task information rule.
In an embodiment of the present application, the processing unit is further configured to: determining whether a created timing task exists; and if the established timing task exists, initializing the established timing task based on the timing task configuration information and the resource object configuration entity information, and taking the initialized timing task as the current timing task.
In this embodiment of the present application, the comparing the weight of the current timing task with the weight of each timing task in the real-time execution queue to determine the execution rule of the current timing task includes: if the idle thread exists, ignoring the comparison result, directly adding the current timing task into the execution queue, and immediately executing the current timing task based on the timing task information; if no free thread exists, but no timing task with weight smaller than that of the current timing task exists in the execution queue, adding the current timing task into the preparation queue; if no free thread exists, but a timing task with the weight smaller than that of the current timing task exists in the execution queue, the execution of the timing task with the lowest weight in the execution queue is immediately stopped, the timing task with the lowest weight is added into the preparation queue, and meanwhile, the thread of the timing task with the lowest weight is distributed to the current timing task.
In an embodiment of the present application, the system further includes: and the log unit is used for recording the execution process information of the timing task in real time.
A third aspect of the present application provides a machine-readable storage medium having stored thereon instructions which, when executed by a processor, cause the processor to be configured to perform the above-described timed task management method.
A fifth aspect of the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the above-described timed task management method.
By the technical scheme, the timed tasks are created or initialized according to the preset relation, each timed task is given with the weight, the weight represents the importance degree of the timed task, the regulation and control rule with the higher weight and the higher execution sequence is formulated based on the importance degree, the important timed tasks are guaranteed to be executed preferentially, and the user satisfaction is improved. In the timing task execution process, log recording is carried out, and both task modification and fault tracking can be carried out based on the log, so that the controllability of the timing task execution process is ensured.
Additional features and advantages of embodiments of the present application will be described in detail in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the embodiments of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the embodiments of the disclosure, but are not intended to limit the embodiments of the disclosure. In the drawings:
FIG. 1 schematically illustrates a flow chart of steps of a method of timed task management according to an embodiment of the present application;
FIG. 2 schematically illustrates a system architecture of a timed task manager system according to an embodiment of the present application;
fig. 3 schematically shows a flow chart of a timed task management method according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it should be understood that the specific embodiments described herein are only used for illustrating and explaining the embodiments of the present application and are not used for limiting the embodiments of the present application. 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 application.
It should be noted that if directional indications (such as up, down, left, right, front, and back … …) are referred to in the embodiments of the present application, the directional indications are only used to explain the relative positional relationship between the components, the movement situation, and the like in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indications are changed accordingly.
In addition, if there is a description of "first", "second", etc. in the embodiments of the present application, the description of "first", "second", etc. is for descriptive purposes only and is not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present application.
The timing task management method can be applied to visualization of timing tasks and application environment modification. Timing tasks are particularly common in actual development, for example, unpaid orders are automatically cancelled after 30 minutes of an e-commerce platform, and data summarization and backup in the early morning and the like are all realized by means of the timing tasks. The existing timing Task execution mainly comprises several commonly used algorithms such as a Timer algorithm, a scheduled executorservice algorithm and a Spring Task algorithm, but all of the algorithms have certain disadvantages, for example, other tasks are affected when the Task is abnormal, the response time is long, and the like. However, in any algorithm, the problems of incapability of intervening and uncontrollable in the execution process of the timing task exist, which is also a common fault in the execution process of the existing timing task. In the existing timing task execution process, only two feedback results of starting execution and completing execution can be received, the process parameters of the timing task cannot be controlled and modified, and the execution process information of the timing task is difficult to execute. In the actual use process, there is often a situation that, under the condition of limited resources, when a timing task which needs to be processed urgently occurs, the execution queue is full at this time and the urgent timing task cannot be executed immediately, which greatly affects the user experience when the user has an urgent need.
Therefore, the method and the device change the current situation that the timing task is uncontrollable and irreconcilable, ensure the supervision operation and the intervention operation of the timing task, perform differentiated timing task execution according to the user requirements, avoid the secondary task from influencing the execution of the main task, and improve the use experience of the user.
Fig. 2 schematically shows a system configuration diagram of a timed task management system according to an embodiment of the present application. As shown in fig. 2, the present application provides a timed task management system, including: the acquisition unit is used for acquiring timing task information and acquiring the weight of the current timing task based on the timing task information; the processing unit is used for comparing the weight of the current timing task with the weight of each timing task in the real-time execution queue and determining the execution rule of the current timing task; the execution rule comprises the execution time of the current timing task and the distributed thread; and executing the current timing task based on the execution rule, and recording a process log in real time in the execution process of the current timing task.
As shown in fig. 2, in one embodiment, the system further comprises: and the creating unit is used for creating the current timing task or initializing the created timing task based on a preset timing task information rule.
As shown in fig. 2, in one embodiment, the system further comprises: and the log unit is used for recording the execution process information of the timing task in real time.
Fig. 1 schematically shows a flow chart of a timed task management method according to an embodiment of the present application. As shown in fig. 1, in an embodiment of the present application, a timed task management method is provided, which includes the following steps:
step S10: and establishing the current timing task based on a preset timing task information rule, and acquiring the weight of the current timing task based on the established timing task information of the timing task.
Specifically, the timed task information includes two parts, which are respectively configured for timed task configuration information and resource object configuration entity information, wherein the timed task configuration information is execution rule information of the timed task, and the resource formation configuration entity information is execution requirement information of the timed task. The timing task configuration information includes: the ID of the timing task, the Cron expression, the task name, the start time, the end condition, the execution times, the weight, the creation time and the modification time.
And the timed task ID is used for binding with the thread ID, has uniqueness, and can be used for subsequent thread tracking.
And the Cron expression is used for executing the periodic expression, comprises a specific time field and is a time positioning basis.
And the task name is used for explaining the task content, namely the task purpose required to be performed.
And the starting time is used for limiting a time node for starting execution of the task.
And the ending condition is used for limiting the ending condition of the task.
And the execution times are used for limiting the highest execution times of the tasks, and if the execution times still cannot reach the end condition when reaching the preset highest execution times, the execution fails.
And the weight is used for indicating the importance degree of the corresponding timing task, and the higher the weight is, the higher the importance is, and the higher the priority of subsequent execution is.
And the creation time is used for representing the creation time of the timing task.
And the modification time is used for recording the latest modification time of the timing task, so that the follow-up task can be conveniently tracked.
The resource object configuration entity information includes: configuration ID, task association ID, configuration name, resource acquisition mode, route, resource object identification, creation time and modification time of the resource object.
The configuration ID of the resource object is a unique primary key, namely a field description name with uniqueness.
And the task association ID is used for distributing the timing task for the resource object.
And the configuration name is used for explaining the specific content of the resource configuration.
And the resource acquisition modes are used for representing the modes of resource acquisition, and the resource acquisition modes are http, https or grpc.
And the route is used for indicating the specific route for acquiring the resource.
And the resource object identifier is used for obtaining the ID of the specific resource or the identifier of the specific resource list.
The creation time and modification time are the same as those described above. The specific information is configured for the timing task, so that accurate positioning and tracking of the timing task can be conveniently and subsequently performed, and the timing task information can be completely controlled.
The information configuration rule of the timing task is an implementation basis of the timing task management method provided by the invention, and the timing task performing the scheme of the invention is required to be created based on the preset timing task information.
If the established timed task exists, the task also needs to be initialized according to the preset timed task information, corresponding timed task configuration information and resource object configuration entity information are added to the timed task, and the managed timed task is ensured to have the complete timed task configuration information and resource object configuration entity information.
During the execution of the timing task, a thread pool is needed to allocate specific threads to the timing task, but the threads of the thread pool are limited, and an execution rule exists. The existing execution rule reference basis is the task starting time, the invention needs to distinguish important tasks from secondary tasks, and ensures that the important tasks can obtain the distribution site in time. Therefore, after the timed task is created, the weight corresponding to the timed task needs to be acquired, so as to determine the importance degree of the timed task.
Step S20: and comparing the weight of the current timing task with the weight of each timing task in the real-time execution queue to determine the execution rule of the current timing task.
Specifically, all threads capable of executing the timing task are integrated into a thread pool, and the timing task execution distribution is performed based on the thread pool. Based on the number of threads of the thread pool, a corresponding execution queue is specified, which represents the maximum number of simultaneous execution of timed tasks. When the thread pool is vacant, namely, a vacant thread exists, the threads capable of executing the timing task are numerous, and the scheduling method can be carried out based on the starting time of the timing task. However, when the thread pool is tense, that is, there is no empty thread, it means that the execution queue is full, and when there is a new timing task, it is not possible to execute the timing task in time. In this case, the timing task needs to be assigned according to the weight of the timing task.
Therefore, the weights of the current timed task need to be compared with the weights of all timed tasks in the current execution queue respectively, and two situations exist as a comparison result, one is that the timed task with the weight smaller than that of the current timed task exists in the execution queue, and the other is that the timed task with the weight smaller than that of the current timed task does not exist in the execution queue. According to the description of the real-time situation of the thread pool resources, the following situations mainly exist after comparison.
In one embodiment, the timed task with the weight less than that of the current timed task does not exist in the real-time execution queue, but an idle thread exists in the current thread pool, which indicates that the importance degree of the current timed task is very low and does not exceed the importance degree of any executed timed task, so that the execution priority of the current timed task is the lowest. However, at this time, because the thread pool has an empty thread, even if the timed task is executed immediately, the idle thread does not affect other more important timed tasks, so that the current timed task can be executed immediately, and the empty thread is allocated to the current task, so that the current task can be executed.
In one embodiment, no timed task with a weight less than that of the current timed task exists in the real-time execution queue, and no idle thread exists in the current thread pool, which indicates that the importance degree of the current timed task is the lowest and the execution priority is the lowest relative to all the timed tasks being executed in the execution queue. Therefore, in order to avoid the current timing task from occupying the thread and causing other more important timing tasks to be affected, it is preferable to add the current task to the preset preparation queue. The preparation queue is a timing task queue to be executed, and the current timing task is executed only when the thread pool is vacant or the weights of the rest timing tasks are lower than that of the current timing task.
In one embodiment, there are timed tasks whose weight is less than that of the current timed task in the real-time execution queue, and there are idle threads, and because there are idle threads, it is the same as the case of the first embodiment described above that it is done by directly allocating the idle threads to the current timed task.
In one embodiment, the timed task with the weight smaller than that of the current timed task exists in the real-time execution queue, but no idle thread exists, which indicates that the importance degree of the current execution queue is smaller than that of the current timed task, in order to avoid influencing the timeliness of the current timed task, the timed task with the minimum weight in the execution queue is screened out and is added into the preparation queue as the new timed task with the lowest execution priority. And when the timing task with the lowest weight is added into the preparation queue, the spare thread is distributed to the current timing task, so that the timing task with higher priority is ensured to be executed preferentially, and the use satisfaction of a user is improved.
In the preliminary queue, it is also necessary to sort based on the weights of the remaining timed tasks, with higher weights leading the higher the ranking. The sequencing result determines the execution priority of the timing tasks when the spare threads exist subsequently, and through weight pre-sequencing, when the spare threads exist, the first timing task in the preparation queue can be directly called, and weight comparison is not needed to be carried out when the threads are left out, so that the time delay is increased.
Step S30: and executing the current timing task based on the execution rule, and recording a process log in real time in the execution process of the current timing task.
Specifically, during the process of executing the timed task, the log unit outputs key information, time and the like of the timed task, before and after the remote resource is called, the key information, the time and the like of the participated-in, participated-in and timed task are also output, the log unit records the key information, the time and the like of the participated-in and timed task in the process of subsequently acquiring the resource, and the execution state of the task is recorded in the process of executing the task. When a fault exists in the timed task execution, related personnel need to query the fault reason, and then need to call the log recorded in the log unit for task tracking. Or the user can extract the log when the user wants to know the execution process of the task in detail, so that the visual control of the execution process of the timed task is facilitated, and the problems that the existing timed task execution method cannot be interfered and controlled are solved.
FIG. 3 is a flowchart illustrating a method for managing timed tasks according to an embodiment. It should be understood that, although the steps in the flowchart of fig. 3 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in fig. 3 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more than one, and the timed task management method is realized by adjusting kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
Embodiments of the present application provide a machine-readable storage medium having stored thereon instructions that, when executed by a processor, cause the processor to be configured to implement the above-described timed task management method.
The present application also provides a computer program product comprising a computer program which, when executed by a processor, implements the above-described timed task management method.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, which include both non-transitory and non-transitory, removable and non-removable media, may implement the information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (14)

1. A method for managing timed tasks, the method comprising:
establishing a current timing task based on a preset timing task information rule, and acquiring the weight of the current timing task based on the established timing task information of the timing task;
comparing the weight of the current timing task with the weight of each timing task in the real-time execution queue, and determining the execution rule of the current timing task; the execution rule comprises the execution time of the current timing task and the distributed thread;
and executing the current timing task based on the execution rule, and recording a process log in real time in the execution process of the current timing task.
2. The method of claim 1, wherein the preset timed task information rule comprises:
configuring information of a timing task and resource object configuration entity information; wherein the content of the first and second substances,
the timing task configuration information includes:
timing ID, Cron expression, task name, start time, end condition, execution times, weight, creation time and modification time of the task;
the resource object configuration entity information includes:
configuration ID, task association ID, configuration name, resource acquisition mode, route, resource object identification, creation time and modification time of the resource object.
3. The method of claim 2, further comprising:
determining whether a created timing task exists;
and if the established timing task exists, initializing the established timing task based on the timing task configuration information and the resource object configuration entity information, and taking the initialized timing task as the current timing task.
4. The method of claim 1, wherein comparing the weight of the current timed task with the weight of each timed task in the real-time execution queue to determine the execution rule of the current timed task comprises:
if the idle thread exists, ignoring the comparison result, directly adding the current timing task into the execution queue, and immediately executing the current timing task based on the timing task information;
if no free thread exists, but no timing task with weight smaller than that of the current timing task exists in the execution queue, adding the current timing task into the preparation queue;
if no free thread exists, but a timing task with the weight smaller than that of the current timing task exists in the execution queue, the execution of the timing task with the lowest weight in the execution queue is immediately stopped, the timing task with the lowest weight is added into the preparation queue, and meanwhile, the thread of the timing task with the lowest weight is distributed to the current timing task.
5. The method of claim 4, wherein the timed tasks in the preparation queue are ordered based on weight magnitude, and wherein the higher the weight, the higher the execution order.
6. The method of claim 5, further comprising:
and when the execution queue is full, adding the first unexecuted timing task in the sequence into the execution queue based on the sequence of the timing tasks in the preparation queue when the execution queue completes one timing task.
7. The method of claim 6, further comprising:
responding to a query request of a user, and calling log information corresponding to a query target; wherein the content of the first and second substances,
the query target is a corresponding timing task;
and the log information is the execution process information recorded in the execution process of the corresponding timing task.
8. A timed task management system, characterized in that it comprises:
the acquisition unit is used for acquiring timing task information and acquiring the weight of the current timing task based on the timing task information;
a processing unit to:
comparing the weight of the current timing task with the weight of each timing task in the real-time execution queue, and determining the execution rule of the current timing task; the execution rule comprises the execution time of the current timing task and the distributed thread;
and executing the current timing task based on the execution rule, and recording a process log in real time in the execution process of the current timing task.
9. The system of claim 8, further comprising:
and the creating unit is used for creating the current timing task or initializing the created timing task based on a preset timing task information rule.
10. The system of claim 8, wherein the processing unit is further configured to:
determining whether a created timing task exists;
and if the established timing task exists, initializing the established timing task based on the timing task configuration information and the resource object configuration entity information, and taking the initialized timing task as the current timing task.
11. The system of claim 8, wherein comparing the weight of the current timed task with the weight of each timed task in the real-time execution queue to determine the execution rule of the current timed task comprises:
if the idle thread exists, ignoring the comparison result, directly adding the current timing task into the execution queue, and immediately executing the current timing task based on the timing task information;
if no free thread exists, but no timing task with weight smaller than that of the current timing task exists in the execution queue, adding the current timing task into the preparation queue;
if no free thread exists, but a timing task with the weight smaller than that of the current timing task exists in the execution queue, the execution of the timing task with the lowest weight in the execution queue is immediately stopped, the timing task with the lowest weight is added into the preparation queue, and meanwhile, the thread of the timing task with the lowest weight is distributed to the current timing task.
12. The system of claim 8, further comprising:
and the log unit is used for recording the execution process information of the timing task in real time.
13. A machine readable storage medium having instructions stored thereon, which when executed by a processor causes the processor to be configured to perform the timed task management method of any of claims 1 to 7.
14. A computer program product comprising a computer program, characterized in that the computer program realizes the timed task management method of any one of claims 1 to 7 when executed by a processor.
CN202111542539.6A 2021-12-14 2021-12-14 Timed task management method and system Pending CN114201284A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111542539.6A CN114201284A (en) 2021-12-14 2021-12-14 Timed task management method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111542539.6A CN114201284A (en) 2021-12-14 2021-12-14 Timed task management method and system

Publications (1)

Publication Number Publication Date
CN114201284A true CN114201284A (en) 2022-03-18

Family

ID=80654513

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111542539.6A Pending CN114201284A (en) 2021-12-14 2021-12-14 Timed task management method and system

Country Status (1)

Country Link
CN (1) CN114201284A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115033393A (en) * 2022-08-11 2022-09-09 苏州浪潮智能科技有限公司 Priority queuing processing method, device, server and medium for batch request issuing

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115033393A (en) * 2022-08-11 2022-09-09 苏州浪潮智能科技有限公司 Priority queuing processing method, device, server and medium for batch request issuing
CN115033393B (en) * 2022-08-11 2023-01-17 苏州浪潮智能科技有限公司 Priority queuing processing method, device, server and medium for batch request issuing

Similar Documents

Publication Publication Date Title
CN112346829B (en) Method and equipment for task scheduling
EP3221795B1 (en) Service addressing in distributed environment
US10853196B2 (en) Prioritizing microservices on a container platform for a restore operation
CN106874084B (en) Distributed workflow scheduling method and device and computer equipment
US9477460B2 (en) Non-transitory computer-readable storage medium for selective application of update programs dependent upon a load of a virtual machine and related apparatus and method
CN107168777B (en) Method and device for scheduling resources in distributed system
CN112527489A (en) Task scheduling method, device and equipment and computer readable storage medium
CN112748993A (en) Task execution method and device, storage medium and electronic equipment
CN115114359B (en) User data processing method and device
CN114201284A (en) Timed task management method and system
CN110968406B (en) Method, device, storage medium and processor for processing task
CN109558249B (en) Control method and device for concurrent operation
CN110011832B (en) Configuration issuing method and device for planned tasks
CN114327835A (en) Distributed task scheduling method and device, processor and electronic equipment
CN114647663A (en) Resource processing method, device and system, electronic equipment and storage medium
CN111143037B (en) Virtual machine resource allocation method, device, system and storage medium
CN108073453B (en) Method and device for scheduling CPU (Central processing Unit) resources in distributed cluster
CN110968401A (en) Task scheduling method and device based on Quartz
CN114706671B (en) Multiprocessor scheduling optimization method and system
CN110365775B (en) Service data uploading method and device and storage medium
CN117369948A (en) Container migration method and device, storage medium and electronic equipment
CN109391588B (en) Request processing method and device
CN113986688A (en) Method for monitoring resource creation by cloud management platform, storage medium and cloud service system
CN117492917A (en) Container migration processing method and device
CN116719796A (en) Method and device for determining upgrading result, processor and electronic equipment

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