public class LiteWorkflowInstance extends Object implements org.apache.hadoop.io.Writable, WorkflowInstance
WorkflowInstance.Status
NODE_VAR_SEPARATOR
Modifier | Constructor and Description |
---|---|
protected |
LiteWorkflowInstance() |
|
LiteWorkflowInstance(LiteWorkflowApp def,
org.apache.hadoop.conf.Configuration conf,
String instanceId) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
void |
fail(String nodeName)
Fail the instance.
|
Map<String,String> |
getAllVars()
Return a map with all the variables in the context of the instance.
|
WorkflowApp |
getApp()
Return the workflow application that defines the instance.
|
org.apache.hadoop.conf.Configuration |
getConf()
Return the configuration of the instance.
|
String |
getId()
Return the ID of the instance.
|
NodeDef |
getNodeDef(String executionPath)
Get NodeDef from workflow instance
|
LiteWorkflowApp |
getProcessDefinition() |
WorkflowInstance.Status |
getStatus()
Return the current status of the instance.
|
Object |
getTransientVar(String name)
Return a transient variable from the context of the instance.
|
String |
getTransition(String node)
Return the transition a node did.
|
String |
getVar(String name)
Return a variable from the context of the instance.
|
boolean |
hasEnded() |
int |
hashCode() |
boolean |
hasTransientVar(String name) |
boolean |
isSuspended() |
void |
kill()
Kill the instance.
|
void |
readFields(DataInput dIn) |
void |
resume()
Resume the instance.
|
void |
setAllVars(Map<String,String> varMap)
Add a set of variables in the context of the instance.
|
void |
setStatus(WorkflowInstance.Status status) |
void |
setTransientVar(String name,
Object value)
Set a transient variable in the context of the instance.
|
void |
setVar(String name,
String value)
Set a variable in the context of the instance.
|
boolean |
signal(String executionPath,
String signalValue)
Signal the instance that a node has completed.
|
boolean |
start()
Start the instance.
|
void |
suspend()
Suspend the instance.
|
void |
write(DataOutput dOut) |
protected LiteWorkflowInstance()
public LiteWorkflowInstance(LiteWorkflowApp def, org.apache.hadoop.conf.Configuration conf, String instanceId)
public boolean start() throws WorkflowException
WorkflowInstance
start
in interface WorkflowInstance
WorkflowException
- thrown if the instance could not be started.public boolean signal(String executionPath, String signalValue) throws WorkflowException
WorkflowInstance
signal
in interface WorkflowInstance
executionPath
- execution path of the node that has completed.signalValue
- signal value for the node.true
if the instance has completed its execution, false
otherwise.WorkflowException
public NodeDef getNodeDef(String executionPath)
getNodeDef
in interface WorkflowInstance
executionPath
- execution pathpublic void fail(String nodeName) throws WorkflowException
WorkflowInstance
All executing nodes will be be signaled for fail.
fail
in interface WorkflowInstance
nodeName
- the name of the node to be failed.WorkflowException
- thrown if the instance could not be failed.public void kill() throws WorkflowException
WorkflowInstance
All executing nodes will be be signaled for kill.
kill
in interface WorkflowInstance
WorkflowException
- thrown if the instance could not be killed.public void suspend() throws WorkflowException
WorkflowInstance
suspend
in interface WorkflowInstance
WorkflowException
- thrown if the instance could not be suspended.public boolean isSuspended()
public void resume() throws WorkflowException
WorkflowInstance
resume
in interface WorkflowInstance
WorkflowException
- thrown if the instance could not be resume.public void setVar(String name, String value)
WorkflowInstance
Variables are persisted with the instance.
setVar
in interface WorkflowInstance
name
- variable name.value
- variable value, setting a null
value removes the variable.public Map<String,String> getAllVars()
WorkflowInstance
getAllVars
in interface WorkflowInstance
public void setAllVars(Map<String,String> varMap)
WorkflowInstance
Variables are persisted with the instance.
setAllVars
in interface WorkflowInstance
varMap
- map with the variables to add.public String getVar(String name)
WorkflowInstance
getVar
in interface WorkflowInstance
name
- name of the variable.null
if the variable is not in the context.public void setTransientVar(String name, Object value)
WorkflowInstance
Transient variables are not persisted with the instance.
setTransientVar
in interface WorkflowInstance
name
- transient variable name.value
- transient variable value, setting a null
value removes the variable.public boolean hasTransientVar(String name)
public Object getTransientVar(String name)
WorkflowInstance
getTransientVar
in interface WorkflowInstance
name
- name of the transient variable.null
if the variable is not in the context.public boolean hasEnded()
public LiteWorkflowApp getProcessDefinition()
public WorkflowInstance.Status getStatus()
WorkflowInstance
getStatus
in interface WorkflowInstance
public void setStatus(WorkflowInstance.Status status)
public void write(DataOutput dOut) throws IOException
write
in interface org.apache.hadoop.io.Writable
IOException
public void readFields(DataInput dIn) throws IOException
readFields
in interface org.apache.hadoop.io.Writable
IOException
public org.apache.hadoop.conf.Configuration getConf()
WorkflowInstance
getConf
in interface WorkflowInstance
public WorkflowApp getApp()
WorkflowInstance
getApp
in interface WorkflowInstance
public String getId()
WorkflowInstance
getId
in interface WorkflowInstance
public String getTransition(String node)
WorkflowInstance
This is meaninful only for action and decision nodes.
getTransition
in interface WorkflowInstance
node
- the node name.null
if the node didn't execute yet.Copyright © 2018 Apache Software Foundation. All rights reserved.