CN110333915A - Timing executes method, apparatus, computer equipment and the storage medium of task - Google Patents
Timing executes method, apparatus, computer equipment and the storage medium of task Download PDFInfo
- Publication number
- CN110333915A CN110333915A CN201910470635.0A CN201910470635A CN110333915A CN 110333915 A CN110333915 A CN 110333915A CN 201910470635 A CN201910470635 A CN 201910470635A CN 110333915 A CN110333915 A CN 110333915A
- Authority
- CN
- China
- Prior art keywords
- task
- subtask
- execution
- task execution
- pending
- 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
- 238000000034 method Methods 0.000 title claims abstract description 226
- 230000015654 memory Effects 0.000 claims description 51
- 238000004891 communication Methods 0.000 claims description 41
- 238000009825 accumulation Methods 0.000 claims description 32
- 230000002159 abnormal effect Effects 0.000 claims description 27
- 238000004590 computer program Methods 0.000 claims description 14
- 238000011897 real-time detection Methods 0.000 claims description 5
- 230000006378 damage Effects 0.000 claims description 3
- 238000012545 processing Methods 0.000 description 14
- 238000001514 detection method Methods 0.000 description 11
- 230000006870 function Effects 0.000 description 10
- 230000000694 effects Effects 0.000 description 9
- 238000012544 monitoring process Methods 0.000 description 6
- 101100297540 Oryza sativa subsp. japonica PHP5 gene Proteins 0.000 description 4
- 101100123444 Schizosaccharomyces pombe (strain 972 / ATCC 24843) hap5 gene Proteins 0.000 description 4
- 230000005540 biological transmission Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000013461 design Methods 0.000 description 3
- 230000005856 abnormality Effects 0.000 description 2
- 230000033228 biological regulation Effects 0.000 description 2
- 238000002347 injection Methods 0.000 description 2
- 239000007924 injection Substances 0.000 description 2
- 238000012423 maintenance Methods 0.000 description 2
- 230000014759 maintenance of location Effects 0.000 description 2
- 230000007812 deficiency Effects 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000001360 synchronised effect Effects 0.000 description 1
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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
- G06F9/4451—User profiles; Roaming
-
- 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/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4482—Procedural
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer And Data Communications (AREA)
Abstract
This application discloses method, apparatus, computer equipment and storage mediums that timing executes task, wherein, the method that timing executes task, it include: the pending task and the corresponding configuration file of pending task that management end receives that task distribution end is sent, pending task is including at least a subtask;Each subtask is assigned to task execution end according to preset rules;According to the configuration file of pending task, the corresponding mission bit stream in the first subtask is obtained, mission bit stream includes at least the first subtask corresponding default execution time;Receive the corresponding actual execution time in first subtask of task execution end feedback;Judge whether the actual execution time is identical as the default execution time;If so, controlling the task execution end terminates to execute first subtask.Timed task system has abandoned the Crontab of Unix system completely, using the written in code of PHP, can reduce many time-consuming process, improve task execution efficiency.
Description
Technical field
This application involves computer field is arrived, method, apparatus, computer equipment that timing executes task are especially related to
And storage medium.
Background technique
Crontab order is common among the operating system of Unix and class Unix, for the finger being periodically performed to be arranged
It enables.The order is read from standard input device and is instructed, and is deposited in " Crontab " file, for reading and holding later
Row.When program operates on Unix system, task is usually timed by Crontab, in Crontab timed task system
The command bar of system be directly timed task setting or special configuration task configuration end to Crontab timed task system into
The setting of row task, Crontab timed task system is executed according to set timed task, when the task of required execution is more
When, need to spend more time, influence execution efficiency, and if when current memory deficiency, Crontab timed task system can not
Judge and carry out respective handling, memory is be easy to cause to overflow situation, the timed task system automation degree based on Crontab
It is low, and timing executes the low efficiency of task.
Summary of the invention
The main purpose of the application is the method for providing timing and executing task, it is intended to solve the timing based on Crontab and appoint
The technical issues of system automation degree of being engaged in is low, and timing executes the low efficiency of task.
The application proposes a kind of method that timing executes task, comprising: management end receive that task distribution end sends wait hold
Row task and the corresponding configuration file of pending task, wherein management end and task distribution end pre-establish communication connection, to
Execution task includes at least a subtask;Each subtask is assigned to task execution end according to preset rules, wherein task is held
Row end and management end pre-establish communication connection;According to the configuration file of pending task, corresponding of the first subtask is obtained
Business information, wherein the first subtask is contained in all subtasks in pending task, mission bit stream includes at least the first son
The task corresponding default execution time;Receive the corresponding actual execution time in the first subtask of task execution end feedback;Judgement
Whether actual execution time is identical as the default execution time;If so, control task actuating station terminates to execute the first subtask.
Present invention also provides the devices that a kind of timing executes task, are integrated in management end, device includes: the first reception mould
Block distributes the pending task and the corresponding configuration file of pending task that end is sent for receiving task, wherein management end
Communication connection is pre-established with task distribution end, pending task includes at least a subtask;Distribution module is used for each son
Task is assigned to task execution end according to preset rules, and wherein task execution end and management end pre-establish communication connection;First
Module is obtained, for the configuration file according to pending task, obtains the corresponding mission bit stream in the first subtask, wherein the first son
Task is contained in all subtasks in pending task, and mission bit stream includes at least the corresponding default execution in the first subtask
Time;Second receiving module, for receiving the corresponding actual execution time in the first subtask of task execution end feedback;Judge mould
Block, for judging whether actual execution time is identical as the default execution time;Control module, if for actual execution time and in advance
If executing, the time is identical, then control task actuating station terminates to execute the first subtask.
Present invention also provides a kind of computer equipment, including memory and processor, memory is stored with computer journey
The step of sequence, processor realizes the above method when executing computer program.
Present invention also provides a kind of computer readable storage mediums, are stored thereon with computer program, computer program
The step of above-mentioned method is realized when being executed by processor.
The timed task system of the application has abandoned the Crontab of Unix system completely, using the written in code of PHP, packet
Task configuration end, management end and task execution end are included, and realizes that task configures end, management end and task execution by TCP or UDP
Communication connection between end, and by being run under cli mode, realize that the multi-process stage runs simultaneously in multiple tasks actuating station
Processing, and directly cached using the OpCode in memory, it greatly reduces request initialization, creation in disk I/O and PHP and holds
Many time-consuming process such as row environment, morphology parsing, syntax parsing, compiling OpCode, request closing, improve task execution efficiency.
And the timed task system of the application is no longer limited by the self-contained Fixed Time Interval of Crontab, two neighboring process rank
Between section, execution task time interval between two neighboring subtask can arbitrarily regulate and control, be more able to satisfy and need to monitor in real time
The demand of running environment further increases task execution efficiency by the way that smaller time interval is arranged.
Detailed description of the invention
The timing of one embodiment of Fig. 1 the application executes the method flow schematic diagram of task;
The timing of one embodiment of Fig. 2 the application executes the apparatus structure schematic diagram of task;
The computer equipment schematic diagram of internal structure of one embodiment of Fig. 3 the application.
Specific embodiment
Referring to Fig.1, the method that the timing of one embodiment of the application executes task, comprising:
S1: management end receives the pending task and the corresponding configuration file of pending task that task distribution end is sent,
Wherein management end and task distribution end pre-establish communication connection, and pending task includes at least a subtask.
The timed task system of the present embodiment, eliminates the reliance on Crontab, but one timed task system of independent design,
The timed task system includes timer and timer, and timer is used to customize the operation duration in multiple script process stages, meter
When device be used to carry out timing to the runing time in each script process stage;Management is arranged in the timed task system of the present embodiment
End, management role actuating station and task configure end, task execution end and management end and are communicated to connect by Socket, task execution
The mission bit stream that managed end is obtained from task configuration end is terminated, the progress of each timed task of management end management and monitoring is remembered in real time
Related data is recorded, the implementation progress, success rate, failure rate of each general assignment are counted.The timed task system of the present embodiment uses
The written in code of PHP, including task configuration end, management end and task execution end, and pass through TCP (Transmission
Control Protocol) or UDP (User Datagram Protocol) network service, TCP and UDP belong to transport layer
Agreement realizes the communication connection between task configuration end, management end and task execution end, since TCP is relatively reliable, it is preferred to use
TCP network service, and by being run under cli (Command Line Interface, command line interface) mode, realize mostly into
The journey stage runs processing in multiple tasks actuating station simultaneously, and realizes that PHP file will be resided after disk reading parsing once
Memory, for use next time when directly use the OpCode in memory to cache, OpCode caching be PHP performance enhancement extension,
They by by oneself injection PHP execution life cycle, and cache the compilation phase as a result, to reuse later, greatly
Reduce request initialization in disk I/O and PHP, creation performing environment, morphology parsing, syntax parsing, compiling OpCode, request
Many time-consuming process such as closing improve task execution efficiency.And the timed task system of the present embodiment has abandoned Unix completely
The Crontab of system does not depend on the containers such as nginx, apache, and reduce that the containers such as nginx, apache communicate with PHP is logical
Cost is interrogated, and resource can be with permanent retention, it is not necessary to each initialization data library connection etc..The timed task system of the present embodiment
Developed using the version of PHP5 or more, its performance of the version after PHP5 is continuously improved, be conducive to system operation it is more smooth,
Preferably, larger change has been done using PHP7, PHP7, compared to before with bigger performance advantage.
S2: each subtask is assigned to task execution end according to preset rules, wherein task execution end and management end are preparatory
Establish communication connection.
Management end is monitored task execution end operating condition, and is carried out according to the rule of setting to task execution end
Corresponding management, management end obtain the current memory situation at task execution end, according to the pending of the task configuration end received
The execution to subtask is responsible at the configuration file of task, each subtask of reasonable distribution to task actuating station, task execution end, is responsible for
It executes the calculating monitoring of time and controls the execution of next subtask.
S3: according to the configuration file of pending task, obtaining the corresponding mission bit stream in the first subtask, wherein the first son is appointed
Business is contained in pending task in all subtasks for including, and mission bit stream includes at least corresponding preset in the first subtask and holds
The row time.
The configuration file of pending task is issued by task configuration end, which is general assignment, including extremely
A few subtask, the mission bit stream of each subtask includes respective subtask title, subtask content, subtask duration
The information such as the execution interval between adjacent subtask.
S4: the corresponding actual execution time in the first subtask of task execution end feedback is received.
The corresponding actual execution time in subtask is subtask Starting Executing Time to tiring out between the end time of subtask
Plot operation duration.By counting the operation duration of each process phases, the corresponding actual execution time in subtask is obtained.The present embodiment
Timed task system, the Crontab of Unix system has been abandoned completely, when being no longer limited by the self-contained fixation of Crontab
Between be spaced, the execution task time interval between the two neighboring process phases of the present embodiment, between two neighboring subtask can
Arbitrarily regulation is more able to satisfy the demand for needing the running environment monitored in real time, such as financial stock market, smaller by being arranged
Time interval further increases task execution efficiency.Task execution end, which calculates and controls subtask, executes the time, guarantees subtask
Go on smoothly, when its subtask duration reach setting value when, task execution end, which controls the subtask, to terminate to execute.
S5: judge whether actual execution time is identical as the default execution time.
It is corresponding to set the corresponding preset duration of each process phases, each process rank when subtask includes multiple process phases
The adduction of the corresponding preset duration of section is the default execution time.Such as subtask a, the execution time for setting subtask a is from n-th second
Start to terminate to m seconds, perhaps setting terminates or be arranged since n-th millisecond to m milliseconds to m since n-th millisecond
Second terminates, or setting terminated since n-th minute to m minutes.
S6: if so, control task actuating station terminates to execute the first subtask.
Further, task execution end includes at least two, and each subtask is assigned to task execution according to preset rules
The step S2 at end, comprising:
Judge whether the current residual amount of ram of first task actuating station meets the needs of the first subtask, wherein first
Task execution end is contained in all task execution ends.
If satisfied, then the first subtask is distributed to first task actuating station.
The present embodiment manages the distribution of subtask by management end, to guarantee that the subtask at task execution end smoothly executes,
And reach making full use of for resource, it avoids task execution end from memory occur and overflows situation.Same general assignment is not in the present embodiment
Can be respectively by different task execution ends with subtask, while each subtask is run, shorten the execution time of general assignment, improves
Task execution efficiency, the thread configuration parameter in each task execution end of the present embodiment is identical, and each task execution end is to execution
The effect of subtask is identical.Above-mentioned " first " is not used in restriction, elsewhere acts on identical similar to term for distinguishing.
Further, task execution end includes at least two, and configuration file includes the thread configuration parameter of pending task,
Each subtask is assigned to the step S2 at task execution end according to preset rules, comprising:
Firstly, determining pending task corresponding second task execution end according to thread configuration parameter.
Then, by the corresponding each subtask of pending task, while the second task execution end is sent to.
In the present embodiment, the corresponding all subtasks of same general assignment carry out at same task execution end, facilitate to be formed simultaneously
Management role log.The thread configuration parameter of the multiple tasks actuating station of the present embodiment is distinguished according to task type, different
The corresponding thread configuration parameter of task type is different, and the general assignment of the correspondence different task type of different service types can basis
The corresponding task execution end of different thread configuration parameter selections.In the application other embodiments, when multiple subtasks need to hold
Row and current task actuating station is unable to satisfy when needing, for example current task actuating station has reached or close to memory limiting value, can
Other task execution ends with identical thread configuration parameter are distributed into remaining subtask, management end plans as a whole each task execution end
Executive condition, realize the execution of general assignment.
Further, the first subtask includes at least two process phases, includes two adjacent processes ranks in configuration file
Prefixed time interval between section, the step of receiving the corresponding actual execution time in the first subtask of task execution end feedback
S4, comprising:
Step 1: the information in the first subtask corresponding current process stage of first task actuating station feedback is received,
The information in middle current process stage includes at least, current process stage corresponding first accumulation operation duration, with current process rank
Next process phases of Duan Xianglin, current process stage and current process stage adjacent next process phases are the first son
The process phases for the arbitrary neighborhood in all process phases that task includes.
Step 2: judging whether the first accumulation operation duration in current process stage reaches preset duration.
Step 3: controlling first task if the first accumulation operation duration in current process stage reaches preset duration and holding
Row end terminates to execute the current process stage, and enters process interval stage.
Step 4: judging whether the corresponding time interval of process interval stage reaches prefixed time interval.
Step 5: controlling first task if the corresponding time interval of process interval stage reaches prefixed time interval and holding
Row end executes the next process phases adjacent with the current process stage.
Step 6: obtaining the second accumulation operation duration of current process stage adjacent next process phases.
Step 7: summarizing the first son according to the acquisition modes of the first accumulation operation duration and the second accumulation operation duration and appointing
The accumulation operation duration for all process phases that business includes, obtains actual execution time.
In the present embodiment, the corresponding preset duration of each process phases be may be the same or different, and is not construed as limiting.Two neighboring process
There are time intervals between stage, to complete the linking between each process phases, including data-linkage etc., such as current process
When stage needs to call the data of a upper process phases, need to carry out data-linkage.The task execution end of the present embodiment includes fixed
Minimum task time interval is arranged in Shi Gongneng, clocking capability and Trigger Function, timing function, and each subtask includes at least one
Process phases, clocking capability carry out timing calculating according to the operation duration of each process phases;Trigger Function is directed to any one
It is corresponding to exit the clocking capability when the timing duration of clocking capability reaches the operation duration of the process phases for process phases
Process phases trigger the operation of process phases new in task execution end.The timing function of the present embodiment is task execution time
Basis instrument, be arranged task time interval minimum value, then corresponding task execution time can be in the base of above-mentioned basis instrument
Multiple setting is carried out on plinth, the settable minimum task time interval of timing function can be Millisecond or second grade or minute
Grade, is arranged according to actual needs, and the minimum execution time compared to Crontab is 1 minute, timing of the present embodiment based on PHP
Task system setting is more flexible, and the scope of application is more extensive.If the setting of task execution time interval is small as far as possible, obtain task execution end
It quickly to handle subtask, is pooled in management end after the completion of each subtask, quickly to send implementing result, improves transmitting efficiency
And corresponding working efficiency, minimum task time interval are Millisecond, 3 milliseconds are preferably provided to, at this point, if being allocated in same
When a task execution end is handled, be equivalent to it is per second there are about 333 subtasks to complete, there are 2000 subtasks to complete within one minute,
Relative to existing dependence Crontab completion timing task, since the minimum execution time of Crontab is 1 minute, the present embodiment
Timed task system executes the more efficient of task.
Further, task configuration end configures web interface, and control task actuating station terminates the step of executing the first subtask
After S6, comprising:
Obtain the corresponding execution data in all subtasks for including in pending task, wherein execute data at least
Implementation progress and implementing result including all subtasks for including in pending task.
According to implementing result, real-time update calculates the success rate and failure for all subtasks for including in pending task
Rate.
All sons that will include in the implementation progress and pending task of all subtasks for including in pending task
The success rate and failure rate of task, Real-time Feedback to web interface are simultaneously shown.
In the present embodiment, timed task system carries out web interface configuration, and the network I/O that timed task system itself carries connects
Mouthful be it is asynchronous, developer can realize the Asynchronous Programming of task based access control event, realize Distributed Application, multiple and different sons is arranged
Task facilitates user configuration task.When compared to creation Crontab task, it is necessary to must have the system that can configure Crontab
Account, needs the system account of the additional each machine of maintenance, and configures Crontab one by one inside the system of each machine,
Process is cumbersome, configuration trouble.Compared to Crontab timed task system, the timed task system of the present embodiment can be looked into intuitively
The implementation progress, success rate, failure rate for seeing each general assignment, the task execution number obtained by management end from task execution end
According to, and feed back into the Mission Monitor of web interface, facilitate user monitoring and checks.
Further, the corresponding step S7 for executing data in all subtasks for including in pending task is obtained,
Include:
Whether real-time detection receives the abnormal of third task execution end feedback and executes data.
If so, the abnormal implementing result for executing the corresponding subtask of data of label is to execute failure.
Then, control third task execution end, which is interrupted, executes current subtask, and controls third task execution end and destroy and work as
The corresponding process in preceding subtask.
Then, the communication connection for obtaining from third task execution end and executing data is disconnected.
The present embodiment task execution end regularly sends heartbeat detection data to management end, and management end judges according to imposing a condition
Task execution end whether normal operation, for example whether abnormal, if operation data is abnormal, show to transport if analyzing the operation data that receives
Row is abnormal.When the task execution at task execution end occurs abnormal, management end quickly carries out corresponding abnormal feedback notification simultaneously
The current subtask of control task actuating station pull-up, and the connection with task execution end is disconnected, prevent management end from continuing to run and appointing
The relevant operation of actuating station of being engaged in, consumption management end memory, influences the speed of service.When the connection of task execution end and management end is normal
When, task execution end re-initiates connection, and management end receives the information at task execution end again.When process rank in the present embodiment
After Duan Jinhang or after being abnormal execution, if process phases continue to remain in task execution end, task execution can be occupied
The memory at end, influences the speed of performing task and efficiency at task execution end, and memory is be easy to cause to overflow situation, can pass through destruction
The abnormal process phases of the process phases or appearance finished, timely releasing memory space.Above-mentioned heartbeat detection is task
It is communicated between actuating station and management end, timing carries out a heartbeat detection, the communication of Detection task actuating station and management end
It whether normal connects.The abnormal judgement of the present embodiment, including user are led to by checking that task daily record and heartbeat detection log obtain
It crosses log to be analyzed and processed, while having to the overall operation of system and getting information about, when being conducive to system appearance exception.
The management end of the present embodiment, task execution end can also be run in same terminal operating in different terminals, and worked as and appointed
When business frequent operation, same terminal then will affect progress, low memory be caused, it is preferred, therefore, that management end, task execution end
It works in the different terminal of each leisure, each inter-terminal communication connection, then management end, task execution end have enough memories to guarantee
Timed task is gone on smoothly.In the present embodiment when being divided into Millisecond between task time, task execution end handles frequent activity,
Be easy to cause memory overflow situation, then task execution end can be separately operable by more terminals, operation distribution by management end according to
Corresponding situation is specified, is to be run by present terminal, otherwise by other if whether memory is enough for the task execution end of present terminal
Terminal operating.Same task execution end can multi-process synchronization process task treatment effeciency improved with speed up processing.
Further, there are dual-thread connection, dual-thread includes holding to third task for management end and third task execution end
Row end sends exectorial first thread, and the second thread for executing data is obtained from third task execution end, disconnect from
Third task execution end obtained after the step of communication connection for executing data, comprising:
Judge whether current time reaches default timing section.
Instruction is reconnected if so, sending by first thread to third task execution end.
Then, receive third task execution end according to the connection signal for reconnecting instruction feedback, and connect the second thread.
Finally, receiving the execution data of third task execution end feedback by the second thread.
The management end of the present embodiment is overall control center, but does not need frequent processing activity, with prevent management end due to
Processing frequent activity causes operation to make mistakes.The timing of task execution end reports task execution data to management end, and management end is according to setting
Fixed condition judge task execution end whether normal operation;Task execution data include the implementation progress, success rate, failure of task
Rate, task execution end report the timing of task execution data that can arbitrarily set, such as 1 minute, to note abnormalities in time.
The present embodiment communicates the information mutual communication for realizing timed task system by Socket, is bi-directionally connected by dual-thread realization, favorably
In task execution end while receiving assignment instructions, can also to management end timing feedback execute data, improve communication efficiency and
The treatment effeciency of timed task system.The each city in 100 cities is such as detected when handling some burdensome tasks in citing ground
Weather information or mail is sent to 1w human hair, entire implementation procedure can be very slow, may block the several seconds, because of general assignment process quilt
Obstruction, will affect subsequent request;Because general assignment process and subtask process are interconnected by Socket communication, can
To pre-establish multiple subtask processes, general assignment process is communicated by Socket assignment instructions being handed down to subtask process,
The subtask process asynchronous execution at one or more task execution ends is simultaneously timely feedbacked data are executed to management end.
Timed task system has abandoned the Crontab of Unix system completely, is matched using the written in code of PHP, including task
End, management end and task execution end are set, and realizes that task configures between end, management end and task execution end by TCP or UDP
Communication connection, and by being run under cli mode, the realization multi-process stage runs processing simultaneously in multiple tasks actuating station, and
Directly cached using the OpCode in memory, greatly reduce request initialization in disk I/O and PHP, creation performing environment,
Many time-consuming process such as morphology parsing, syntax parsing, compiling OpCode, request closing, improve task execution efficiency.And the application
Timed task system be no longer limited by the self-contained Fixed Time Interval of Crontab, the two neighboring process of the present embodiment
Execution task time interval between stage, between two neighboring subtask can arbitrarily regulate and control, and be more able to satisfy and need to monitor in real time
The demand of running environment further increase task execution efficiency by the way that smaller time interval is arranged.
Referring to Fig. 2, the timing of one embodiment of the application executes the device of task, is integrated in management end, device includes:
First receiving module 1 receives the pending task and pending task that task distribution end is sent for management end
Corresponding configuration file, wherein management end and task distribution end pre-establish communication connection, and pending task includes at least one
Subtask.
The timed task system of the present embodiment, eliminates the reliance on Crontab, but one timed task system of independent design,
The timed task system includes timer and timer, and timer is used to customize the operation duration in multiple script process stages, meter
When device be used to carry out timing to the runing time in each script process stage;Management is arranged in the timed task system of the present embodiment
End, management role actuating station and task configure end, task execution end and management end and are communicated to connect by Socket, task execution
The mission bit stream that managed end is obtained from task configuration end is terminated, the progress of each timed task of management end management and monitoring is remembered in real time
Related data is recorded, the implementation progress, success rate, failure rate of each general assignment are counted.The timed task system of the present embodiment uses
The written in code of PHP, including task configuration end, management end and task execution end, and pass through TCP (Transmission
Control Protocol) or UDP (User Datagram Protocol) network service, TCP and UDP belong to transport layer
Agreement realizes the communication connection between task configuration end, management end and task execution end, since TCP is relatively reliable, it is preferred to use
TCP network service, and by being run under cli (Command Line Interface, command line interface) mode, realize mostly into
The journey stage runs processing in multiple tasks actuating station simultaneously, and realizes that PHP file will be resided after disk reading parsing once
Memory, for use next time when directly use the OpCode in memory to cache, OpCode caching be PHP performance enhancement extension,
They by by oneself injection PHP execution life cycle, and cache the compilation phase as a result, to reuse later, greatly
Reduce request initialization in disk I/O and PHP, creation performing environment, morphology parsing, syntax parsing, compiling OpCode, request
Many time-consuming process such as closing improve task execution efficiency.And the timed task system of the present embodiment has abandoned Unix completely
The Crontab of system does not depend on the containers such as nginx, apache, and reduce that the containers such as nginx, apache communicate with PHP is logical
Cost is interrogated, and resource can be with permanent retention, it is not necessary to each initialization data library connection etc..The timed task system of the present embodiment
Developed using the version of PHP5 or more, its performance of the version after PHP5 is continuously improved, be conducive to system operation it is more smooth,
Preferably, larger change has been done using PHP7, PHP7, compared to before with bigger performance advantage.
Distribution module 2, for each subtask to be assigned to task execution end according to preset rules, wherein task execution end
Communication connection is pre-established with management end.
Management end is monitored task execution end operating condition, and is carried out according to the rule of setting to task execution end
Corresponding management, management end obtain the current memory situation at task execution end, according to the pending of the task configuration end received
The execution to subtask is responsible at the configuration file of task, each subtask of reasonable distribution to task actuating station, task execution end, is responsible for
It executes the calculating monitoring of time and controls the execution of next subtask.
First obtains module 3, for the configuration file according to pending task, obtains the corresponding task letter in the first subtask
Breath, wherein the first subtask is contained in pending task in all subtasks for including, mission bit stream includes at least the first son
The task corresponding default execution time.
The configuration file of pending task is issued by task configuration end, which is general assignment, including extremely
A few subtask, the mission bit stream of each subtask includes respective subtask title, subtask content, subtask duration
The information such as the execution interval between adjacent subtask.
Second receiving module 4, for receiving the corresponding actual execution time in the first subtask of task execution end feedback.
The corresponding actual execution time in subtask is subtask Starting Executing Time to tiring out between the end time of subtask
Plot operation duration.By counting the operation duration of each process phases, the corresponding actual execution time in subtask is obtained.The present embodiment
Timed task system, the Crontab of Unix system has been abandoned completely, when being no longer limited by the self-contained fixation of Crontab
Between be spaced, the execution task time interval between the two neighboring process phases of the present embodiment, between two neighboring subtask can
Arbitrarily regulation is more able to satisfy the demand for needing the running environment monitored in real time, such as financial stock market, smaller by being arranged
Time interval further increases task execution efficiency.Task execution end, which calculates and controls subtask, executes the time, guarantees subtask
Go on smoothly, when its subtask duration reach setting value when, task execution end, which controls the subtask, to terminate to execute.
Judgment module 5, for judging whether actual execution time is identical as the default execution time.
It is corresponding to set the corresponding preset duration of each process phases, each process rank when subtask includes multiple process phases
The adduction of the corresponding preset duration of section is the default execution time.Such as subtask a, the execution time for setting subtask a is from n-th second
Start to terminate to m seconds, perhaps setting terminates or be arranged since n-th millisecond to m milliseconds to m since n-th millisecond
Second terminates, or setting terminated since n-th minute to m minutes.
Control module 6, if identical as the default execution time for actual execution time, control task actuating station terminates to hold
The first subtask of row.
Further, task execution end includes at least two, distribution module 2, comprising:
First judging unit, for judging whether the current residual amount of ram of first task actuating station meets the first subtask
Demand, wherein first task actuating station is contained in all task execution ends.Allocation unit, for if satisfied, then by first
Subtask is distributed to first task actuating station.
The present embodiment manages the distribution of subtask by management end, to guarantee that the subtask at task execution end smoothly executes,
And reach making full use of for resource, it avoids task execution end from memory occur and overflows situation.Same general assignment is not in the present embodiment
Can be respectively by different task execution ends with subtask, while each subtask is run, shorten the execution time of general assignment, improves
Task execution efficiency, the thread configuration parameter in each task execution end of the present embodiment is identical, and each task execution end is to execution
The effect of subtask is identical.Above-mentioned " first " is not used in restriction, elsewhere acts on identical similar to term for distinguishing.
Further, task execution end includes at least two, and configuration file includes the thread configuration parameter of pending task,
Distribution module 2, comprising:
Determination unit, for determining pending task corresponding second task execution end according to thread configuration parameter.First
Transmission unit is used for the corresponding each subtask of pending task, while being sent to the second task execution end.
In the present embodiment, the corresponding all subtasks of same general assignment carry out at same task execution end, facilitate to be formed simultaneously
Management role log.The thread configuration parameter of the multiple tasks actuating station of the present embodiment is distinguished according to task type, different
The corresponding thread configuration parameter of task type is different, and the general assignment of the correspondence different task type of different service types can basis
The corresponding task execution end of different thread configuration parameter selections.In the application other embodiments, when multiple subtasks need to hold
Row and current task actuating station is unable to satisfy when needing, for example current task actuating station has reached or close to memory limiting value, can
Other task execution ends with identical thread configuration parameter are distributed into remaining subtask, management end plans as a whole each task execution end
Executive condition, realize the execution of general assignment.
Further, the first subtask includes at least two process phases, includes two adjacent processes ranks in configuration file
Prefixed time interval between section, the second receiving module 4, comprising:
Receiving unit, the letter in the first subtask corresponding current process stage for receiving first task actuating station feedback
Breath, wherein the information in current process stage includes at least, and current process stage corresponding first accumulation operation duration is advanced with working as
Journey stage adjacent next process phases, current process stage and current process stage adjacent next process phases are the
The process phases for the arbitrary neighborhood in all process phases that one subtask includes.
Second judgment unit, for judging whether the first accumulation operation duration in current process stage reaches preset duration.
First control unit controls if the first accumulation operation duration for the current process stage reaches preset duration
First task actuating station terminates to execute the current process stage, and enters process interval stage.
Third judging unit, for judging whether the corresponding time interval of process interval stage reaches prefixed time interval.
Second control unit controls if reaching prefixed time interval for the corresponding time interval of process interval stage
First task actuating station executes the next process phases adjacent with the current process stage.
Acquiring unit, for obtaining the second accumulation operation duration of current process stage adjacent next process phases.
Collection unit summarizes for the acquisition modes according to the first accumulation operation duration and the second accumulation operation duration
The accumulation operation duration for all process phases that one subtask includes, obtains actual execution time.
In the present embodiment, the corresponding preset duration of each process phases be may be the same or different, and is not construed as limiting.Two neighboring process
There are time intervals between stage, to complete the linking between each process phases, including data-linkage etc., such as current process
When stage needs to call the data of a upper process phases, need to carry out data-linkage.The task execution end of the present embodiment includes fixed
Minimum task time interval is arranged in Shi Gongneng, clocking capability and Trigger Function, timing function, and each subtask includes at least one
Process phases, clocking capability carry out timing calculating according to the operation duration of each process phases;Trigger Function is directed to any one
It is corresponding to exit the clocking capability when the timing duration of clocking capability reaches the operation duration of the process phases for process phases
Process phases trigger the operation of process phases new in task execution end.The timing function of the present embodiment is task execution time
Basis instrument, be arranged task time interval minimum value, then corresponding task execution time can be in the base of above-mentioned basis instrument
Multiple setting is carried out on plinth, the settable minimum task time interval of timing function can be Millisecond or second grade or minute
Grade, is arranged according to actual needs, and the minimum execution time compared to Crontab is 1 minute, timing of the present embodiment based on PHP
Task system setting is more flexible, and the scope of application is more extensive.
In the present embodiment, task configures end and sends pending task, i.e. general assignment, which includes that multiple sons are appointed
Business, which is assigned to task execution end and is responsible for executing corresponding subtask by management end, if between task execution time
It is small as far as possible every being arranged, enable task execution end quickly processing subtask, to be pooled in management end after the completion of each subtask, with fast
Speed sends implementing result, improves transmitting efficiency and corresponding working efficiency, and minimum task time interval is Millisecond, preferably sets
Be set to 3 milliseconds, at this point, if when being allocated in the processing of the same task execution end, be equivalent to it is per second there are about 333 subtasks to complete,
There are 2000 subtasks to complete within one minute, relative to existing dependence Crontab completion timing task, most due to Crontab
The small execution time is 1 minute, and the timed task system of the present embodiment executes the more efficient of task.
Further, task configuration end configures web interface, and timing executes the device of task, comprising:
Second obtains module, for obtaining the corresponding execution data in all subtasks for including in pending task,
Wherein, implementation progress and implementing result that data include at least all subtasks for including in pending task are executed.
Update module, for according to implementing result, real-time update to calculate all subtasks for including in pending task
Success rate and failure rate.
Feedback module, the implementation progress and pending task of all subtasks for that will include in pending task
In include all subtasks success rate and failure rate, Real-time Feedback to web interface simultaneously shows.
In the present embodiment, timed task system carries out web interface configuration, and the network I/O that timed task system itself carries connects
Mouthful be it is asynchronous, developer can realize the Asynchronous Programming of task based access control event, realize Distributed Application, multiple and different sons is arranged
Task facilitates user configuration task.When compared to creation Crontab task, it is necessary to must have the system that can configure Crontab
Account, needs the system account of the additional each machine of maintenance, and configures Crontab one by one inside the system of each machine,
Process is cumbersome, configuration trouble.Compared to Crontab timed task system, the timed task system of the present embodiment can be looked into intuitively
The implementation progress, success rate, failure rate for seeing each general assignment, the task execution number obtained by management end from task execution end
According to, and feed back into the Mission Monitor of web interface, facilitate user monitoring and checks.
Further, second module is obtained, comprising:
Detection unit executes data for whether real-time detection to receive the abnormal of third task execution end feedback.
Marking unit marks abnormal execution if executing data for receiving the abnormal of third task execution end feedback
The implementing result of the corresponding subtask of data is to execute failure.
Third control unit interrupts the current subtask of execution for controlling third task execution end, and controls third task
Actuating station destroys the corresponding process in current subtask.
Switching units obtain the communication connection for executing data from third task execution end for disconnecting.
The present embodiment task execution end regularly sends heartbeat detection data to management end, and management end judges according to imposing a condition
Task execution end whether normal operation, for example whether abnormal, if operation data is abnormal, show to transport if analyzing the operation data that receives
Row is abnormal.When the task execution at task execution end occurs abnormal, management end quickly carries out corresponding abnormal feedback notification simultaneously
The current subtask of control task actuating station pull-up, and the connection with task execution end is disconnected, prevent management end from continuing to run and appointing
The relevant operation of actuating station of being engaged in, consumption management end memory, influences the speed of service.When the connection of task execution end and management end is normal
When, task execution end re-initiates connection, and management end receives the information at task execution end again.When process rank in the present embodiment
After Duan Jinhang or after being abnormal execution, if process phases continue to remain in task execution end, task execution can be occupied
The memory at end, influences the speed of performing task and efficiency at task execution end, and memory is be easy to cause to overflow situation, can pass through destruction
The abnormal process phases of the process phases or appearance finished, timely releasing memory space.Above-mentioned heartbeat detection is task
It is communicated between actuating station and management end, timing carries out a heartbeat detection, the communication of Detection task actuating station and management end
It whether normal connects.The abnormal judgement of the present embodiment, including user are led to by checking that task daily record and heartbeat detection log obtain
It crosses log to be analyzed and processed, while having to the overall operation of system and getting information about, when being conducive to system appearance exception.
The management end of the present embodiment, task execution end can also be run in same terminal operating in different terminals, and worked as and appointed
When business frequent operation, same terminal then will affect progress, low memory be caused, it is preferred, therefore, that management end, task execution end
It works in the different terminal of each leisure, each inter-terminal communication connection, then management end, task execution end have enough memories to guarantee
Timed task is gone on smoothly.In the present embodiment when being divided into Millisecond between task time, task execution end handles frequent activity,
Be easy to cause memory overflow situation, then task execution end can be separately operable by more terminals, operation distribution by management end according to
Corresponding situation is specified, is to be run by present terminal, otherwise by other if whether memory is enough for the task execution end of present terminal
Terminal operating.Same task execution end can multi-process synchronization process task treatment effeciency improved with speed up processing.
Further, there are dual-thread connection, dual-thread includes holding to third task for management end and third task execution end
Row end sends exectorial first thread, and the second thread for executing data is obtained from third task execution end, and second obtains
Modulus block, comprising:
Third judging unit, for judging whether current time reaches default timing section.Second transmission unit, is used for
If current time reaches default timing section, is sent by first thread to third task execution end and reconnect instruction.It connects
By unit, for receiving third task execution end according to the connection signal for reconnecting instruction feedback, and the second thread is connected.It connects
Unit is received, for receiving the execution data of third task execution end feedback by the second thread.
The management end of the present embodiment is overall control center, but does not need frequent processing activity, with prevent management end due to
Processing frequent activity causes operation to make mistakes.The timing of task execution end reports task execution data to management end, and management end is according to setting
Fixed condition judge task execution end whether normal operation;Task execution data include the implementation progress, success rate, failure of task
Rate, task execution end report the timing of task execution data that can arbitrarily set, such as 1 minute, to note abnormalities in time.
The present embodiment communicates the information mutual communication for realizing timed task system by Socket, is bi-directionally connected by dual-thread realization, favorably
In task execution end while receiving assignment instructions, can also to management end timing feedback execute data, improve communication efficiency and
The treatment effeciency of timed task system.The each city in 100 cities is such as detected when handling some burdensome tasks in citing ground
Weather information or mail is sent to 1w human hair, entire implementation procedure can be very slow, may block the several seconds, because of general assignment process quilt
Obstruction, will affect subsequent request;Because general assignment process and subtask process are interconnected by Socket communication, can
To pre-establish multiple subtask processes, general assignment process is communicated by Socket assignment instructions being handed down to subtask process,
The subtask process asynchronous execution at one or more task execution ends is simultaneously timely feedbacked data are executed to management end.
Referring to Fig. 3, a kind of computer equipment is also provided in the embodiment of the present application, which can be server,
Its internal structure can be as shown in Figure 3.The computer equipment includes processor, the memory, network connected by system bus
Interface and database.Wherein, the processor of the Computer Design is for providing calculating and control ability.The computer equipment is deposited
Reservoir includes non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system, computer program
And database.The internal memory provides environment for the operation of operating system and computer program in non-volatile memory medium.It should
The database of computer equipment is used to store timing and executes all data that the process of task needs.The network of the computer equipment
Interface is used to communicate with external end by network connection.Appointed when the computer program is executed by processor with realizing that timing executes
The method of business.
Above-mentioned processor executes the method that above-mentioned timing executes task, comprising: management end receives what task distribution end was sent
Pending task and the corresponding configuration file of pending task, wherein management end and task distribution end pre-establish communication and connect
It connects, pending task includes at least a subtask;Each subtask is assigned to task execution end according to preset rules, wherein appointing
Business actuating station and management end pre-establish communication connection;According to the configuration file of pending task, it is corresponding to obtain the first subtask
Mission bit stream, wherein the first subtask is contained in all subtasks in pending task, mission bit stream includes at least the
The one subtask corresponding default execution time;Receive the corresponding actual execution time in the first subtask of task execution end feedback;
Judge whether actual execution time is identical as the default execution time;If so, control task actuating station terminates to execute the first son times
Business.
Above-mentioned computer equipment, timed task system have abandoned the Crontab of Unix system completely, using the code of PHP
Write, including task configuration end, management end and task execution end, and by TCP or UDP realize task configure end, management end and
Communication connection between task execution end, and by being run under cli mode, realize the multi-process stage in multiple tasks actuating station
Processing is run simultaneously, and is directly cached using the OpCode in memory, is greatly reduced in disk I/O and PHP and is requested initially
Change, creation performing environment, morphology parsing, syntax parsing, compiling OpCode, request many time-consuming process such as closing, improves task
Execution efficiency.And the timed task system of the application is no longer limited by the self-contained Fixed Time Interval of Crontab, this implementation
Example two neighboring process phases between, the execution task time interval between two neighboring subtask can arbitrarily regulate and control, more can
Meet the demand for needing the running environment monitored in real time, by the way that smaller time interval is arranged, further increases task execution effect
Rate.
In one embodiment, task execution end includes at least two, and above-mentioned processor is by each subtask according to default rule
The step of being then assigned to task execution end, comprising: judge whether the current residual amount of ram of first task actuating station meets first
The demand of subtask, wherein first task actuating station is contained in all task execution ends;If satisfied, then by the first subtask
It distributes to first task actuating station.
In one embodiment, task execution end includes at least two, and configuration file includes that the thread of pending task is matched
Parameter is set, the step of each subtask is assigned to task execution end according to preset rules by above-mentioned processor, comprising: match according to thread
It sets parameter and determines pending task corresponding second task execution end;By the corresponding each subtask of pending task, send simultaneously
To the second task execution end.
In one embodiment, the first subtask includes at least two process phases, includes two adjacent in configuration file
Prefixed time interval between process phases, above-mentioned processor receive the corresponding reality in the first subtask of task execution end feedback
The step of executing the time, comprising: receive the letter in the first subtask corresponding current process stage of first task actuating station feedback
Breath, wherein the information in current process stage includes at least, and current process stage corresponding first accumulation operation duration is advanced with working as
Journey stage adjacent next process phases, current process stage and current process stage adjacent next process phases are the
Two process phases of the arbitrary neighborhood in all process phases that one subtask includes;Judge that the first of the current process stage tires out
Whether plot operation duration reaches preset duration;If the first accumulation operation duration in current process stage reaches preset duration, control
First task actuating station processed terminates to execute the current process stage, and enters process interval stage;Judgement process interval stage is corresponding
Time interval whether reach prefixed time interval;If the corresponding time interval of process interval stage reaches prefixed time interval,
It then controls first task actuating station and executes the next process phases adjacent with the current process stage;It is adjacent to obtain the current process stage
Next process phases second accumulation operation duration;According to the acquisition of the first accumulation operation duration and the second accumulation operation duration
Mode summarizes the accumulation operation duration for all process phases that the first subtask includes, obtains actual execution time.
In one embodiment, task configuration end configures web interface, and above-mentioned processor control task actuating station terminates to execute
After the step of first subtask, comprising: the corresponding execution data in all subtasks for including in pending task are obtained,
Wherein, implementation progress and implementing result that data include at least all subtasks for including in pending task are executed;According to holding
Row is as a result, real-time update calculates the success rate and failure rate for all subtasks for including in pending task;By pending task
In include all subtasks implementation progress and pending task in include all subtasks success rate and failure
Rate, Real-time Feedback to web interface are simultaneously shown.
In one embodiment, above-mentioned processor obtains that all subtasks for including in pending task are corresponding to hold
The step of row data, comprising: whether real-time detection receives the abnormal of third task execution end feedback and execute data;If so,
The abnormal implementing result for executing the corresponding subtask of data of label is to execute failure;Control third task execution end, which interrupts to execute, works as
Preceding subtask, and control third task execution end and destroy the corresponding process phases in current subtask;It disconnects from third task execution
End obtains the communication connection for executing data.
In one embodiment, there are dual-thread connection, dual-thread includes to third for management end and third task execution end
Task execution end sends exectorial first thread, and the second thread for executing data is obtained from third task execution end,
Above-mentioned processor disconnected after the step of obtaining the communication connection for executing data from third task execution end, comprising: judgement is current
Whether the time reaches preset timing section;Refer to if so, sending to reconnect to third task execution end by first thread
It enables;Receive third task execution end according to the connection signal for reconnecting instruction feedback, and connects the second thread;Pass through the second line
Journey receives the execution data of third task execution end feedback.
It will be understood by those skilled in the art that structure shown in Fig. 3, only part relevant to application scheme is tied
The block diagram of structure does not constitute the restriction for the computer equipment being applied thereon to application scheme.
One embodiment of the application also provides a kind of computer readable storage medium, is stored thereon with computer program, calculates
When machine program is executed by processor realize timing execute task method, comprising: management end receive task distribution end send to
Execution task and the corresponding configuration file of pending task, wherein management end and task distribution end pre-establish communication connection,
Pending task includes at least a subtask;Each subtask is assigned to task execution end according to preset rules, wherein task
Actuating station and management end pre-establish communication connection;According to the configuration file of pending task, it is corresponding to obtain the first subtask
Mission bit stream, wherein the first subtask is contained in all subtasks in pending task, mission bit stream includes at least first
The subtask corresponding default execution time;Receive the corresponding actual execution time in the first subtask of task execution end feedback;Sentence
Whether disconnected actual execution time is identical as the default execution time;If so, control task actuating station terminates to execute the first subtask.
Above-mentioned computer readable storage medium, timed task system have abandoned the Crontab of Unix system completely, use
The written in code of PHP, including task configuration end, management end and task execution end, and by TCP or UDP realize task configure end,
Communication connection between management end and task execution end, and by being run under cli mode, realize the multi-process stage at multiple
Business actuating station runs processing simultaneously, and is directly cached using the OpCode in memory, greatly reduces and asks in disk I/O and PHP
Many time-consuming process such as initialization, creation performing environment, morphology parsing, syntax parsing, compiling OpCode, request closing are sought, are mentioned
High task execution efficiency.And the timed task system of the application is no longer limited by the self-contained Fixed Time Interval of Crontab,
Execution task time interval between the two neighboring process phases of the present embodiment, between two neighboring subtask can arbitrarily adjust
Control is more able to satisfy the demand for needing the running environment monitored in real time, by the way that smaller time interval is arranged, further increases task
Execution efficiency.
In one embodiment, task execution end includes at least two, and above-mentioned processor is by each subtask according to default rule
The step of being then assigned to task execution end, comprising: judge whether the current residual amount of ram of first task actuating station meets first
The demand of subtask, wherein first task actuating station is contained in all task execution ends;If satisfied, then by the first subtask
It distributes to first task actuating station.
In one embodiment, task execution end includes at least two, and configuration file includes that the thread of pending task is matched
Parameter is set, the step of each subtask is assigned to task execution end according to preset rules by above-mentioned processor, comprising: match according to thread
It sets parameter and determines pending task corresponding second task execution end;By the corresponding each subtask of pending task, send simultaneously
To the second task execution end.
In one embodiment, the first subtask includes at least two process phases, includes two adjacent in configuration file
Prefixed time interval between process phases, above-mentioned processor receive the corresponding reality in the first subtask of task execution end feedback
The step of executing the time, comprising: receive the letter in the first subtask corresponding current process stage of first task actuating station feedback
Breath, wherein the information in current process stage includes at least, and current process stage corresponding first accumulation operation duration is advanced with working as
Journey stage adjacent next process phases, current process stage and current process stage adjacent next process phases are the
Two process phases of the arbitrary neighborhood in all process phases that one subtask includes;Judge that the first of the current process stage tires out
Whether plot operation duration reaches preset duration;If the first accumulation operation duration in current process stage reaches preset duration, control
First task actuating station processed terminates to execute the current process stage, and enters process interval stage;Judgement process interval stage is corresponding
Time interval whether reach prefixed time interval;If the corresponding time interval of process interval stage reaches prefixed time interval,
It then controls first task actuating station and executes the next process phases adjacent with the current process stage;It is adjacent to obtain the current process stage
Next process phases second accumulation operation duration;According to the acquisition of the first accumulation operation duration and the second accumulation operation duration
Mode summarizes the accumulation operation duration for all process phases that the first subtask includes, obtains actual execution time.
In one embodiment, task configuration end configures web interface, and above-mentioned processor control task actuating station terminates to execute
After the step of first subtask, comprising: the corresponding execution data in all subtasks for including in pending task are obtained,
Wherein, implementation progress and implementing result that data include at least all subtasks for including in pending task are executed;According to holding
Row is as a result, real-time update calculates the success rate and failure rate for all subtasks for including in pending task;By pending task
In include all subtasks implementation progress and pending task in include all subtasks success rate and failure
Rate, Real-time Feedback to web interface are simultaneously shown.
In one embodiment, above-mentioned processor obtains that all subtasks for including in pending task are corresponding to hold
The step of row data, comprising: whether real-time detection receives the abnormal of third task execution end feedback and execute data;If so,
The abnormal implementing result for executing the corresponding subtask of data of label is to execute failure;Control third task execution end, which interrupts to execute, works as
Preceding subtask, and control third task execution end and destroy the corresponding process phases in current subtask;It disconnects from third task execution
End obtains the communication connection for executing data.
In one embodiment, there are dual-thread connection, dual-thread includes to third for management end and third task execution end
Task execution end sends exectorial first thread, and the second thread for executing data is obtained from third task execution end,
Above-mentioned processor disconnected after the step of obtaining the communication connection for executing data from third task execution end, comprising: judgement is current
Whether the time reaches preset timing section;Refer to if so, sending to reconnect to third task execution end by first thread
It enables;Receive third task execution end according to the connection signal for reconnecting instruction feedback, and connects the second thread;Pass through the second line
Journey receives the execution data of third task execution end feedback.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with
Relevant hardware is instructed to complete by computer program, above-mentioned computer program can be stored in a non-volatile computer
In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein,
Any reference used in provided herein and embodiment to memory, storage, database or other media,
Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM
(PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include
Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms,
Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double speed are according to rate SDRAM (SSRSDRAM), enhancing
Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM
(RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
The foregoing is merely preferred embodiment of the present application, are not intended to limit the scope of the patents of the application, all utilizations
Equivalent structure or equivalent flow shift made by present specification and accompanying drawing content is applied directly or indirectly in other correlations
Technical field, similarly include in the scope of patent protection of the application.
Claims (10)
1. a kind of method that timing executes task characterized by comprising
Management end receives the pending task and the corresponding configuration file of the pending task that task distribution end is sent, wherein
The management end and task distribution end pre-establish communication connection, and the pending task includes at least a subtask;
Each subtask is assigned to task execution end according to preset rules, wherein the task execution end and the management end
Pre-establish communication connection;
According to the configuration file of the pending task, the corresponding mission bit stream in the first subtask is obtained, wherein first son
Task is contained in all subtasks in the pending task, and the mission bit stream includes at least first subtask pair
The default execution time answered;
Receive the corresponding actual execution time in first subtask of the task execution end feedback;
Judge whether the actual execution time is identical as the default execution time;
If so, controlling the task execution end terminates to execute first subtask.
2. the method that timing according to claim 1 executes task, which is characterized in that the task execution end includes at least
Two, described the step of each subtask is assigned to task execution end according to preset rules, comprising:
Judge whether the current residual amount of ram of first task actuating station meets the needs of first subtask, wherein described
First task actuating station is contained in all task execution ends;
If satisfied, then first subtask is distributed to the first task actuating station.
3. the method that timing according to claim 1 executes task, which is characterized in that the task execution end includes at least
Two, the configuration file includes the thread configuration parameter of the pending task, it is described by each subtask according to default
Rule is assigned to the step of task execution end, comprising:
Pending task corresponding second task execution end is determined according to the thread configuration parameter;
By the corresponding each subtask of the pending task, while being sent to second task execution end.
4. the method that timing according to claim 2 or 3 executes task, which is characterized in that first subtask is at least
It include the prefixed time interval between two adjacent process phases, institute including two process phases, in the configuration file
The step of stating the corresponding actual execution time in first subtask for receiving task execution end feedback, comprising:
The information in the first subtask corresponding current process stage of the first task actuating station feedback is received, wherein institute
The information for stating the current process stage includes at least, and the current process stage corresponding first accumulates operation duration, works as with described
The adjacent next process phases of preceding process phases, the current process stage and the current process stage it is adjacent it is next into
Journey stage, two process phases of the arbitrary neighborhood in all process phases for including for first subtask;
Judge whether the first accumulation operation duration in the current process stage reaches preset duration;
If the first accumulation operation duration in the current process stage reaches preset duration, the first task actuating station is controlled
Terminate to execute the current process stage, and enters process interval stage;
Judge whether the corresponding time interval of the process interval stage reaches prefixed time interval;
If the corresponding time interval of the process interval stage reaches prefixed time interval, the first task actuating station is controlled
Execute the next process phases adjacent with the current process stage;
Obtain the second accumulation operation duration of the current process stage adjacent next process phases;
According to the acquisition modes of the first accumulation operation duration and the second accumulation operation duration, summarizes first son and appoint
The accumulation operation duration for all process phases that business includes, obtains the actual execution time.
5. the method that timing according to claim 1 executes task, which is characterized in that task configuration end configures web
Interface, after the control task execution end terminates the step of executing first subtask, comprising:
Obtain the corresponding execution data in all subtasks for including in the pending task, wherein the execution data
Including at least the implementation progress and implementing result of all subtasks for including in the pending task;
According to the implementing result, real-time update calculates the success rate and mistake for all subtasks for including in the pending task
Lose rate;
The institute that will include in the implementation progress for all subtasks for including in the pending task and the pending task
There are the success rate and failure rate of subtask, Real-time Feedback is to the web interface and shows.
6. the method that timing according to claim 5 executes task, which is characterized in that described to obtain the pending task
In include the corresponding execution data in all subtasks the step of, comprising:
Whether real-time detection receives the abnormal of third task execution end feedback and executes data;
If so, the label abnormal implementing result for executing the corresponding subtask of data is to execute failure;
It controls third task execution end and interrupts the current subtask of execution, and control described in the destruction of third task execution end
The corresponding process phases in current subtask;
Disconnect the communication connection for obtaining from third task execution end and executing data.
7. the method that timing according to claim 6 executes task, which is characterized in that the management end and the third are appointed
For actuating station of being engaged in there are dual-thread connection, the dual-thread includes sending exectorial First Line to third task execution end
Journey, and the second thread for executing data is obtained from third task execution end, it is described to disconnect from the third task execution
End obtained after the step of communication connection for executing data, comprising:
Judge whether current time reaches preset timing section;
Instruction is reconnected if so, sending by the first thread to third task execution end;
Receive third task execution end according to the connection signal for reconnecting instruction feedback, and connects second line
Journey;
The execution data of third task execution end feedback are received by second thread.
8. the device that a kind of timing executes task, which is characterized in that be integrated in management end, described device includes:
First receiving module, for receiving the pending task and the pending task is corresponding matches that task distribution end is sent
File is set, wherein the management end and task distribution end pre-establish communication connection, the pending task is included at least
One subtask;
Distribution module, for each subtask to be assigned to task execution end according to preset rules, wherein the task execution
End pre-establishes communication connection with the management end;
First obtains module, for the configuration file according to the pending task, obtains the corresponding task letter in the first subtask
Breath, wherein first subtask is contained in all subtasks in the pending task, the mission bit stream is at least wrapped
Include the first subtask corresponding default execution time;
Second receiving module, when the corresponding reality in first subtask for receiving the task execution end feedback executes
Between;
Judgment module, for judging whether the actual execution time is identical as the default execution time;
Control module controls the task execution if identical as the default execution time for the actual execution time
End terminates to execute first subtask.
9. a kind of computer equipment, including memory and processor, the memory are stored with computer program, feature exists
In the step of processor realizes any one of claims 1 to 7 the method when executing the computer program.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program
The step of method described in any one of claims 1 to 7 is realized when being executed by processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910470635.0A CN110333915A (en) | 2019-05-31 | 2019-05-31 | Timing executes method, apparatus, computer equipment and the storage medium of task |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910470635.0A CN110333915A (en) | 2019-05-31 | 2019-05-31 | Timing executes method, apparatus, computer equipment and the storage medium of task |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110333915A true CN110333915A (en) | 2019-10-15 |
Family
ID=68140682
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910470635.0A Pending CN110333915A (en) | 2019-05-31 | 2019-05-31 | Timing executes method, apparatus, computer equipment and the storage medium of task |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110333915A (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110888865A (en) * | 2019-12-04 | 2020-03-17 | 北京明略软件系统有限公司 | Data processing method and device based on one-way linked list |
CN111309463A (en) * | 2020-02-05 | 2020-06-19 | 北京明略软件系统有限公司 | Method and device for determining task execution time and readable storage medium |
CN112667383A (en) * | 2020-12-31 | 2021-04-16 | 北京高途云集教育科技有限公司 | Task execution and scheduling method, system, device, computing equipment and medium |
CN113535353A (en) * | 2021-06-29 | 2021-10-22 | 未鲲(上海)科技服务有限公司 | Timing task scheduling method and device and computer equipment |
CN114326670A (en) * | 2021-12-24 | 2022-04-12 | 北京龙鼎源科技股份有限公司 | Method and device for detecting task executed by controller, storage medium and electronic device |
CN115098253A (en) * | 2022-06-17 | 2022-09-23 | 特赞(上海)信息科技有限公司 | Subtask execution method and system and electronic equipment |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2013091219A1 (en) * | 2011-12-22 | 2013-06-27 | 华为技术有限公司 | Method and apparatus for processing concurrent tasks |
WO2013106923A1 (en) * | 2012-01-20 | 2013-07-25 | Energy Aware Technology Inc. | System and method of compiling and organizing power consumption data and converting such data into one or more user actionable formats |
CN106775965A (en) * | 2016-11-17 | 2017-05-31 | 腾讯科技(深圳)有限公司 | A kind of processing method and processing device of timed task |
CN107748695A (en) * | 2017-10-24 | 2018-03-02 | 平安科技(深圳)有限公司 | Timed task processing method, device, storage medium and computer equipment |
-
2019
- 2019-05-31 CN CN201910470635.0A patent/CN110333915A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2013091219A1 (en) * | 2011-12-22 | 2013-06-27 | 华为技术有限公司 | Method and apparatus for processing concurrent tasks |
WO2013106923A1 (en) * | 2012-01-20 | 2013-07-25 | Energy Aware Technology Inc. | System and method of compiling and organizing power consumption data and converting such data into one or more user actionable formats |
CN106775965A (en) * | 2016-11-17 | 2017-05-31 | 腾讯科技(深圳)有限公司 | A kind of processing method and processing device of timed task |
CN107748695A (en) * | 2017-10-24 | 2018-03-02 | 平安科技(深圳)有限公司 | Timed task processing method, device, storage medium and computer equipment |
Non-Patent Citations (1)
Title |
---|
刘一田;刘士进;: "多租户高可用并行任务调度框架", 计算机系统应用, no. 12 * |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110888865A (en) * | 2019-12-04 | 2020-03-17 | 北京明略软件系统有限公司 | Data processing method and device based on one-way linked list |
CN111309463A (en) * | 2020-02-05 | 2020-06-19 | 北京明略软件系统有限公司 | Method and device for determining task execution time and readable storage medium |
CN111309463B (en) * | 2020-02-05 | 2023-04-07 | 北京明略软件系统有限公司 | Method and device for determining task execution time and readable storage medium |
CN112667383A (en) * | 2020-12-31 | 2021-04-16 | 北京高途云集教育科技有限公司 | Task execution and scheduling method, system, device, computing equipment and medium |
CN112667383B (en) * | 2020-12-31 | 2024-02-09 | 北京高途云集教育科技有限公司 | Task execution and scheduling method, system, device, computing equipment and medium |
CN113535353A (en) * | 2021-06-29 | 2021-10-22 | 未鲲(上海)科技服务有限公司 | Timing task scheduling method and device and computer equipment |
CN113535353B (en) * | 2021-06-29 | 2022-05-20 | 未鲲(上海)科技服务有限公司 | Timing task scheduling method and device and computer equipment |
CN114326670A (en) * | 2021-12-24 | 2022-04-12 | 北京龙鼎源科技股份有限公司 | Method and device for detecting task executed by controller, storage medium and electronic device |
CN114326670B (en) * | 2021-12-24 | 2024-03-05 | 北京龙鼎源科技股份有限公司 | Detection method and device for executing tasks by controller, storage medium and electronic device |
CN115098253A (en) * | 2022-06-17 | 2022-09-23 | 特赞(上海)信息科技有限公司 | Subtask execution method and system and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110333915A (en) | Timing executes method, apparatus, computer equipment and the storage medium of task | |
US10877813B2 (en) | Resource control stack based system for multiple domain presentation of cloud computing resource control | |
US11321132B2 (en) | Edge computing method and apparatus for flexibly allocating computing resource | |
ES2326538T3 (en) | SYSTEM AND METHOD FOR MANAGING OPERATING CHARACTERISTICS IN A COMPUTER ENVIRONMENT OF VARIOUS LEVELS. | |
CN107688496A (en) | Task distribution formula processing method, device, storage medium and server | |
CN108834086B (en) | Method and device for sending short message, computer equipment and storage medium | |
DE102004052270B4 (en) | Processing device management system | |
CN108845884A (en) | Physical source distributing method, apparatus, computer equipment and storage medium | |
CN108965381A (en) | Implementation of load balancing, device, computer equipment and medium based on Nginx | |
CN108132833A (en) | Distributed timing task scheduling method and device based on zookeeper technology | |
US8295963B2 (en) | Methods for performing data management for a recipe-and-component control module | |
CN110297814A (en) | Method for monitoring performance, device, equipment and the storage medium of database manipulation | |
CN106330769A (en) | Business processing method and server | |
CN106575247A (en) | Fault tolerant federation of computing clusters | |
CN106209482A (en) | A kind of data center monitoring method and system | |
CN107451147A (en) | A kind of method and apparatus of kafka clusters switching at runtime | |
CN107783829A (en) | Task processing method, device, storage medium and computer equipment | |
CN110334126A (en) | Timed task processing method, device and computer equipment based on Spring MVC | |
CN109634730A (en) | Method for scheduling task, device, computer equipment and storage medium | |
CN104168326A (en) | Server load balancing method and system | |
US10892947B2 (en) | Managing cross-cloud distributed application | |
CN109062982A (en) | Financial data exchange method, device, computer equipment and storage medium | |
CN107634871B (en) | Connectivity test method, device and system | |
CN106559485B (en) | A kind of method and device of control server shutdown | |
US20090234786A1 (en) | Method for Governing the Operation of a Generalist Agent within a Complex Multi-Agent Adaptive System |
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 |