cascading.flow
Class FlowProcess

java.lang.Object
  extended by cascading.flow.FlowProcess
Direct Known Subclasses:
HadoopFlowProcess

public abstract class FlowProcess
extends Object

FlowProcess implementations provide a call-back interface into the current computing system. Each Operation is given a reference to a particluar implemenation, 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, int) may start incrementing from zero if the operation making the call belongs to a subsquent '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.

See Also:
FlowSession

Field Summary
static FlowProcess NULL
          Field NULL is a noop implementation of FlowSession.
 
Constructor Summary
protected FlowProcess()
           
protected FlowProcess(FlowSession currentSession)
           
 
Method Summary
 FlowSession getCurrentSession()
          Method getCurrentSession returns the currentSession of this FlowProcess object.
abstract  Object getProperty(String key)
          Method getProperty should be used to return configuration parameters from the underlying system.
abstract  void increment(Enum counter, int amount)
          Method increment is used to increment a custom counter.
abstract  void increment(String group, String counter, int amount)
          Method increment is used to increment a custom counter.
abstract  void keepAlive()
          Method keepAlive notifies the system that the current process is still alive.
abstract  TupleEntryIterator openTapForRead(Tap tap)
          Method openTapForRead return a TupleIterator for the given Tap instance.
abstract  TupleEntryCollector openTapForWrite(Tap tap)
          Method openTapForWrite 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(String status)
          Method setStatus is used to set the status of the current operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

public static FlowProcess NULL
Field NULL is a noop implementation of FlowSession.

Constructor Detail

FlowProcess

protected FlowProcess()

FlowProcess

protected FlowProcess(FlowSession currentSession)
Method Detail

getCurrentSession

public FlowSession getCurrentSession()
Method getCurrentSession returns the currentSession of this FlowProcess object.

Returns:
the currentSession (type FlowSession) of this FlowProcess object.

setCurrentSession

public void setCurrentSession(FlowSession currentSession)
Method setCurrentSession sets the currentSession of this FlowProcess object.

Parameters:
currentSession - the currentSession of this FlowProcess object.

getProperty

public abstract Object getProperty(String key)
Method getProperty should be used to return configuration parameters from the underlying system.

In the case of Hadoop, the current JobConf will be queried.

Parameters:
key - of type String
Returns:
an Object

keepAlive

public abstract void keepAlive()
Method keepAlive notifies the system that the current process is still alive. Use this method if a particular Operation takes some moments to complete. Each system is different, so calling ping every few seconds to every minute or so would be best.


increment

public abstract void increment(Enum counter,
                               int amount)
Method increment is used to increment a custom counter. Counters must be of type Enum. The amount to increment must be a integer value.

Parameters:
counter - of type Enum
amount - of type int

increment

public abstract void increment(String group,
                               String counter,
                               int amount)
Method increment is used to increment a custom counter. The amount to increment must be a integer value.

Parameters:
group - of type String
counter - of type String
amount - of type int

setStatus

public abstract void setStatus(String status)
Method setStatus is used to set the status of the current operation.

Parameters:
status - of type String

openTapForRead

public abstract TupleEntryIterator openTapForRead(Tap tap)
                                           throws IOException
Method openTapForRead return a TupleIterator for the given Tap instance.

Parameters:
tap - of type Tap
Returns:
TupleIterator
Throws:
IOException - when there is a failure opening the resource

openTapForWrite

public abstract TupleEntryCollector openTapForWrite(Tap tap)
                                             throws IOException
Method openTapForWrite returns a (@link TupleCollector} for the given Tap instance.

Parameters:
tap - of type Tap
Returns:
TupleCollector
Throws:
IOException - when there is a failure opening the resource


Copyright © 2007-2010 Concurrent, Inc. All Rights Reserved.