Should be called for every jobmensa processor
487813
def post_processing(img)
      img.combine_options do |cmd|
        cmd.strip # Deletes metatags
        cmd.colorspace 'sRGB' # Change colorspace
        cmd.auto_orient # Reset rotation
        cmd.quiet # Suppress warnings
      end
    end
47786
protected function job(): void
    {
        while (true) {

            $orders = $this->retrieve([
                'corporation_id' => $this->getCorporationId(),
            ]);

            if ($orders->isCachedLoad()) return;

            collect($orders)->each(function ($order) {

                CorporationOrder::firstOrNew([
                    'corporation_id' => $this->getCorporationId(),
                    'order_id'       => $order->order_id,
                ])->fill([
                    'type_id'         => $order->type_id,
                    'region_id'       => $order->region_id,
                    'location_id'     => $order->location_id,
                    'range'           => $order->range,
                    'is_buy_order'    => $order->is_buy_order ?? null,
                    'price'           => $order->price,
                    'volume_total'    => $order->volume_total,
                    'volume_remain'   => $order->volume_remain,
                    'issued'          => carbon($order->issued),
                    'issued_by'       => $order->issued_by,
                    'min_volume'      => $order->min_volume ?? null,
                    'wallet_division' => $order->wallet_division ?? null,
                    'duration'        => $order->duration ?? null,
                    'escrow'          => $order->escrow ?? null,
                ])->save();
            });

            if (! $this->nextPage($orders->pages))
                return;
        }
    }
454254
function callProcessor(eventType, data, callback) {
    var p = processors[eventType];
    // no processors
    if (p===undefined || p.length==0) {
      if (callback!==undefined) callback(data);
      return;
    }
    // now go through all processors
    var n = 0;
    var cbCalled = false;
    var cb = function(inData) {
      if (cbCalled) throw new Error("Internal error in "+eventType+" processor. Callback is called TWICE.");
      cbCalled = true;
      if (n < p.length) {
        cbCalled = false;
        p[n++](inData, cb);
      } else {
        if (callback!==undefined) callback(inData);
      }
    };
    cb(data);
  }
241213
def start(self):
		
		if self._thread_running.is_set():
			raise RuntimeError('the JobManager has already been started')
		self._thread.start()
		self._thread_running.wait()
		return
997100
private void runJobLauncherLoop() throws JobException {
    try {
      while (true) {
        currentJobLauncher = this.jobScheduler.buildJobLauncher(jobProps);
        // in "run once" case, job scheduler will remove current job from the scheduler
        boolean isEarlyStopped = this.jobScheduler.runJob(jobProps, jobListener, currentJobLauncher);
        boolean isRetriggerEnabled = this.isRetriggeringEnabled();
        if (isEarlyStopped && isRetriggerEnabled) {
          log.info("Job {} will be re-triggered.", jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY));
        } else {
          break;
        }
        currentJobLauncher = null;
      }
    } catch (Exception e) {
      log.error("Failed to run job {}", jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
      throw new JobException("Failed to run job " + jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), e);
    }
  }
1170051
def as_completed(jobs):
  '''  '''

  jobs = tuple(jobs)
  event = threading.Event()
  callback = lambda f, ev: event.set()
  [job.add_listener(Job.SUCCESS, callback, once=True) for job in jobs]
  [job.add_listener(Job.ERROR, callback, once=True) for job in jobs]

  while jobs:
    event.wait()
    event.clear()

    jobs, finished = split_list_by(jobs, lambda x: x.finished)
    for job in finished:
      yield job
164021
protected function job(): void
    {
        while (true) {

            $medals = $this->retrieve([
                'corporation_id' => $this->getCorporationId(),
            ]);

            if ($medals->isCachedLoad()) return;

            collect($medals)->each(function ($medal) {

                CorporationMedal::firstOrNew([
                    'corporation_id' => $this->getCorporationId(),
                    'medal_id'       => $medal->medal_id,
                ])->fill([
                    'title'       => $medal->title,
                    'description' => $medal->description,
                    'creator_id'  => $medal->creator_id,
                    'created_at'  => carbon($medal->created_at),
                ])->save();

            });

            if (! $this->nextPage($medals->pages))
                break;
        }
    }
676790
def job_runner(self):
        # We recommend that you define a subclass, override this method and set up your own config
        
        outputs = luigi.task.flatten(self.output())
        for output in outputs:
            if not isinstance(output, luigi.contrib.hdfs.HdfsTarget):
                warnings.warn("Job is using one or more non-HdfsTarget outputs" +
                              " so it will be run in local mode")
                return LocalJobRunner()
        else:
            return DefaultHadoopJobRunner()
1055393
@Override
	public void run() {

		final long currentTime = System.currentTimeMillis();

		synchronized (this.collectedEvents) {

			final Iterator<JobID> it = this.collectedEvents.keySet().iterator();
			while (it.hasNext()) {

				final JobID jobID = it.next();
				final List<AbstractEvent> eventList = this.collectedEvents.get(jobID);
				if (eventList == null) {
					continue;
				}

				final Iterator<AbstractEvent> it2 = eventList.iterator();
				while (it2.hasNext()) {

					final AbstractEvent event = it2.next();
					// If the event is older than TIMERTASKINTERVAL, remove it
					if ((event.getTimestamp() + this.timerTaskInterval) < currentTime) {
						archiveEvent(jobID, event);
						it2.remove();
					}
				}

				if (eventList.isEmpty()) {
					it.remove();
				}
			}
		}

		synchronized (this.recentJobs) {

			final Iterator<Map.Entry<JobID, RecentJobEvent>> it = this.recentJobs.entrySet().iterator();
			while (it.hasNext()) {

				final Map.Entry<JobID, RecentJobEvent> entry = it.next();
				final JobStatus jobStatus = entry.getValue().getJobStatus();

				// Only remove jobs from the list which have stopped running
				if (jobStatus != JobStatus.FINISHED && jobStatus != JobStatus.CANCELED
					&& jobStatus != JobStatus.FAILED) {
					continue;
				}

				// Check time stamp of last job status update
				if ((entry.getValue().getTimestamp() + this.timerTaskInterval) < currentTime) {
					archiveJobevent(entry.getKey(), entry.getValue());
					it.remove();
					synchronized (this.recentManagementGraphs) {
						archiveManagementGraph(entry.getKey(), this.recentManagementGraphs.get(entry.getKey()));
						this.recentManagementGraphs.remove(entry.getValue());
					}
					synchronized (this.recentNetworkTopologies) {
						archiveNetworkTopology(entry.getKey(), this.recentNetworkTopologies.get(entry.getKey()));
						this.recentNetworkTopologies.remove(entry.getValue());
					}
				}
			}
		}
	}
705131
protected function job(): void
    {
        $killmails = $this->retrieve([
            'corporation_id' => $this->getCorporationId(),
        ]);

        if ($killmails->isCachedLoad()) return;

        collect($killmails)->each(function ($killmail) {

            CorporationKillmail::firstOrCreate([
                'corporation_id' => $this->getCorporationId(),
                'killmail_id'    => $killmail->killmail_id,
            ], [
                'killmail_hash' => $killmail->killmail_hash,
            ]);
        });
    }
961349
function(processors) {
        var that = this;
        _.each(processors, function(processor, name) {
            if (name in that._processors) {
                throw new Error('Processor "' + name + '" already exists!');
            }
            that._processors[name] = processor;
        });

        return this;
    }
1274084
function(jobid, taskid, config) { 
  if(!jobid || !taskid || !config) {
    throw Error('taskid/jobid missing');
  }
  if(!config.executable && !config.javascript) {
    throw Error("invalid executable/javascript. don't know what to run:"+taskid);
  }
  if(config.executable && config.javascript) {
    throw Error('only one of executable/javascript should be specified:'+taskid);
  }
  this.id = taskid;
  this.job = jobid;
  this.name = config.name || this.id;
  this.state = State.INIT;
  this.input = config.input || '';
  // these both are out params from the worker
  this.output = [];
  this.log=[];
  // information about the worker
  this.process = {};
  this.exec = config.executable;
  if(config.javascript) {
    this.jsfile = config.javascript.lib;
    this.methodName = config.javascript.method || 'task';
    if(!this._isJSModulePresent(this.jsfile, this.methodName)) {
      throw Error('given method:'+ this.methodName + ' not found in jsfile:' + this.jsfile);
    }
  }
}
1027721
private static void runApplicationMaster(final CommandLine cliParser,
      AlluxioConfiguration alluxioConf) throws Exception {
    int numWorkers = Integer.parseInt(cliParser.getOptionValue("num_workers", "1"));
    String masterAddress = cliParser.getOptionValue("master_address");
    String resourcePath = cliParser.getOptionValue("resource_path");

    ApplicationMaster applicationMaster =
        new ApplicationMaster(numWorkers, masterAddress, resourcePath, alluxioConf);
    applicationMaster.start();
    applicationMaster.requestAndLaunchContainers();
    applicationMaster.waitForShutdown();
    applicationMaster.stop();
  }
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);
    }
}
980347
protected function job(): void
    {
        while (true) {

            $contacts = $this->retrieve([
                'corporation_id' => $this->getCorporationId(),
            ]);

            if ($contacts->isCachedLoad()) return;

            collect($contacts)->each(function ($contact) {

                CorporationContact::firstOrNew([
                    'corporation_id' => $this->getCorporationId(),
                    'contact_id'     => $contact->contact_id,
                ])->fill([
                    'standing'     => $contact->standing,
                    'contact_type' => $contact->contact_type,
                    'is_watched'   => $contact->is_watched ?? false,
                    'label_ids'    => $contact->label_ids ?? null,
                ])->save();
            });

            $this->known_contact_ids->push(collect($contacts)
                ->pluck('contact_id')->flatten()->all());

            if (! $this->nextPage($contacts->pages))
                break;
        }

        // Cleanup old contacts
        CorporationContact::where('corporation_id', $this->getCorporationId())
            ->whereNotIn('contact_id', $this->known_contact_ids->flatten()->all())
            ->delete();
    }
1003524
function jobCallback(job, worker, index) {

    // as long as we have urls that we want to crawl we execute the job
    var url = pages[index];
    if (index < pages.length) {

        // the first argument contains the data which is passed to the worker
        // the second argument is a callback which is called when the job is executed
        job({
            url : url,
            id : index
        }, function(err) {
            // Lets log if it worked
            if (err) {
                console.log('There were some problems for url ' + url + ': ' + err.message);
            } else {
                console.log('DONE: ' + url + '(' + index + ')');
            }
        });
    } else {
        // if we have no more jobs, we call the function job with null
        job(null);
    }
}
97311
def run_job(self):
        """"""
        try:
            self.load_parsers()
            self.load_filters()
            self.load_outputs()
            self.config_args()
            if self.args.list_parsers:
                self.list_parsers()
            if self.args.verbosemode: print('Loading input files')
            self.load_inputs()
            if self.args.verbosemode: print('Running parsers')
            self.run_parse()
            if self.args.verbosemode: print('Merging data')
            self.data_set['finalized_data'] = \
                    logdissect.utils.merge_logs(
                            self.data_set['data_set'], sort=True)
            if self.args.verbosemode: print('Running filters')
            self.run_filters()
            if self.args.verbosemode: print('Running output')
            self.run_output()
        except KeyboardInterrupt:
            sys.exit(1)