CN106020951A - Task scheduling method and system - Google Patents
Task scheduling method and system Download PDFInfo
- Publication number
- CN106020951A CN106020951A CN201610313299.5A CN201610313299A CN106020951A CN 106020951 A CN106020951 A CN 106020951A CN 201610313299 A CN201610313299 A CN 201610313299A CN 106020951 A CN106020951 A CN 106020951A
- Authority
- CN
- China
- Prior art keywords
- task
- queue
- manager
- scheduling
- performer
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4843—Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
- G06F9/4881—Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
Embodiments of the invention provide a task scheduling method and system. The method comprises the steps of starting a task manager to initialize a task queue, wherein the task queue is realized based on a delay queue, and a task in the task queue can be called from the task queue only when corresponding delay time is up; starting a task scanner by the task manager; cyclically calling an interface used for obtaining the task when the delay time is up from the task queue and provided by the task manager, obtaining the task when the delay time is up from the task queue, and handing over the obtained task to a task executor until a state of the task manager is changed to a stop state; and executing the task by the task executor through a working thread, generating a new task according to a time interval of repeatedly executing the task, and adding the new task into the task queue by an interface used for adding the task into the task queue and provided by the task manager. According to the embodiments of the task scheduling method and system, the purposes of realizing task scheduling by simple configuration and reducing resource occupation can be achieved.
Description
Technical field
The present invention relates to technical field of data processing, more particularly, it relates to a kind of method for scheduling task and
System.
Background technology
Major applications system has the demand repeating some task at present, is therefore accomplished by using appointing
The mode of business scheduling is spaced these tasks of having adjusted, and these tasks of the execution repeated, to reach this demand.
Current task scheduling mode be mainly based upon Quartz Open Framework realize (Quartz be one completely
The job scheduling framework of increasing income write by java), but use Quartz Open Framework to realize task scheduling and need
Introducing third-party storehouse, this makes the configuration of task scheduling complex, and it is more to take resource;Cause
This realizes task scheduling as how simply configured, and reduces resource occupation, becomes people in the art
The problem that member needs to consider.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of method for scheduling task and system, reaches with simply
Configuration realizes task scheduling, and reduces the purpose of resource occupation.
For achieving the above object, the following technical scheme of embodiment of the present invention offer:
A kind of method for scheduling task, including:
Start task manager, with initialization task queue;Described task queue realizes based on time delay queue,
Described task queue set has the task of one group of delayed-type, and the task in described task queue is only in correspondence
The extension time could be transferred when arriving from described task queue;
Task manager starts task scan device;
Obtaining from task queue that task scan device recursive call task manager provides arrives the extension time
The interface of task, from task queue, obtain the task of arriving the extension time, and appoint described in obtaining
Task performer is given in business, until the Status Change of task manager is for stopping;
Task performer performs described task by worker thread, and between performing according to described task duplication
Interval, generate new task, with interpolation task the connecing to task queue provided by task manager
Mouthful, add this new task in task queue, repeat fortune with the interval of task realizing repeating
OK.
Optionally, described method also includes:
Task performer controls the quantity of worker thread, the number of tasks simultaneously run with control.
Optionally, task performer performs the run method that the entrance of task is tasks carrying class, performs run
Method calls execute method and afterExcuter method with order;
Wherein, execute method realizes the execution of task definition, task realize class and realize;afterExcuter
Method realizes adding new task in task queue, upper class realize.
Optionally, described method also includes:
When task scan device scans task discovery device, scheduler task finds device;
Find that task is found the data that device obtains when building and safeguards from configuration data by device by task
The last maintenance time of data in last maintenance time, with up-to-date configuration data is compared;
If comparison is inconsistent, obtain the task that newly changes of the inconsistent correspondence of comparison;
New change task the interpolation task that provided by the task manager interface to task queue is provided,
Add to newly changing task in task queue.
Optionally, described method also includes:
By task manager management role queue, start task scan device, stopping task scan device.
The embodiment of the present invention also provides for a kind of task scheduling system, including: task manager, task queue,
Task scan device, and task performer;
Wherein, described task manager, for provide interpolation task to the interface of task queue, from task
Queue obtains the interface of the task of arriving the extension time;And described task queue opening with task manager
Move and initialize;
Described task queue realizes based on time delay queue, and for collecting the task of unification group delayed-type, institute
State the task in task queue only to transfer from described task queue when correspondence delays time arrival;
Described task scan device, gets from task queue for what recursive call task manager provided
Reach the interface of the task of extension time, from task queue, obtain the task of arriving the extension time, and will obtain
The described task taken gives task performer, until the Status Change of task manager is for stopping;
Described task performer, for performing described task by worker thread, and according to described task weight
The multiple interval time performed, generate new task, take office with the interpolation task provided by task manager
The interface of business queue, adds this new task in task queue, with the task of realizing repeating
Rerun in interval.
Optionally, described task performer can be additionally used in, and controls the quantity of worker thread, to control simultaneously
The number of tasks run.
Optionally, task performer performs the run method that the entrance of task is tasks carrying class, performs run
Method calls execute method and afterExcuter method with order;
Wherein, execute method realizes the execution of task definition, task realize class and realize;afterExcuter
Method realizes adding new task in task queue, upper class realize.
Optionally, described system also includes: task finds device, is used for when being scanned by task scan device,
Following content is performed: task is found, and device obtains also from configuration data when building by the scheduling of task scan device
The last maintenance time of data safeguarded, compares with the last maintenance time of data in up-to-date configuration data
Right, if comparison is inconsistent, obtain the task that newly changes of the inconsistent correspondence of comparison, build and newly change task
And the interpolation task provided by task manager is to the interface of task queue, adds to newly changing task
In task queue.
Optionally, described task manager can be additionally used in, management role queue, start task scan device,
Stop task scan device.
Based on technique scheme, the method for scheduling task that the embodiment of the present invention provides includes: start task
Manager, with initialization task queue;Described task queue realizes based on time delay queue, described task team
Row set has the task of one group of delayed-type, and the task in described task queue only arrives in the correspondence extension time
Could transfer from described task queue when reaching;Task manager starts task scan device;Task scan device
The interface obtaining the task of arriving the extension time from task queue that recursive call task manager provides,
From task queue, obtain the task of arriving the extension time, and give tasks carrying by the described task obtained
Device, until the Status Change of task manager is for stopping;Task performer performs described by worker thread
Task, and the interval time performed according to described task duplication, generate new task, to pass through task
The interpolation task that manager provides, to the interface of task queue, adds this new task in task queue,
Rerun with the interval of task realizing repeating.It can be seen that the embodiment of the present invention is realizing
During task scheduling, it is not necessary to operationally use special third-party storehouse, i.e. need not to use special
Data structure storage configuration information, but can the self-described of task based access control information, utilize based on time delay queue
The task queue realized and task scan device and task performer realize the repetitive schedule of task and perform so that
The configuration of task scheduling more angle, and less resource can be used to realize task duplication tune in application system
The demand that degree performs, and the resource saved can improve the load capacity of application system, the embodiment of the present invention
Can reach and realize task scheduling with simple configuration, and reduce the purpose of resource occupation.
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to reality
Execute the required accompanying drawing used in example or description of the prior art to be briefly described, it should be apparent that below,
Accompanying drawing in description is only embodiments of the invention, for those of ordinary skill in the art, not
On the premise of paying creative work, it is also possible to obtain other accompanying drawing according to the accompanying drawing provided.
The structured flowchart of the task scheduling system that Fig. 1 provides for the embodiment of the present invention;
The flow chart of the method for scheduling task that Fig. 2 provides for the embodiment of the present invention;
Another flow chart of the method for scheduling task that Fig. 3 provides for the embodiment of the present invention;
Fig. 4 is the Booting sequence figure of task manager;
Fig. 5 is the workflow diagram of task scan device;
Fig. 6 is the workflow diagram of task performer;
Another structured flowchart of the task scheduling system that Fig. 7 provides for the embodiment of the present invention;
Fig. 8 is the workflow diagram that task finds device;
The component diagram of the task scheduling system that Fig. 9 provides for the embodiment of the present invention.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out
Clearly and completely describe, it is clear that described embodiment is only a part of embodiment of the present invention, and
It is not all, of embodiment.Based on the embodiment in the present invention, those of ordinary skill in the art are not doing
Go out the every other embodiment obtained under creative work premise, broadly fall into the scope of protection of the invention.
The structured flowchart of the task scheduling system that Fig. 1 provides for the embodiment of the present invention, with reference to Fig. 1, the present invention
The task scheduling system that embodiment provides may include that task manager 10, and task queue 20, task is swept
Retouch device 30, and task performer 40;
In embodiments of the present invention, task manager is mainly used in management role queue, starts task scan
The functions such as device and stopping task scan device;
Task manager to there being a task queue, and can provide interpolation task to task queue, from task
Queue obtains the interface of extension task dispatching operation;Meanwhile, when task manager starts, can initialization task
Queue.
In embodiments of the present invention, task queue is the set of one group of pending task, and task it is believed that
Being executable service logic unit, task can comprise following information:
Mission number, the number-mark of task;
Task type, is divided into once execution task or repeats task;
Repetition period (unit second), repeat the task execution interval of task;
Task definition, description task realizes class;
The final updating time, the up-to-date maintenance time of task configuration information;
Optionally, the embodiment of the present invention may utilize Java (a kind of can write cross-platform program towards
The programming language of object) Sdk (Software Development Kit, SDK) carries
The time delay queue (DelayedQueue) of confession realizes task queue;DelayedQueue be one for time delay
The queue of processing element, when so-called delay process is that is can be element one extension of setting in queue
Between, the operation of element was controlled by this time of delaying;
Therefore, the task queue of the embodiment of the present invention can be added the task of Delayed (time delay) type,
When only the extension time of the task in task queue arrives, this task could be extracted from task queue
Perform;
Common, DelayedQueue is usually used in processing time-out, and the embodiment of the present invention utilizes
DelayedQueue realizes task queue, do not arrive based on DelayedQueue the extension time can not obtain wherein unit
The characteristic of element, the embodiment of the present invention can constantly obtain the element having arrived the extension time in DelayedQueue
(task) realizes task scheduling.
Task scan device mainly obtains connecing of extension task by what task manager provided from task queue
Mouthful, from task queue, obtain the task of arriving the extension time, and calling task executor performs acquired
Arrive the extension time task;
Optionally, obtaining from task queue that task scan device calling task capable of circulation manager provides is delayed
The interface of task, obtains the task of arriving the extension time, and transfers to task performer to hold the task of acquisition
OK, circulate execution with this, until task manager Status Change is for stopping.
Task performer mainly realizes the execution of the task acquired in task scan device, and can add next need
Performing of task is to task queue;
Optionally, task performer can perform the task acquired in task scan device by worker thread,
After tasks carrying, the interval time that can perform according to task duplication, generate new task, to pass through task
What manager provided provides interpolation task to the interface of task queue, adds this new task to task queue
In, it is achieved rerun in the interval of need to repeating of task;Can ensure that same task interval is run simultaneously,
Do not have the many single recurrence intervals of same task in other task scheduling engines in short-term, multiple phase of same time
Situation about simultaneously performing with task.
Above-mentioned task manager, task queue, task scan device, and task performer may be considered should
With the logic functional block assembly in system.
Based on task scheduling system shown in Fig. 1, Fig. 2 shows the task scheduling side that the embodiment of the present invention provides
The flow chart of method, with reference to Fig. 2, this method for scheduling task may include that
Step S100, startup task manager, with initialization task queue;Described task queue is based on prolonging
Time queue realize, described task queue set has the task of one group of delayed-type, in described task queue
Task only could be transferred when correspondence delays time arrival from described task queue;
Optionally, task may be considered executable service logic unit, and it comprises mission number, appoints
The information such as service type, repetition period, task definition, final updating time;It can be seen that task based access control
In the final updating temporal information that comprises, can be by the self-described of the information realization task configuration information of task;
Task manager can management role queue, and task manager can a corresponding task queue;
Task manager can provide interpolation task to the interface of task queue, obtains to arrive and delay from task queue
The interface etc. of the task of time;Meanwhile, when task manager starts, task queue initializes simultaneously;Can
Choosing, the embodiment of the present invention can be passed through task manager management role queue, startup task scan device, stop
Only task scan device.
Step S110, task manager start task scan device;
What step S120, task scan device recursive call task manager provided gets from task queue
Reach the interface of the task of extension time, from task queue, obtain the task of arriving the extension time, and will obtain
The described task taken gives task performer, until the Status Change of task manager is for stopping;
After task scan device starts, obtaining from task queue of calling task manager capable of circulation offer arrives
The interface of the task of extension time, after getting the task of arriving the extension time, can transfer to tasks carrying
Device performs, and then proceedes to this circulation and goes the acquisition arrival from task queue that calling task manager provides to prolong
The interface of the task of time phase, ceaselessly gets the task of arriving the extension time, until task manager
Status Change for stop;
Optionally, obtaining from task queue that task scan device each calling task manager provides arrives
During the interface of the task of extension time, can all judge the state of lower task manager, if task manager
Status Change for stopping, then task scan device can jump out circulation, terminates scanning, i.e. terminates calling task
The interface obtaining the task of arriving the extension time from task queue that manager provides.
Step S130, task performer perform described task by worker thread, and according to described task weight
The multiple interval time performed, generate new task, take office with the interpolation task provided by task manager
The interface of business queue, adds this new task in task queue, with the task of realizing repeating
Rerun in interval.
Optionally, task performer performs the run method that the entrance of task can be tasks carrying class, performs
Run method can sequentially call execute method and afterExcuter method;Wherein, execute method realizes appointing
The execution of business content, is realized class by task and realizes;AfterExcuter method realizes adding new task and takes office
In business queue, upper class realize;I.e. on the basis of upper class realizes, the embodiment of the present invention is the most only
Need task to realize class and realize execute method;
Optionally, after execution, task can be according to the self-described of configuration information, by task pipe for task
The task that reason device provides, to the interface of task queue, is added in task queue, to realize current task
Repeat.
Optionally, the embodiment of the present invention has only to realize execute method when development task realizes class, and
The details such as how task repeats need not be considered.
The method for scheduling task that the embodiment of the present invention provides includes: start task manager, appoints to initialize
Business queue;Described task queue realizes based on time delay queue, and described task queue set has one group of time delay class
The task of type, the task in described task queue only could be from described task when correspondence delays time arrival
Queue is transferred;Task manager starts task scan device;Task scan device recursive call task manager
The interface obtaining the task of arriving the extension time from task queue provided, gets from task queue
Reach the task of extension time, and give task performer by the described task obtained, until task manager
Status Change for stop;Task performer performs described task by worker thread, and according to described
Business interval time of repeating, generate new task, appoint with the interpolation provided by task manager
Business, to the interface of task queue, adds this new task in task queue, with realize repeating
Rerun in the interval of task.It can be seen that the embodiment of the present invention is when realizing task scheduling, it is not necessary to
Operationally use special third-party storehouse, i.e. need not use special data structure storage configuration letter
Breath, but can the self-described of task based access control information, utilize the task queue realized based on time delay queue and appoint
Business scanning device and task performer realize the repetitive schedule of task and perform so that the configuration of task scheduling is more
Angle, and less resource can be used to realize the demand that in application system, task duplication scheduling performs, and save
Resource about can improve the load capacity of application system, and the embodiment of the present invention can reach with simple configuration
Realize task scheduling, and reduce the purpose of resource occupation.
Optionally, in embodiments of the present invention, task performer also can control the quantity of worker thread, with
Control the number of tasks simultaneously run, it is to avoid the situation that resource is overflowed occurs when considerable task runs simultaneously.
Optionally, the embodiment of the present invention finds device also by arranging task, dynamically to add scheduler task;
Task finds that the essence of device is a special task, and task finds that device can be carried out by task scan device
Scheduling, task scan device scans the tasks carrying content after task finds device and is: obtain newly-increased task,
And the interface of the interpolation task of calling task manager offer increases new task in task queue;
Task finds that device obtains the operation principle of newly-increased task and is: task finds that device is safeguarded when task builds
One at that time from configuration data (data base or configuration file) acquisition " the last maintenance time of data ",
When tasks carrying, by the data in this " the last maintenance time of data " and up-to-date configuration data
Last maintenance time is compared, and identifies new task;
Optionally, Fig. 3 shows another flow chart of the method for scheduling task that the embodiment of the present invention provides, ginseng
According to Fig. 3, this method for scheduling task may include that
When step S200, task scan device scan task discovery device, scheduler task finds device;
Step S210, found that by task task is found that device obtains also from configuration data when building by device
The last maintenance time of data safeguarded, compares with the last maintenance time of data in up-to-date configuration data
Right;
If the comparison of step S220 is inconsistent, obtain the task that newly changes of the inconsistent correspondence of comparison;
Final updating temporal information in task, can be last with the data configuring being maintained in data of task
Maintenance time synchronised, so that record has the final updating time of each task to believe in up-to-date configuration data
Breath, thus when task finds that device is finally safeguarded from the data configuring each task obtaining data and safeguarding
Between, and when in up-to-date configuration data, the last maintenance time of data of each task of record is inconsistent, can be by
The task of inconsistent correspondence is as newly changing task.
Step S230, build new change task the interpolation task that provided by task manager to task team
The interface of row, adds to newly changing task in task queue.
Optionally, the method for scheduling task that the embodiment of the present invention provides can have the advantage that
Light structure, for needing the task of repeating to have adjusted to carry out configuration information self-described, and with based on prolonging
Time the task queue that realizes of queue and task scan device and task performer realize the repetitive schedule of task and hold
OK, resource is taken few;
New task can be generated according to recurrence interval and be re-added to task queue after tasks carrying, it is ensured that
Same task interval is run, and does not haves the situation that multiple same task of same time performs;
Controlled the number of tasks simultaneously run by the quantity arranging worker thread, resource can be avoided to overflow wind
Danger;
Use task finds device, can dynamically increase scheduler task.
The task scheduling system provided the embodiment of the present invention below is introduced, and task described below is adjusted
Degree system can reference corresponding with above-described method for scheduling task.
The structure of the task scheduling system that the embodiment of the present invention provides can be as it is shown in figure 1, include: task management
Device 10, task queue 20, task scan device 30, and task performer 40;
Wherein, described task manager, for provide interpolation task to the interface of task queue, from task
Queue obtains the interface of the task of arriving the extension time;And described task queue opening with task manager
Move and initialize;
Described task queue realizes based on time delay queue, and for collecting the task of unification group delayed-type, institute
State the task in task queue only to transfer from described task queue when correspondence delays time arrival;
Described task scan device, gets from task queue for what recursive call task manager provided
Reach the interface of the task of extension time, from task queue, obtain the task of arriving the extension time, and will obtain
The described task taken gives task performer, until the Status Change of task manager is for stopping;
Described task performer, for performing described task by worker thread, and according to described task weight
The multiple interval time performed, generate new task, take office with the interpolation task provided by task manager
The interface of business queue, adds this new task in task queue, with the task of realizing repeating
Rerun in interval.
Optionally, in embodiments of the present invention, described task performer can be additionally used in, and controls worker thread
Quantity, with the number of tasks run of control simultaneously.
Optionally, in embodiments of the present invention, the Booting sequence of task manager can wrap as shown in Figure 4
Include:
Step S10, initialization task queue;
Step S11, the state of task manager is set for running;
Step S12, startup task scan device.
Optionally, task manager can be additionally used in management role queue, starts task scan device, stopping times
Business scanning device.
Optionally, in embodiments of the present invention, the workflow of task scan device can be wrapped as described in Figure 5
Include:
Step S20, judge whether to stop scanning, if so, enter step S21, if it is not, enter step
S22;
Step S21, end flow process;
Optionally, can stop scanning the state of task manager such as is situation about stopping.
Step S22, judge to arrive extension time by obtaining from task queue of providing of task manager
The interface of task, if the task of arriving the extension time can be got, if so, perform step S23, if it is not,
Return step S20;
Step S23, acquisition arrive the task of extension time;
Step S24, transfer to task performer to perform acquired task, return step S20.
Optionally, in embodiments of the present invention, the workflow of task performer can be wrapped as shown in Figure 6
Include:
The task that step S30, execution task scan device are given;
Step S31, the current task that judges whether to repeat, if so, perform step S32, if it is not,
Perform step S33;
Need to repeating of task can be determined by the task type information in task.
Step S32, the interval time performed according to task duplication, generate new task and pass through task management
The interpolation task that device provides, to the interface of task queue, adds this new task in task queue;
Step S33, end flow process.
Optionally, task performer performs the run method that the entrance of task is tasks carrying class, performs run
Method calls execute method and afterExcuter method with order;Wherein, execute method realizes task
The execution of content, is realized class by task and realizes;AfterExcuter method realizes adding new task to task
In queue, upper class realize.
Optionally, Fig. 7 shows another structured flowchart of the task scheduling system that the embodiment of the present invention provides,
Shown in Fig. 1 and Fig. 7, this task scheduling system can also include: task finds device 50;
Task finds that device is mainly used in, and when being scanned by task scan device, is held by the scheduling of task scan device
The following content of row: task is found, and device obtains from configuration data when building and the data safeguarded finally are tieed up
Protect the time, compare, if comparison differs with the last maintenance time of data in up-to-date configuration data
Cause, obtain the task that newly changes of the inconsistent correspondence of comparison, build new change task and pass through task manager
The interpolation task provided, to the interface of task queue, is added to newly changing task in task queue.
Optionally, in embodiments of the present invention, task finds that the workflow of device can be wrapped as shown in Figure 8
Include:
Step S40, reading configuration data;
Step S41, determine whether newly to change task, if so, perform step S42, if it is not, perform step
Rapid S43;
Step S42, build new change task the interpolation task that provided by task manager to task queue
Interface, add to newly changing task in task queue;
Step S43, end flow process.
Optionally, Fig. 9 shows the component diagram of the task scheduling system that the embodiment of the present invention provides, can
Reference.
Through practical test, the task scheduling system that the embodiment of the present invention provides is applied at Cathay platform caching pipe
After on the automatic refresh function of reason, have received good effect;
First, the task scheduling system simple in construction that the embodiment of the present invention provides, repeats to adjust for needs
Task carry out configuration information self-described, it is not necessary to operationally use special data structure storage to configure
Information, thus may utilize the task queue and task scan device and task performer realized based on time delay queue
The repetitive schedule realizing task performs, and uses minimum resource to achieve application demand, and the resource of saving can
To improve the load capacity of system;
Secondly, the refresh tasks of Cathay Platform Requirements class caching can only run one simultaneously and ensure interval
Running, the present invention generates new task according to recurrence interval after task definition performs and is re-added to task
The design of queue well meets this demand;
Again, Cathay platform caching can take Installed System Memory in a large number, and application cache refreshing requirement is by certain
Class caching full dose is disposable after reading replaces old caching, and in refresh process, committed memory is bigger;If
Allow multiple refreshing to carry out simultaneously, may result in internal memory and overflow, it is necessary to the cache flush performed simultaneously
Number of tasks is controlled;And utilize the present invention, control concurrent tasks by arranging worker thread quantity
Characteristic, can be set to 1 by worker thread quantity, easily avoid multiple caching simultaneously refreshed cause internal memory overflow
The risk gone out;
Finally, Cathay Platform Requirements supports the most newly-increased caching, and newly-increased caching needs the most automatically to refresh,
And utilize the task of the present invention to find device, can be realized easily by the change of periodic scanning configuration information
This demand.
In this specification, each embodiment uses the mode gone forward one by one to describe, and each embodiment stresses
Being the difference with other embodiments, between each embodiment, identical similar portion sees mutually.
For system disclosed in embodiment, owing to it corresponds to the method disclosed in Example, so describing
Fairly simple, relevant part sees method part and illustrates.
Professional further appreciates that, respectively shows in conjunction with what the embodiments described herein described
The unit of example and algorithm steps, it is possible to realize with computer software, the most according to merit
Composition and the step of each example can be generally described.Professional and technical personnel can specifically should to each
It is used for using different methods to realize described function, but this realization is it is not considered that exceed the present invention
Scope.
The method described in conjunction with the embodiments described herein or the step of algorithm can perform with processor
Software module implement.Software module can be placed in random access memory (RAM), internal memory, read-only deposit
Reservoir (ROM), electrically programmable ROM, electrically erasable ROM, depositor, hard disk, can
In any other form of storage medium well known in mobile disk, CD-ROM or technical field.
Described above to the disclosed embodiments, makes professional and technical personnel in the field be capable of or uses
The present invention.Multiple amendment to these embodiments will be aobvious and easy for those skilled in the art
See, generic principles defined herein can without departing from the spirit or scope of the present invention,
Realize in other embodiments.Therefore, the present invention is not intended to be limited to the embodiments shown herein,
And it is to fit to the widest scope consistent with principles disclosed herein and features of novelty.
Claims (10)
1. a method for scheduling task, it is characterised in that including:
Start task manager, with initialization task queue;Described task queue realizes based on time delay queue,
Described task queue set has the task of one group of delayed-type, and the task in described task queue is only in correspondence
The extension time could be transferred when arriving from described task queue;
Task manager starts task scan device;
Obtaining from task queue that task scan device recursive call task manager provides arrives the extension time
The interface of task, from task queue, obtain the task of arriving the extension time, and appoint described in obtaining
Task performer is given in business, until the Status Change of task manager is for stopping;
Task performer performs described task by worker thread, and between performing according to described task duplication
Interval, generate new task, with interpolation task the connecing to task queue provided by task manager
Mouthful, add this new task in task queue, repeat fortune with the interval of task realizing repeating
OK.
Method for scheduling task the most according to claim 1, it is characterised in that also include:
Task performer controls the quantity of worker thread, the number of tasks simultaneously run with control.
Method for scheduling task the most according to claim 1, it is characterised in that task performer performs
The entrance of task is the run method of tasks carrying class, performs run method and calls execute method with order
With afterExcuter method;
Wherein, execute method realizes the execution of task definition, task realize class and realize;afterExcuter
Method realizes adding new task in task queue, upper class realize.
Method for scheduling task the most according to claim 1, it is characterised in that also include:
When task scan device scans task discovery device, scheduler task finds device;
Find that task is found the data that device obtains when building and safeguards from configuration data by device by task
The last maintenance time of data in last maintenance time, with up-to-date configuration data is compared;
If comparison is inconsistent, obtain the task that newly changes of the inconsistent correspondence of comparison;
New change task the interpolation task that provided by the task manager interface to task queue is provided,
Add to newly changing task in task queue.
Method for scheduling task the most according to claim 1, it is characterised in that also include:
By task manager management role queue, start task scan device, stopping task scan device.
6. a task scheduling system, it is characterised in that including: task manager, task queue, appoints
Business scanning device, and task performer;
Wherein, described task manager, for provide interpolation task to the interface of task queue, from task
Queue obtains the interface of the task of arriving the extension time;And described task queue opening with task manager
Move and initialize;
Described task queue realizes based on time delay queue, and for collecting the task of unification group delayed-type, institute
State the task in task queue only to transfer from described task queue when correspondence delays time arrival;
Described task scan device, gets from task queue for what recursive call task manager provided
Reach the interface of the task of extension time, from task queue, obtain the task of arriving the extension time, and will obtain
The described task taken gives task performer, until the Status Change of task manager is for stopping;
Described task performer, for performing described task by worker thread, and according to described task weight
The multiple interval time performed, generate new task, take office with the interpolation task provided by task manager
The interface of business queue, adds this new task in task queue, with the task of realizing repeating
Rerun in interval.
Task scheduling system the most according to claim 6, it is characterised in that described task performer
Can be additionally used in, control the quantity of worker thread, the number of tasks simultaneously run with control.
Task scheduling system the most according to claim 6, it is characterised in that task performer performs
The entrance of task is the run method of tasks carrying class, perform run method with order call execute method and
AfterExcuter method;
Wherein, execute method realizes the execution of task definition, task realize class and realize;afterExcuter
Method realizes adding new task in task queue, upper class realize.
Task scheduling system the most according to claim 6, it is characterised in that also include: task is sent out
Existing device, for when being scanned by task scan device, is performed following content by the scheduling of task scan device: will
Task finds the last maintenance time of data that device obtains when building and safeguards from configuration data, with up-to-date
Configuration data in the last maintenance time of data compare, if comparison is inconsistent, obtain comparison not
The consistent corresponding task that newly changes, builds new change task the interpolation task provided by task manager
To the interface of task queue, add to newly changing task in task queue.
Task scheduling system the most according to claim 6, it is characterised in that described task manager
Can be additionally used in, management role queue, startup task scan device, stopping task scan device.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610313299.5A CN106020951A (en) | 2016-05-12 | 2016-05-12 | Task scheduling method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610313299.5A CN106020951A (en) | 2016-05-12 | 2016-05-12 | Task scheduling method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106020951A true CN106020951A (en) | 2016-10-12 |
Family
ID=57099637
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610313299.5A Pending CN106020951A (en) | 2016-05-12 | 2016-05-12 | Task scheduling method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106020951A (en) |
Cited By (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106844608A (en) * | 2017-01-18 | 2017-06-13 | 算丰科技(北京)有限公司 | Detection and the method for switch data, device and electronic equipment |
CN107291566A (en) * | 2017-06-15 | 2017-10-24 | 北京京东尚科信息技术有限公司 | The method and apparatus that delay task is performed |
CN107391271A (en) * | 2017-05-17 | 2017-11-24 | 阿里巴巴集团控股有限公司 | A kind of delayed tasks triggering method and device based on Message Queuing system |
CN107704323A (en) * | 2017-11-07 | 2018-02-16 | 广州探迹科技有限公司 | A kind of web crawlers method for scheduling task and device |
CN107870782A (en) * | 2017-09-29 | 2018-04-03 | 北京空间飞行器总体设计部 | The method and system that a kind of high rail remote sensing satellite load task expansion performs |
CN108958906A (en) * | 2017-05-27 | 2018-12-07 | 北京嘀嘀无限科技发展有限公司 | task processing method, device and equipment |
CN109542609A (en) * | 2018-11-30 | 2019-03-29 | 深圳市盟天科技有限公司 | A kind of method, apparatus withholding refund, computer equipment and storage medium |
CN110162385A (en) * | 2018-02-14 | 2019-08-23 | 微软技术许可有限责任公司 | Can dynamic refresh memory object processing frame |
CN112148442A (en) * | 2020-08-06 | 2020-12-29 | 武汉达梦数据库有限公司 | ETL flow scheduling method and device |
CN113312391A (en) * | 2021-06-01 | 2021-08-27 | 上海万物新生环保科技集团有限公司 | Method and equipment for cache asynchronous delay refreshing |
EP3985506A1 (en) * | 2020-10-15 | 2022-04-20 | Juniper Networks, Inc. | Utilizing models for concurrently discovering network resources of a network |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4553202A (en) * | 1982-05-06 | 1985-11-12 | International Business Machines Corporation | User controlled dialog resource switching in a multi-tasking word processor |
US4908750A (en) * | 1985-03-01 | 1990-03-13 | Wang Laboratories, Inc. | Data processing system having tunable operating system means |
CN1828541A (en) * | 2006-04-07 | 2006-09-06 | 浙江大学 | Implementation method for timing task in Java operating system |
CN1862575A (en) * | 2005-08-19 | 2006-11-15 | 华为技术有限公司 | Method for planing dispatching timing task |
CN1873615A (en) * | 2006-01-20 | 2006-12-06 | 华为技术有限公司 | Method for servicing task of timer |
CN102129393A (en) * | 2011-03-09 | 2011-07-20 | 南京恩瑞特实业有限公司 | Universal timed task management realization method |
-
2016
- 2016-05-12 CN CN201610313299.5A patent/CN106020951A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4553202A (en) * | 1982-05-06 | 1985-11-12 | International Business Machines Corporation | User controlled dialog resource switching in a multi-tasking word processor |
US4908750A (en) * | 1985-03-01 | 1990-03-13 | Wang Laboratories, Inc. | Data processing system having tunable operating system means |
CN1862575A (en) * | 2005-08-19 | 2006-11-15 | 华为技术有限公司 | Method for planing dispatching timing task |
CN1873615A (en) * | 2006-01-20 | 2006-12-06 | 华为技术有限公司 | Method for servicing task of timer |
CN1828541A (en) * | 2006-04-07 | 2006-09-06 | 浙江大学 | Implementation method for timing task in Java operating system |
CN102129393A (en) * | 2011-03-09 | 2011-07-20 | 南京恩瑞特实业有限公司 | Universal timed task management realization method |
Non-Patent Citations (3)
Title |
---|
JANE W.S. LIU;姬孟洛: "《实时系统》", 31 December 2003 * |
杨云君: "《Android的设计与实现 卷1》", 31 May 2013 * |
郭金发,张龙: "《短信与BREW开发技术及实践》", 30 June 2005 * |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106844608A (en) * | 2017-01-18 | 2017-06-13 | 算丰科技(北京)有限公司 | Detection and the method for switch data, device and electronic equipment |
CN106844608B (en) * | 2017-01-18 | 2020-12-11 | 比特大陆科技有限公司 | Method and device for detecting and switching data and electronic equipment |
CN107391271A (en) * | 2017-05-17 | 2017-11-24 | 阿里巴巴集团控股有限公司 | A kind of delayed tasks triggering method and device based on Message Queuing system |
CN107391271B (en) * | 2017-05-17 | 2020-10-20 | 创新先进技术有限公司 | Message queue system-based delayed task triggering method and device |
CN108958906A (en) * | 2017-05-27 | 2018-12-07 | 北京嘀嘀无限科技发展有限公司 | task processing method, device and equipment |
CN107291566A (en) * | 2017-06-15 | 2017-10-24 | 北京京东尚科信息技术有限公司 | The method and apparatus that delay task is performed |
CN107291566B (en) * | 2017-06-15 | 2020-06-05 | 北京京东尚科信息技术有限公司 | Method and device for delaying task execution |
CN107870782B (en) * | 2017-09-29 | 2020-07-14 | 北京空间飞行器总体设计部 | Method and system for unfolding and executing high-orbit remote sensing satellite load task |
CN107870782A (en) * | 2017-09-29 | 2018-04-03 | 北京空间飞行器总体设计部 | The method and system that a kind of high rail remote sensing satellite load task expansion performs |
CN107704323A (en) * | 2017-11-07 | 2018-02-16 | 广州探迹科技有限公司 | A kind of web crawlers method for scheduling task and device |
CN110162385A (en) * | 2018-02-14 | 2019-08-23 | 微软技术许可有限责任公司 | Can dynamic refresh memory object processing frame |
CN109542609A (en) * | 2018-11-30 | 2019-03-29 | 深圳市盟天科技有限公司 | A kind of method, apparatus withholding refund, computer equipment and storage medium |
CN112148442A (en) * | 2020-08-06 | 2020-12-29 | 武汉达梦数据库有限公司 | ETL flow scheduling method and device |
EP3985506A1 (en) * | 2020-10-15 | 2022-04-20 | Juniper Networks, Inc. | Utilizing models for concurrently discovering network resources of a network |
CN113312391A (en) * | 2021-06-01 | 2021-08-27 | 上海万物新生环保科技集团有限公司 | Method and equipment for cache asynchronous delay refreshing |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106020951A (en) | Task scheduling method and system | |
CN108958920B (en) | Distributed task scheduling method and system | |
Liu et al. | Online multi-workflow scheduling under uncertain task execution time in IaaS clouds | |
Verma et al. | Large-scale cluster management at Google with Borg | |
Van den Bossche et al. | Cost-efficient scheduling heuristics for deadline constrained workloads on hybrid clouds | |
Das et al. | Skedulix: Hybrid cloud scheduling for cost-efficient execution of serverless applications | |
Wang et al. | FESTAL: Fault-tolerant elastic scheduling algorithm for real-time tasks in virtualized clouds | |
CN106293950B (en) | A kind of resource optimization management method towards group system | |
Ousterhout et al. | Sparrow: distributed, low latency scheduling | |
Sonmez et al. | Performance analysis of dynamic workflow scheduling in multicluster grids | |
Liu et al. | Dependency-aware and resource-efficient scheduling for heterogeneous jobs in clouds | |
US20100293551A1 (en) | Job scheduling apparatus and job scheduling method | |
Cucinotta et al. | Virtualised e-learning with real-time guarantees on the irmos platform | |
CN111104211A (en) | Task dependency based computation offload method, system, device and medium | |
CN111026519A (en) | Distributed task priority scheduling method and system and storage medium | |
Balla et al. | Reliability enhancement in cloud computing via optimized job scheduling implementing reinforcement learning algorithm and queuing theory | |
CN106407007B (en) | Cloud resource configuration optimization method for elastic analysis process | |
US20100161571A1 (en) | Ultimate locking mechanism | |
Lai et al. | Delay-aware container scheduling in kubernetes | |
Justino et al. | Outsourcing resource-intensive tasks from mobile apps to clouds: Android and aneka integration | |
Werner et al. | HARDLESS: A generalized serverless compute architecture for hardware processing accelerators | |
Peri et al. | Orchestrating the execution of serverless functions in hybrid clouds | |
Salman et al. | Scheduling elastic applications in compositional real-time systems | |
Meena et al. | Optimal resource reservation for offloaded tasks in mobile cloud computing | |
Bands et al. | Dual priority algorithm to schedule real-time tasks in a shared memory multiprocessor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20161012 |
|
RJ01 | Rejection of invention patent application after publication |