public abstract class FlowProcess<Config>
extends java.lang.Object
Operation
is given a reference to a particular implementation, allowing it
to get configuration properties, send a "keep alive" ping, or to set a counter value.
Depending on the underlying system, FlowProcess instances are not continuous across all operations in a Flow
.
Thus, a call to increment(Enum, long)
may start incrementing from zero if the operation making the call
belongs to a subsequent 'job' or 'step' from any previous operations calling increment.
A FlowProcess is roughly a child of FlowSession
. FlowSession is roughly one to one with a particular Flow
.
And every FlowSession will have one or more FlowProcesses.FlowSession
Modifier and Type | Class and Description |
---|---|
static class |
FlowProcess.NullFlowProcess |
Modifier and Type | Field and Description |
---|---|
static FlowProcess |
NULL
Field NULL is a noop implementation of FlowSession.
|
Modifier | Constructor and Description |
---|---|
protected |
FlowProcess() |
protected |
FlowProcess(FlowSession currentSession) |
Modifier and Type | Method and Description |
---|---|
abstract Config |
copyConfig(Config jobConf) |
abstract FlowProcess |
copyWith(Config config) |
abstract java.util.Map<java.lang.String,java.lang.String> |
diffConfigIntoMap(Config defaultConfig,
Config updatedConfig) |
abstract Config |
getConfigCopy() |
FlowSession |
getCurrentSession()
Method getCurrentSession returns the currentSession of this FlowProcess object.
|
abstract int |
getCurrentSliceNum()
Method getCurrentSliceNum returns an integer representing which slice instance currently running.
|
java.lang.String |
getID()
Method getID() returns the current
|
java.lang.Integer |
getIntegerProperty(java.lang.String key)
Method getIntegerProperty should be used to return configuration parameters from the underlying system.
|
abstract int |
getNumProcessSlices()
Method getNumProcessSlices returns the number of parallel slices or tasks allocated
for this process execution.
|
abstract java.lang.Object |
getProperty(java.lang.String key)
Method getProperty should be used to return configuration parameters from the underlying system.
|
abstract java.util.Collection<java.lang.String> |
getPropertyKeys()
Method getPropertyKeys returns an immutable collection of all available property key values.
|
java.lang.String |
getStringProperty(java.lang.String key)
Method getStringProperty should be used to return configuration parameters from the underlying system.
|
abstract void |
increment(java.lang.Enum counter,
long amount)
Method increment is used to increment a custom counter.
|
abstract void |
increment(java.lang.String group,
java.lang.String counter,
long amount)
Method increment is used to increment a custom counter.
|
abstract boolean |
isCounterStatusInitialized()
Method isCounterStatusInitialized returns true if it is safe to increment a counter or set a status.
|
abstract void |
keepAlive()
Method keepAlive notifies the system that the current process is still alive.
|
abstract Config |
mergeMapIntoConfig(Config defaultConfig,
java.util.Map<java.lang.String,java.lang.String> map) |
abstract java.lang.Object |
newInstance(java.lang.String className)
Method newInstance creates a new object instance from the given className argument delegating to any
platform specific instantiation and configuration routines.
|
abstract TupleEntryCollector |
openSystemIntermediateForWrite() |
abstract TupleEntryIterator |
openTapForRead(Tap tap)
Method openTapForRead return a
TupleEntryIterator for the given Tap instance. |
abstract TupleEntryCollector |
openTapForWrite(Tap tap)
Method openTapForWrite returns a (@link TupleCollector} for the given Tap instance.
|
abstract TupleEntryCollector |
openTrapForWrite(Tap trap)
Method openTrapForWrite returns a (@link TupleCollector} for the given Tap instance.
|
void |
setCurrentSession(FlowSession currentSession)
Method setCurrentSession sets the currentSession of this FlowProcess object.
|
abstract void |
setStatus(java.lang.String status)
Method setStatus is used to set the status of the current operation.
|
public static FlowProcess NULL
protected FlowProcess()
protected FlowProcess(FlowSession currentSession)
public abstract FlowProcess copyWith(Config config)
public java.lang.String getID()
public FlowSession getCurrentSession()
public void setCurrentSession(FlowSession currentSession)
currentSession
- the currentSession of this FlowProcess object.public abstract int getNumProcessSlices()
public abstract int getCurrentSliceNum()
0
(zero) is the first slice instance.public abstract java.lang.Object getProperty(java.lang.String key)
key
- of type Stringpublic java.lang.String getStringProperty(java.lang.String key)
key
- of type String, null if property is not setpublic java.lang.Integer getIntegerProperty(java.lang.String key)
key
- of type Integer, null if property is not setpublic abstract java.util.Collection<java.lang.String> getPropertyKeys()
public abstract java.lang.Object newInstance(java.lang.String className)
className
- public abstract void keepAlive()
Operation
takes some moments to complete. Each system is different, so calling
ping every few seconds to every minute or so would be best.
This method will fail silently if the underlying mechanism to notify keepAlive status are not initialized.public abstract void increment(java.lang.Enum counter, long amount)
isCounterStatusInitialized()
.counter
- of type Enumamount
- of type intpublic abstract void increment(java.lang.String group, java.lang.String counter, long amount)
isCounterStatusInitialized()
.group
- of type Stringcounter
- of type Stringamount
- of type intpublic abstract void setStatus(java.lang.String status)
isCounterStatusInitialized()
.status
- of type Stringpublic abstract boolean isCounterStatusInitialized()
public abstract TupleEntryIterator openTapForRead(Tap tap) throws java.io.IOException
TupleEntryIterator
for the given Tap instance.
Note the returned iterator will return the same instance of TupleEntry
on every call,
thus a copy must be made of either the TupleEntry or the underlying Tuple
instance if they are to be
stored in a Collection.tap
- of type Tapjava.io.IOException
- when there is a failure opening the resourcepublic abstract TupleEntryCollector openTapForWrite(Tap tap) throws java.io.IOException
tap
- of type Tapjava.io.IOException
- when there is a failure opening the resourcepublic abstract TupleEntryCollector openTrapForWrite(Tap trap) throws java.io.IOException
trap
- of type Tapjava.io.IOException
- when there is a failure opening the resourcepublic abstract TupleEntryCollector openSystemIntermediateForWrite() throws java.io.IOException
java.io.IOException
public abstract Config getConfigCopy()
public abstract java.util.Map<java.lang.String,java.lang.String> diffConfigIntoMap(Config defaultConfig, Config updatedConfig)