/** {@inheritDoc} */ @Override public HadoopJobStatus run(ComputeJobContext jobCtx, Hadoop hadoop, HadoopProtocolTaskArguments args) throws IgniteCheckedException { UUID nodeId = UUID.fromString(args.<String>get(0)); Integer id = args.get(1); HadoopDefaultJobInfo info = args.get(2); assert nodeId != null; assert id != null; assert info != null; HadoopJobId jobId = new HadoopJobId(nodeId, id); hadoop.submit(jobId, info); HadoopJobStatus res = hadoop.status(jobId); if (res == null) // Submission failed. res = new HadoopJobStatus(jobId, info.jobName(), info.user(), 0, 0, 0, 0, PHASE_CANCELLING, true, 1); return res; } }
/** * Checks job execution status. * * @param jobId Job ID. * @param complete Completion status. * @throws Exception If failed. */ private void checkStatus(HadoopJobId jobId, boolean complete) throws Exception { for (int i = 0; i < gridCount(); i++) { IgniteKernal kernal = (IgniteKernal)grid(i); Hadoop hadoop = kernal.hadoop(); HadoopJobStatus stat = hadoop.status(jobId); assert stat != null; IgniteInternalFuture<?> fut = hadoop.finishFuture(jobId); if (!complete) assertFalse(fut.isDone()); else { info("Waiting for status future completion on node [idx=" + i + ", nodeId=" + kernal.getLocalNodeId() + ']'); fut.get(); } } }