public class JobHelper extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
JobHelper.DataPusher
Simple interface for retry operations
|
| Constructor and Description |
|---|
JobHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
authenticate()
Does authenticate against a secured hadoop cluster
In case of any bug fix make sure to fix the code at HdfsStorageAuthentication#authenticate as well.
|
static long |
copyFileToZipStream(File file,
ZipOutputStream zipOutputStream,
org.apache.hadoop.util.Progressable progressable) |
static org.apache.hadoop.fs.Path |
distributedClassPath(org.apache.hadoop.fs.Path base) |
static org.apache.hadoop.fs.Path |
distributedClassPath(String path) |
static void |
ensurePaths(HadoopDruidIndexerConfig config) |
static String |
getJobTrackerAddress(org.apache.hadoop.conf.Configuration config) |
static URI |
getURIFromSegment(DataSegment dataSegment) |
static void |
injectDruidProperties(org.apache.hadoop.conf.Configuration configuration,
HadoopDruidIndexerConfig hadoopDruidIndexerConfig) |
static org.apache.hadoop.conf.Configuration |
injectSystemProperties(org.apache.hadoop.conf.Configuration conf,
HadoopDruidIndexerConfig hadoopDruidIndexerConfig) |
static org.apache.hadoop.fs.Path |
makeFileNamePath(org.apache.hadoop.fs.Path basePath,
org.apache.hadoop.fs.FileSystem fs,
DataSegment segmentTemplate,
String baseFileName,
DataSegmentPusher dataSegmentPusher) |
static org.apache.hadoop.fs.Path |
makeTmpPath(org.apache.hadoop.fs.Path basePath,
org.apache.hadoop.fs.FileSystem fs,
DataSegment segmentTemplate,
org.apache.hadoop.mapreduce.TaskAttemptID taskAttemptID,
DataSegmentPusher dataSegmentPusher) |
static void |
maybeDeleteIntermediatePath(boolean jobSucceeded,
HadoopIngestionSpec indexerSchema) |
static org.apache.hadoop.fs.Path |
prependFSIfNullScheme(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path) |
static void |
renameIndexFilesForSegments(HadoopIngestionSpec indexerSchema,
List<DataSegmentAndIndexZipFilePath> segmentAndIndexZipFilePaths)
Renames the index files for the segments.
|
static boolean |
runJobs(List<Jobby> jobs) |
static boolean |
runSingleJob(Jobby job) |
static DataSegmentAndIndexZipFilePath |
serializeOutIndex(DataSegment segmentTemplate,
org.apache.hadoop.conf.Configuration configuration,
org.apache.hadoop.util.Progressable progressable,
File mergedBase,
org.apache.hadoop.fs.Path finalIndexZipFilePath,
org.apache.hadoop.fs.Path tmpPath,
DataSegmentPusher dataSegmentPusher) |
static void |
setupClasspath(org.apache.hadoop.fs.Path distributedClassPath,
org.apache.hadoop.fs.Path intermediateClassPath,
org.apache.hadoop.mapreduce.Job job)
Uploads jar files to hdfs and configures the classpath.
|
static com.google.common.base.Predicate<Throwable> |
shouldRetryPredicate() |
static long |
unzipNoGuava(org.apache.hadoop.fs.Path zip,
org.apache.hadoop.conf.Configuration configuration,
File outDir,
org.apache.hadoop.util.Progressable progressable,
org.apache.hadoop.io.retry.RetryPolicy retryPolicy) |
static void |
writeJobIdToFile(String hadoopJobIdFileName,
String hadoopJobId) |
static void |
writeSegmentDescriptor(org.apache.hadoop.fs.FileSystem outputFS,
DataSegmentAndIndexZipFilePath segmentAndPath,
org.apache.hadoop.fs.Path descriptorPath,
org.apache.hadoop.util.Progressable progressable) |
static long |
zipAndCopyDir(File baseDir,
OutputStream baseOutputStream,
org.apache.hadoop.util.Progressable progressable) |
public static final String INDEX_ZIP
public static org.apache.hadoop.fs.Path distributedClassPath(String path)
public static org.apache.hadoop.fs.Path distributedClassPath(org.apache.hadoop.fs.Path base)
public static void authenticate()
public static void setupClasspath(org.apache.hadoop.fs.Path distributedClassPath,
org.apache.hadoop.fs.Path intermediateClassPath,
org.apache.hadoop.mapreduce.Job job)
throws IOException
distributedClassPath - classpath shared across multiple jobsintermediateClassPath - classpath exclusive for this job. used to upload SNAPSHOT jar files.job - job to runIOExceptionpublic static com.google.common.base.Predicate<Throwable> shouldRetryPredicate()
public static void injectDruidProperties(org.apache.hadoop.conf.Configuration configuration,
HadoopDruidIndexerConfig hadoopDruidIndexerConfig)
public static org.apache.hadoop.conf.Configuration injectSystemProperties(org.apache.hadoop.conf.Configuration conf,
HadoopDruidIndexerConfig hadoopDruidIndexerConfig)
public static void ensurePaths(HadoopDruidIndexerConfig config)
public static void writeJobIdToFile(String hadoopJobIdFileName, String hadoopJobId)
public static boolean runSingleJob(Jobby job)
public static void maybeDeleteIntermediatePath(boolean jobSucceeded,
HadoopIngestionSpec indexerSchema)
public static DataSegmentAndIndexZipFilePath serializeOutIndex(DataSegment segmentTemplate, org.apache.hadoop.conf.Configuration configuration, org.apache.hadoop.util.Progressable progressable, File mergedBase, org.apache.hadoop.fs.Path finalIndexZipFilePath, org.apache.hadoop.fs.Path tmpPath, DataSegmentPusher dataSegmentPusher) throws IOException
IOExceptionpublic static void writeSegmentDescriptor(org.apache.hadoop.fs.FileSystem outputFS,
DataSegmentAndIndexZipFilePath segmentAndPath,
org.apache.hadoop.fs.Path descriptorPath,
org.apache.hadoop.util.Progressable progressable)
throws IOException
IOExceptionpublic static long zipAndCopyDir(File baseDir, OutputStream baseOutputStream, org.apache.hadoop.util.Progressable progressable) throws IOException
IOExceptionpublic static long copyFileToZipStream(File file, ZipOutputStream zipOutputStream, org.apache.hadoop.util.Progressable progressable) throws IOException
IOExceptionpublic static org.apache.hadoop.fs.Path makeFileNamePath(org.apache.hadoop.fs.Path basePath,
org.apache.hadoop.fs.FileSystem fs,
DataSegment segmentTemplate,
String baseFileName,
DataSegmentPusher dataSegmentPusher)
public static org.apache.hadoop.fs.Path makeTmpPath(org.apache.hadoop.fs.Path basePath,
org.apache.hadoop.fs.FileSystem fs,
DataSegment segmentTemplate,
org.apache.hadoop.mapreduce.TaskAttemptID taskAttemptID,
DataSegmentPusher dataSegmentPusher)
public static void renameIndexFilesForSegments(HadoopIngestionSpec indexerSchema, List<DataSegmentAndIndexZipFilePath> segmentAndIndexZipFilePaths) throws IOException
indexerSchema - the hadoop ingestion specsegmentAndIndexZipFilePaths - the list of segments with their currently stored tmp path and the final path
that they should be renamed to.IOExceptionpublic static org.apache.hadoop.fs.Path prependFSIfNullScheme(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path)
public static long unzipNoGuava(org.apache.hadoop.fs.Path zip,
org.apache.hadoop.conf.Configuration configuration,
File outDir,
org.apache.hadoop.util.Progressable progressable,
@Nullable
org.apache.hadoop.io.retry.RetryPolicy retryPolicy)
throws IOException
IOExceptionpublic static URI getURIFromSegment(DataSegment dataSegment)
public static String getJobTrackerAddress(org.apache.hadoop.conf.Configuration config)
Copyright © 2011–2022 The Apache Software Foundation. All rights reserved.