getStatus()->markRunning(); $result->addLog(sprintf('[%s] started.', $this->getName())); try { $result = $this->handle($result); $result->getStatus()->markSuccess(); $result->addLog(sprintf('[%s] completed successfully.', $this->getName())); } catch (\Throwable $throwable) { $result->getStatus()->markFailed(); $result->setException($throwable); $result->addLog(sprintf('[%s] failed: %s', $this->getName(), $throwable->getMessage())); } finally { $result->setEndedAt(microtime(true)); } return $result; } abstract protected function handle(ImportJobResult $result): ImportJobResult; }