public static boolean init ( JobHistoryObserver jobTracker , JobConf conf , String hostname , long jobTrackerStartTime ) { try { LOG_DIR = conf . get ( "hadoop.job.history.location" , "file:///" + new File ( System . getProperty ( "hadoop.log.dir" , "/tmp" ) ) . getAbsolutePath ( ) + File . separator + "history" ) ; JOBTRACKER_UNIQUE_STRING = hostname + "_" + String . valueOf ( jobTrackerStartTime ) + "_" ; jobtrackerHostname = hostname ; Path logDir = new Path ( LOG_DIR ) ; LOGDIR_FS = logDir . getFileSystem ( conf ) ; if ( ! LOGDIR_FS . exists ( logDir ) ) { if ( ! LOGDIR_FS . mkdirs ( logDir , new FsPermission ( HISTORY_DIR_PERMISSION ) ) ) { throw new IOException ( "Mkdirs failed to create " + logDir . toString ( ) ) ; } } conf . set ( "hadoop.job.history.location" , LOG_DIR ) ; disableHistory = false ; // set the job history block size (default is 3MB) jobHistoryBlockSize = conf . getLong ( "mapred.jobtracker.job.history.block.size" , 3 * 1024 * 1024 ) ; jtConf = conf ; // initialize the file manager fileManager = new JobHistoryFilesManager ( conf , jobTracker , logDir ) ; } catch ( IOException e ) { LOG . error ( "Failed to initialize JobHistory log file" , e ) ; disableHistory = true ; } fileManager . startIOExecutor ( ) ; return ! ( disableHistory ) ; }
Initialize JobHistory files .