Summary of the invention
In view of this, the application's object is to provide a kind of workflow task creation method and device, in order to solve in existing task creation scheme, task creation type and the parameter of each workflow node were set before work flow operation, when making it pending data changing separately, the task amount being created cannot be made corresponding variation in time, and the treatment effeciency that causes the wasting of resources or treat deal with data reduces, and the situation of data congestion even occurs.
The application provides a kind of workflow task creation method, comprising:
Obtain the first quantitative value of the pending data of work at present stream node;
Wherein, described work at present stream node is the workflow node to be started of the workflow in running status;
The second quantitative value of determining the required creation task of described work at present stream node according to described the first quantitative value, described the second quantitative value is more than or equal to 2;
If the first preset rules is set up, the task class offset of described work at present stream node is set for splitting type;
If the second preset rules is set up, the task creation limit value that described fractionation type is set is the second quantitative value;
Start described work at present stream node;
Create the task of described the second quantitative value.
Said method, preferred, the task of described the second quantitative value of described establishment comprises:
In default thread pool, activate the thread of described the second quantitative value;
The thread triggering the activation creates respectively its each self-corresponding task.
Said method, preferred, described the first preset rules is that the current task types value of described work at present stream node is general type or merges type;
If described the first preset rules is false, described method also comprises:
Set up if carry out described the second preset rules, the task creation limit value that described fractionation type is set is the second quantitative value.
Said method, preferred, the second preset rules is that the current task establishment limit value of the fractionation type of work at present stream node is greater than or less than described the second quantitative value;
If described the first preset rules is false and described the second preset rules is false, described method also comprises:
Carry out described startup work at present stream node.
The application also provides a kind of workflow task creation apparatus, comprising:
The first quantitative value acquiring unit, for obtaining first quantitative value of pending data of work at present stream node;
Wherein, described work at present stream node is the workflow node to be started of the workflow in running status;
The second quantitative value acquiring unit, for determine the second quantitative value of the required creation task of described work at present stream node according to described the first quantitative value, described the second quantitative value is more than or equal to 2;
The first setting unit, if set up for the first preset rules, arranges the task class offset of described work at present stream node for splitting type;
The second setting unit, if set up for the second preset rules, the task creation limit value that described fractionation type is set is the second quantitative value;
Trigger start unit, for starting described work at present stream node;
Task creation unit, for creating the task of described the second quantitative value.
Said apparatus, preferred, described task creation unit comprises:
Thread activates subelement, for activate the thread of described the second quantitative value at default thread pool;
Task creation subelement, creates respectively its each self-corresponding task for the thread triggering the activation.
From such scheme, a kind of workflow task creation method and device that the application provides, flow the first quantitative value of the pending data of node by obtaining work at present, determine the second quantitative value of the required creation task of described work at present stream node according to described the first quantitative value, the task class offset that described work at present stream node is set is that fractionation type the task creation limit value that described fractionation type is set are the second quantitative value, thereby start described work at present stream node, create the task of described the second quantitative value, afterwards realize dynamic creation multitask in work flow operation process, create the task of respective numbers according to the data value of the pending data of reality of this workflow node, at hour reduction system resources consumption of pending quantity, and in the time that pending data volume is larger, improve data-handling efficiency.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present application, the technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment is only some embodiments of the present application, instead of whole embodiment.Based on the embodiment in the application, those of ordinary skill in the art are not making the every other embodiment obtaining under creative work prerequisite, all belong to the scope of the application's protection.
With reference to figure 1, it shows the process flow diagram of a kind of workflow task creation method embodiment mono-that the application provides, and described method can comprise the following steps:
Step 101: the first quantitative value of obtaining the pending data of work at present stream node;
Wherein, described work at present stream node is the workflow node to be started of the workflow in running status.
It should be noted that, it is that describedstep 101 starting point of carrying out that is triggered can, for the time point before work at present stream node operation in work flow operation process, can also be work flow operation time point before that the embodiment of the present application is applicable in the process of work flow operation and before operation.
Step 102: determine the second quantitative value of the required creation task of described work at present stream node according to described the first quantitative value, described the second quantitative value is more than or equal to 2.
Wherein, described the second quantitative value is more than or equal to 2 expressions: two even more tasks of the first quantitative value needs of described pending data are processed, and ensure that pending data are processed in time.Be the larger situation of pending data volume that the embodiment of the present application is applicable to workflow node, but be equally applicable to the less situation of pending data volume of workflow node.
Step 103: judge whether the first preset rules is set up, if so,execution step 104;
Step 104: the task class offset of described work at present stream node is set for splitting type.
Wherein, described the first preset rules can be empty, after describedstep 102, gives tacit consent to described the first preset rules and sets up, and carries out described step 104.The task for the required establishment of: work at present stream node of it is also understood that is for being more than or equal to 2, and the non-described fractionation type of initial default type of acquiescence work at present stream node, described the first preset rules is set up thus, the task class offset of described work at present stream node is set for splitting type, make after the operation of work at present stream node starts, can create two or more tasks and treat deal with data and process.
Step 105: judge whether the second preset rules is set up, if so,execution step 106;
Step 106: the task creation limit value that described fractionation type is set is the second quantitative value.
Wherein, described the second preset rules can be empty, gives tacit consent to described the second preset rules and sets up, and after describedstep 104, carries out described step 106.Be: the acquiescence task creation limit value of the fractionation type that describedstep 104 arranges is different from described the second quantitative value, carries out thus describedstep 106.
Step 107: start described work at present stream node.
Step 108: the task of creating described the second quantitative value.
Preferably, create the task of described the second quantitative value by the flow engine of the described work at present stream node in starting state, and then by creating of task, described pending data are processed.
It should be noted that, be more than or equal to 2 from described the second quantitative value, the quantity of creating in describedstep 108 of task is for being more than or equal to 2.
From such scheme, a kind of workflow task creation method embodiment mono-that the application provides, flow the first quantitative value of the pending data of node by obtaining work at present, determine the second quantitative value of the required creation task of described work at present stream node according to described the first quantitative value, the task class offset that described work at present stream node is set is that fractionation type the task creation limit value that described fractionation type is set are the second quantitative value, thereby start described work at present stream node, create the task of described the second quantitative value, afterwards realize dynamic creation multitask in work flow operation process, create the task of respective numbers according to the data value of the pending data of reality of this workflow node, at hour reduction system resources consumption of pending quantity, and in the time that pending data volume is larger, improve data-handling efficiency.
With reference to figure 2, it shows the part process flow diagram of a kind of workflow task creation method embodiment bis-that the application provides, and wherein, describedstep 108 can comprise the following steps:
Step S201: the thread that activates described the second quantitative value in default thread pool.
Wherein, described default thread pool comprises at least two threads, activates the thread of described the second quantitative value, specific implementation in the following manner at described step S201 in default thread pool:
In default thread pool, whether be more than or equal to described the second quantitative value in the Thread Count value of unactivated state, if, in default thread pool, activate the thread of described the second quantitative value, otherwise, activate the thread in unactivated state in described thread pool, and wait in described thread pool that the thread that is converted to unactivated state by state of activation is activated.Be: if the number of threads in unactivated state in described thread pool is less than described the second quantitative value, first activate the thread in unactivated state, then after waiting for that other threads are converted to unactivated state, the thread of reactivation transition status.
Preferably, in the specific implementation of described step S201, if be less than described the second quantitative value in the Thread Count value of unactivated state in default thread pool, all right:
Wait for that in described thread pool, the number of threads in unactivated state is more than or equal to described the second quantitative value, activate the thread of described the second quantitative value, replace the thread in unactivated state in the described thread pool of above-mentioned activation, and wait in described thread pool that the thread that is converted to unactivated state by state of activation is activated.Be: wait for when the number of threads in unactivated state in thread pool is more than or equal to described the second quantitative value the thread of the second quantitative value described in reactivation.
Step S202: the thread triggering the activation creates respectively its each self-corresponding task.
It should be noted that, it is corresponding with himself that the thread of described each activation all can create a task, and then by creating of task, described pending data are processed.
From such scheme, a kind of workflow task creation method embodiment bis-that the application provides, flow the first quantitative value of the pending data of node by obtaining work at present, determine the second quantitative value of the required creation task of described work at present stream node according to described the first quantitative value, the task class offset that described work at present stream node is set is that fractionation type the task creation limit value that described fractionation type is set are the second quantitative value, thereby start described work at present stream node, in default thread pool, activate the thread of described the second quantitative value, the thread triggering the activation creates respectively its each self-corresponding task, afterwards realize dynamic creation multitask in work flow operation process, create the task of respective numbers according to the data value of the pending data of reality of this workflow node, simultaneously, adopt Thread Pool Technology, treating deal with data by the multiple tasks of the concurrent establishment of multiple threads processes, at hour reduction system resources consumption of pending quantity, and in the time that pending data volume is larger, adopt the scheme of concurrent establishment processing, further reduce the stand-by period of data processing, improve data-handling efficiency.
With reference to figure 3, it shows the process flow diagram of a kind of workflow task creation method embodiment tri-that the application provides, and described method can comprise the following steps:
Step 301: the first quantitative value of obtaining the pending data of work at present stream node;
Wherein, described work at present stream node is the workflow node to be started of the workflow in running status.
It should be noted that, it is that describedstep 301 starting point of carrying out that is triggered can, for the time point before work at present stream node operation in work flow operation process, can also be work flow operation time point before that the embodiment of the present application is applicable in the process of work flow operation and before operation.
Step 302: determine the second quantitative value of the required creation task of described work at present stream node according to described the first quantitative value, described the second quantitative value is more than or equal to 2.
Wherein, described the second quantitative value is more than or equal to 2 expressions: two even more tasks of the first quantitative value needs of described pending data are processed, and ensure that pending data are processed in time.Be the larger situation of pending data volume that the embodiment of the present application is applicable to workflow node, but be equally applicable to the less situation of pending data volume of workflow node.
Step 303: judge whether the first preset rules is set up, if so, execution step 304, otherwise, carry out described step 305;
Step 304: the task class offset of described work at present stream node is set for splitting type.
Wherein, described the first preset rules is: the current task types value of described work at present stream node is general type or merges type.If described the first preset rules is false, be: the default task class offset of described work at present stream node is not for general type or merge type, but fractionation type, be that described current task types value is default task class offset,, without carrying out again described step 304, can directly carry out described step 305.
It should be noted that, described default task class offset refers to, flows node before its work flow operation, the task class offset being pre-arranged in described work at present.
Step 305: judge whether the second preset rules is set up, if so, execution step 306;
Step 306: the task creation limit value that described fractionation type is set is the second quantitative value.
Wherein, described the second preset rules can be empty, gives tacit consent to described the second preset rules and sets up, and after described step 303 or described step 304, carries out described step 306.Be: the default task creation limit value (all can be described as current task and create limit value) of the acquiescence task creation limit value of the fractionation type that described step 304 arranges or described work at present stream node is different from described the second quantitative value, carries out thus described step 306.
It should be noted that, described default task creation limit value refers to, flows node before its work flow operation, the task creation limit value of the fractionation type being pre-arranged in described work at present.
Step 307: start described work at present stream node.
Step 308: the task of creating described the second quantitative value.
Preferably, create the task of described the second quantitative value by the flow engine of the described work at present stream node in starting state, and then by creating of task, described pending data are processed.
It should be noted that, be more than or equal to 2 from described the second quantitative value, the quantity of creating in described step 308 of task is for being more than or equal to 2.
From such scheme, a kind of workflow task creation method embodiment tri-that the application provides, flow the first quantitative value of the pending data of node by obtaining work at present, determine the second quantitative value of the required creation task of described work at present stream node according to described the first quantitative value, the task class offset that described work at present stream node is set is that fractionation type the task creation limit value that described fractionation type is set are the second quantitative value, thereby start described work at present stream node, create the task of described the second quantitative value, afterwards realize dynamic creation multitask in work flow operation process, create the task of respective numbers according to the data value of the pending data of reality of this workflow node, at hour reduction system resources consumption of pending quantity, and in the time that pending data volume is larger, improve data-handling efficiency.
Preferably, in the various embodiments described above, described the second preset rules is that the current task establishment limit value of the fractionation type of work at present stream node is greater than or less than described the second quantitative value;
If described the second preset rules is false, described method also comprises:
Carry out the described work at present stream of described startup node.
Wherein, if described the first preset rules is set up, the current task of described work at present stream node creates limit value and is: the task class offset arranging in the embodiment of the present application is the acquiescence task creation limit value that splits type.If described the first preset rules is false, the current task of described work at present stream node creates limit value and is: in the embodiment of the present application, the task class offset that under work at present stream node, workflow is set up between its operation is the acquiescence task creation limit value that splits type.
It should be noted that, if described the second preset rules is false, be: the current task of the fractionation type of described work at present stream node creates limit value and equals described the second quantitative value, be the second quantitative value without carrying out the described task creation limit value that described fractionation type is set, carry out the described work at present stream of described startup node.
With reference to figure 4, it shows the structural representation of a kind of workflow task creation apparatus embodiment tetra-that the application provides, and described device comprises:
The first quantitativevalue acquiring unit 401, for obtaining first quantitative value of pending data of work at present stream node;
Wherein, described work at present stream node is the workflow node to be started of the workflow in running status.
It should be noted that, it is that described the first quantitativevalue acquiring unit 401 starting point of carrying out that is triggered can, for the time point before work at present stream node operation in work flow operation process, can also be work flow operation time point before that the embodiment of the present application is applicable in the process of work flow operation and before operation.
The second quantitativevalue acquiring unit 402, for determine the second quantitative value of the required creation task of described work at present stream node according to described the first quantitative value, described the second quantitative value is more than or equal to 2.
Wherein, described the second quantitative value is more than or equal to 2 expressions: two even more tasks of the first quantitative value needs of described pending data are processed, and ensure that pending data are processed in time.Be the larger situation of pending data volume that the embodiment of the present application is applicable to workflow node, but be equally applicable to the less situation of pending data volume of workflow node.
Thefirst setting unit 403, if set up for the first preset rules, arranges the task class offset of described work at present stream node for splitting type.
Wherein, described the first preset rules can be empty, and thefirst setting unit 403 is given tacit consent to described the first preset rules establishment, carries out the described task class offset that described work at present stream node is set for splitting type.The task for the required establishment of: work at present stream node of it is also understood that is for being more than or equal to 2, and the non-described fractionation type of initial default type of acquiescence work at present stream node, described the first preset rules is set up thus, the task class offset of described work at present stream node is set for splitting type, make after the operation of work at present stream node starts, can create two or more tasks and treat deal with data and process.
Thesecond setting unit 404, if set up for the second preset rules, the task creation limit value that described fractionation type is set is the second quantitative value.
Wherein, described the second preset rules can be empty, and described thesecond setting unit 404 is given tacit consent to described the second preset rules establishment, and carrying out the described task creation limit value that described fractionation type is set is the second quantitative value.Be: the acquiescence task creation limit value of the fractionation type that described thefirst setting unit 403 arranges is different from described the second quantitative value, triggering thus the task creation limit value that described fractionation type is set in described thesecond setting unit 404 is the second quantitative value.
Trigger start unit 405, for starting described work at present stream node.
Task creation unit 406, for creating the task of described the second quantitative value.
Preferably, create the task of described the second quantitative value by the flow engine of the described work at present stream node in starting state, and then by creating of task, described pending data are processed.
It should be noted that, be more than or equal to 2 from described the second quantitative value, the quantity of creating in describedtask creation unit 406 of task is for being more than or equal to 2.
From such scheme, a kind of workflow task creation apparatus embodiment tetra-that the application provides, flow the first quantitative value of the pending data of node by obtaining work at present, determine the second quantitative value of the required creation task of described work at present stream node according to described the first quantitative value, the task class offset that described work at present stream node is set is that fractionation type the task creation limit value that described fractionation type is set are the second quantitative value, thereby start described work at present stream node, create the task of described the second quantitative value, afterwards realize dynamic creation multitask in work flow operation process, create the task of respective numbers according to the data value of the pending data of reality of this workflow node, at hour reduction system resources consumption of pending quantity, and in the time that pending data volume is larger, improve data-handling efficiency.
With reference to figure 5, it shows the part-structure schematic diagram of a kind of workflow task creation apparatus embodiment five that the application provides, and wherein, describedtask creation unit 406 comprises:
Thread activatessubelement 461, for activate the thread of described the second quantitative value at default thread pool.
Wherein, described default thread pool comprises at least two threads, activates the thread of described the second quantitative value, specific implementation in the following manner at describedthread activation subelement 461 in default thread pool:
In default thread pool, whether be more than or equal to described the second quantitative value in the Thread Count value of unactivated state, if, in default thread pool, activate the thread of described the second quantitative value, otherwise, activate the thread in unactivated state in described thread pool, and wait in described thread pool that the thread that is converted to unactivated state by state of activation is activated.Be: if the number of threads in unactivated state in described thread pool is less than described the second quantitative value, first activate the thread in unactivated state, then after waiting for that other threads are converted to unactivated state, the thread of reactivation transition status.
Preferably, described thread activates in the specific implementation ofsubelement 461, if be less than described the second quantitative value in the Thread Count value of unactivated state in default thread pool, all right:
Wait for that in described thread pool, the number of threads in unactivated state is more than or equal to described the second quantitative value, activate the thread of described the second quantitative value, replace the thread in unactivated state in the described thread pool of above-mentioned activation, and wait in described thread pool that the thread that is converted to unactivated state by state of activation is activated.Be: wait for when the number of threads in unactivated state in thread pool is more than or equal to described the second quantitative value the thread of the second quantitative value described in reactivation.
Task creation subelement 462, creates respectively its each self-corresponding task for the thread triggering the activation.
It should be noted that, it is corresponding with himself that the thread of described each activation all can create a task, and then by creating of task, described pending data are processed.
From such scheme, a kind of workflow task creation apparatus embodiment five that the application provides, flow the first quantitative value of the pending data of node by obtaining work at present, determine the second quantitative value of the required creation task of described work at present stream node according to described the first quantitative value, the task class offset that described work at present stream node is set is that fractionation type the task creation limit value that described fractionation type is set are the second quantitative value, thereby start described work at present stream node, in default thread pool, activate the thread of described the second quantitative value, the thread triggering the activation creates respectively its each self-corresponding task, afterwards realize dynamic creation multitask in work flow operation process, create the task of respective numbers according to the data value of the pending data of reality of this workflow node, simultaneously, adopt Thread Pool Technology, treating deal with data by the multiple tasks of the concurrent establishment of multiple threads processes, at hour reduction system resources consumption of pending quantity, and in the time that pending data volume is larger, adopt the scheme of concurrent establishment processing, further reduce the stand-by period of data processing, improve data-handling efficiency.
Preferably, in the various embodiments described above, described the first preset rules is: the current task types value of described work at present stream node is general type or merges type.If described the first preset rules is false, be: the default task class offset of described work at present stream node is not for general type or merge type, but fractionation type, be that described current task types value is default task class offset, described thefirst setting unit 403 is no longer carried out the described task class offset that described work at present stream node is set for splitting type, directly triggers described thesecond setting unit 404.
Preferably, in the various embodiments described above, described the second preset rules is that the current task establishment limit value of the fractionation type of work at present stream node is greater than or less than described the second quantitative value;
Wherein, if described the first preset rules is set up, the current task of described work at present stream node creates limit value and is: the task class offset arranging in the embodiment of the present application is the acquiescence task creation limit value that splits type.If described the first preset rules is false, the current task of described work at present stream node creates limit value and is: in the embodiment of the present application, the task class offset that under work at present stream node, workflow is set up between its operation is the acquiescence task creation limit value that splits type.
It should be noted that, if described the second preset rules is false, be: the current task of the fractionation type of described work at present stream node creates limit value and equals described the second quantitative value, described thesecond setting unit 404 is the second quantitative value without carrying out the described task creation limit value that described fractionation type is set, and carries out the described work at present stream of described startup node but trigger described triggeringstart unit 405.
For example, as shown in Figure 6, for application, the application realizes the schematic flow sheet that multitask creates:
First task quantity is being set;
Create new task A, can be understood as model of creation task A;
Start the thread in thread pool, the concurrent creation task A1 of thread, A2, A3 ... An, wherein n is more than or equal to 2.
Be noted that each embodiment in this instructions all adopts the mode of going forward one by one to describe, what each embodiment stressed is and the difference of other embodiment, between each embodiment identical similar part mutually referring to.
Finally, also it should be noted that, in this article, relational terms such as the first and second grades is only used for an entity or operation to separate with another entity or operational zone, and not necessarily requires or imply and between these entities or operation, have the relation of any this reality or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thereby the process, method, article or the equipment that make to comprise a series of key elements not only comprise those key elements, but also comprise other key elements of clearly not listing, or be also included as the intrinsic key element of this process, method, article or equipment.The in the situation that of more restrictions not, the key element being limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment that comprises described key element and also have other identical element.
Above a kind of workflow task creation method provided by the present invention and device are described in detail, applied specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment is just for helping to understand method of the present invention and core concept thereof; , for one of ordinary skill in the art, according to thought of the present invention, all will change in specific embodiments and applications, in sum, this description should not be construed as the restriction to the application meanwhile.