org.apache.oozie.action.hadoop
Class LauncherMapper<K1,V1,K2,V2>

java.lang.Object
  extended by org.apache.oozie.action.hadoop.LauncherMapper<K1,V1,K2,V2>
All Implemented Interfaces:
Closeable, Runnable, org.apache.hadoop.mapred.JobConfigurable, org.apache.hadoop.mapred.Mapper<K1,V1,K2,V2>

public class LauncherMapper<K1,V1,K2,V2>
extends Object
implements org.apache.hadoop.mapred.Mapper<K1,V1,K2,V2>, Runnable


Field Summary
static String ACTION_PREFIX
           
static String ACTION_PREPARE_XML
           
static String CONF_OOZIE_ACTION_MAIN_CLASS
           
static String CONF_OOZIE_ACTION_MAX_OUTPUT_DATA
           
static String EXTERNAL_ACTION_STATS
           
static String EXTERNAL_CHILD_IDS
           
 
Constructor Summary
LauncherMapper()
           
 
Method Summary
 void close()
           
 void configure(org.apache.hadoop.mapred.JobConf jobConf)
           
static org.apache.hadoop.fs.Path getActionStatsDataPath(org.apache.hadoop.fs.Path actionDir)
          Get the location of stats file
static org.apache.hadoop.fs.Path getErrorPath(org.apache.hadoop.fs.Path actionDir)
           
static org.apache.hadoop.fs.Path getExternalChildIDsDataPath(org.apache.hadoop.fs.Path actionDir)
          Get the location of external Child IDs file
static org.apache.hadoop.fs.Path getIdSwapPath(org.apache.hadoop.fs.Path actionDir)
           
protected  org.apache.hadoop.mapred.JobConf getJobConf()
           
static String[] getMainArguments(org.apache.hadoop.conf.Configuration conf)
           
static org.apache.hadoop.fs.Path getOutputDataPath(org.apache.hadoop.fs.Path actionDir)
           
static String getRecoveryId(org.apache.hadoop.conf.Configuration launcherConf, org.apache.hadoop.fs.Path actionDir, String recoveryId)
           
static boolean hasIdSwap(org.apache.hadoop.mapred.RunningJob runningJob)
           
static boolean hasIdSwap(org.apache.hadoop.mapred.RunningJob runningJob, String user, String group, org.apache.hadoop.fs.Path actionDir)
           
static boolean hasOutputData(org.apache.hadoop.mapred.RunningJob runningJob)
           
static boolean hasStatsData(org.apache.hadoop.mapred.RunningJob runningJob)
          Check whether runningJob has stats data or not
static boolean isMainDone(org.apache.hadoop.mapred.RunningJob runningJob)
           
static boolean isMainSuccessful(org.apache.hadoop.mapred.RunningJob runningJob)
           
 void map(K1 key, V1 value, org.apache.hadoop.mapred.OutputCollector<K2,V2> collector, org.apache.hadoop.mapred.Reporter reporter)
           
protected  void printContentsOfCurrentDir()
          Print files and directories in current directory.
 void run()
           
static void setupLauncherInfo(org.apache.hadoop.mapred.JobConf launcherConf, String jobId, String actionId, org.apache.hadoop.fs.Path actionDir, String recoveryId, org.apache.hadoop.conf.Configuration actionConf, String prepareXML)
           
static void setupMainArguments(org.apache.hadoop.conf.Configuration launcherConf, String[] args)
           
static void setupMainClass(org.apache.hadoop.conf.Configuration launcherConf, String javaMainClass)
           
static void setupMaxExternalStatsSize(org.apache.hadoop.conf.Configuration launcherConf, int maxStatsData)
          Set the maximum value of stats data
static void setupMaxOutputData(org.apache.hadoop.conf.Configuration launcherConf, int maxOutputData)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONF_OOZIE_ACTION_MAIN_CLASS

public static final String CONF_OOZIE_ACTION_MAIN_CLASS
See Also:
Constant Field Values

CONF_OOZIE_ACTION_MAX_OUTPUT_DATA

public static final String CONF_OOZIE_ACTION_MAX_OUTPUT_DATA
See Also:
Constant Field Values

ACTION_PREFIX

public static final String ACTION_PREFIX
See Also:
Constant Field Values

EXTERNAL_CHILD_IDS

public static final String EXTERNAL_CHILD_IDS
See Also:
Constant Field Values

EXTERNAL_ACTION_STATS

public static final String EXTERNAL_ACTION_STATS
See Also:
Constant Field Values

ACTION_PREPARE_XML

public static final String ACTION_PREPARE_XML
See Also:
Constant Field Values
Constructor Detail

LauncherMapper

public LauncherMapper()
Method Detail

getRecoveryId

public static String getRecoveryId(org.apache.hadoop.conf.Configuration launcherConf,
                                   org.apache.hadoop.fs.Path actionDir,
                                   String recoveryId)
                            throws HadoopAccessorException,
                                   IOException
Parameters:
launcherConf -
actionDir -
recoveryId -
Returns:
Throws:
HadoopAccessorException
IOException

setupMainClass

public static void setupMainClass(org.apache.hadoop.conf.Configuration launcherConf,
                                  String javaMainClass)

setupMainArguments

public static void setupMainArguments(org.apache.hadoop.conf.Configuration launcherConf,
                                      String[] args)

setupMaxOutputData

public static void setupMaxOutputData(org.apache.hadoop.conf.Configuration launcherConf,
                                      int maxOutputData)

setupMaxExternalStatsSize

public static void setupMaxExternalStatsSize(org.apache.hadoop.conf.Configuration launcherConf,
                                             int maxStatsData)
Set the maximum value of stats data

Parameters:
launcherConf - the oozie launcher configuration
maxStatsData - the maximum allowed size of stats data

setupLauncherInfo

public static void setupLauncherInfo(org.apache.hadoop.mapred.JobConf launcherConf,
                                     String jobId,
                                     String actionId,
                                     org.apache.hadoop.fs.Path actionDir,
                                     String recoveryId,
                                     org.apache.hadoop.conf.Configuration actionConf,
                                     String prepareXML)
                              throws IOException,
                                     HadoopAccessorException
Parameters:
launcherConf -
jobId -
actionId -
actionDir -
recoveryId -
actionConf -
Throws:
IOException
HadoopAccessorException

isMainDone

public static boolean isMainDone(org.apache.hadoop.mapred.RunningJob runningJob)
                          throws IOException
Throws:
IOException

isMainSuccessful

public static boolean isMainSuccessful(org.apache.hadoop.mapred.RunningJob runningJob)
                                throws IOException
Throws:
IOException

hasOutputData

public static boolean hasOutputData(org.apache.hadoop.mapred.RunningJob runningJob)
                             throws IOException
Throws:
IOException

hasStatsData

public static boolean hasStatsData(org.apache.hadoop.mapred.RunningJob runningJob)
                            throws IOException
Check whether runningJob has stats data or not

Parameters:
runningJob - the runningJob
Returns:
returns whether the running Job has stats data or not
Throws:
IOException

hasIdSwap

public static boolean hasIdSwap(org.apache.hadoop.mapred.RunningJob runningJob)
                         throws IOException
Parameters:
runningJob -
Returns:
Throws:
IOException

hasIdSwap

public static boolean hasIdSwap(org.apache.hadoop.mapred.RunningJob runningJob,
                                String user,
                                String group,
                                org.apache.hadoop.fs.Path actionDir)
                         throws IOException,
                                HadoopAccessorException
Parameters:
runningJob -
user -
group -
actionDir -
Returns:
Throws:
IOException
HadoopAccessorException

getOutputDataPath

public static org.apache.hadoop.fs.Path getOutputDataPath(org.apache.hadoop.fs.Path actionDir)

getActionStatsDataPath

public static org.apache.hadoop.fs.Path getActionStatsDataPath(org.apache.hadoop.fs.Path actionDir)
Get the location of stats file

Parameters:
actionDir - the action directory
Returns:
the hdfs location of the file

getExternalChildIDsDataPath

public static org.apache.hadoop.fs.Path getExternalChildIDsDataPath(org.apache.hadoop.fs.Path actionDir)
Get the location of external Child IDs file

Parameters:
actionDir - the action directory
Returns:
the hdfs location of the file

getErrorPath

public static org.apache.hadoop.fs.Path getErrorPath(org.apache.hadoop.fs.Path actionDir)

getIdSwapPath

public static org.apache.hadoop.fs.Path getIdSwapPath(org.apache.hadoop.fs.Path actionDir)

configure

public void configure(org.apache.hadoop.mapred.JobConf jobConf)
Specified by:
configure in interface org.apache.hadoop.mapred.JobConfigurable

map

public void map(K1 key,
                V1 value,
                org.apache.hadoop.mapred.OutputCollector<K2,V2> collector,
                org.apache.hadoop.mapred.Reporter reporter)
         throws IOException
Specified by:
map in interface org.apache.hadoop.mapred.Mapper<K1,V1,K2,V2>
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException

getJobConf

protected org.apache.hadoop.mapred.JobConf getJobConf()

getMainArguments

public static String[] getMainArguments(org.apache.hadoop.conf.Configuration conf)

run

public void run()
Specified by:
run in interface Runnable

printContentsOfCurrentDir

protected void printContentsOfCurrentDir()
Print files and directories in current directory. Will list files in the sub-directory (only 1 level deep)



Copyright © 2012 Apache Software Foundation. All Rights Reserved.