@Override public void run() { LOGGER.debug("cleaning up after job: {}", jobId); ncs.removeJobParameterByteStore(jobId); ncs.getPartitionManager().jobCompleted(jobId, status); Map<JobId, Joblet> jobletMap = ncs.getJobletMap(); Joblet joblet = jobletMap.remove(jobId); if (joblet != null) { joblet.cleanup(status); } } }
@Override public void run() { try { Map<JobId, Joblet> jobletMap = ncs.getJobletMap(); Joblet ji = jobletMap.get(pid.getJobId()); if (ji != null) { PartitionChannel channel = new PartitionChannel(pid, new NetworkInputChannel(ncs.getNetworkManager(), new InetSocketAddress( InetAddress.getByAddress(networkAddress.lookupIpAddress()), networkAddress.getPort()), pid, 5)); ji.reportPartitionAvailability(channel); } } catch (Exception e) { throw new RuntimeException(e); } } }
@Override protected void doRun() throws Exception { List<JobProfile> profiles = new ArrayList<>(); Map<JobId, Joblet> jobletMap = ncs.getJobletMap(); jobletMap.values().stream().filter(ji -> ji.getJobId().getCcId().equals(ccId)) .forEach(ji -> profiles.add(new JobProfile(ji.getJobId()))); for (JobProfile jProfile : profiles) { Joblet ji; JobletProfile jobletProfile = new JobletProfile(ncs.getId()); ji = jobletMap.get(jProfile.getJobId()); if (ji != null) { ji.dumpProfile(jobletProfile); jProfile.getJobletProfiles().put(ncs.getId(), jobletProfile); } } fv.setValue(profiles); } }
private void performCleanup() { nodeController.getJobletMap().remove(jobId); IJobletEventListener listener = getJobletEventListener(); if (listener != null) { listener.jobletFinish(cleanupStatus); } close(); cleanupPending = false; try { nodeController.getClusterController(jobId.getCcId()).notifyJobletCleanup(jobId, nodeController.getId()); } catch (Exception e) { e.printStackTrace(); } }
@Override public void run() { if (LOGGER.isInfoEnabled()) { LOGGER.info("Aborting Tasks: " + jobId + ":" + tasks); } IResultPartitionManager resultPartitionManager = ncs.getResultPartitionManager(); if (resultPartitionManager != null) { ncs.getResultPartitionManager().abortReader(jobId); } Joblet ji = ncs.getJobletMap().get(jobId); if (ji != null) { Map<TaskAttemptId, Task> taskMap = ji.getTaskMap(); for (TaskAttemptId taId : tasks) { Task task = taskMap.get(taId); if (task != null) { task.abort(); } } } else { LOGGER.log(Level.WARN, "Joblet couldn't be found. Tasks of job " + jobId + " have all either completed or failed"); } } }
@Override protected void doRun() throws Exception { LOGGER.info("Aborting all tasks for controller {}", ccId); IResultPartitionManager resultPartitionManager = ncs.getResultPartitionManager(); if (resultPartitionManager == null) { LOGGER.log(Level.WARN, "ResultPartitionManager is null on " + ncs.getId()); } Deque<Task> abortedTasks = new ArrayDeque<>(); Collection<Joblet> joblets = ncs.getJobletMap().values(); // TODO(mblow): should we have one jobletmap per cc? joblets.stream().filter(joblet -> joblet.getJobId().getCcId().equals(ccId)).forEach(joblet -> { joblet.getTaskMap().values().forEach(task -> { task.abort(); abortedTasks.add(task); }); final JobId jobId = joblet.getJobId(); if (resultPartitionManager != null) { resultPartitionManager.abortReader(jobId); resultPartitionManager.sweep(jobId); } ncs.getWorkQueue().schedule(new CleanupJobletWork(ncs, jobId, JobStatus.FAILURE)); }); ncs.getExecutor().submit(new EnsureAllCcTasksCompleted(ncs, ccId, abortedTasks)); } }
private Joblet getOrCreateLocalJoblet(DeploymentId deploymentId, INCServiceContext appCtx, byte[] acgBytes) throws HyracksException { Map<JobId, Joblet> jobletMap = ncs.getJobletMap(); Joblet ji = jobletMap.get(jobId); if (ji == null) { ActivityClusterGraph acg = (deployedJobSpecId != null) ? ncs.getActivityClusterGraph(deployedJobSpecId) : (ActivityClusterGraph) DeploymentUtils.deserialize(acgBytes, deploymentId, appCtx); ncs.createOrGetJobParameterByteStore(jobId).setParameters(jobParameters); IJobletEventListenerFactory listenerFactory = acg.getJobletEventListenerFactory(); if (listenerFactory != null) { if (deployedJobSpecId != null) { listenerFactory = acg.getJobletEventListenerFactory().copyFactory(); } listenerFactory.updateListenerJobParameters(ncs.createOrGetJobParameterByteStore(jobId)); } ji = new Joblet(ncs, deploymentId, jobId, appCtx, acg, listenerFactory, jobStartTime); jobletMap.put(jobId, ji); } return ji; }