/**
  * Mark a job execution as failed
  * @param JobExecution $jobExecution
  */
 public function markAsFailed(JobExecution $jobExecution)
 {
     $jobExecution->setStatus(new BatchStatus(BatchStatus::FAILED));
     $jobExecution->setExitStatus(new ExitStatus(ExitStatus::FAILED));
     $jobExecution->setEndTime(new \DateTime('now'));
     $jobExecution->addFailureException(new \Exception('An exception occured during the job execution'));
     $this->entityManager->persist($jobExecution);
     $this->entityManager->flush();
 }
 /**
  * {@inheritDoc}
  */
 public function setExitStatus(\Akeneo\Bundle\BatchBundle\Job\ExitStatus $exitStatus)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setExitStatus', array($exitStatus));
     return parent::setExitStatus($exitStatus);
 }