Returnes a report.

@param $workflow_job_key
@param $workflow_job_config
@param array $end_state
@return array
@throws \Exception
490777
static function endJob($workflow_job_key, $workflow_job_config, $end_state = []) {
        $workflow_job_config = array_merge($workflow_job_config, [
            "status" => self::STATUS_COMPLETED,
            "end_state" => $end_state,
            "finished" => new \DateTime()
        ]);
        DataStore::saveWorkflowJob($workflow_job_key, $workflow_job_config);
        return $workflow_job_config;
    }
613675
public function getrange($key, $start, $end) {
        return $this->returnCommand(['GETRANGE'], $key, [$key, $start, $end]);
    }
395319
static function isWorkflowRunning($workflow_key) {
        $status = self::STATUS_RUNNING;
        if (Util::isDevServer()) {
            $created_after = "-60 seconds";
        } else {
            $created_after = "-" . Moment::ONEHOUR . " seconds";
        }
        $data = DataStore::retrieveMostCurrentWorkflowJobByAgeAndStatus($workflow_key, $status, $created_after);
        $result = (bool)$data;
        return $result;
    }
157009
public JobExecutionResult execute(String job_name) throws Exception {
		distributeFiles();
		JobExecutionResult result = this.env.execute(job_name);
		return result;
	}
52299
public function valid()
    {
        if (null === $this->getManagerName()) {
            $errMsg = 'No workflow manager';
            throw new Exception\InvalidArgumentException($errMsg);
        }

        if (null === $this->getActionName()) {
            $errMsg = 'Not Specified action for workflow';
            throw new Exception\InvalidArgumentException($errMsg);
        }

        $workflowActivity = $this->getRunType();
        if (!array_key_exists($workflowActivity, $this->allowWorkflowRunType)) {
            $errMsg = sprintf('Invalid activity %s', $workflowActivity);
            throw new Exception\InvalidArgumentException($errMsg);
        }

        if (static::WORKFLOW_RUN_INITIALIZE === $workflowActivity && null === $this->getWorkflowName()) {
            $errMsg = 'Not specified name workflow';
            throw new Exception\InvalidArgumentException($errMsg);
        }

        if (static::WORKFLOW_RUN_TYPE_DO_ACTION === $workflowActivity && null === $this->getEntryId()) {
            $errMsg = 'Not specified entryId';
            throw new Exception\InvalidArgumentException($errMsg);
        }
    }
928581
public function waitForReportToFinish()
    {
        $reportJobStatus = $this->reportService
            ->getReportJobStatus($this->reportJobId);
        while ($reportJobStatus === ReportJobStatus::IN_PROGRESS) {
            $this->logger->info(
                sprintf(
                    'Report job ID %d has status %s. Sleeping for %d seconds '
                    . 'before polling again for report status.',
                    $this->reportJobId,
                    $reportJobStatus,
                    $this->pollTimeSeconds
                )
            );
            sleep($this->pollTimeSeconds);
            $reportJobStatus = $this->reportService
                ->getReportJobStatus($this->reportJobId);
        }

        return $reportJobStatus === ReportJobStatus::COMPLETED;
    }
1261961
public function getInvoices(
        DateTime $startDate = null,
        DateTime $endDate = null,
        $max = self::MIRAKL_API_MAX_PAGINATE,
        $offset = self::MIRAKL_API_DEFAULT_OFFSET_PAGINATE,
        $shopId = null,
        $type = 'AUTO_INVOICE',
        $currency = null
    ) {
        $this->restClient->getConfig()->setPath(
            'request.options/headers/Authorization',
            $this->operatorKey
        );
        $command = $this->restClient->getCommand(
            'GetInvoices',
            array(
                'shopId' => $shopId,
                'startDate' => $startDate,
                'endDate' => $endDate,
                'type' => $type,
                'currency' => $currency,
                'max' => $max,
                'offset' => $offset
            )
        );
        $result = $this->restClient->execute($command);

        return $result;
    }
59543
public function getWorkflowDescriptor($workflowName)
    {
        try {
            return $this->getConfiguration()->getWorkflow($workflowName);
        } catch (FactoryException $e) {
            $errMsg = 'Ошибка при загрузке workflow';
            $this->getLog()->error($errMsg, ['exception' => $e]);
            throw new InternalWorkflowException($errMsg, $e->getCode(), $e);
        }
    }
18597
function getJobDetail(jobId, resultFunc) {
  $.ajax({
    type: 'GET',
    url: 'command/get_job_detail',
    dataType: 'text',
    data: {'mapreduce_id': jobId},
    statusCode: {
      404: function() {
        setButter('job ' + jobId + ' was not found.', true);
      }
    },
    error: function(request, textStatus) {
      getResponseDataJson(textStatus);
    },
    success: function(data, textStatus, request) {
      var response = getResponseDataJson(null, data);
      if (response) {
        resultFunc(jobId, response);
      }
    }
  });
}
1008691
protected function validateJobParams(Job $job)
    {
        if (empty($job->getFromMail())) {
            throw new ResultException(ResultException::ERROR_PARAM_FROM_MAIL);
        }

        if (empty($job->getFromName())) {
            throw new ResultException(ResultException::ERROR_PARAM_FROM_NAME);
        }

        if (empty($job->getToMail())) {
            throw new ResultException(ResultException::ERROR_PARAM_TO_MAIL);
        }

        if (empty($job->getSubject())) {
            throw new ResultException(ResultException::ERROR_PARAM_SUBJECT);
        }

        if (empty($job->getBody())) {
            throw new ResultException(ResultException::ERROR_PARAM_BODY);
        }

    }
966747
public function process(DateTime $startDate, DateTime $endDate, DateTime $cycleDate)
    {
        $this->logger->info('Control Mirakl Settings', array('miraklId' => null, "action" => "Operations creation"));
        // control mirakl settings
        $boolControl = $this->getControlMiraklSettings($this->documentTypes);
        if ($boolControl === false) {
            // log critical
            $title = $this->criticalMessageMiraklSettings;
            $message = $this->formatNotification->formatMessage($title);
            $this->logger->critical($message, array('miraklId' => null, "action" => "Operations creation"));
        } else {
            $this->logger->info(
                'Control Mirakl Settings OK',
                array('miraklId' => null, "action" => "Operations creation")
            );
        }

        $this->logger->info('Cashout Initializer', array('miraklId' => null, "action" => "Operations creation"));

        //Fetch Invoices
        $this->logger->info(
            'Fetch invoices documents from Mirakl from ' .
            $startDate->format('Y-m-d H:i') .
            ' to ' .
            $endDate->format('Y-m-d H:i')
            ,
            array('miraklId' => null, "action" => "Operations creation")
        );

        // get invoices from Mirakl API
        $invoices = $this->getInvoices($startDate, $endDate);

        $this->logger->info(
            '[OK] Fetched ' . count($invoices) . ' invoices',
            array('miraklId' => null, "action" => "Operations creation")
        );

        $this->logger->info('Process invoices', array('miraklId' => null, "action" => "Operations creation"));

        $operations = $this->processInvoices($invoices, $cycleDate);

        $this->saveOperations($operations);

    }
524299
def callback(self):
    """"""
    if self.was_aborted:
      return

    mapreduce_id = self.outputs.job_id.value
    mapreduce_state = model.MapreduceState.get_by_job_id(mapreduce_id)
    if mapreduce_state.result_status != model.MapreduceState.RESULT_SUCCESS:
      self.retry("Job %s had status %s" % (
          mapreduce_id, mapreduce_state.result_status))
      return

    mapper_spec = mapreduce_state.mapreduce_spec.mapper
    outputs = []
    output_writer_class = mapper_spec.output_writer_class()
    if (output_writer_class and
        mapreduce_state.result_status == model.MapreduceState.RESULT_SUCCESS):
      outputs = output_writer_class.get_filenames(mapreduce_state)

    self.fill(self.outputs.result_status, mapreduce_state.result_status)
    self.fill(self.outputs.counters, mapreduce_state.counters_map.to_dict())
    self.complete(outputs)
502116
function continueWorkflow()
    {
        if( $this->paymentObject )
        {
            $workflowID = $this->paymentObject->attribute( 'workflowprocess_id' );
            if( $workflowID )
            {
                return eZPaymentObject::continueWorkflow( $workflowID );
            }

            $this->logger->writeTimedString( "workflowID is not set", 'continueWorkflow failed' );
            return null;
        }

        $this->logger->writeTimedString( "payment object is not set", 'continueWorkflow failed' );
        return null;
    }
1027507
def end_job_input(self, job_id):
        
        log.debug("EndJobInput %r", job_id)
        path = "/%s/jobs/%s/live/in/end" % (self.account, job_id)
        headers = {
            # "Content-Length": "0"   #XXX needed?
        }
        res, content = self._request(path, "POST", headers=headers)
        if res["status"] != '202':
            raise errors.MantaAPIError(res, content)
865847
def process_job(job, options = {}, report_email = nil, postback_url = nil, binary_key = nil)
      data = options
      data['job'] = job
      if !report_email.nil?
        data['report_email'] = report_email
      end

      if !postback_url.nil?
        data['postback_url'] = postback_url
      end
      api_post(:job, data, binary_key)
    end
766822
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (!$this->workflowRegistry instanceof Registry) {
            throw new Exception('Can not execute task: No workflows were defined');
        }

        $taskId = $input->getArgument('task-id');

        $callback = function () use ($taskId) {
            $task = $this->entityManager->find(Task::class, $taskId);

            if ($task instanceof Task) {
                $task->setStatus('in-progress');
            }

            return $task;
        };

        $task = $this->entityManager->transactional($callback);

        if (!$task instanceof Task) {
            $output->writeln(sprintf('No task found for id %d', $taskId));

            return;
        }

        $this->setAnonymousToken();

        $subject = $this->subjectManager->createSubject($task->getModel());
        $subject->setUp();
        $generator = $this->generatorManager->getGenerator($task->getGenerator());
        $workflow = $this->workflowRegistry->get($subject, $task->getModel());

        $path = new Path();
        $path->add(null, null, [$workflow->getDefinition()->getInitialPlace()]);

        try {
            foreach ($generator->getAvailableTransitions($workflow, $subject, $task->getMetaData()) as $transitionName) {
                try {
                    if (!$generator->applyTransition($workflow, $subject, $transitionName)) {
                        throw new Exception(sprintf("Generator '%s' generated transition '%s' that can not be applied", $task->getGenerator(), $transitionName));
                    }
                } catch (Throwable $throwable) {
                    throw $throwable;
                } finally {
                    $data = $subject->getStoredData();
                    $places = array_keys(array_filter($workflow->getMarking($subject)->getPlaces()));
                    $path->add($transitionName, $data, $places);
                }
            }
        } catch (Throwable $throwable) {
            $message = new CreateBugMessage(
                $this->defaultBugTitle,
                Path::serialize($path),
                $path->countPlaces(),
                $throwable->getMessage(),
                $task->getId(),
                'new'
            );
            $this->messageBus->dispatch($message);
        } finally {
            $subject->tearDown();

            $this->messageBus->dispatch(new UpdateTaskStatusMessage($taskId, 'completed'));
        }
    }
241864
public function getJobStatus($jobId) {

        $data["Envelope"] = array(
            "Body" => array(
                "GetJobStatus" => array(
                    "JOB_ID" => $jobId
                ),
            ),
        );

        $response = $this->_request($data);
        $result = $response["Envelope"]["Body"]["RESULT"];

        if ($this->_isSuccess($result)) {
            if (isset($result['JOB_STATUS']))
                return $result;
            else {
                throw new Exception('Job status query was successful but no status was found.');
            }
        } else {
            throw new \Exception("getJobStatus Error: ".$this->_getErrorFromResponse($response));
        }

    }