CN110109741A - Management method, device, electronic equipment and the storage medium of cycle task - Google Patents

Management method, device, electronic equipment and the storage medium of cycle task Download PDF

Info

Publication number
CN110109741A
CN110109741A CN201910384521.4A CN201910384521A CN110109741A CN 110109741 A CN110109741 A CN 110109741A CN 201910384521 A CN201910384521 A CN 201910384521A CN 110109741 A CN110109741 A CN 110109741A
Authority
CN
China
Prior art keywords
task
time
cycle
cycle task
interval
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.)
Granted
Application number
CN201910384521.4A
Other languages
Chinese (zh)
Other versions
CN110109741B (en
Inventor
陈跃鹏
曹志敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Megvii Technology Co Ltd
Original Assignee
Beijing Megvii Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Megvii Technology Co Ltd filed Critical Beijing Megvii Technology Co Ltd
Priority to CN201910384521.4A priority Critical patent/CN110109741B/en
Publication of CN110109741A publication Critical patent/CN110109741A/en
Application granted granted Critical
Publication of CN110109741B publication Critical patent/CN110109741B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

Abstract

Present disclose provides a kind of management method of cycle task, the managing device of cycle task, electronic equipment and computer readable storage mediums, belong to field of computer technology.This method comprises: obtaining task list, task list includes the nearest execution time and interval time of multiple cycle tasks and each cycle task, wherein each cycle task is respectively by an association Cheng Zhihang;The time interval of nearest execution time and current time in response to any cycle task reach the interval time of the cycle task, push the associated business datum of the cycle task;Update the nearest execution time of any of the above-described cycle task in task list;If there is the cycle task that the time interval of execution time and current time recently reaches preset time in task list, which is reactivated.The disclosure can carry out unified monitoring and management to cycle task, improve efficiency without independent deployment program to reduce resource consumption, and increase the reliability of system.

Description

Management method, device, electronic equipment and the storage medium of cycle task
Technical field
This disclosure relates to the place of field of computer technology more particularly to a kind of management method of cycle task, cycle task Manage device, electronic equipment and computer readable storage medium.
Background technique
Cycle task refers to repeating according to period regular hour or trigger condition for task, current most of circulations Task in the process of implementation, requires individually to dispose the process that a set of program carrys out maintenance task, expends more resource in this way, such as Server, system calculate power, manpower etc., lead to inefficiency.
It should be noted that information is only used for reinforcing the reason to the background of the disclosure disclosed in above-mentioned background technology part Solution, therefore may include the information not constituted to the prior art known to persons of ordinary skill in the art.
Summary of the invention
Present disclose provides a kind of management method of cycle task, the processing unit of cycle task, electronic equipment and calculating Machine readable storage medium storing program for executing, and then overcome the problems, such as that the prior art expends more resource at least to a certain extent.
Other characteristics and advantages of the disclosure will be apparent from by the following detailed description, or partially by the disclosure Practice and acquistion.
According to the disclosure in a first aspect, providing a kind of management method of cycle task, comprising: obtain task list, institute The nearest execution time and interval time that task list includes multiple cycle tasks and each cycle task are stated, wherein described every A cycle task is respectively by an association Cheng Zhihang;In response to the time of nearest the execution time and current time of any cycle task Interval reaches the interval time of any cycle task, pushes any associated business datum of cycle task;Update institute State the nearest execution time of any cycle task described in task list;If existing in the task list and executing the time recently Reach the cycle task of preset time with the time interval of current time, then reactivates the cycle task.
In a kind of exemplary embodiment of the disclosure, each cycle task has corresponding preset time, described Preset time is the interval time of corresponding cycle task multiplied by N, and N is the real number greater than 1.
In a kind of exemplary embodiment of the disclosure, the task list further includes the starting of each cycle task Time, starting time difference, interval time identical cycle task are by the association Cheng Zhihang in the same thread.
In a kind of exemplary embodiment of the disclosure, if in the task list exist recently execute the time and The time interval of current time reaches the cycle task of preset time, then reactivates the cycle task, comprising: if described There is the cycle task that the time interval of execution time and current time recently reaches preset time in task list, then follows this Ring task is removed from the task list, and adds the removed cycle task again in the bottom of the task list.
In a kind of exemplary embodiment of the disclosure, the task list further includes the shape of each cycle task State, the state include it is to be processed or processing in;If in the task list exist recently execute the time and it is current when Between time interval reach the cycle task of preset time, then the cycle task is reactivated, comprising: if the task arranges Reach preset time in the presence of the time interval for executing time and current time recently in table and state is the circulation times in processing Business, then reactivate the cycle task.
In a kind of exemplary embodiment of the disclosure, the multiple cycle task in the task list is according to respectively following Ring task adds the sequencing arrangement of time in the task list;The method also includes: it is in processing in state The cycle task of addition time the latest is determined in cycle task;If there is the addition time earlier than addition time the following the latest Ring task, and state is other cycle tasks to be processed, then reactivates other described cycle tasks.
In a kind of exemplary embodiment of the disclosure, each association's journey has a timer, for monitoring journey institute, the association Whether the nearest execution time of the cycle task of execution and the time interval of current time reach the interval time of the cycle task Or the preset time.
Including at least a cycle task in a kind of exemplary embodiment of the disclosure, in the multiple cycle task is Data-pushing task;It is described to be performed in response to any cycle task in the multiple cycle task, update the task list Described in cycle task the nearest execution time, comprising: in response to starting to execute the data-pushing task, detect whether exist The business datum for needing to push;If it exists, then the business datum is pushed, data-pushing described in the task list is updated and appoints The nearest execution time of business, and execute the data-pushing task again after the first interval time;If it does not exist, then second The data-pushing task is executed after interval time again;Wherein, when first interval time is different from the described second interval Between.
According to the second aspect of the disclosure, a kind of processing unit of cycle task is provided, comprising: module is obtained, for obtaining Task list is taken, the task list includes the nearest execution time of multiple cycle tasks and each cycle task, wherein institute Each cycle task is stated respectively by an association Cheng Zhihang;Execution module, when for nearest execution in response to any cycle task Between and the time interval of current time reach interval time of any cycle task, push any cycle task association Business datum;Update module, for updating the nearest execution time of any cycle task described in the task list;Activation Module, if reaching preset time for there is the time interval of execution time and current time recently in the task list Cycle task then reactivates the cycle task.
In a kind of exemplary embodiment of the disclosure, each cycle task has corresponding preset time, described Preset time is the interval time of corresponding cycle task multiplied by N, and N is the real number greater than 1.
In a kind of exemplary embodiment of the disclosure, the task list further includes the starting of each cycle task Time, starting time difference, interval time identical cycle task are by the association Cheng Zhihang in the same thread.
In a kind of exemplary embodiment of the disclosure, the active module, if for existing in the task list The time interval of execution time and current time reaches the cycle task of preset time recently, then by the cycle task from described It is removed in business list, and adds the removed cycle task again in the bottom of the task list.
In a kind of exemplary embodiment of the disclosure, the task list further includes the shape of each cycle task State, the state include it is to be processed or processing in;The active module, if executed recently for existing in the task list The time interval of time and current time reaches preset time and state is the cycle task in processing, then by the cycle task It reactivates.
In a kind of exemplary embodiment of the disclosure, the multiple cycle task in the task list is according to respectively following Ring task adds the sequencing arrangement of time in the task list;The active module is also used in state as in processing Cycle task in determine addition time cycle task the latest, the latest earlier than addition time if there is the addition time Cycle task, and state is other cycle tasks to be processed, then reactivates other described cycle tasks.
In a kind of exemplary embodiment of the disclosure, each association's journey has a timer, for monitoring journey institute, the association Whether the nearest execution time of the cycle task of execution and the time interval of current time reach the interval time of the cycle task Or the preset time.
According to the third aspect of the disclosure, a kind of electronic equipment is provided, comprising: processor;And memory, for storing The executable instruction of the processor;Wherein, the processor is configured to above-mentioned to execute via the executable instruction is executed Method described in any one.
According to the fourth aspect of the disclosure, a kind of computer readable storage medium is provided, computer program is stored thereon with, The computer program realizes method described in above-mentioned any one when being executed by processor.
The exemplary embodiment of the disclosure has the advantages that
The nearest execution time and interval time of each cycle task are recorded and managed by task list, respectively by each Association's journey periodically recycle each cycle task of execution, with normal transmission service data, if there is some cycle task etc. To the abnormal conditions of overlong time, then the task is reactivated.On the one hand, the mode of task based access control list is to a certain range of Cycle task carries out unified monitoring and management, without individually disposing a set of program for each task, can be realized and appoints to circulation The effective control for implementation procedure of being engaged in, it is possible to reduce the consumption of resource improves efficiency.On the other hand, it is distributed for each cycle task One association's journey is that task processing can be improved to assist this lesser unit of journey to be formed and independently execute to each cycle task Flexibility, and journey is assisted to be equivalent to the reference to code in original program or process, increase instruction or function without additional, it can be into one Step reduces the consumption of resource.In another aspect, the time interval of nearest execution time and current time based on cycle task determine Its state can find the abnormal conditions in cycle task in time, and the operation reactivated is taken in its abort, guarantee Cycle task operates normally, and increases the reliability of system.
It should be understood that above general description and following detailed description be only it is exemplary and explanatory, not The disclosure can be limited.
Detailed description of the invention
The drawings herein are incorporated into the specification and forms part of this specification, and shows the implementation for meeting the disclosure Example, and together with specification for explaining the principles of this disclosure.It should be evident that the accompanying drawings in the following description is only the disclosure Some embodiments for those of ordinary skill in the art without creative efforts, can also basis These attached drawings obtain other attached drawings.
Fig. 1 shows a kind of flow chart of the management method of cycle task in the present exemplary embodiment;
Fig. 2 shows the sub-process figures of the management method of cycle task a kind of in the present exemplary embodiment;
Fig. 3 shows the sub-process figure of the management method of another cycle task in the present exemplary embodiment;
Fig. 4 shows the flow chart of the management method of another cycle task in the present exemplary embodiment;
Fig. 5 shows a kind of structural block diagram of the managing device of cycle task in the present exemplary embodiment;
Fig. 6 shows a kind of electronic equipment for realizing the above method in the present exemplary embodiment;
Fig. 7 shows a kind of computer readable storage medium for realizing the above method in the present exemplary embodiment.
Specific embodiment
Example embodiment is described more fully with reference to the drawings.However, example embodiment can be with a variety of shapes Formula is implemented, and is not understood as limited to example set forth herein;On the contrary, thesing embodiments are provided so that the disclosure will more Fully and completely, and by the design of example embodiment comprehensively it is communicated to those skilled in the art.Described feature, knot Structure or characteristic can be incorporated in any suitable manner in one or more embodiments.
The exemplary embodiment of the disclosure provides a kind of management method of cycle task, can be applied to all have number According on the electronic equipment of processing function, such as computer, smart phone, tablet computer etc..Fig. 1 shows the process of this method, Including step S110~S140:
Step S110, obtain task list, the task list include multiple cycle tasks and each cycle task most It is close to execute time and interval time.
Wherein, each cycle task can be executed by association's journey respectively, and association's journey can be individually to call in program and hold One section of capable code, instruction or function corresponding to cycle task are a lesser execution units, therefore task can be improved The flexibility of processing.In the present exemplary embodiment, task list can be the task list based on a certain program or process, can also To be the task list of whole programs or process in system, task list can only include cycle task, also may include non-follow Ring task, wherein cycle task can be distinguished with non-cyclic task by specific field, attribute or label etc..Circulation Task is usually repeated according to period regular hour or process cycle, can recorde each cycle task in task list most Closely time for once executing, nearest execution time and cycle task in as step S110 per between executing twice Every time namely the time cycle of cycle task.In one exemplary embodiment, task list can also be stored in specific appoint It is engaged in database.
Illustrate by taking computer as an example, in one exemplary embodiment, when the operating system on computer, Ke Yi Backstage starts a cycle task management service, can be a daemon thread, the institute run in real time scan acquisition system There is cycle task, generates task list on backstage;Alternatively, when specific process operation, synchronous averaging one service in process Thread, cycle task information and state in statistics process generate task list.Further, it can also count and to have created Journey information is assisted, time, performed function including association's journey creation, about the variate-value etc. for executing the time, to obtain task List.
Step S120, the time interval of nearest execution time and current time in response to any cycle task reach this and follow The interval time of ring task pushes the associated business datum of the cycle task.
In the present exemplary embodiment, cycle task can be data-pushing task, and e.g. server is to client push The task of data is also possible to system to specific memory section or the task of database propelling data, can also be the number between process According to push task dispatching, different cycle tasks belongs to different business modules, each cycle task and corresponding business module institute What is generated has association to transmission service data.Reach when the nearest execution time of cycle task and the time interval of current time It the interval time of the cycle task, that is, reaches and executes the time next time, then push business datum associated by the cycle task.? In one exemplary embodiment, the business datum for needing to push be can store in service database, and cycle task periodically follows Ring carries out, and after each transmission service data, business datum can be removed from service database, can also be in service database In stamp the label stamp of " push ", the new business datum being written in service database is the data for needing to push next time.
Step S130 updates the nearest execution time of above-mentioned cycle task in task list.
In the present exemplary embodiment, the state that task list can keep dynamic to update, once the cycle task in list It is performed, then updates its corresponding nearest execution time.Specifically, cycle task management service can keep logical with other processes Letter, when other processes execute cycle task, cycle task management service gets relevant information, synchronized update task list; Alternatively, in service thread real time monitoring process in process all cycle tasks operating condition, real-time update its execute recently Time.For example, the interval time of cycle task R1 is T1, R1 is performed in current time t0, then when executing it recently Between be updated to t0, t0+T1 is scheduled to execute the time next time.
Task execution time is reached it should be noted that existing in the step s 120, but the business without needing to push The case where data.It, still can be by it due to starting the instruction of execution although cycle task does not execute really at this time The execution time is updated to current time recently.Or in one exemplary embodiment, if this does not have when executing cycle task Push any data, then will can execute next time the time it is appropriate in advance, such as: for cycle task R1 be arranged pre-set time measure Ts, ts are usually less than the interval time T1 of R1, when current time t0 executes R1, the not related business datum of R1, therefore There is no propelling data, the nearest execution time of R1 can be updated to t0-ts at this time, then executing the time next time is t0-ts+ T1, the time, can be to avoid accumulations largely to transmission service data earlier than t0+T1.
Step S140, if reach default in the presence of the time interval for executing time and current time recently in task list Between cycle task, then the cycle task is reactivated.
Wherein, the time interval, that is, current time for executing time and current time recently subtracts the execution time recently, to follow The waiting time of ring task indicates after cycle task was executed from last time to currently have passed through waiting how long.In an example Property embodiment in, in order to accurately calculate the waiting time, can be executed to the time terminated as nearest the cycle task last time The time is executed, record execution can also start to terminate two times with execution within the execution time recently, to execute the end time Difference to current time indicates the waiting time.In one exemplary embodiment, system or cycle task management service can weeks Phase property detects the waiting time of each cycle task, to obtain the accurate waiting time.In one exemplary embodiment, task list In can also with the waiting time of each cycle task of real-time update, such as in the form of timer, to each cycle task etc. Then its waiting time is reset, then restarts timing if there is some cycle task is performed to accumulated time timing.
Preset time can be used as the waiting time whether too long standard for measuring cycle task, if the waiting time reaches Preset time illustrates that the waiting time is too long, and unexpected suspension may occur for cycle task, can be reactivated.Each circulation is appointed The preset time of business may be the same or different, in one exemplary embodiment, it is contemplated that week time of each cycle task Can preset time targetedly be set separately for each cycle task in the difference of phase, process cycle etc., more accurately to weigh Measure each cycle task whether wait it is too long.The mode that cycle task is reactivated can specifically include: by cycle task weight It opens, by the journey resetting of task association, replacement executes association's journey etc. of the task, such as: a conditional statement can be set in a program, If the waiting time of a cycle task reaches preset time, the coroutine.resume of cycle task association journey is executed Function, or association's journey is waken up by sentences such as send ();Journey can also be assisted by coroutine.status functional query State distributes new association's journey when returning to abnormality value for cycle task.
In the present exemplary embodiment, since each cycle task is executed as unit of assisting journey, circulation is being reactivated When task, it can also not need by the scope limitation of processing in this association journey, without influencing other tasks from entire program or clothes Intervened in the level of business, therefore it is beneficial to reduce overheads.
Based on above description, the present exemplary embodiment is recorded by task list and manages the nearest execution of each cycle task Time and interval time are periodically recycled by each association's journey execute each cycle task respectively, with normal transmission service number According to if there is the abnormal conditions that the waiting time of some cycle task is too long, then reactivating the task.On the one hand, it is based on The mode of task list carries out unified monitoring and management to a certain range of cycle task, without being the independent portion of each task A set of program is affixed one's name to, effective control to cycle task implementation procedure can be realized, it is possible to reduce the consumption of resource improves efficiency. On the other hand, association's journey is distributed for each cycle task, is to assist this lesser unit of journey to be formed to each cycle task It independently executes, the flexibility of task processing can be improved, and journey is assisted to be equivalent to the reference to code in original program or process, be not necessarily to It is additional to increase instruction or function, the consumption of resource can be further reduced.In another aspect, when nearest execution based on cycle task Between and the time interval of current time determine its state, the abnormal conditions in cycle task can be found in time, in its exception The operation reactivated is taken when only, is guaranteed that cycle task operates normally, is increased the reliability of system.
In one exemplary embodiment, it can have a timer in each association's journey, for monitoring performed by association's journey Whether the nearest execution time of cycle task and the time interval of current time reach the interval time or above-mentioned of the cycle task Preset time, when reaching interval time, that is, meeting the condition of step S120, timers trigger assists Cheng Zhihang cycle task, when Reach preset time, that is, when meeting the condition of step S140, timers trigger reactivates cycle task.
In one exemplary embodiment, each cycle task have corresponding preset time, i.e., different cycle tasks its Preset time can be different.Particularly, the corresponding preset time of each cycle task can be the interval time of the cycle task It is the real number greater than 1 multiplied by N, N.Under normal circumstances, when the waiting time of each cycle task reaches interval time, it should enter It executes, is executed next time if do not entered next time, illustrate that cycle task may be abnormal, it is contemplated that during task execution Some deviations or timing on error, preset time as measurement standard can be made less times greater than interval time, according to Actual demand sets its coefficient N, such as N can be set as to 2, then judges the condition whether cycle task is abnormal are as follows:
Waiting time=current time-executes time >=interval time * 2 recently;
It if meeting above-mentioned condition, may determine that cycle task is abnormal, execute the step of reactivating.
In one exemplary embodiment, task list can also include the starting time of each cycle task, refer to circulation The time that task executes for the first time.Correspondingly, starting time difference, interval time identical cycle task can be assigned to same Different association Cheng Zhihang in a thread.It, will be according to this is because the starting time is different, interval time identical multiple cycle tasks The fixed period successively executes, and the same time is not in the case where two tasks are performed simultaneously, and a thread is arranged successively to transport Association's journey of these cycle tasks of row can be very good to carry out serial process, and reduce the expense on thread, be further reduced Resource consumption.
In one exemplary embodiment, step S140 can be realized by following steps:
If there is the circulation that the time interval of execution time and current time recently reaches preset time in task list Task then removes the cycle task from task list, and adds the removed circulation again in the bottom of task list Task.
Wherein, in task list circulation it is any can according to its generate time (generally also be added to task list In time) arrangement, the task at the top of list generates at first, and the task of bottom is newly generated, naturally it is also possible to general Task list is set as opposite situation, and the disclosure does not limit this.In the present exemplary embodiment, followed for what is be abnormal Ring task is reinserted into task list after can removing it as a new task, can plan execution again for it Time and its interval time can also retain nearest execution time and interval time in predecessor's business, and the execution time adds recently Interval time obtains the Time Of Next execution of new task, to start the cycle over implementation procedure.
Further, for new cycle task increased in task list, it can star new association's journey and newly followed with executing this Ring task.Such as it can be added wherein by coroutine.create function creation one new association's journey about new circulation The code of task, and relevant variate-value is set, it brings into operation.Particularly, when executing step S140, the waiting time is reached To the abnormal task of preset time, management service can be moved out task list, and recycle the association's journey for originally executing the task, The task is then re-added to the bottom of task list, and distributes the new association Cheng Zhihang task, is realized with this different Normal cycle task reactivates.Since the exception of cycle task may be to be reassigned as caused by association Cheng Yichang by association's journey Mode can significantly more efficient solution abnormal problem.
It in one exemplary embodiment, can also include the state of each cycle task in task list, usually wait locate In reason or processing, specifically, task list can use the state of a specific field or each cycle task of attribute record, 0 indicates to be processed, in 1 expression processing, naturally it is also possible to be indicated with other numerical value.Each cycle task is being added to task list Afterwards, initial state is usually all to be processed, indicates that the task distributes resource in waiting system at this time, such as distribute available line Journey, association's journey etc., once being assigned to resource, bring into operation the task, and Status Change is in processing.In the present exemplary embodiment, If step S140 may include: when having the time interval of execution time and current time recently in task list to reach default Between and state be processing in cycle task, then the cycle task is reactivated.In other words, when can will pass through waiting Between it is whether too long to judge whether cycle task that abnormal method is only applied in processing, for task to be processed, due to It was also not carried out, and there is no the time is executed recently, can not also obtain its waiting time, therefore step S140 can not be executed, from And reduce the task quantity for needing to monitor, further save resource.
Certainly, it is cycle task to be processed for state, abnormal mechanism can also be prevented using certain.In an example In property embodiment, each cycle task in task list can add in task list the sequencing of time according to it and be arranged Column, such as addition time earliest cycle task are arranged at the top of list, the addition time the latest in list bottom, certainly may be used To be set as opposite situation, depending on the concrete condition of task list, the disclosure is not limited this.As shown in Fig. 2, circulation The management method of task can with the following steps are included:
Step S210 determines the cycle task of addition time the latest in the cycle task that state is in processing;
Step S220, the cycle task if there is the addition time earlier than the above-mentioned addition time the latest, and state is wait locate Other cycle tasks of reason, then reactivate the cycle task.
Wherein, system is that each cycle task distributes resource according to the sequencing of addition time, i.e., arranges in task list Cycle task at front end (or top) preferentially obtains resource, is preferentially in processing by Status Change to be processed.Therefore, normally In the case of, the time is added in task list, and several cycle tasks are state in processing earlier, wherein coming that last Cycle task, i.e. the cycle task of addition time the latest, can be considered state line of demarcation, the circulation before the task in step S210 Task is all state in processing, and cycle task later is all armed state, if there is the situation in step S220, that is, is deposited It is relatively early but still in the cycle task of armed state in the addition time, illustrate that the cycle task may occur in waiting process When distributing resource mistake occurs for exception, such as system, and the resource perhaps distributed is unavailable or the task itself can not be by Resource operation distributed etc., then can reactivate the cycle task, the mode reactivated can refer to the part step S140 Explanation.
You need to add is that cycle task be also in it is to be processed in processing other than other states, such as cancel Or terminate, cancelling indicates the task by manual cancellation, terminates to indicate that the task execution terminates, has such as reached scheduled circulation and executed Number, or meet scheduled termination condition etc., for these two types of tasks, management service can recycle its resource, Huo Zhe Task list is moved out after once confirming (confirmation cancellation operation is errorless or end state is errorless) again.
In one exemplary embodiment, as shown in figure 3, step S120 and S130 can be realized by following steps:
Step S301, the time interval of nearest execution time and current time in response to any cycle task reach this and follow The interval time of ring task detects whether there is the business datum for needing to push;
Step S302, and if it exists, the business datum is then pushed, when updating the nearest execution of the cycle task in task list Between be current time;
Step S303, if it does not exist, then with earlier than current time pre-set time amount at the time of update task list in this follow The nearest execution time of ring task.
Wherein, pre-set time amount is indicated in the case where a data-pushing makes a turn, and data-pushing next time is shifted to an earlier date Time quantum is less than the interval time of cycle task.It usually requires in the business datum storage and service database of push, every time When starting execution task, can first it detect with the presence or absence of the business datum for needing to push in service database, if it is present just Task is often executed, the nearest execution time for updating the cycle task in task list is current time, and after interval time again Secondary the execution cycle task, the i.e. situation of step S302;If there is no the business datum that needs push, then by cycle task At the time of measuring earlier than current time pre-set time, to execute cycle task next time earlier, i.e., executing time modification recently is The situation of step S303.
Fig. 4 shows a kind of flow diagram of the management method of cycle task in the present exemplary embodiment, specifically includes: The management service of cycle task starts, and obtains task list, distributes association's journey for wherein each cycle task to execute task; When executing any circulation, first detect whether there is business datum to be pushed, if it is present normally pushing number According to, and be confirmed whether to push successfully;If pushed successfully, it is determined that executed after the first interval time for the next time of the cycle task Time, the interval time of the first interval time i.e. cycle task itself;If push is unsuccessful, one can be repeated immediately Unexpected message can be generated if repeatedly pushing unsuccessful in subtask;If there is no data to be pushed, it is determined that second It is the Time Of Next execution of the cycle task after interval time, usual second interval time is less than the first interval time;In addition, It may determine that whether the task reaches the condition of completion, if reached, end task, if not up to, executed according to next time Time executes the treatment process of the primary data-pushing task again.By the method for Fig. 4, can under the premise of saving resource, Guarantee the normal operation of data-pushing task.
The exemplary embodiment of the disclosure additionally provides a kind of processing unit of cycle task, as shown in figure 5, the device 500 may include: to obtain module 510, and for obtaining task list, task list includes multiple cycle tasks and each circulation The nearest execution time of task, wherein each cycle task is respectively by an association Cheng Zhihang;Execution module 520, in response to The nearest execution time of any cycle task and the time interval of current time reach the interval time of any cycle task, push The associated business datum of the cycle task;Update module 530, for updating the nearest execution of above-mentioned cycle task in task list Time;Active module 540, if reaching pre- for there is the time interval of execution time and current time recently in task list If the cycle task of time then reactivates the cycle task.
In one exemplary embodiment, each cycle task can have corresponding preset time, and preset time can be The interval time of corresponding cycle task is the real number greater than 1 multiplied by N, N.
In one exemplary embodiment, task list can also include the starting time of each cycle task, start the time Different, interval time identical cycle task can be by the association Cheng Zhihang in the same thread.
In one exemplary embodiment, the time is executed recently and is worked as if active module can be used in task list existing The time interval of preceding time reaches the cycle task of preset time, then removes the cycle task from task list, and in office Again the removed cycle task is added in the bottom of business list.
In one exemplary embodiment, task list can also include the state of each cycle task, and state includes wait locate In reason or processing;If active module can be used in task list having the time interval for executing time and current time recently Reach preset time and state is the cycle task in processing, then reactivates the cycle task.
In one exemplary embodiment, multiple cycle tasks in task list can be arranged according to each cycle task in task The sequencing arrangement of time is added in table;Active module can be also used for the determination in the cycle task that state is in processing and add Cycle task between added-time the latest, the cycle task if there is the addition time earlier than the addition time the latest, and state is wait locate Other cycle tasks of reason, then reactivate other cycle tasks.
In one exemplary embodiment, each association's journey has a timer, for monitoring cycle task performed by association's journey The nearest execution time and the time interval of current time whether reach interval time or the preset time of the cycle task.
The detail of each module has been described in detail in the embodiment of method part in above-mentioned apparatus, undisclosed thin Section content may refer to the embodiment content of method part, therefore repeat no more.
The exemplary embodiment of the disclosure additionally provides a kind of electronic equipment that can be realized the above method.
Person of ordinary skill in the field it is understood that various aspects of the disclosure can be implemented as system, method or Program product.Therefore, various aspects of the disclosure can be with specific implementation is as follows, it may be assumed that complete hardware embodiment, complete The embodiment combined in terms of full Software Implementation (including firmware, microcode etc.) or hardware and software, can unite here Referred to as circuit, " module " or " system ".
The electronic equipment 600 of this exemplary embodiment according to the disclosure is described referring to Fig. 6.What Fig. 6 was shown Electronic equipment 600 is only an example, should not function to the embodiment of the present disclosure and use scope bring any restrictions.
As shown in fig. 6, electronic equipment 600 is showed in the form of universal computing device.The component of electronic equipment 600 can wrap It includes but is not limited to: at least one above-mentioned processing unit 610, at least one above-mentioned storage unit 620, the different system components of connection The bus 630 of (including storage unit 620 and processing unit 610), display unit 640.
Wherein, storage unit is stored with program code, and program code can be executed with unit 610 processed, so that processing is single Member 610 executes the step described in above-mentioned " illustrative methods " part of this specification according to the various illustrative embodiments of the disclosure Suddenly.For example, processing unit 610 can execute Fig. 1, Fig. 2 or method and step shown in Fig. 3 etc..
Storage unit 620 may include the readable medium of volatile memory cell form, such as Random Access Storage Unit (RAM) 621 and/or cache memory unit 622, it can further include read-only memory unit (ROM) 623.
Storage unit 620 can also include program/utility 624 with one group of (at least one) program module 625, Such program module 625 includes but is not limited to: operating system, one or more application program, other program modules and It may include the realization of network environment in program data, each of these examples or certain combination.
Bus 630 can be to indicate one of a few class bus structures or a variety of, including storage unit bus or storage Cell controller, peripheral bus, graphics acceleration port, processing unit use any bus structures in a variety of bus structures Local bus.
Electronic equipment 600 can also be with one or more external equipments 800 (such as keyboard, sensing equipment, bluetooth equipment Deng) communication, can also be enabled a user to one or more equipment interact with the electronic equipment 600 communicate, and/or with make Any equipment (such as the router, modulation /demodulation that the electronic equipment 600 can be communicated with one or more of the other calculating equipment Device etc.) communication.This communication can be carried out by input/output (I/O) interface 650.Also, electronic equipment 600 can be with By network adapter 660 and one or more network (such as local area network (LAN), wide area network (WAN) and/or public network, Such as internet) communication.As shown, network adapter 660 is communicated by bus 630 with other modules of electronic equipment 600. It should be understood that although not shown in the drawings, other hardware and/or software module can not used in conjunction with electronic equipment 600, including but not Be limited to: microcode, device driver, redundant processing unit, external disk drive array, RAID system, tape drive and Data backup storage system etc..
Through the above description of the embodiments, those skilled in the art is it can be readily appreciated that example described herein is implemented Mode can also be realized by software realization in such a way that software is in conjunction with necessary hardware.Therefore, according to the disclosure The technical solution of embodiment can be embodied in the form of software products, which can store non-volatile at one Property storage medium (can be CD-ROM, USB flash disk, mobile hard disk etc.) in or network on, including some instructions are so that a calculating Equipment (can be personal computer, server, terminal installation or network equipment etc.) is executed according to the exemplary implementation of the disclosure The method of example.
The exemplary embodiment of the disclosure additionally provides a kind of computer readable storage medium, and being stored thereon with can be realized The program product of this specification above method.In some possible embodiments, various aspects of the disclosure can also be realized For a kind of form of program product comprising program code, when program product is run on the terminal device, program code is used for Execute terminal device described in above-mentioned " illustrative methods " part of this specification according to the various exemplary embodiment party of the disclosure The step of formula.
It is produced refering to what is shown in Fig. 7, describing the program according to the exemplary embodiment of the disclosure for realizing the above method Product 700, can be using portable compact disc read only memory (CD-ROM) and including program code, and can set in terminal It is standby, such as run on PC.However, the program product of the disclosure is without being limited thereto, in this document, readable storage medium storing program for executing can With to be any include or the tangible medium of storage program, the program can be commanded execution system, device or device use or Person is in connection.
Program product can be using any combination of one or more readable mediums.Readable medium can be readable signal Jie Matter or readable storage medium storing program for executing.Readable storage medium storing program for executing for example can be but be not limited to electricity, magnetic, optical, electromagnetic, infrared ray or partly lead System, device or the device of body, or any above combination.More specific example (the non exhaustive column of readable storage medium storing program for executing Table) it include: the electrical connection with one or more conducting wires, portable disc, hard disk, random access memory (RAM), read-only storage Device (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read only memory (CD- ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, In carry readable program code.The data-signal of this propagation can take various forms, including but not limited to electromagnetic signal, Optical signal or above-mentioned any appropriate combination.Readable signal medium can also be any readable Jie other than readable storage medium storing program for executing Matter, the readable medium can send, propagate or transmit for by instruction execution system, device or device use or and its The program of combined use.
The program code for including on readable medium can transmit with any suitable medium, including but not limited to wirelessly, have Line, optical cable, RF etc. or above-mentioned any appropriate combination.
Can with any combination of one or more programming languages come write for execute the disclosure operation program Code, programming language include object oriented program language-Java, C++ etc., further include conventional process Formula programming language-such as " C " language or similar programming language.Program code can be calculated fully in user It executes in equipment, partly execute on a user device, executing, as an independent software package partially in user calculating equipment Upper part executes on a remote computing or executes in remote computing device or server completely.It is being related to remotely counting In the situation for calculating equipment, remote computing device can pass through the network of any kind, including local area network (LAN) or wide area network (WAN), it is connected to user calculating equipment, or, it may be connected to external computing device (such as utilize ISP To be connected by internet).
In addition, above-mentioned attached drawing is only the schematic theory of the processing according to included by the method for disclosure exemplary embodiment It is bright, rather than limit purpose.It can be readily appreciated that the time that above-mentioned processing shown in the drawings did not indicated or limited these processing is suitable Sequence.In addition, be also easy to understand, these processing, which can be, for example either synchronously or asynchronously to be executed in multiple modules.
It should be noted that although being referred to several modules or list for acting the equipment executed in the above detailed description Member, but this division is not enforceable.In fact, according to an exemplary embodiment of the present disclosure, above-described two or More multimode or the feature and function of unit can embody in a module or unit.Conversely, above-described one A module or the feature and function of unit can be to be embodied by multiple modules or unit with further division.
Those skilled in the art after considering the specification and implementing the invention disclosed here, will readily occur to its of the disclosure His embodiment.This application is intended to cover any variations, uses, or adaptations of the disclosure, these modifications, purposes or Adaptive change follow the general principles of this disclosure and including the undocumented common knowledge in the art of the disclosure or Conventional techniques.The description and examples are only to be considered as illustrative, and the true scope and spirit of the disclosure are by claim It points out.
It should be understood that the present disclosure is not limited to the precise structures that have been described above and shown in the drawings, and And various modifications and changes may be made without departing from the scope thereof.The scope of the present disclosure is only limited by the attached claims.

Claims (10)

1. a kind of management method of cycle task characterized by comprising
Obtain task list, the task list include multiple cycle tasks and each cycle task the nearest execution time and Interval time, wherein each cycle task is respectively by an association Cheng Zhihang;
The time interval of nearest execution time and current time in response to any cycle task reach any cycle task Interval time, push any associated business datum of cycle task;
Update the nearest execution time of any cycle task described in the task list;
If there is the circulation that the time interval of execution time and current time recently reaches preset time in the task list Task then reactivates the cycle task.
2. the method according to claim 1, wherein each cycle task have corresponding preset time, The preset time is the interval time of corresponding cycle task multiplied by N, and N is the real number greater than 1.
3. according to the method described in claim 2, it is characterized in that, the task list further includes each cycle task Start the time, starting time difference, interval time identical cycle task are by the association Cheng Zhihang in the same thread.
4. if the method according to claim 1, wherein when there is execution recently in the task list Between and the time interval of current time reach the cycle task of preset time, then the cycle task is reactivated, comprising:
If there is the circulation that the time interval of execution time and current time recently reaches preset time in the task list Task then removes the cycle task from the task list, and adds this again in the bottom of the task list and moved The cycle task removed.
5. the method according to claim 1, wherein the task list further includes each cycle task State, the state include it is to be processed or processing in;
If there is the time interval of execution time and current time recently in the task list reaches preset time Cycle task then reactivates the cycle task, comprising:
If there is the time interval of execution time and current time recently in the task list reaches preset time and state For the cycle task in processing, then the cycle task is reactivated.
6. according to the method described in claim 5, it is characterized in that, the multiple cycle task in the task list according to Each cycle task adds the sequencing arrangement of time in the task list;
The method also includes:
The cycle task of addition time the latest is determined in the cycle task that state is in processing;
Cycle task if there is the addition time earlier than the addition time the latest, and state is that other circulations to be processed are appointed Business, then reactivate other described cycle tasks.
7. the method according to claim 1, wherein each association's journey has a timer, for monitoring the association Whether the nearest execution time of cycle task performed by journey and the time interval of current time reach the interval of the cycle task Time or the preset time.
8. a kind of processing unit of cycle task characterized by comprising
Module is obtained, for obtaining task list, the task list includes multiple cycle tasks and each cycle task The time is executed recently, wherein each cycle task is respectively by an association Cheng Zhihang;
Execution module, the time interval for nearest execution time and current time in response to any cycle task reach described The interval time of any cycle task pushes any associated business datum of cycle task;
Update module, for updating the nearest execution time of any cycle task described in the task list;
Active module, if reaching pre- for there is the time interval of execution time and current time recently in the task list If the cycle task of time then reactivates the cycle task.
9. a kind of electronic equipment characterized by comprising
Processor;And
Memory, for storing the executable instruction of the processor;
Wherein, the processor is configured to come described in any one of perform claim requirement 1-7 via the execution executable instruction Method.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program Method of any of claims 1-7 is realized when being executed by processor.
CN201910384521.4A 2019-05-09 2019-05-09 Method and device for managing circular tasks, electronic equipment and storage medium Active CN110109741B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910384521.4A CN110109741B (en) 2019-05-09 2019-05-09 Method and device for managing circular tasks, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910384521.4A CN110109741B (en) 2019-05-09 2019-05-09 Method and device for managing circular tasks, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110109741A true CN110109741A (en) 2019-08-09
CN110109741B CN110109741B (en) 2021-08-27

Family

ID=67489101

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910384521.4A Active CN110109741B (en) 2019-05-09 2019-05-09 Method and device for managing circular tasks, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110109741B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111078323A (en) * 2019-10-12 2020-04-28 平安科技(深圳)有限公司 Coroutine-based data processing method and device, computer equipment and storage medium
CN112988414A (en) * 2021-02-07 2021-06-18 杭州复杂美科技有限公司 Block chain transaction batch broadcasting method, computer equipment and storage medium
CN113190777A (en) * 2021-03-31 2021-07-30 北京达佳互联信息技术有限公司 Data updating method and device, electronic equipment, storage medium and product
CN114125045A (en) * 2021-10-29 2022-03-01 北京旷视科技有限公司 Data processing method and device and electronic system

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1645334A (en) * 2005-01-12 2005-07-27 宁波大学 Timer dispatching method for real-time multi-task operating system
CN1758605A (en) * 2004-10-10 2006-04-12 华为技术有限公司 Scheduling method of mobile data service
CN1828541A (en) * 2006-04-07 2006-09-06 浙江大学 Implementation method for timing task in Java operating system
JP4047783B2 (en) * 2003-09-01 2008-02-13 沖電気工業株式会社 Task control method and task switching device
CN103645909A (en) * 2013-12-30 2014-03-19 中国烟草总公司湖南省公司 Handling method and device for timed task
CN107908486A (en) * 2017-11-06 2018-04-13 山东浪潮通软信息科技有限公司 A kind of cycle performs the method and device of task
CN108123820A (en) * 2016-11-29 2018-06-05 北京神州泰岳软件股份有限公司 A kind of network equipment information acquisition method and device
CN109245988A (en) * 2018-06-05 2019-01-18 平安科技(深圳)有限公司 Monitor mail automatic sending method, system, computer equipment and storage medium
CN109240846A (en) * 2018-09-19 2019-01-18 郑州云海信息技术有限公司 A kind of power failure diagnosing method, apparatus and server

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4047783B2 (en) * 2003-09-01 2008-02-13 沖電気工業株式会社 Task control method and task switching device
CN1758605A (en) * 2004-10-10 2006-04-12 华为技术有限公司 Scheduling method of mobile data service
CN1645334A (en) * 2005-01-12 2005-07-27 宁波大学 Timer dispatching method for real-time multi-task operating system
CN1828541A (en) * 2006-04-07 2006-09-06 浙江大学 Implementation method for timing task in Java operating system
CN103645909A (en) * 2013-12-30 2014-03-19 中国烟草总公司湖南省公司 Handling method and device for timed task
CN108123820A (en) * 2016-11-29 2018-06-05 北京神州泰岳软件股份有限公司 A kind of network equipment information acquisition method and device
CN107908486A (en) * 2017-11-06 2018-04-13 山东浪潮通软信息科技有限公司 A kind of cycle performs the method and device of task
CN109245988A (en) * 2018-06-05 2019-01-18 平安科技(深圳)有限公司 Monitor mail automatic sending method, system, computer equipment and storage medium
CN109240846A (en) * 2018-09-19 2019-01-18 郑州云海信息技术有限公司 A kind of power failure diagnosing method, apparatus and server

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111078323A (en) * 2019-10-12 2020-04-28 平安科技(深圳)有限公司 Coroutine-based data processing method and device, computer equipment and storage medium
CN112988414A (en) * 2021-02-07 2021-06-18 杭州复杂美科技有限公司 Block chain transaction batch broadcasting method, computer equipment and storage medium
CN113190777A (en) * 2021-03-31 2021-07-30 北京达佳互联信息技术有限公司 Data updating method and device, electronic equipment, storage medium and product
CN114125045A (en) * 2021-10-29 2022-03-01 北京旷视科技有限公司 Data processing method and device and electronic system
CN114125045B (en) * 2021-10-29 2024-04-02 北京旷视科技有限公司 Data processing method, device and electronic system

Also Published As

Publication number Publication date
CN110109741B (en) 2021-08-27

Similar Documents

Publication Publication Date Title
CN110109741A (en) Management method, device, electronic equipment and the storage medium of cycle task
CN104520815B (en) A kind of method and device of task schedule
CN103294533B (en) task flow control method and system
CN103679392B (en) A kind of task scheduling processing method and system
US8392907B2 (en) Communication terminal
CN106843170B (en) Method for scheduling task based on token
US20100333094A1 (en) Job-processing nodes synchronizing job databases
CN103034536A (en) Usability for improving stateful applications
CN112214260A (en) Loading method and device of terminal application APP
US8538793B2 (en) System and method for managing real-time batch workflows
CN108563502A (en) A kind of method for scheduling task and device
CN109298951A (en) The execution method and terminal device of Celery task
US20150100968A1 (en) Operating Programs on a Computer Cluster
CN105388991A (en) Timing wake-up processing system and method
CN113626280B (en) Cluster state control method and device, electronic equipment and readable storage medium
CN112445598A (en) Task scheduling method and device based on quartz, electronic equipment and medium
JP2003529819A (en) Automation device and update method
CN110110306A (en) Method for exhibiting data, device, terminal and computer readable storage medium
CN110377331B (en) Monitoring method, device, equipment and storage medium for issuing application program
CN113204425B (en) Method, device, electronic equipment and storage medium for process management internal thread
CN105450737B (en) A kind of data processing method, device and system
CN103678537A (en) Cluster-based metadata modification method and device and node units
US8291419B2 (en) Fault tolerant system for execution of parallel jobs
JP5755025B2 (en) Program update instruction device
CN115185787A (en) Method and device for processing transaction log

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
GR01 Patent grant
GR01 Patent grant