Class Workflow
- All Implemented Interfaces:
Serializable,Copyable
A workflow whose precedence graph is series-parallel is reduced exactly, by recursive composition of the series-parallel tree, which handles arbitrary nesting (a fork inside a loop, a branch that is itself a fork-join). Graphs that are not series-parallel fall back to the block-based composition, which is a heuristic.
A loop repeats its body a geometric number of times of mean COUNT, the semantics of the POST_LOOP precedence of an activity graph, rather than COUNT times deterministically.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA node of the series-parallel decomposition.static classThe series-parallel decomposition of the precedence graph. -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddActivity(String name, double meanServiceTime) addActivity(String name, Distribution hostDemand) voidvoidaddPrecedence(ActivityPrecedence[] precs) static ActivityPrecedenceAndFork(WorkflowActivity preAct, List<WorkflowActivity> postActs) static ActivityPrecedenceAndJoin(List<WorkflowActivity> preActs, WorkflowActivity postAct) static ActivityPrecedenceAndJoin(List<WorkflowActivity> preActs, WorkflowActivity postAct, int quorum) AND-join waiting for QUORUM of the branches.composeLoopGeometric(Matrix alpha, Matrix T, double count) Geometric repetition of a PH law, the POST_LOOP semantics of an activity graph: the number of executions of the body is geometric of mean COUNT.composeMixture(List<Matrix> alphas, List<Matrix> Ts, double[] probs) Probabilistic mixture of several PH laws, which is aph_simplify pattern 3 generalised to any number of branches.composeParallel(Matrix alpha1, Matrix T1, Matrix alpha2, Matrix T2) composeRepeat(Matrix alpha, Matrix T, int count) Deterministic COUNT-fold convolution of a PH law.composeSerial(Matrix alpha1, Matrix T1, Matrix alpha2, Matrix T2) static WorkflowfromWfCommons(String jsonFile) Load a workflow from a WfCommons JSON file.static WorkflowfromWfCommons(String jsonFile, WfCommonsOptions options) Load a workflow from a WfCommons JSON file with options.getActivity(String name) Cached series-parallel decomposition, or null when the precedence graph is not series-parallel.voidinvalidateActivity(int actIdx) Mark the law of one activity dirty, keeping the topology and every other cached block.voidDiscard the cached law and decomposition, after a change that can alter the shape of the series-parallel tree.static booleanTrue when the phase graph of T has no cycle.static ActivityPrecedenceLoop(WorkflowActivity preAct, List<WorkflowActivity> postActs, double count) static ActivityPrecedenceOrFork(WorkflowActivity preAct, List<WorkflowActivity> postActs, double[] probs) static ActivityPrecedenceOrJoin(List<WorkflowActivity> preActs, WorkflowActivity postAct) Recompose the workflow law after a demand change, reusing every cached series-parallel node whose subtree is unchanged.voidrescaleActivityLeaf(int actIdx, double factor) Time-scale a cached leaf in place, as T -> T*factor with alpha fixed.static ActivityPrecedence[]Serial(WorkflowActivity... activities) voidsetActivityDemand(String name, Distribution hostDemand) Change the host demand of one activity, marking only that leaf dirty.voidsetActivityDemandMean(String name, double meanValue) Change only the mean of one activity, preserving its shape and order.toPH()Composed law of the workflow execution time.validate()Methods inherited from class jline.lang.Model
getAttribute, getName, getVersion, setAttribute, setName, setVersion
-
Constructor Details
-
Workflow
-
-
Method Details
-
addActivity
-
addActivity
-
addPrecedence
-
addPrecedence
-
getActivity
-
getActivities
-
getPrecedences
-
validate
-
toPH
Composed law of the workflow execution time.- Returns:
- an APH, or a PH when the composed generator is cyclic, which a geometric loop over a multi-phase body makes it
-
refreshPH
Recompose the workflow law after a demand change, reusing every cached series-parallel node whose subtree is unchanged.- Returns:
- the composed law
-
setActivityDemand
Change the host demand of one activity, marking only that leaf dirty.- Parameters:
name- activity namehostDemand- new host demand law
-
setActivityDemandMean
Change only the mean of one activity, preserving its shape and order.- Parameters:
name- activity namemeanValue- new mean
-
invalidateTopology
public void invalidateTopology()Discard the cached law and decomposition, after a change that can alter the shape of the series-parallel tree. -
invalidateActivity
public void invalidateActivity(int actIdx) Mark the law of one activity dirty, keeping the topology and every other cached block.- Parameters:
actIdx- activity index
-
rescaleActivityLeaf
public void rescaleActivityLeaf(int actIdx, double factor) Time-scale a cached leaf in place, as T -> T*factor with alpha fixed.- Parameters:
actIdx- activity indexfactor- rate scaling factor
-
getSPTree
Cached series-parallel decomposition, or null when the precedence graph is not series-parallel. Field execs carries the expected number of executions of each node per workflow execution.- Returns:
- the decomposition
-
composeSerial
-
composeMixture
public static Pair<Matrix,Matrix> composeMixture(List<Matrix> alphas, List<Matrix> Ts, double[] probs) Probabilistic mixture of several PH laws, which is aph_simplify pattern 3 generalised to any number of branches.- Parameters:
alphas- branch initial vectorsTs- branch subgeneratorsprobs- branch probabilities- Returns:
- the mixture law
-
composeLoopGeometric
Geometric repetition of a PH law, the POST_LOOP semantics of an activity graph: the number of executions of the body is geometric of mean COUNT.For COUNT>=1 the body runs at least once and repeats on absorption with probability P = 1-1/COUNT, so T_OUT = T + P/D*(-T*e)*ALPHA and ALPHA_OUT = ALPHA/D with D = 1-P*(1-ALPHA*e) the correction for an atom at zero in ALPHA. The order is that of the body, unlike the COUNT-fold convolution of composeRepeat, and the mean is COUNT times the mean of the body in both cases. For COUNT<1 the body is executed at most once, with probability COUNT.
- Parameters:
alpha- body initial vectorT- body subgeneratorcount- mean number of executions- Returns:
- the repeated law
-
isAcyclicGenerator
True when the phase graph of T has no cycle. A geometric loop over a body of two or more phases closes a cycle, so the composed law is a PH and not an APH.- Parameters:
T- subgenerator- Returns:
- true when acyclic
-
composeParallel
-
composeRepeat
Deterministic COUNT-fold convolution of a PH law. The POST_LOOP precedence of an activity graph is instead geometric; use composeLoopGeometric for it.- Parameters:
alpha- initial vectorT- subgeneratorcount- number of executions- Returns:
- the convolved law
-
Serial
-
AndFork
-
AndJoin
-
AndJoin
public static ActivityPrecedence AndJoin(List<WorkflowActivity> preActs, WorkflowActivity postAct, int quorum) AND-join waiting for QUORUM of the branches. Workflow refuses a partial join, since it is not the maximum of the branches; the overload exists so that such a graph is rejected by name rather than mis-composed.- Parameters:
preActs- branch tail activitiespostAct- activity after the joinquorum- number of branches to wait for- Returns:
- the precedence
-
OrFork
public static ActivityPrecedence OrFork(WorkflowActivity preAct, List<WorkflowActivity> postActs, double[] probs) -
OrJoin
-
Loop
public static ActivityPrecedence Loop(WorkflowActivity preAct, List<WorkflowActivity> postActs, double count) -
fromWfCommons
Load a workflow from a WfCommons JSON file.WfCommons (https://github.com/wfcommons/workflow-schema) is a standard format for representing scientific workflow traces.
- Parameters:
jsonFile- Path to the WfCommons JSON file- Returns:
- Workflow object
- Throws:
IOException- If the file cannot be read
-
fromWfCommons
Load a workflow from a WfCommons JSON file with options.- Parameters:
jsonFile- Path to the WfCommons JSON fileoptions- Loader options- Returns:
- Workflow object
- Throws:
IOException- If the file cannot be read
-