Class TaskGroup
- All Implemented Interfaces:
Indexable
The method invokeAsync(InvocationContext) ()} kick-off invocation of tasks
in the group, task are invoked in topological sorted order.
addDependencyTaskGroup(TaskGroup): A task group "A" can take dependency on
another task group "B" through this method e.g. `A.addDependencyTaskGroup(B)` indicates that
completion of tasks in the dependency task group "B" is required before the invocation of root
task in group "A". A.invokeAsync(cxt) will ensure this order.
addPostRunDependentTaskGroup(TaskGroup): there are scenarios where a subset
of dependent task groups say "H", "I" may required to run after the invocation of a task group
"K" when K.invokeAsync(cxt) is called. Such special dependents can be added via
K.addPostRunDependentTaskGroup(H) and K.addPostRunDependentTaskGroup(I).
The result produced by the tasks in the group are of type Indexable.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn interface representing a type composes a TaskGroup.static final classA mutable type that can be used to pass data around task items during the invocation of the TaskGroup.protected static final classWrapper type to simplify operations on proxy TaskGroup.Nested classes/interfaces inherited from class com.azure.resourcemanager.resources.fluentcore.dag.Graph
Graph.EdgeType, Graph.Visitor<U> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected TaskGroup.ProxyTaskGroupWrapperThe helper to operate on proxy TaskGroup of this TaskGroup for supporting dependents marked for post run.Fields inherited from class com.azure.resourcemanager.resources.fluentcore.dag.DAGraph
parentDAGs, queue -
Constructor Summary
ConstructorsConstructorDescriptionTaskGroup(IndexableTaskItem rootTaskItem) Creates TaskGroup.Creates TaskGroup. -
Method Summary
Modifier and TypeMethodDescriptionaddDependency(FunctionalTaskItem dependencyTaskItem) Mark root of this task task group depends on the given TaskItem.voidaddDependency(TaskGroup.HasTaskGroup hasTaskGroup) Mark root of this task task group depends on the given item's taskGroup.voidaddDependencyTaskGroup(TaskGroup dependencyTaskGroup) Mark root of this task task group depends on the given task group's root.addPostRunDependent(FunctionalTaskItem dependentTaskItem) Mark the given TaskItem depends on this taskGroup.addPostRunDependent(FunctionalTaskItem dependentTaskItem, ResourceManagerUtils.InternalRuntimeContext internalContext) Mark the given TaskItem depends on this taskGroup.voidaddPostRunDependent(TaskGroup.HasTaskGroup hasTaskGroup) Mark the given item with taskGroup depends on this taskGroup.voidaddPostRunDependentTaskGroup(TaskGroup dependentTaskGroup) Mark root of the given task group depends on this task group's root.booleanChecks this TaskGroup depends on the given TaskGroup.Invokes tasks in the group.invokeAsync(TaskGroup.InvocationContext context) Invokes tasks in the group.Invokes dependency tasks in the group, but not.key()protected TaskGroupEntry<TaskItem>root()taskResult(String taskId) Retrieve the result produced by a task with the given id in the group.Methods inherited from class com.azure.resourcemanager.resources.fluentcore.dag.DAGraph
addDependencyGraph, addDependentGraph, getNext, getNode, hasParents, isPreparer, isRootNode, prepareForEnumeration, reportCompletion, reportError
-
Field Details
-
proxyTaskGroupWrapper
The helper to operate on proxy TaskGroup of this TaskGroup for supporting dependents marked for post run.
-
-
Constructor Details
-
TaskGroup
Creates TaskGroup.- Parameters:
rootTaskItemId- the id of the root task in the grouprootTaskItem- the root task
-
TaskGroup
Creates TaskGroup.- Parameters:
rootTaskItem- the root task
-
-
Method Details
-
key
-
taskResult
Retrieve the result produced by a task with the given id in the group.This method can be used to retrieve the result of invocation of both dependency and "post-run" dependent tasks. If task with the given id does not exists then IllegalArgumentException exception will be thrown.
- Parameters:
taskId- the task item id- Returns:
- the task result, null will be returned if task has not yet been invoked
-
dependsOn
Checks this TaskGroup depends on the given TaskGroup.- Parameters:
taskGroup- the TaskGroup to check- Returns:
- true if TaskGroup is depends on the given TaskGroup
-
root
- Overrides:
rootin classDAGraph<TaskItem,TaskGroupEntry<TaskItem>> - Returns:
- the root task entry in the group.
-
addDependency
Mark root of this task task group depends on the given TaskItem. This ensure this task group's root get picked for execution only after the completion of invocation of provided TaskItem.- Parameters:
dependencyTaskItem- the task item that this task group depends on- Returns:
- the key of the dependency
-
addDependency
Mark root of this task task group depends on the given item's taskGroup. This ensure this task group's root get picked for execution only after the completion of invocation of provided TaskItem.- Parameters:
hasTaskGroup- an item with taskGroup that this task group depends on
-
addDependencyTaskGroup
Mark root of this task task group depends on the given task group's root. This ensure this task group's root get picked for execution only after the completion of all tasks in the given group.- Parameters:
dependencyTaskGroup- the task group that this task group depends on
-
addPostRunDependent
Mark the given TaskItem depends on this taskGroup.- Parameters:
dependentTaskItem- the task item that depends on this task group- Returns:
- key to be used as parameter to taskResult(string) method to retrieve result of invocation of given task item.
-
addPostRunDependent
public String addPostRunDependent(FunctionalTaskItem dependentTaskItem, ResourceManagerUtils.InternalRuntimeContext internalContext) Mark the given TaskItem depends on this taskGroup.- Parameters:
dependentTaskItem- the task item that depends on this task groupinternalContext- the internal runtime context- Returns:
- key to be used as parameter to taskResult(string) method to retrieve result of invocation of given task item.
-
addPostRunDependent
Mark the given item with taskGroup depends on this taskGroup.- Parameters:
hasTaskGroup- an item with as task group that depends on this task group
-
addPostRunDependentTaskGroup
Mark root of the given task group depends on this task group's root. This ensure given task group's root get picked for invocation only after the completion of all tasks in this group. Calling invokeAsync(cxt) will run the tasks in the given dependent task group as well.- Parameters:
dependentTaskGroup- the task group depends on this task group
-
invokeAsync
Invokes tasks in the group. It is not guaranteed to return indexable in topological order.- Parameters:
context- group level shared context that need be passed to invokeAsync(cxt) method of each task item in the group when it is selected for invocation.- Returns:
- an observable that emits the result of tasks in the order they finishes.
-
invokeAsync
Invokes tasks in the group.- Returns:
- the root result of task group.
-
invokeDependencyAsync
Invokes dependency tasks in the group, but not.- Parameters:
context- group level shared context that need be passed to invokeAsync(cxt) method of each task item in the group when it is selected for invocation.- Returns:
- an observable that emits the result of tasks in the order they finishes.
-
newInvocationContext
- Returns:
- a new clean context instance.
-