Example #1
0
 /**
  * Checks or job is dead.
  *
  * @param JobConfigurationInterface $configuration
  *
  * @return bool
  */
 private function isDead(JobConfigurationInterface $configuration)
 {
     $report = $configuration->getLastReport();
     if ($report && $report->getPid() && !posix_getsid($report->getPid())) {
         return true;
     }
     return false;
 }
 /**
  * Process job configuration delete.
  *
  * @param JobConfigurationInterface $configuration
  * @param Request $request
  *
  * @return bool
  */
 public function process(JobConfigurationInterface $configuration, Request $request)
 {
     if ($request->isMethod('DELETE') && JobState::STATE_RUNNING !== $configuration->getState()) {
         $this->manager->remove($configuration);
         return true;
     }
     return false;
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function create(JobConfigurationInterface $configuration)
 {
     return new ShellJob($configuration->getParameter('shell_command'), $this->reportManager);
 }
Example #4
0
 /**
  * Save job state.
  *
  * @param JobConfigurationInterface $configuration
  * @param string $state
  */
 private function saveJobState(JobConfigurationInterface $configuration, $state)
 {
     $configuration->setState($state);
     $this->configurationManager->add($configuration, true);
 }
Example #5
0
 /**
  * {@inheritdoc}
  */
 public function create(JobConfigurationInterface $configuration)
 {
     $command = $this->commandBuilder->build($configuration->getParameter('symfony_command'));
     return new ShellJob($command, $this->reportManager);
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function getFactory(JobConfigurationInterface $configuration)
 {
     return $this->factoryRegistry->getFactory($configuration->getFactory());
 }
Example #7
0
 /**
  * {@inheritdoc}
  */
 public function create(JobConfigurationInterface $configuration)
 {
     return new PhpJob($configuration->getParameter('php_script'), $this->reportManager);
 }
Example #8
0
 /**
  * {@inheritdoc}
  */
 public function create(JobConfigurationInterface $configuration)
 {
     return new ServiceJob($this->container, $configuration->getParameter('symfony_service_id'), $configuration->getParameter('symfony_service_method'));
 }