public class TaskGroup extends DAGraph<TaskItem,TaskGroupEntry<TaskItem>> implements Indexable
The method TaskGroup.invokeAsync(InvocationContext) ()} kick-off invocation of tasks
in the group, task are invoked in topological sorted order.
TaskGroup.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.
TaskGroup.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.
| Modifier and Type | Class and Description |
|---|---|
static interface |
TaskGroup.HasTaskGroup
An interface representing a type composes a TaskGroup.
|
static class |
TaskGroup.InvocationContext
A mutable type that can be used to pass data around task items during the invocation
of the TaskGroup.
|
protected static class |
TaskGroup.ProxyTaskGroupWrapper
Wrapper type to simplify operations on proxy TaskGroup.
|
Graph.EdgeType, Graph.Visitor<U>| Modifier and Type | Field and Description |
|---|---|
protected TaskGroup.ProxyTaskGroupWrapper |
proxyTaskGroupWrapper
The helper to operate on proxy TaskGroup of this TaskGroup for supporting dependents marked
for post run.
|
parentDAGs, queue| Constructor and Description |
|---|
TaskGroup(IndexableTaskItem rootTaskItem)
Creates TaskGroup.
|
TaskGroup(String rootTaskItemId,
TaskItem rootTaskItem)
Creates TaskGroup.
|
| Modifier and Type | Method and Description |
|---|---|
String |
addDependency(FunctionalTaskItem dependencyTaskItem)
Mark root of this task task group depends on the given TaskItem.
|
void |
addDependency(TaskGroup.HasTaskGroup hasTaskGroup)
Mark root of this task task group depends on the given item's taskGroup.
|
void |
addDependencyTaskGroup(TaskGroup dependencyTaskGroup)
Mark root of this task task group depends on the given task group's root.
|
String |
addPostRunDependent(FunctionalTaskItem dependentTaskItem)
Mark the given TaskItem depends on this taskGroup.
|
String |
addPostRunDependent(FunctionalTaskItem dependentTaskItem,
ResourceManagerUtils.InternalRuntimeContext internalContext)
Mark the given TaskItem depends on this taskGroup.
|
void |
addPostRunDependent(TaskGroup.HasTaskGroup hasTaskGroup)
Mark the given item with taskGroup depends on this taskGroup.
|
void |
addPostRunDependentTaskGroup(TaskGroup dependentTaskGroup)
Mark root of the given task group depends on this task group's root.
|
boolean |
dependsOn(TaskGroup taskGroup)
Checks this TaskGroup depends on the given TaskGroup.
|
Mono<Indexable> |
invokeAsync()
Invokes tasks in the group.
|
Flux<Indexable> |
invokeAsync(TaskGroup.InvocationContext context)
Invokes tasks in the group.
|
Flux<Indexable> |
invokeDependencyAsync(TaskGroup.InvocationContext context)
Invokes dependency tasks in the group, but not.
|
String |
key() |
TaskGroup.InvocationContext |
newInvocationContext() |
protected TaskGroupEntry<TaskItem> |
root() |
Indexable |
taskResult(String taskId)
Retrieve the result produced by a task with the given id in the group.
|
addDependencyGraph, addDependentGraph, getNext, getNode, hasParents, isPreparer, isRootNode, prepareForEnumeration, reportCompletion, reportErrorprotected TaskGroup.ProxyTaskGroupWrapper proxyTaskGroupWrapper
public TaskGroup(String rootTaskItemId, TaskItem rootTaskItem)
rootTaskItemId - the id of the root task in the grouprootTaskItem - the root taskpublic TaskGroup(IndexableTaskItem rootTaskItem)
rootTaskItem - the root taskpublic String key()
public Indexable taskResult(String taskId)
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.
taskId - the task item idpublic boolean dependsOn(TaskGroup taskGroup)
taskGroup - the TaskGroup to checkprotected TaskGroupEntry<TaskItem> root()
root in class DAGraph<TaskItem,TaskGroupEntry<TaskItem>>public String addDependency(FunctionalTaskItem dependencyTaskItem)
dependencyTaskItem - the task item that this task group depends onpublic void addDependency(TaskGroup.HasTaskGroup hasTaskGroup)
hasTaskGroup - an item with taskGroup that this task group depends onpublic void addDependencyTaskGroup(TaskGroup dependencyTaskGroup)
dependencyTaskGroup - the task group that this task group depends onpublic String addPostRunDependent(FunctionalTaskItem dependentTaskItem)
dependentTaskItem - the task item that depends on this task grouppublic String addPostRunDependent(FunctionalTaskItem dependentTaskItem, ResourceManagerUtils.InternalRuntimeContext internalContext)
dependentTaskItem - the task item that depends on this task groupinternalContext - the internal runtime contextpublic void addPostRunDependent(TaskGroup.HasTaskGroup hasTaskGroup)
hasTaskGroup - an item with as task group that depends on this task grouppublic void addPostRunDependentTaskGroup(TaskGroup dependentTaskGroup)
dependentTaskGroup - the task group depends on this task grouppublic Flux<Indexable> invokeAsync(TaskGroup.InvocationContext context)
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.public Mono<Indexable> invokeAsync()
public Flux<Indexable> invokeDependencyAsync(TaskGroup.InvocationContext context)
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.public TaskGroup.InvocationContext newInvocationContext()
Copyright © 2021 Microsoft Corporation. All rights reserved.