160 likes | 234 Views
Early Completion of the Flow Activity - A proposal -. Scenario. In many cases the process does not need to wait for all the concurrent activities to complete in order to reach the overall goal
E N D
Scenario • In many cases the process does not need to wait for all the concurrent activities to complete in order to reach the overall goal • Example: A process is waiting in parallel for 3 reviews of a paper. If 2 positive reviews are received the paper will be accepted. Otherwise, all 3 reviews will be collected and the rejection including the responses from reviewers should be sent to the authors.
Requirements • A way to express that the desired goal has been achieved is needed • All active concurrent activities that are considered as “unnecessary” should be terminated • Ability to support various flavors of conditions used to specify when the desired goal has been achieved: • Wait for N out of M • Wait until after condition C evaluates to true • The condition is evaluated immediately after one branch has completed
Proposal Consists of two parts: • Activity <complete> • Specifies a way to explicitly complete a <flow> activity • Includes termination of the active concurrent activities • Completion condition for the <flow> activity • Hides a part of the early completion pattern (e.g. counter for completed branches)
Proposal (cont’d) • Targeting <flow> activity only – not <scope> • Most common cases for early completion: 80-20 rule • All flow branches MUST be <scope> based • Encapsulate the effect and work of early completion to each branch. E.g.: Enabling self clean up of branches • Allow differentiation of branch-based completion conditions • 1 + 2 together • avoid the need of <completionHandler> at <scope> • <completionHandler> not easy to understand and define
Activity <complete>: Syntax <complete target="flow-activity-name" /> Example:<flow name="F1"> <scope name="scopeA"> <sequence> … <switch> <case><condition> … </condition> <complete target="F1" /> … </scope> <scope name="scopeB"> … other parallel action … </scope> <scope name="scopeC"> … other parallel action … </scope> </flow>
scopeA scopeC scopeB TH TH TH CH CH CH seq seq seq Activity <complete>: Diagram Flow F1 TH =termination handler CH =compensation handler … early completionsignal … … complete termination signal
Activity <complete>: Semantics • <complete> activity (at ‘ScopeA’) sends early-completion signal to the target flow activity ‘F1’ • Flow ‘F1’ sends termination signal to scope-based branches which are still running – ‘ScopeB’ and ‘ScopeC’ • TH of ‘ScopeB’ and ‘ScopeC’ are activated • TH may invoke CH • Reach end of the flow, after TH are finished
Completion condition: Syntax <flow> <completionCondition> ? <branches expressionLanguage="URI"? countCompletedScopesOnly="yes|no"?> an-integer-expression </branches>? <booleanExpression expressionLanguage="URI"?> a-boolean-expression </booleanExpression>? </completionCondition> </flow>
Completion condition: Semantics <flow name=“f1”> <completionCondition> <booleanExpression> a-boolean-expression </booleanExpression> </completionCondition> <scope name="s1"> … </scope> <scope name="s2"> … </scope> </flow> …Would be translated into ->
Completion condition: Semantics (cont.) <flow name="f1"> <scope name="s1"> <sequence> activity-X <switch> <case> <condition> a-boolean-expression </condition> <complete target="f1" /> </case> </switch> </sequence> </scope> <scope name="s2"> <sequence>activity-Y <switch> … similar switch … </switch> </sequence> </scope> </flow>
Completion condition: Semantics (cont.) <flow name=“f1”> <completionCondition> <branches countCompletedScopesOnly="yes"> 2 </branches> </completionCondition> <scope name="s1"> … </scope> <scope name="s2"> … </scope> <scope name="s3"> … </scope> </flow> …Would be translated into ->
Completion condition: Semantics (cont.) <flow name="f1"> <scope> <sequence> <scope name="s1"> … </scope> <assign>branch=branch+1</assign> <switch> <case> <condition> “branch=2” </condition> <complete target="f1"/> </case> </switch> </sequence> </scope> … </flow>
New standard fault • completionConditionFailure: After all scopes branches ends, if the completionCondition is still evaluated to false, the fault MUST be thrown.
Open issues • Do we need to allow <complete> activity to perform an early completion against a <flow> activity which is not the inner most <flow> activity in the ancestor chain?
Activity <complete>: Cascade Effect Flow F1 Flow F2 … … complete target=F1 … … early completionsignal termination signal