I know you hurtin' and worryin', I can feel it on you,
but you oughta quit on it now. Because I want it over
and done. I do. I'm tired, boss.

@param string $jobId
@param string $executionArn
168338
private function stopExecution(string $jobId, string $executionArn): void
    {
        try {
            $this->sfnClient->stopExecution([
                'executionArn' => $executionArn,
                'cause'        => 'canceled',
            ]);
        } catch (\Throwable $t) {
            $this->logger->error(
                'Failed to stopExecution of [{execution_arn}] for [{job_id}].',
                [
                    'exception'     => $t,
                    'execution_arn' => $executionArn,
                    'job_id'        => $jobId,
                ]
            );
        }
    }
801752
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $producer = $this->getContainer()->get('graviton.message.jobproducer');
        $producer->setContentType('application/json');
        $producer->publish(
            $input->getArgument('data'),
            $input->getArgument('message')
        );
    }
1295150
protected function _die( $msg, $sql = null )
    {
        if ( $this->db )
        {
            $error = $this->db->errorInfo();
            eZDebug::writeError( $sql, "$msg: {$error[2]}" );
        }
        else
        {
            eZDebug::writeError( $sql, $msg );
        }
    }
1061138
public function handle(JobDeleted $event)
    {
        $this->jobs->completed($event->payload, $event->job->hasFailed());

        if (! $event->job->hasFailed() && count($this->tags->monitored($event->payload->tags())) > 0) {
            $this->jobs->remember($event->connectionName, $event->queue, $event->payload);
        }
    }
341716
@POST
  @Path(ServiceConstants.CANCEL)
  public Response cancel(@QueryParam("jobId") final long jobId) {
    return RestUtils.call(new RestUtils.RestCallable<Void>() {
      @Override
      public Void call() throws Exception {
        mJobMaster.cancel(jobId);
        return null;
      }
    }, ServerConfiguration.global());
  }
927871
protected function action($deliveryExecution, $executionId, $isEndDate = false)
    {
        $this->getDeliveryStateService()->terminateExecution($deliveryExecution, [
            'reasons' =>[
                'category' => 'Technical'
            ],
            'comment' => $isEndDate
                ? 'The assessment was automatically terminated because end time expired.'
                : 'The assessment was automatically terminated.'
        ]);
        $this->report->add(Report::createSuccess('Execution terminated with success:'. $executionId ));
    }
406642
function handleMessage(m, workerIdx) {
	var job = jobs[m.context.jobID];

	switch(job.type) {
		case 'func':
			handleArrayResult(m, workerIdx);
			break;
		case 'exec':
			handleExecResult(m, workerIdx);
			break;
		default:
			throw Error('Invalid job type: ' + job.type);
	}
}
218456
public function run($job, array $jobOptions = [], Io\IoDescriptor $io = null)
    {
        if (is_string($job)) {
            $job = $this->createJob($job, $jobOptions);
        }

        if (!$job instanceof JobInterface) {
            throw new \InvalidArgumentException('Job should be a string or a JobInterface');
        }

        $graph = $this->buildGraph($job);
        $this->init($job, $graph, $io);
        $execution = $this->executionFactory->create($job, $graph);
        $this->execute($execution);

        return $this;
    }
501064
protected function launchJob($jobID)
        {
            $pid = pcntl_fork();
            if ($pid == -1) {
                error_log('Could not launch new job, exiting');
                echo 'Could not launch new job, exiting';
                return false;
            } else if ($pid) {
                $this->currentJobs[$pid] = $jobID;
                if (isset($this->signalQueue[$pid])) {
                    $this->childSignalHandler(SIGCHLD, $pid, $this->signalQueue[$pid]);
                    unset($this->signalQueue[$pid]);
                }
            } else {
                $exitStatus = 0; //Error code if you need to or whatever
                exit($exitStatus);
            }
            return true;
        }
249702
public void kill() {
    boolean killNow = false;
    synchronized(jobInitKillStatus) {
      jobInitKillStatus.killed = true;
      //if not in middle of init, terminate it now
      if(!jobInitKillStatus.initStarted || jobInitKillStatus.initDone) {
        //avoiding nested locking by setting flag
        killNow = true;
      }
    }
    if(killNow) {
      terminate(JobStatus.KILLED);
    }
  }
1085448
public function handle()
	{
		$counter = JobsFacade::run();

		if ($counter === false) {
			$this->error('Job executor needs to cool down for '.(JobsFacade::remainingCoolDown() * 60)
                .' seconds! No jobs executed.');
		} else {
			$this->info('Done. Jobs executed: '.$counter.'/'.JobsFacade::count());
		}			
	}
355303
def kill_running_submission(self, submissionid, user_check=True):
        
        submission = self.get_submission(submissionid, user_check)
        if not submission:
            return False
        if "jobid" not in submission:
            return False

        return self._client.kill_job(submission["jobid"])
555565
void executeInABox(final Job job) {
        try {
            job.execute();
        } catch (Exception e) {
            System.err.println("The execution of the job threw an exception");
            e.printStackTrace(System.err);
        }
    }
283453
function quit(): void {
        if($this->goingAway) {
            return;
        }
        
        $this->goingAway = \React\Promise\resolve();
        
        /** @var \Plasma\DriverInterface  $conn */
        foreach($this->connections->all() as $conn) {
            $conn->quit();
            $this->connections->delete($conn);
        }
        
        /** @var \Plasma\DriverInterface  $conn */
        foreach($this->busyConnections->all() as $conn) {
            $conn->quit();
            $this->busyConnections->delete($conn);
        }
    }
345273
public void executeDirectly(String jobId) {

        final CmsScheduledJobInfo jobInfo = (CmsScheduledJobInfo)getJob(jobId).clone();
        if (jobInfo == null) {
            LOG.error(Messages.get().getBundle().key(Messages.LOG_INVALID_JOB_1, "null"));
            return;
        }
        Thread thread = new Thread() {

            /**
             * @see java.lang.Thread#run()
             */
            @Override
            public void run() {

                executeJob(jobInfo);
            }
        };
        thread.start();
    }
653012
public function logFailedJob(JobInterface $job, $reason)
    {
        if (mb_strlen($reason) > 191) {
            $reason = mb_substr($reason, 0, 191);
        }

        $this->connection->transact(function () use ($job, $reason) {
            $this->connection->execute('INSERT INTO `' . self::FAILED_JOBS_TABLE_NAME . '` (`type`, `channel`, `batch_id`, `data`, `failed_at`, `reason`) VALUES (?, ?, ?, ?, ?, ?)', get_class($job), $job->getChannel(), $job->getBatchId(), json_encode($job->getData()), date('Y-m-d H:i:s'), $reason);
            $this->deleteJob($job);
        });
    }
24252
private function execute(Job $job, JobRunner $runner, $callback) {
        $runner->runIt($job, $callback);
    }