/**
  * Launch the background process for the given $operation
  *
  * @param BatchableOperationInterface $operation
  *
  * @throws NotFoundResourceException
  */
 public function launch(BatchableOperationInterface $operation)
 {
     $jobInstanceCode = $operation->getJobInstanceCode();
     $jobInstance = $this->jobInstanceRepo->findOneBy(['code' => $jobInstanceCode]);
     if (null === $jobInstance) {
         throw new NotFoundResourceException(sprintf('No JobInstance found with code "%s"', $jobInstanceCode));
     }
     if ($operation instanceof ConfigurableOperationInterface) {
         $operation->finalize();
     }
     $configuration = $operation->getBatchConfig();
     $this->jobLauncher->launch($jobInstance, $this->tokenStorage->getToken()->getUser(), $configuration);
 }
 /**
  * @param JobRepositoryInterface  $jobRepository
  * @param JobConfigurationFactory $jobConfigFactory
  * @param ObjectManager           $objectManager
  * @param string                  $rootDir
  * @param string                  $environment
  */
 public function __construct(JobRepositoryInterface $jobRepository, JobConfigurationFactory $jobConfigFactory, ObjectManager $objectManager, $rootDir, $environment)
 {
     parent::__construct($jobRepository, $rootDir, $environment);
     $this->jobConfigFactory = $jobConfigFactory;
     $this->objectManager = $objectManager;
 }