List of usage examples for org.apache.hadoop.mapred TaskID getJobID
public JobID getJobID()
From source file:de.l3s.streamcorpus.mapreduce.TerrierIndexing.java
License:Mozilla Public License
/** Performs cleanup of an index path removing temporary files */ public static void deleteTaskFiles(String path, JobID job) { String[] fileNames = Files.list(path); if (fileNames == null) return;/* ww w.j av a 2 s . c o m*/ for (String filename : fileNames) { String periodParts[] = filename.split("\\."); try { TaskID tid = TaskID.forName(periodParts[0]); if (tid.getJobID().equals(job)) { if (!Files.delete(path + "/" + filename)) logger.warn("Could not delete temporary map side-effect file " + path + "/" + filename); } } catch (Exception e) { } } }
From source file:hivemall.utils.hadoop.HadoopUtils.java
License:Open Source License
@Nonnull public static String getJobIdFromTaskId(@Nonnull String taskidStr) { if (!taskidStr.startsWith("task_")) {// workaround for Tez taskidStr = taskidStr.replace("task", "task_"); taskidStr = taskidStr.substring(0, taskidStr.lastIndexOf('_')); }/* www . j av a 2 s .c o m*/ TaskID taskId = TaskID.forName(taskidStr); JobID jobId = taskId.getJobID(); return jobId.toString(); }
From source file:org.apache.tez.mapreduce.hadoop.IDConverter.java
License:Apache License
public static TezTaskID fromMRTaskId(org.apache.hadoop.mapreduce.TaskID taskid) { return TezTaskID.getInstance(TezVertexID.getInstance(fromMRJobId(taskid.getJobID()), (taskid.getTaskType() == TaskType.MAP ? 0 : 1)), taskid.getId()); }
From source file:skewtune.mapreduce.STJobTracker.java
License:Apache License
private Future<JobID> fastSplitTask(TaskID taskid, int n) throws IOException, InterruptedException { JobInProgress jip = null;/* w ww . j a v a 2 s . c o m*/ synchronized (jobs) { jip = jobs.get(taskid.getJobID()); } if (jip == null) { String msg = "unknown task " + taskid; LOG.error(msg); throw new IOException(msg); } TaskInProgress tip = jip.getTaskInProgress(taskid); ReactionContext context = taskid.getTaskType() == TaskType.MAP ? new ReexecMap(tip, n) : new ReexecReduce(tip); return fastSplitTask(context, true); // return fastSplitTask(taskid,n,true); }
From source file:skewtune.mapreduce.STJobTracker.java
License:Apache License
/** * schedule scan task. scan the input data and collect information. * once information collected, scheduling algorithm will run and launch reactive task. * only happens on handover/*from ww w .j a v a 2 s .c o m*/ * * @param taskid * @param action * @return * @throws IOException * @throws InterruptedException */ private Future<JobID> scheduleScanTask(TaskID taskid, JobInProgress.ReactionContext action) throws IOException, InterruptedException { JobInProgress jip = null; synchronized (jobs) { jip = jobs.get(taskid.getJobID()); } if (jip == null) { String msg = "unknown task " + taskid; LOG.error(msg); throw new IOException(msg); } JobID jobid = null; try { jip.waitUntilReadyToSplit(taskid); if (LOG.isDebugEnabled()) { LOG.debug("scheduling asynchronous scan task for task " + taskid); } return this.asyncWorkers.submit(new ScanTask(jip, taskid, action)); } catch (ExecutionException e) { throw new IOException(e.getCause()); // wrap again! } }