Cleans up ImageJob once completed.
@method
@private
@param loader - ImageLoader used to start job.
@param job - The ImageJob that has completed.
@param callback - Called once cleanup is finished.
516536
function completeJob(loader, job, callback) {
    var nextJob;

    loader.jobsInProgress--;

    if ((!loader.jobLimit || loader.jobsInProgress < loader.jobLimit) && loader.jobQueue.length > 0) {
        nextJob = loader.jobQueue.shift();
        nextJob.start();
        loader.jobsInProgress++;
    }

    callback(job.image, job.errorMsg, job.request);
}
87022
public function run(Job $job /*, Callable $callback=null*/) {
        $this->logger->info('Starting Job: '.$job->id.' | '.$job->command);
        $callback = array($this, 'notifyExecutionEnd');

        $runner = $this->getJobRunner($job);

        if ($this->hasDependency($job)) {
            $job_dep = $this->getDependency($job);

            if ($job_dep->exit_code == self::EXIT_CODE_NORMAL && $this->isValid($job_dep)) {
                $this->logger->info('Job has dependency and his dependency is OK | dependency: '.$job_dep->id . ' | '.$job_dep->command);

                $job->status_code = 1;
                $this->execute($job, $runner, $callback);

            } else if ($this->isRunning($job_dep) || $this->isWaiting($job)) {
                $this->logger->info('Job has dependency and his dependency is working | dependency: '.$job_dep->id . ' | '.$job_dep->command);

                $job->status_code = 4;
                $this->execute($job, $runner, $callback);

            } else {
                $this->logger->error('Job has dependency and his dependency get some error, aborting | dependency: '.$job_dep->id . ' | '.$job_dep->command);

                $job->status_code = 2;

            }
        } else {
            $job->status_code = 1;
            $this->execute($job, $runner, $callback);
        }
    }
1280310
function JobCallback (job) {
    if (job !== null) {
       job.gateway.Debug (6,"Queued Request:%s command=%s devid=%s [done]", job.request, job.command, job.devId);
    }
}
515845
public void printJob(PrinterJob job)
    {
        Frame frame = this.getFrame();
        dialog = new PrintDialog(frame, false);
        
        dialog.pack();
        if (frame != null)
            this.centerDialogInFrame(dialog, frame);

        
        Map<String,Object> map = new Hashtable<String,Object>();
        map.put("job", job);
        SyncPageWorker thread = new SyncPageWorker(dialog, map)
        {
            public void runPageLoader()
            {
                Thread swingPageLoader = new Thread("SwingPageLoader")
                {
                    public void run()
                    {
                        ((PrintDialog)m_syncPage).setVisible(true);
                    }
                };
                SwingUtilities.invokeLater(swingPageLoader);
            }
            public void afterPageDisplay()
            {
                Thread swingPageLoader = new Thread("SwingPageLoader")
                {
                    public void run()
                    {
                        try {
                            PrinterJob job = (PrinterJob)get("job");
                            job.print();
                        } catch (PrinterException ex) {
                            ex.printStackTrace ();
                        }
                        ((PrintDialog)m_syncPage).setVisible(false);
                    }
                };
                SwingUtilities.invokeLater(swingPageLoader);
            }
        };
        thread.start();
    }
661986
synchronized void finalizeJob(JobInProgress job) {
    // Mark the 'non-running' tasks for pruning
    markCompletedJob(job);

    JobEndNotifier.registerNotification(job.getJobConf(), job.getStatus());

    // start the merge of log files
    JobID id = job.getStatus().getJobID();

    // mark the job as completed
    try {
      JobHistory.JobInfo.markCompleted(id);
    } catch (IOException ioe) {
      LOG.info("Failed to mark job " + id + " as completed!", ioe);
    }

    final JobTrackerInstrumentation metrics = getInstrumentation();
    metrics.finalizeJob(conf, id);

    long now = getClock().getTime();

    // mark the job for cleanup at all the trackers
    addJobForCleanup(id);

    try {
      File userFileForJob =
        new File(lDirAlloc.getLocalPathToRead(SUBDIR + "/" + id,
                                              conf).toString());
      if (userFileForJob != null) {
        userFileForJob.delete();
      }
    } catch (IOException ioe) {
      LOG.info("Failed to delete job id mapping for job " + id, ioe);
    }

    // add the blacklisted trackers to potentially faulty list
    if (job.getStatus().getRunState() == JobStatus.SUCCEEDED) {
      if (job.getNoOfBlackListedTrackers() > 0) {
        for (Entry<String, List<String>> e : job.getBlackListedTrackers().entrySet()) {
          String tt = e.getKey();
          String jobName = job.getJobID().toString();
          String[] exceptions = e.getValue().toArray(new String[0]);

          faultyTrackers.incrementFaults(tt, new JobFault(tt, jobName, exceptions));
        }
      }
    }

    String jobUser = job.getProfile().getUser();
    //add to the user to jobs mapping
    synchronized (userToJobsMap) {
      ArrayList<JobInProgress> userJobs = userToJobsMap.get(jobUser);
      if (userJobs == null) {
        userJobs =  new ArrayList<JobInProgress>();
        userToJobsMap.put(jobUser, userJobs);
      }
      userJobs.add(job);
    }
  }
46220
@Override
  @Deprecated
  public final void cleanupJob(org.apache.hadoop.mapreduce.JobContext context
                               ) throws IOException {
    cleanupJob((JobContext) context);
  }
881968
function validateObject(job, object, callback) {
		if (typeof object.value === 'undefined') {
			var onLoad = function (err, obj) {
				if (err) {
					job.error = err;
					return callback(err);
				}
				object.value = obj;
				doValidateObject(job, object, callback);
			};
			var opts = {
				timeout: (job.context.options.timeout || 5000)
			};
			//TODO verify http:, file: and plain paths all load properly
			if (object.path) {
				loader.loadPath(object.path, opts, onLoad);
			}
			else if (object.url) {
				loader.load(object.url, opts, onLoad);
			}
			else {
				callback(new Error('object missing value, path or url'));
			}
		}
		else {
			doValidateObject(job, object, callback);
		}
	}
1277893
@Override
  synchronized void finalizeJob(JobInProgress job) {

    // Let the SimulatorEngine know that the job is done
    JobStatus cloneStatus = (JobStatus)job.getStatus().clone();
    engine.markCompletedJob(cloneStatus, 
                            SimulatorJobTracker.getClock().getTime());

    JobID jobId = job.getStatus().getJobID();
    LOG.info("Finished job " + jobId + " endtime = " +
              getClock().getTime() + " with status: " +
              JobStatus.getJobRunState(job.getStatus().getRunState()));
    
    // for updating the metrics and JobHistory, invoke the original 
    // finalizeJob.
    super.finalizeJob(job);
    
    // now placing this job in queue for future nuking
    cleanupJob(job);
  }
297035
private void clearWaitJobs() {
        log.debug("Clear wait jobs");
        if (pullAndPush != null) {
            subscriberStream.cancelJob(pullAndPush);
            releasePendingMessage();
            pullAndPush = null;
        }
        if (waitLiveJob != null) {
            schedulingService.removeScheduledJob(waitLiveJob);
            waitLiveJob = null;
        }
    }
1196372
@Override
	public void removeCallback(Callback callback) {
		callbacks.remove(callback);
		if (manager != null) {
			callback.cleanup();
		}
	}
310672
function loadSchemaList(job, uris, callback) {
		uris = uris.filter(function (value) {
			return !!value;
		});

		if (uris.length === 0) {
			nextTick(function () {
				callback();
			});
			return;
		}

		var sweep = function () {
			if (uris.length === 0) {
				nextTick(callback);
				return;
			}
			forAsync(uris, function (uri, i, callback) {
				if (!uri) {
					out.writeln('> ' + style.error('cannot load') + ' "' + tweakURI(uri) + '"');
					callback();
				}
				out.writeln('> ' + style.accent('load') + ' + ' + tweakURI(uri));

				loader.load(uri, job.context.options, function (err, schema) {
					if (err) {
						return callback(err);
					}
					job.context.tv4.addSchema(uri, schema);
					uris = job.context.tv4.getMissingUris();
					callback();
				});
			}, function (err) {
				if (err) {
					job.error = err;
					return callback(null);
				}
				// sweep again
				sweep();
			});
		};
		sweep();
	}
457393
protected function finishJob(Job $job, bool $internal): void
    {
        if ($this->logger) {
            $this->logger->info('Finished a job.', [
                'name' => $job->getName(),
                'arguments' => $job->getArguments(),
            ]);
        }
        if ($this->eventDispatcher) {
            $this->eventDispatcher->dispatch(self::JOB_FINISHED_EVENT, new FinishedJobEvent($job, $internal));
        }
        if ($this->triggerBatchEvents) {
            $this->finishBatch(new JobBatch([], [$job]));
        }
    }
729781
public void handle(Object job)
    {
        Socket socket = (Socket) job;
        try
        {
            if (_tcpNoDelay) socket.setTcpNoDelay(true);
            handleConnection(socket);
        }
        catch (Exception e)
        {
            log.debug("Connection problem", e);
        }
        finally
        {
            try
            {
                socket.close();
            }
            catch (Exception e)
            {
                log.debug("Connection problem", e);
            }
        }
    }
1199374
synchronized void garbageCollect() {
    // Cancel task tracker reservation
    cancelReservedSlots();

    // Remove the remaining speculative tasks counts
    totalSpeculativeReduceTasks.addAndGet(-speculativeReduceTasks);
    totalSpeculativeMapTasks.addAndGet(-speculativeMapTasks);
    garbageCollected = true;

    // Let the JobTracker know that a job is complete
    jobtracker.getInstrumentation().decWaitingMaps(getJobID(), pendingMaps());
    jobtracker.getInstrumentation().decWaitingReduces(getJobID(), pendingReduces());
    jobtracker.storeCompletedJob(this);
    jobtracker.finalizeJob(this);

    try {
      // Definitely remove the local-disk copy of the job file
      if (localJobFile != null) {
        localFs.delete(localJobFile, true);
        localJobFile = null;
      }

      // clean up splits
      for (int i = 0; i < maps.length; i++) {
        maps[i].clearSplit();
      }

      // JobClient always creates a new directory with job files
      // so we remove that directory to cleanup
      // Delete temp dfs dirs created if any, like in case of
      // speculative exn of reduces.
      Path tempDir = jobtracker.getSystemDirectoryForJob(getJobID());
      new CleanupQueue().addToQueue(new PathDeletionContext(
          FileSystem.get(conf), tempDir.toUri().getPath()));
    } catch (IOException e) {
      LOG.warn("Error cleaning up "+profile.getJobID()+": "+e);
    }

    cleanUpMetrics();
    // free up the memory used by the data structures
    this.nonRunningMapCache = null;
    this.runningMapCache = null;
    this.nonRunningReduces = null;
    this.runningReduces = null;
    this.trackerMapStats = null;
    this.trackerReduceStats = null;
  }
280842
function( loadClass, loadSpecs, name, callback ) {

		// Trigger bundle loader and return TRUE if this
		// was handled by this loader.
		return BundleLoader.load( loadClass, loadSpecs, function( data, extra ) {

			// Prepare response array
			var objects = {};
			objects[name] = data;
			if (extra) objects[name+':extra'] = extra;

			// Notify that we are compiled
			callback( null, objects );

		});


	}
731383
function callbackWrapper() {
					callback && callback.apply( this, arguments );

					// Removed the just loaded script from the queue.
					pending.shift();

					loadNext.call( that );
				}
791615
def load_job(self, job):
        
        if not isinstance(job, Job):
            self.log_exc(u"job is not an instance of Job", None, True, ExecuteJobInputError)
        self.job = job