public class JobUtils
extends java.lang.Object
Contains convenience methods used among demo jobs
| Constructor and Description |
|---|
JobUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> java.lang.Class<? extends org.apache.hadoop.mapred.InputFormat<K,V>> |
getMapredInputFormat(org.apache.hadoop.mapred.JobConf conf, java.lang.Class<?> rawClass)
Checks if the given class is an org.apache.hadoop.mapred.InputFormat or an org.apache.hadoop.mapreduce.lib.input.FileInputFormat and returns the appropriate adapter if needed.
|
static org.apache.hadoop.fs.Path[] |
getPaths(java.lang.String inStr, org.apache.hadoop.conf.Configuration conf) |
static void |
jobCleanup(org.apache.hadoop.conf.Configuration conf)
Performs cleaning tasks once a job has finished.
|
static org.apache.hadoop.fs.Path |
setupInputPath(java.lang.String inStr, org.apache.hadoop.mapreduce.Job job) |
static org.apache.hadoop.fs.Path |
setupInputPath(java.lang.String inStr, org.apache.hadoop.mapred.JobConf conf)
A convenience method to infer a job's input provided by the user.
|
static org.apache.hadoop.fs.Path |
setupOutputPath(java.lang.String outStr, org.apache.hadoop.fs.Path basePath, org.apache.hadoop.mapreduce.Job job) |
static org.apache.hadoop.fs.Path |
setupOutputPath(java.lang.String outStr, org.apache.hadoop.fs.Path basePath, org.apache.hadoop.mapred.JobConf conf)
Convenience method for setting a job's output path.
|
static void |
validateInputDataSet(InputDataSet inputDs, org.apache.hadoop.conf.Configuration conf) |
static void |
validateMapRedInputDataSet(InputDataSet inputDs, org.apache.hadoop.mapred.JobConf jobConf) |
public static org.apache.hadoop.fs.Path setupInputPath(java.lang.String inStr,
org.apache.hadoop.mapred.JobConf conf)
throws java.io.IOException
inStr - the input data location. It may be a file's path, a comma-separated paths, a glob expression or an expression of the form path/<filename as regex>, that is, a path where the file name is given by a regular expression.conf - the job configurationjava.io.IOException
public static org.apache.hadoop.fs.Path setupInputPath(java.lang.String inStr,
org.apache.hadoop.mapreduce.Job job)
throws java.io.IOException
java.io.IOException
public static org.apache.hadoop.fs.Path[] getPaths(java.lang.String inStr,
org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
java.io.IOException
public static org.apache.hadoop.fs.Path setupOutputPath(java.lang.String outStr,
org.apache.hadoop.fs.Path basePath,
org.apache.hadoop.mapred.JobConf conf)
throws java.io.IOException
outStr - the output string as specified by the userbasePath - a base folder to be used in case outStr is a relative pathconf - the job configurationjava.io.IOException
public static <K,V> java.lang.Class<? extends org.apache.hadoop.mapred.InputFormat<K,V>> getMapredInputFormat(org.apache.hadoop.mapred.JobConf conf,
java.lang.Class<?> rawClass)
conf - the job configurationrawClass - a class to be used as input format
public static org.apache.hadoop.fs.Path setupOutputPath(java.lang.String outStr,
org.apache.hadoop.fs.Path basePath,
org.apache.hadoop.mapreduce.Job job)
throws java.io.IOException
java.io.IOExceptionpublic static void jobCleanup(org.apache.hadoop.conf.Configuration conf)
conf - the job configurationpublic static void validateMapRedInputDataSet(InputDataSet inputDs, org.apache.hadoop.mapred.JobConf jobConf) throws java.lang.Exception
java.lang.Exceptionpublic static void validateInputDataSet(InputDataSet inputDs, org.apache.hadoop.conf.Configuration conf) throws java.lang.Exception
java.lang.ExceptionCopyright © 2016 Oracle and/or its affiliates. All Rights Reserved.