Create or update entry for process with finished at information.
Set status to "failed".

@param ProcessId $processId
@param \DateTimeImmutable $finishedAt
@return void
2254
public function logProcessFailed(ProcessId $processId, \DateTimeImmutable $finishedAt)
    {
        $data = [
            'finished_at' => $finishedAt->format(\DateTime::ISO8601),
            'status' => self::STATUS_FAILED,
        ];

        $entry = $this->loadProcessEntryIfExists($processId);

        if (is_null($entry)) {
            $this->insertNewEntry($processId, $data);
        } else {
            $this->updateEntry($processId, $data);
        }
    }
812230
public function setCreatedAtValue(\DateTime $createdAt = null)
    {
        if($createdAt==null && $this->createdAt == null){
            $this->createdAt = new \DateTime();
        }else if($createdAt instanceof \DateTime){
            $this->createdAt = $createdAt;
        }
    }
778003
private function setCreatedAt(Carbon $createdAt = null)
    {
        if (is_null($createdAt)) {
            $createdAt = Carbon::now();
        }

        $this->createdAt = $createdAt;
    }
60577
def _on_process_finished(self):
        
        exit_code = self._process.exitCode()
        if self._process.exitStatus() != self._process.NormalExit:
            exit_code = 139
        self._formatter.append_message('\x1b[0m\nProcess finished with exit code %d' % exit_code,
                                       output_format=OutputFormat.CustomFormat)
        self.setReadOnly(True)
        self.process_finished.emit()
356184
public void retryLastFailedTask(String workflowId) {
        Preconditions.checkArgument(StringUtils.isNotBlank(workflowId), "workflow id cannot be blank");
        postForEntityWithUriVariablesOnly("workflow/{workflowId}/retry", workflowId);
    }
1277255
public function setProcessing($iRefundId, $aData = [])
    {
        $aData['status'] = self::STATUS_PROCESSING;
        return $this->update($iRefundId, $aData);
    }
810884
public function completed(JobPayload $payload, $failed = false)
    {
        if ($payload->isRetry()) {
            $this->updateRetryInformationOnParent($payload, $failed);
        }

        $this->connection()->pipeline(function ($pipe) use ($payload, $failed) {
            $this->markJobAsCompleted($pipe, $payload->id(), $failed);
        });
    }
1142367
protected function runProcess(Process $process)
    {
        $ioHandler = $this->getIO();
        $process->run(
            function ($pipe, $content) use ($ioHandler) {
                if (Process::ERR === $pipe) {
                    $ioHandler->writeError($content, false);
                    // @codingStandardsIgnoreStart
                    return;
                    // @codingStandardsIgnoreEnd
                }
                $ioHandler->write($content, false);
            }
        );

        if (0 !== $process->getExitCode()) {
            throw new ProcessFailedException($process);
        }
    }
121490
public synchronized void done(TaskAttemptID taskid)
  throws IOException {
    TaskInProgress tip = tasks.get(taskid);
    commitResponses.remove(taskid);
    if (tip != null) {
      tip.reportDone();
    } else {
      LOG.warn("Unknown child task done: "+taskid+". Ignored.");
    }
  }
919531
public void reload(Long processId) {
        try {
            if (logger.isDebugEnabled()) {
                logger.debug("## reload Stage pipeline[{}] process[{}]", getPipelineId(), processId);
            }

            initProcessStage(processId);
        } catch (Exception cause) {
        }
    }
374812
public function setFinished($value)
    {
        $this->_validateDate('Finished', $value);

        if ($this->data['finished'] === $value) {
            return;
        }

        $this->data['finished'] = $value;

        $this->_setModified('finished');
    }
229410
public function setEndState($stateId, $eventId)
    {
        if ($this->stateMachine->getState(StateMachine::STATE_FINAL) === null) {
            $this->stateMachine->addState(new FinalState(StateMachine::STATE_FINAL));
        }

        $this->addTransition($stateId, StateMachine::STATE_FINAL, $eventId);
    }
29953
public function create($orderId, $fulfillmentId, FulfillmentEvent &$fulfillmentEvent)
    {
        $data = $fulfillmentEvent->exportData();
        $endpoint = '/admin/orders/'.$orderId.'/fulfillments/'.$fulfillmentId.'/events.json';
        $response = $this->request(
            $endpoint, 'POST', array(
            'fulfillment_event' => $data
            )
        );
        $fulfillmentEvent->setData($response['fulfillment_event']);
    }
442057
private function processBeginRequestRecord(int $requestId, ?string $contentData): void
    {
        if (isset($this->requests[$requestId])) {
            throw new ProtocolException('Unexpected FCGI_BEGIN_REQUEST record');
        }

        $contentFormat = 'nrole/Cflags/x5';

        $content = unpack($contentFormat, $contentData);

        $keepAlive = DaemonInterface::FCGI_KEEP_CONNECTION & $content['flags'];

        $this->requests[$requestId] = [
            'keepAlive' => $keepAlive,
            'stdin'     => fopen('php://temp', 'r+'),
            'params'    => [],
        ];

        if ($this->shutdown) {
            $this->endRequest($requestId, 0, DaemonInterface::FCGI_OVERLOADED);

            return;
        }

        if (DaemonInterface::FCGI_RESPONDER !== $content['role']) {
            $this->endRequest($requestId, 0, DaemonInterface::FCGI_UNKNOWN_ROLE);

            return;
        }
    }
569366
public function process_going_overdue($timestamp, $studentisonline) {
        global $DB;

        $transaction = $DB->start_delegated_transaction();
        $this->attempt->timemodified = $timestamp;
        $this->attempt->state = self::OVERDUE;
        // If we knew the attempt close time, we could compute when the graceperiod ends.
        // Instead we'll just fix it up through cron.
        $this->attempt->timecheckstate = $timestamp;
        $DB->update_record('quiz_attempts', $this->attempt);

        $this->fire_state_transition_event('\mod_quiz\event\attempt_becameoverdue', $timestamp);

        $transaction->allow_commit();

        quiz_send_overdue_message($this);
    }
119267
public void setResourceId(String resourceId) {

        try {
            if (!m_type.isFolder()) {
                m_resourceId = new CmsUUID(resourceId);
            } else {
                m_resourceId = new CmsUUID();
            }
        } catch (Throwable e) {
            setThrowable(e);
        }
    }
669971
protected function handleProcessOutput(
        array $processInfo,
        BufferedOutputInterface $output,
        callable $processTerminatedCallback
    ) {
        // Get the process.
        /** @var Process $process */
        $process = $processInfo['process'];

        // Get the project.
        /** @var Project $project */
        $project = $processInfo['project'];

        // Start the process if not already started.
        if (!$process->isStarted()) {
            $process->start();
        }

        // Get the last output from the process.
        $incrementalOutput = $this->getIncrementalProcessOutput($process);

        $this->workaroundForSingleChar(
            $incrementalOutput,
            $project
        );

        // Show the output.
        if ($incrementalOutput != '') {
            // Dispatch an event.
            $this->dispatcher->dispatch(
                IncrementalOutputReceivedEvent::NAME,
                new IncrementalOutputReceivedEvent(
                    $incrementalOutput,
                    $project,
                    $process
                )
            );

            if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
                if ($project->getForegroundColor() <= 0) {
                    $output->write(
                        sprintf(
                            '%s:' . "\t" . '%s',
                            $project->getName(),
                            $incrementalOutput
                        )
                    );
                } else {
                    if ($this->writtenToBuffer) {
                        $output->write("\n");
                    }

                    $projectName = sprintf(
                        "\033[38;5;%dm%s:\033[0m",
                        $project->getForegroundColor(),
                        $project->getName()
                    );

                    if (!empty($project->getBackgroundColor())) {
                        $projectName = sprintf(
                            "\033[38;5;%dm%s:\033[0m",
                            $project->getBackgroundColor(),
                            $project->getName()
                        );

                        $projectOutput = sprintf(
                            "\t\033[38;5;%dm\033[48;5;%dm%s\033[0m",
                            $project->getForegroundColor(),
                            $project->getBackgroundColor(),
                            $incrementalOutput
                        );
                    } else {
                        $projectOutput = sprintf(
                            "\t%s",
                            $incrementalOutput
                        );
                    }

                    $output->write(
                        sprintf(
                            '%s%s',
                            $projectName,
                            $projectOutput
                        )
                    );
                    $this->writtenToBuffer = true;
                }
            }
        }


        if ($process->isTerminated()) {
            $processTerminatedCallback();
        }
    }