|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcascading.flow.Flow
public class Flow
A Pipe assembly is connected to the necessary number of Tap sinks and
sources into a Flow. A Flow is then executed to push the incoming source data through
the assembly into one or more sinks.
Pipe assemblies can be reused in multiple Flow instances. They maintain
no state regarding the Flow execution. Subsequently, Pipe assemblies can be given
parameters through its calling Flow so they can be built in a generic fashion.
When a Flow is created, an optimized internal representation is created that is then executed
within the cluster. Thus any overhead inherent to a give Pipe assembly will be removed
once it's placed in context with the actual execution environment.
Properties
FlowConnector| Nested Class Summary | |
|---|---|
static class |
Flow.FlowHolder
Class FlowHolder is a helper class for wrapping Flow instances. |
| Field Summary | |
|---|---|
protected boolean |
stopJobsOnExit
Field stopJobsOnExit |
| Constructor Summary | |
|---|---|
protected |
Flow()
Used for testing. |
protected |
Flow(Map<Object,Object> properties,
JobConf jobConf,
String name,
|
protected |
Flow(Map<Object,Object> properties,
JobConf jobConf,
String name,
|
| Method Summary | |
|---|---|
void |
addListener(FlowListener flowListener)
Method addListener registers the given flowListener with this instance. |
boolean |
areSinksStale()
Method areSinksStale returns true if any of the sinks referenced are out of date in relation to the sources. |
boolean |
areSourcesNewer(long sinkModified)
Method areSourcesNewer returns true if any source is newer than the given sinkModified date value. |
void |
complete()
Method complete starts the current Flow instance if it has not be previously started, then block until completion. |
void |
deleteSinks()
Method deleteSinks deletes all sinks. |
FlowStats |
getFlowStats()
Method getFlowStats returns the flowStats of this Flow object. |
Flow.FlowHolder |
getHolder()
Used to return a simple wrapper for use as an edge in a graph where there can only be one instance of every edge. |
JobConf |
getJobConf()
Method getJobConf returns the jobConf of this Flow object. |
String |
getName()
Method getName returns the name of this Flow object. |
static boolean |
getPreserveTemporaryFiles(Map<Object,Object> properties)
Returns property preserveTemporaryFiles. |
Tap |
getSink()
Method getSink returns the first sink of this Flow object. |
long |
getSinkModified()
Method getSinkModified returns the youngest modified date of any sink Tap managed by this Flow instance. |
Map<String,Tap> |
getSinks()
Method getSinks returns the sinks of this Flow object. |
Map<String,Tap> |
getSources()
Method getSources returns the sources of this Flow object. |
List<FlowStep> |
getSteps()
Method getSteps returns the steps of this Flow object. |
static boolean |
getStopJobsOnExit(Map<Object,Object> properties)
Returns property stopJobsOnExit. |
Map<String,Tap> |
getTraps()
Method getTraps returns the traps of this Flow object. |
boolean |
hasListeners()
Method hasListeners returns true if FlowListener instances have been registered. |
boolean |
isPreserveTemporaryFiles()
Method isPreserveTemporaryFiles returns true if temporary files will be cleaned when this Flow completes. |
boolean |
isSkipFlow()
Method isSkipFlow returns true if the parent Cascade should skip this Flow instance. |
boolean |
isSkipIfSinkExists()
Method isSkipIfSinkExists returns the skipIfSinkExists of this Flow object. |
boolean |
isStopJobsOnExit()
Method isStopJobsOnExit returns the stopJobsOnExit of this Flow object. |
boolean |
jobsAreLocal()
Method jobsAreLocal returns true if all jobs are executed in-process as a single map and reduce task. |
TapIterator |
openSink()
Method openSink opens the first sink Tap. |
TapIterator |
openSink(String name)
Method openSink opens the named sink Tap. |
TapIterator |
openSource()
Method openSource opens the first source Tap. |
TapIterator |
openSource(String name)
Method openSource opens the named source Tap. |
TapIterator |
openTapForRead(Tap tap)
Method openTapForRead return a TapIterator for the given Tap instance. |
TapCollector |
openTapForWrite(Tap tap)
Method openTapForWrite returns a (@link TapCollector} for the given Tap instance. |
TapIterator |
openTrap()
Method openTrap opens the first trap Tap. |
TapIterator |
openTrap(String name)
Method openTrap opens the named trap Tap. |
protected static void |
printElementGraph(String filename,
|
protected static void |
printElementGraph(Writer writer,
|
boolean |
removeListener(FlowListener flowListener)
Method removeListener removes the given flowListener from this instance. |
void |
run()
Method run implements the Runnable run method. |
protected void |
setName(String name)
|
static void |
setPreserveTemporaryFiles(Map<Object,Object> properties,
boolean preserveTemporaryFiles)
Property preserveTemporaryFiles forces the Flow instance to keep any temporary intermediate data sets. |
protected void |
setSinks(Map<String,Tap> sinks)
|
void |
setSkipIfSinkExists(boolean skipIfSinkExists)
Method setSkipIfSinkExists sets the skipIfSinkExists of this Flow object. |
protected void |
setSources(Map<String,Tap> sources)
|
protected void |
setStepGraph(
|
static void |
setStopJobsOnExit(Map<Object,Object> properties,
boolean stopJobsOnExit)
Propety stopJobsOnExit will tell the Flow to add a JVM shutdown hook that will kill all running processes if the underlying computing system supports it. |
protected void |
setTraps(Map<String,Tap> traps)
|
void |
start()
Method start begins the execution of this Flow instance. |
void |
start(JobConf jobConf)
Method start begins the execution of this Flow instance. |
void |
stop()
Method stop stops all running jobs, killing any currently executing. |
boolean |
tapPathExists(Tap tap)
Method tapExists returns true if the resource represented by the given Tap instance exists. |
String |
toString()
|
void |
writeDOT(String filename)
Method writeDOT writes this Flow instance to the given filename as a DOT file for import into a graphics package. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected boolean stopJobsOnExit
| Constructor Detail |
|---|
protected Flow()
protected Flow(Map<Object,Object> properties,
JobConf jobConf,
String name,
pipeGraph,
stepGraph,
Map<String,Tap> sources,
Map<String,Tap> sinks,
Map<String,Tap> traps)
protected Flow(Map<Object,Object> properties,
JobConf jobConf,
String name,
stepGraph,
Map<String,Tap> sources,
Map<String,Tap> sinks,
Map<String,Tap> traps)
| Method Detail |
|---|
public static void setPreserveTemporaryFiles(Map<Object,Object> properties,
boolean preserveTemporaryFiles)
false.
properties - of type MappreserveTemporaryFiles - of type booleanpublic static boolean getPreserveTemporaryFiles(Map<Object,Object> properties)
properties - of type Map
public static void setStopJobsOnExit(Map<Object,Object> properties,
boolean stopJobsOnExit)
true.
properties - of type MapstopJobsOnExit - of type booleanpublic static boolean getStopJobsOnExit(Map<Object,Object> properties)
properties - of type Map
public String getName()
protected void setName(String name)
protected void setSources(Map<String,Tap> sources)
protected void setSinks(Map<String,Tap> sinks)
protected void setTraps(Map<String,Tap> traps)
protected void setStepGraph(stepGraph)
public JobConf getJobConf()
public FlowStats getFlowStats()
public boolean hasListeners()
FlowListener instances have been registered.
public void addListener(FlowListener flowListener)
flowListener - of type FlowListenerpublic boolean removeListener(FlowListener flowListener)
flowListener - of type FlowListener
public Map<String,Tap> getSources()
public Map<String,Tap> getSinks()
public Map<String,Tap> getTraps()
public Tap getSink()
public boolean isPreserveTemporaryFiles()
public boolean isStopJobsOnExit()
true.
public boolean isSkipIfSinkExists()
public void setSkipIfSinkExists(boolean skipIfSinkExists)
Tap.pathExists(JobConf) returns true.
If Tap.isDeleteOnSinkInit() returns true, this Flow instance will execute after deleting
the Tap resource.
skipIfSinkExists - the skipIfSinkExists of this Flow object.
public boolean isSkipFlow()
throws IOException
Cascade should skip this Flow instance. True is returned
if isSkipIfSinkExists returns true and any of the sinks exist and are not
Tap.isDeleteOnSinkInit(). Or is the sinks are newer than the sources.
IOException - when
public boolean areSinksStale()
throws IOException
Tap.isDeleteOnSinkInit() returns true.
IOException - when
public boolean areSourcesNewer(long sinkModified)
throws IOException
sinkModified - of type long
IOException - when
public long getSinkModified()
throws IOException
Tap managed by this Flow instance.
If zero (0) is returned, atleast one of the sink resources does not exist. If minus one (-1) is returned,
atleast one of the sinks are marked for delete (returns true).
IOException - whenpublic List<FlowStep> getSteps()
public void start(JobConf jobConf)
complete()
to block until this Flow completes. The given JobConf instance will replace any previous value.
jobConf - of type JobConfpublic void start()
complete()
to block until this Flow completes.
public void stop()
public void complete()
public TapIterator openSource()
throws IOException
IOException - when
public TapIterator openSource(String name)
throws IOException
name - of type String
IOException - when
public TapIterator openSink()
throws IOException
IOException - when
public TapIterator openSink(String name)
throws IOException
name - of type String
IOException - when
public TapIterator openTrap()
throws IOException
IOException - when
public TapIterator openTrap(String name)
throws IOException
name - of type String
IOException - when
public void deleteSinks()
throws IOException
Cascade before executing the flow if the sinks are stale.
Use with caution.
IOException - when
public boolean tapPathExists(Tap tap)
throws IOException
tap - of type Tap
IOException - when
public TapIterator openTapForRead(Tap tap)
throws IOException
TapIterator for the given Tap instance.
tap - of type Tap
IOException - when
public TapCollector openTapForWrite(Tap tap)
throws IOException
tap - of type Tap
IOException - whenpublic boolean jobsAreLocal()
public void run()
run in interface Runnablepublic String toString()
toString in class Objectpublic void writeDOT(String filename)
filename - of type Stringpublic Flow.FlowHolder getHolder()
protected static void printElementGraph(String filename,
graph)
protected static void printElementGraph(Writer writer,
graph)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||