public class WorkflowManagerImpl extends Object implements WorkflowManager, WorkflowAdmin
Modifier and Type | Field and Description |
---|---|
long |
debugLastSubmittedTimeMs |
Constructor and Description |
---|
WorkflowManagerImpl(org.apache.curator.framework.CuratorFramework curator,
QueueFactory queueFactory,
String instanceName,
List<TaskExecutorSpec> specs,
AutoCleanerHolder autoCleanerHolder,
Serializer serializer,
Executor taskRunnerService) |
Modifier and Type | Method and Description |
---|---|
boolean |
cancelRun(RunId runId)
Attempt to cancel the given run.
|
boolean |
clean(RunId runId)
Delete all saved data for the given run.
|
void |
close() |
void |
debugValidateClosed() |
WorkflowAdmin |
getAdmin()
Return administration operations
|
org.apache.curator.framework.CuratorFramework |
getCurator() |
String |
getInstanceName() |
List<RunId> |
getRunIds()
Return all run IDs completed or currently executing
in the workflow manager
|
List<RunInfo> |
getRunInfo()
Return info about all runs completed or currently executing
in the workflow manager
|
RunInfo |
getRunInfo(RunId runId)
Return info about the given run
|
Serializer |
getSerializer() |
Map<TaskId,TaskDetails> |
getTaskDetails(RunId runId)
Returns a map of all task details for the given run
|
Optional<TaskExecutionResult> |
getTaskExecutionResult(RunId runId,
TaskId taskId)
Return the result for a given task of a given run
|
List<TaskInfo> |
getTaskInfo(RunId runId)
Return info about all the tasks completed, started or waiting for
the given run
|
WorkflowManagerState |
getWorkflowManagerState()
Return information about the internal run/state of the workflow manager
|
WorkflowListenerManager |
newWorkflowListenerManager()
Allocate a new WorkflowListenerManager
|
void |
start()
The manager must be started before use.
|
RunId |
submitSubTask(RunId runId,
RunId parentRunId,
Task task)
Same as
WorkflowManager.submitTask(Task) except that, when completed, the parent run will
be notified. |
RunId |
submitSubTask(RunId parentRunId,
Task task)
Same as
WorkflowManager.submitTask(Task) except that, when completed, the parent run will
be notified. |
RunId |
submitTask(RunId runId,
Task task)
Submit a task for execution.
|
RunId |
submitTask(Task task)
Submit a task for execution.
|
void |
updateTaskProgress(RunId runId,
TaskId taskId,
int progress)
Update task progress info.
|
public WorkflowManagerImpl(org.apache.curator.framework.CuratorFramework curator, QueueFactory queueFactory, String instanceName, List<TaskExecutorSpec> specs, AutoCleanerHolder autoCleanerHolder, Serializer serializer, Executor taskRunnerService)
public org.apache.curator.framework.CuratorFramework getCurator()
public void start()
WorkflowManager
The manager must be started before use. Call Closeable.close()
when done
with the manager. Every instance that starts a manager using
the same WorkflowManagerBuilder.withCurator(CuratorFramework, String, String)
namespace
and version
will participate in the workflow.
One instance will be nominated as the scheduler and will be responsible for starting tasks and advancing the workflow.
Task executors will be started based on the values in the WorkflowManagerBuilder
.
Each WorkflowManager can declare a different combination of task executors
as needed.
start
in interface WorkflowManager
public WorkflowListenerManager newWorkflowListenerManager()
WorkflowManager
newWorkflowListenerManager
in interface WorkflowManager
public Map<TaskId,TaskDetails> getTaskDetails(RunId runId)
WorkflowAdmin
getTaskDetails
in interface WorkflowAdmin
runId
- runpublic RunId submitTask(Task task)
WorkflowManager
submitTask
in interface WorkflowManager
task
- task to executepublic RunId submitTask(RunId runId, Task task)
WorkflowManager
submitTask
in interface WorkflowManager
runId
- the RunId to use - MUST BE GLOBALLY UNIQUEtask
- task to executepublic RunId submitSubTask(RunId parentRunId, Task task)
WorkflowManager
WorkflowManager.submitTask(Task)
except that, when completed, the parent run will
be notified. This method is meant to be used inside of TaskExecutor
for a task
that needs to initiate a sub-run and have the parent run wait for the sub-run to complete.submitSubTask
in interface WorkflowManager
parentRunId
- run id of the parent runtask
- task to executepublic RunId submitSubTask(RunId runId, RunId parentRunId, Task task)
WorkflowManager
WorkflowManager.submitTask(Task)
except that, when completed, the parent run will
be notified. This method is meant to be used inside of TaskExecutor
for a task
that needs to initiate a sub-run and have the parent run wait for the sub-run to complete.submitSubTask
in interface WorkflowManager
runId
- the RunId to use - MUST BE GLOBALLY UNIQUEparentRunId
- run id of the parent runtask
- task to executepublic void updateTaskProgress(RunId runId, TaskId taskId, int progress)
WorkflowManager
TaskExecutor
for a running task to update its execution progress(0-100).updateTaskProgress
in interface WorkflowManager
runId
- run id of the tasktaskId
- the taskprogress
- progress to be setpublic boolean cancelRun(RunId runId)
WorkflowManager
cancelRun
in interface WorkflowManager
runId
- the run to cancelpublic Optional<TaskExecutionResult> getTaskExecutionResult(RunId runId, TaskId taskId)
WorkflowManager
getTaskExecutionResult
in interface WorkflowManager
runId
- the runtaskId
- the taskpublic String getInstanceName()
public void debugValidateClosed()
public void close()
close
in interface Closeable
close
in interface AutoCloseable
public WorkflowAdmin getAdmin()
WorkflowManager
getAdmin
in interface WorkflowManager
public WorkflowManagerState getWorkflowManagerState()
WorkflowAdmin
getWorkflowManagerState
in interface WorkflowAdmin
public boolean clean(RunId runId)
WorkflowAdmin
clean
in interface WorkflowAdmin
runId
- the runpublic RunInfo getRunInfo(RunId runId)
WorkflowAdmin
getRunInfo
in interface WorkflowAdmin
runId
- runpublic List<RunId> getRunIds()
WorkflowAdmin
getRunIds
in interface WorkflowAdmin
public List<RunInfo> getRunInfo()
WorkflowAdmin
getRunInfo
in interface WorkflowAdmin
public List<TaskInfo> getTaskInfo(RunId runId)
WorkflowAdmin
getTaskInfo
in interface WorkflowAdmin
runId
- runpublic Serializer getSerializer()
Copyright © 2014–2018 Nirmata. All rights reserved.