Summary of the invention
The present invention seeks to: at deficiency of the prior art, the present invention proposes the method and the assembly of a kind of managing group task (GTM), each task route is to be made of many task paths, under unix, can dispose a plurality of tasks by crontab, can serial, serial/parallel row mixes and execute the task.
Technical scheme of the present invention is: the method for managing group task, employing operates in the managing group task GTM assembly of the finger daemon under the UNIX operating system environment, go to carry out the work of satisfying executive condition by timing scan configuration information operational factor table, work is made up of one or more tasks, each task all is an independently logical block, when all tasks all are finished, work is just finished, and assembly is done in advance definition in proper order to task executions in working; The assembly implementation will be carried out route in strict accordance with task and carry out, and every work has only a task route, and each task route is to be made of many task paths, and task executions is that serial or serial/parallel row mix in proper order:
1) serial is carried out: dispose a plurality of tasks by crontab under unix, these tasks are independent of each other, the order that managing group task GTM assembly is carried out by configuration task is carried out a plurality of tasks with the mode serial of chained list, and a back task executions must be based upon on the basis that previous task runs succeeded; Have only as task T
iCould carry out T after complete
I+1As last T
I+1Could carry out end step TE after complete; When TE was performed, this work is performed to be finished, and i is a natural number;
2) mix execution: under unix, dispose a plurality of tasks by crontab, these tasks are independent of each other, the order that managing group task GTM assembly is carried out by configuration task is carried out a plurality of tasks in the mode of string and mixing, i.e. a plurality of tasks of concurrent execution on the basis of the intact task of successful execution wait for that multitask finishes string and type multitask hybrid processing mechanism that the some independent tasks of execution are continued in the back. and a back task executions must be based upon on the basis that previous or a plurality of tasks run succeeded; Have only after all parallel tasks are complete and could carry out next task, by that analogy, after the front parallel task is complete, could carry out the task of back with serial mode, finish, carry out TE again up to all tasks, when TE was performed, this work is performed to be finished;
Configuration task: a job is needed 3 parameter lists at least by complete definition, is respectively: worksheet, routing table, task list; Described assembly is alarmed when the work of overrun or mistake takes place; The mode of alarm adopts note or mail; Described short message alarm is provided with and allows to alarm start and end time; The interval time that sends alarm message is controlled.
Effect of the present invention is: compared with prior art, the assembly of this method and formation can carry out serial, serial/parallel row mixing is executed the task.
Embodiment
The invention will be further described below in conjunction with accompanying drawing and embodiment.
1, serial is carried out.Under unix, can dispose a plurality of tasks by crontab, but these tasks all are independent of each other, managing group task (GTM) assembly can be carried out a plurality of tasks by the order that configuration task is carried out with the mode serial of chained list, and a back task executions must be based upon on the basis that previous task runs succeeded.
2, mix execution.Under unix, can dispose a plurality of tasks by crontab, but these tasks all are independent of each other, managing group task (GTM) assembly can be carried out a plurality of tasks by the order that configuration task is carried out in the mode of string and mixing, promptly can be on the basis of the intact task of successful execution a plurality of tasks of concurrent execution, wait for that multitask finishes string and type multitask hybrid processing mechanism that the some independent tasks of execution are continued in the back. and a back task executions must be based upon on the basis that previous or a plurality of tasks run succeeded.
3, alarm.By alarm, the work that overrun or mistake take place is reminded to relevant responsible official, so that further find out alarm cause, deal with problems by the mode of manual intervention; Can be undertaken by the mode of note and mail.For short message alarm permission can be set and alarm start and end time,, can send note to the phone number of appointment only in this following period of time.Also can accomplish to control for the density of note, require in the time range that allows alarm, to send alarm message once, allow the people produce the detest sense in order to avoid note is too concentrated every how long.
Configuration instruction: a job is needed 3 parameter lists at least by complete definition, is respectively: worksheet, routing table, task list.
The work definition: the simple understanding of work is exactly the thing that will do.Usually the effective ways of handling complex thing are to divide and rule, and becoming huge, a numerous and diverse job analysis a plurality of tasks with clearly defined objective, easy realization to finish is the comparison appropriate methods.Little task after these decompose has been done, and this work also just has been done so.
Explanation of field: the ID of every work is the unique identification of a job of difference; Every work is all by work title, the subsystem under the work, the state of work, carry out type, execution time last time, this execution time, Time Of Next execution, in the time interval, whether alarm the priority of work, overtime switch setting, work comes into effect the time, and the end-of-job entry-into-force time, the work service marking is formed.Only support two kinds to carry out types in present managing group task assembly: a kind of be that regularly type is a kind of is to trigger type.For the timing type of work, when next time, the execution time arrived, assembly just automatically performed this work; For triggering type of work, when needing to carry out, need its execution of manual activation at every turn.When the execution type of this work is to trigger type, Time Of Next execution so, time interval field does not need definition.If the execution type of work is regularly a type, then need to dispose Time Of Next execution, the time interval.When Time Of Next execution is carried out for the first time, by manual configuration, later on by the configuration at interval of the automatic modification time of system.
Fixed time interval is represented: to the execution time between two tasks at interval can by, month, week, day, hour, minute.Example:
Carried out once in every month: add_months (next_date, 1)
Per three weeks carry out once: next_date+3*7
Carried out once in per two days: next_date+2
Carried out once in per three hours: next_date+3/24
Carried out once in per 40 minutes: next_date+40/ (24*60)
Overtime switch setting: when its value is 0, represent that it closes overtime setting; (promptly after this work surpasses timeout minute working time, the state of this work will change into the overrun state by normal operating condition otherwise for opening overtime switch.If alarm is masked as ' 1 ', then can alarm the work of overrun.This moment need be at an alarm of parameter list (td_s_alarm) configuration record.
The state of task node transforms, with reference to figure 3, and according to the assembly of Fig. 4.
Task definition: every task is the logic component units that constitutes a job.Every task all has own uniquely identified ID, task names, and package types, the plug-in unit name, channel number comes into effect the time, finishes the entry-into-force time, the sign that comes into force, whether card address encrypts link information, connects user name, connects password, connects compositions such as SID.Can be applied in the different work for same task, that is to say that it can be shared by one or more work.A typical example in the managing group task assembly, defines two system-level tasks; They are used to represent essential in an all working beginning task (ID is 0) and one end task (ID is-1).They exist as virtual node in the work route, and all routes all have from beginning task node and begin to carry out, and carry out from end node and finish whole work.The managing group task assembly is supported two kinds of package types at present: a kind of is background application or shell script under the UNIX; A kind of is storing process.In the plug-in unit name,, then can comprise the absolute path of appointment in the plugin name if package types is background application or shell script; Otherwise, search and carry out under the shell path of appointment in assembly.As: shell script l.sh, in the plug-in unit name, promptly can be configured to, also can be configured to l.sh.A kind of for the back, only under the work at present catalogue of managing group task or specific shell catalogue, search and carry out.
Channel number exists as task fixed delivery parameter.It goes to explain by managing group task assembly user of service configuration and by corresponding storing process or background application (comprising the shell script).
For example, in the application of BOSS1.0, when the data volume of a table is very big, usually these record data are carried out packet transaction; You can allow specific channel number task handle the particular group data, and (task of 10 passages [numbering from 0 to 9] goes to handle 0 to 9999 group data, and then 0 passage is handled 0-999 group data, and 1 passage is handled the 1000-1999 data, by that analogy).For another example, the storing process that arrearage is handled comprises defaulting subscriber, the pre-pin of arrearage number, arrearage pin function; These functions are combined in the storing process, at this moment can allow storing process explain and use different functions by be configured to different numerical value at channel number.
It is that storing process is provided with that card address is primarily aimed at task type.For non-storing process type, it must be configured to " LOCAL ", because at present performed shell script of managing group task assembly or background application prerequisite be they must with the assembly management assembly on same application server, can't support interdepartmental system to carry out.If task type is a storing process, can be by being configured to " REMOTE ", to reach function expansion: can move the storing process that belongs to different user under the same database instance; Can move the storing process under the disparate databases example.Otherwise, when the position is configured to " LOCAL ", can only moves with the core parameter table and belong to storing process under the same user.When task type is storing process and card address during for " REMOTE ", whether encrypts link information, connect user name, connect password, to connect SID just meaningful.When ISENCRYPT is " NO ", connect the user of database, password, SID are that the form with plain code is kept in the corresponding task; Otherwise, will preserve with the form of encrypting. and the definition of storing process must have fixing parameter to import, spread out of form into, the return code of v_resultcode storing process; The return message of v_resultinfo storing process.Please see Command Line Parsing in detail. do not need to do affairs control in storage, the control of affairs is that realize the outside of storing process.
Route: each work all corresponding a unique execution route.The master control process is carried out satisfying condition of task according to the task of showing in the route successively execution sequence.Last virtual ending task during node in carrying out route is indicating that whole work finishes, and the state of at this moment working is got back to ready state from running status, waits for the arrival of Time Of Next execution.The route classification, route is carried out simple classification:
I) serial route is with reference to figure 1:TB-〉T1-〉T2-〉T3-〉T4-〉T5-〉TE
In above-mentioned work routing diagram, have only after task Ti (i=1-4) is complete and could carry out Ti+1; After last Ti+1 (being T5) is complete, could carry out TE; When TE is performed, think just that this work is performed to finish.The task of composition work is held according to route serial sequentially
II) parallel route: task T1, T2, T3, T4, the concurrent execution of T5.After Ti (i=1-5) is complete, could carry out TE.When TE is performed, think just that this work is performed to finish.
III) mix route
In above-mentioned work routing diagram, task T1, T2, the concurrent execution of T4.Have only as task T1, could carry out T3 after T4 is complete; Have only the T2 of working as, could carry out T5 after T4 is complete; After T3 and T5 are complete, could carry out TE.When TE is performed, think just that this work is performed to finish.No matter (with reference to the configuration of arrearage data generation work in the ucr_yy01_kf.td_s_work table) is any work routing diagram, all has two virtual task nodes in the task of forming work.Any route all is to begin the summit from virtual beginning task node as route, with virtual end node as the route end vertex.Oriented line arrive another task node from a task node is called directed edge (directed edge).Each bar directed edge constitutes a record in the routing table in the work routing diagram.In the work routing diagram, many directed edges that point to same task node have identical control information (promptly being performed the control information of task).These control informations comprise: state, process ID, beginning execution time, finish the execution time, whether overtime, timeout interval is set, is converted into the time interval of status of fail, overtime action code, failure action code, failure retry control number of times, current failure retry control number of times, the last failure retry time, the failure retry time interval from timeout mode.In the managing group task assembly, the directed edge that points to same task node may be many, and control information is redundant in the configuration of work routing table on these directed edges, but necessary.
With reference to figure 3, the state of task node transforms figure, and state comprises: ready (S_PREPARED), normal operation (S_RUNNING), overrun (S_TORUNNING), retry operation (S_REDORUNNING), normal termination (S_END), jump out ends (S_SKIPEND), (S_FAULT) fails.
In the life cycle for some work, these states can all not occur; And the appearance of some state of task node be with directed edge on control information be provided with relation.As, in control information, be not provided with overtimely, then the S_TORUNNING state can not appear in the task node of this directed edge indication.Time institute takes alarm relevant with the failure strategy to carrying out this node with you in the appearance of some state of task node.Process ID is the subprocess ID when carrying out this task node.If this node is the virtual node that ends task, then this process ID is the master control Parent process ID.Beginning execution time and end execution time are write down this task node from beginning to carry out the time keeping that finishes.Whether be provided with overtime is to make restriction working time for this node.When overtime this restriction of task execution time (being timeout interval), then the state of this task will be transformed into the overrun state.If be not provided with, then do not have the overrun state.For the task of overrun state, you can determine to allow it always " overtime " go down, also can allow it arrive some threshold values (promptly being converted into the time interval of status of fail) and change into status of fail automatically from timeout mode.This " decision " depends on the overtime action code that you dispose.In overtime action code, TC_NOTRANSIT is can this node overtime always, up to its failure or finish; TC_TRANSIT can allow and " come to a halt " after this node overrun a period of time at this point.For the failure action code be to the failure processing policy: ignore (giving tacit consent to this task node runs succeeded); Retry (limited or unlimited trial).
When the failure action code was retry, the retry of then failing control number of times, current failure retry control number of times, the last failure retry time, the failure retry time interval worked.Failure retry control number of times then is the unlimited failure of attempting, till this task successful execution smaller or equal to 0.
Alarm: by alarm, the work that overrun or mistake take place is reminded to relevant responsible official,, dealt with problems by the mode of manual intervention so that further find out alarm cause; Can be undertaken by the mode of note and mail.For short message alarm permission can be set and alarm start and end time,, can send note to the phone number of appointment only in this following period of time.Also can accomplish to control for the density of note, require in the time range that allows alarm, to send alarm message once, allow the people produce the detest sense in order to avoid note is too concentrated every how long.Each bar alarm configuration parameter belongs to a certain specific work.When work is in overrun or error status, then can according to work whether the alarm sign determines whether sending alarm notification to the user.Give notice to the user and to depend on the alarm parameter table.It comprises work ID, Alarm ID, alarm mode, the last alarm time, alarm at interval, allow the alarm start time, allow alarm concluding time, Mobile Directory Number, e-mail address, the alarm compositions such as sign that whether come into force.The alarm mode of assembly support at present: a kind of is short message mode; Another kind is a lettergram mode.Assembly does not guarantee that the user who is alarmed necessarily receives alarm notification information; It only inserts relevant warning information in the corresponding alarm interface table, as the short message interface table, and is finished the processing of interface message by relevant interface handling procedure.Alarm interlude unit is minute.Allowing the alarm start time and allowing the form of alarm concluding time is the format string of hh24mi, as, allow from morning 08:00 to evening 9:00 during this period of time in
To user's alarm notification information of sending short messages, its time corresponding format string is respectively: " 0800 ", " 2100 ".The last alarm time is that assembly is safeguarded when alarm automatically, does not need manual intervention.When the user does not wish to receive alarm notification information, he can be set to the alarm sign that whether comes into force not come into force.