Esempio n. 1
0
 /**
  * Attempt to run the given job.
  *
  * @param Job $job
  *
  * @return void
  */
 public function run(Job &$job)
 {
     $this->getPHPQ()->getLogger()->info(sprintf('Running job #%d', $job->getId()));
     JobReflector::setFailed($job, false);
     JobReflector::setFinished($job, null);
     JobReflector::setHasResult($job, false);
     JobReflector::setResult($job, null);
     try {
         $job->setUp();
         $job->perform($this->getPHPQ()->getContainer());
         $job->tearDown();
     } catch (\Exception $e) {
         JobReflector::setFailed($job, true);
     }
     $this->getPHPQ()->getDriver()->persistJobState($job);
     $this->getPHPQ()->getDriver()->detach($job);
     return;
 }