public class StreamingCommand
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
StreamingCommand
represents the specification of an external
command to be executed in a Pig Query.
StreamingCommand
encapsulates all relevant details of the
command specified by the user either directly via the STREAM
operator or indirectly via a DEFINE
operator. It includes
details such as input/output/error specifications and also files to be
shipped to the cluster and files to be cached.Modifier and Type | Class and Description |
---|---|
static class |
StreamingCommand.Handle
Handle to communicate with the external process.
|
static class |
StreamingCommand.HandleSpec
Specification about the usage of the
StreamingCommand.Handle to communicate
with the external process. |
Modifier and Type | Field and Description |
---|---|
static int |
MAX_TASKS |
Constructor and Description |
---|
StreamingCommand(PigContext pigContext,
java.lang.String[] argv)
Create a new
StreamingCommand with the given command. |
Modifier and Type | Method and Description |
---|---|
void |
addHandleSpec(StreamingCommand.Handle handle,
StreamingCommand.HandleSpec handleSpec)
Attach a
StreamingCommand.HandleSpec to a given StreamingCommand.Handle |
void |
addPathToCache(java.lang.String path)
Add a file to be cached on execute nodes on the cluster.
|
void |
addPathToShip(java.lang.String path)
Add a file to be shipped to the cluster.
|
java.lang.Object |
clone() |
java.util.List<java.lang.String> |
getCacheSpecs()
Get the list of files which need to be cached on the execute nodes.
|
java.lang.String[] |
getCommandArgs()
Get the parsed command arguments.
|
java.lang.String |
getExecutable()
Get the command to be executed.
|
java.util.List<StreamingCommand.HandleSpec> |
getHandleSpecs(StreamingCommand.Handle handle)
Get specifications for the given
Handle . |
StreamingCommand.HandleSpec |
getInputSpec()
Get the input specification of the
StreamingCommand . |
java.lang.String |
getLogDir()
Get the directory where the log-files of the command are persisted.
|
int |
getLogFilesLimit()
Get the maximum number of tasks whose stderr logs files are persisted.
|
StreamingCommand.HandleSpec |
getOutputSpec()
Get the specification of the primary output of the
StreamingCommand . |
boolean |
getPersistStderr()
Should the stderr of the managed process be persisted?
|
boolean |
getShipFiles()
Get whether files for this command should be shipped or not.
|
java.util.List<java.lang.String> |
getShipSpecs()
Get the list of files which need to be shipped to the cluster.
|
void |
setCommandArgs(java.lang.String[] argv)
Set the command line arguments for the
StreamingCommand . |
void |
setExecutable(java.lang.String executable)
Set the executable for the
StreamingCommand . |
void |
setInputSpec(StreamingCommand.HandleSpec spec)
Set the input specification for the
StreamingCommand . |
void |
setLogDir(java.lang.String logDir)
Set the directory where the log-files of the command are persisted.
|
void |
setLogFilesLimit(int logFilesLimit)
Set the maximum number of tasks whose stderr logs files are persisted.
|
void |
setOutputSpec(StreamingCommand.HandleSpec spec)
Set the specification for the primary output of the
StreamingCommand . |
void |
setPersistStderr(boolean persistStderr)
Specify if the stderr of the managed process should be persisted.
|
void |
setShipFiles(boolean shipFiles)
Set whether files should be shipped or not.
|
java.lang.String |
toString() |
public static final int MAX_TASKS
public StreamingCommand(PigContext pigContext, java.lang.String[] argv)
StreamingCommand
with the given command.pigContext
- PigContext structureargv
- parsed arguments of the command
public java.lang.String getExecutable()
public void setExecutable(java.lang.String executable)
StreamingCommand
.executable
- the executable for the StreamingCommand
public void setCommandArgs(java.lang.String[] argv)
StreamingCommand
.argv
- the command line arguments for the
StreamingCommand
public java.lang.String[] getCommandArgs()
String[]
public java.util.List<java.lang.String> getShipSpecs()
public java.util.List<java.lang.String> getCacheSpecs()
public void addPathToShip(java.lang.String path) throws java.io.IOException
path
- path of the file to be shipped to the clusterjava.io.IOException
public void addPathToCache(java.lang.String path) throws java.io.IOException
path
- path of the file to be cached on the execute nodesjava.io.IOException
public void addHandleSpec(StreamingCommand.Handle handle, StreamingCommand.HandleSpec handleSpec)
StreamingCommand.HandleSpec
to a given StreamingCommand.Handle
handle
- Handle
to which the specification is to
be attached.handleSpec
- HandleSpec
for the given handle.public void setInputSpec(StreamingCommand.HandleSpec spec)
StreamingCommand
.spec
- input specificationpublic StreamingCommand.HandleSpec getInputSpec()
StreamingCommand
.StreamingCommand
public void setOutputSpec(StreamingCommand.HandleSpec spec)
StreamingCommand
.spec
- specification for the primary output of the
StreamingCommand
public StreamingCommand.HandleSpec getOutputSpec()
StreamingCommand
.StreamingCommand
public java.util.List<StreamingCommand.HandleSpec> getHandleSpecs(StreamingCommand.Handle handle)
Handle
.handle
- Handle
of the streamHandle
public boolean getPersistStderr()
true
if the stderr of the managed process should be
persisted, false
otherwise.public void setPersistStderr(boolean persistStderr)
persistStderr
- true
if the stderr of the managed
process should be persisted, else false
public java.lang.String getLogDir()
public void setLogDir(java.lang.String logDir)
logDir
- the directory where the log-files of the command are persistedpublic int getLogFilesLimit()
public void setLogFilesLimit(int logFilesLimit)
logFilesLimit
- the maximum number of tasks whose stderr logs files
are persistedpublic void setShipFiles(boolean shipFiles)
shipFiles
- true
if files of this command should be
shipped, false
otherwisepublic boolean getShipFiles()
true
if files of this command should be shipped,
false
otherwisepublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Object clone()
clone
in class java.lang.Object
Copyright © 2007-2017 The Apache Software Foundation