/** * Get the configurations at the beginning of the job flow, it will contain information about the * map/reduce plan and decoded pig script. * * @param job job whose configuration should be fetched. * @param jobClient client with which to retrieve job configuration. */ public void setJobConfFromFile(MapReduceJob job, JobClient jobClient) { try { RunningJob runningJob = getRunningJob(job, jobClient); String jobFile = runningJob.getJobFile(); LOG.info(String.format("Loading RunningJob configuration file '%s'", jobFile)); Path path = new Path(jobFile); FileSystem fileSystem = FileSystem.get(new Configuration()); InputStream inputStream = fileSystem.open(path); Configuration conf = new Configuration(false); conf.addResource(inputStream); job.setConfiguration(toProperties(conf)); } catch (Exception e) { LOG.warn("Error occurred when retrieving configuration info", e); } }
private void updateMapRedStatsJson(MapRedStats stats, RunningJob rj) throws IOException, JSONException { if (statsJSON == null) { statsJSON = new JSONObject(); } if (stats != null) { if (stats.getNumMap() >= 0) { statsJSON.put(NUMBER_OF_MAPPERS, stats.getNumMap()); } if (stats.getNumReduce() >= 0) { statsJSON.put(NUMBER_OF_REDUCERS, stats.getNumReduce()); } if (stats.getCounters() != null) { statsJSON.put(COUNTERS, getCountersJson(stats.getCounters())); } } if (rj != null) { statsJSON.put(JOB_ID, rj.getID().toString()); statsJSON.put(JOB_FILE, rj.getJobFile()); statsJSON.put(TRACKING_URL, rj.getTrackingURL()); statsJSON.put(MAP_PROGRESS, Math.round(rj.mapProgress() * 100)); statsJSON.put(REDUCE_PROGRESS, Math.round(rj.reduceProgress() * 100)); statsJSON.put(CLEANUP_PROGRESS, Math.round(rj.cleanupProgress() * 100)); statsJSON.put(SETUP_PROGRESS, Math.round(rj.setupProgress() * 100)); statsJSON.put(COMPLETE, rj.isComplete()); statsJSON.put(SUCCESSFUL, rj.isSuccessful()); } }