Start the process.

@param JobReport $report
327161
public function run(JobReport $report)
    {
        $this->report = $report;
        $report->setStartTime(microtime(true));
        $this->getProcess()->start(function ($type, $buffer) use ($report) {
            if (Process::ERR === $type) {
                $report->addError($buffer);
            } else {
                $report->addOutput($buffer);
            }
        });
    }
165640
protected function main(): void
    {
        $this->logger->info('start job listener', [
            'category' => get_class($this),
        ]);

        $cursor_jobs = $this->jobs->getCursor([
            '$or' => [
                ['status' => JobInterface::STATUS_WAITING],
                ['status' => JobInterface::STATUS_POSTPONED],
            ],
        ]);

        $cursor_events = $this->events->getCursor([
            'timestamp' => ['$gte' => new UTCDateTime()],
            'job' => ['$exists' => true],
            'status' => ['$gt' => JobInterface::STATUS_POSTPONED],
        ]);

        $this->catchSignal();

        while ($this->loop()) {
            while ($this->loop()) {
                if (null === $cursor_events->current()) {
                    if ($cursor_events->getInnerIterator()->isDead()) {
                        $this->logger->error('event queue cursor is dead, is it a capped collection?', [
                            'category' => get_class($this),
                        ]);

                        $this->events->create();

                        $this->main();

                        break;
                    }

                    $this->events->next($cursor_events, function () {
                        $this->main();
                    });
                }

                $event = $cursor_events->current();
                $this->events->next($cursor_events, function () {
                    $this->main();
                });

                if($event === null) {
                    break;
                }

                $this->handleEvent($event);
            }

            if (null === $cursor_jobs->current()) {
                if ($cursor_jobs->getInnerIterator()->isDead()) {
                    $this->logger->error('job queue cursor is dead, is it a capped collection?', [
                        'category' => get_class($this),
                    ]);

                    $this->jobs->create();
                    $this->main();

                    break;
                }

                $this->jobs->next($cursor_jobs, function () {
                    $this->main();
                });

                continue;
            }

            $job = $cursor_jobs->current();

            $this->jobs->next($cursor_jobs, function () {
                $this->main();
            });

            $this->handleJob($job);
        }
    }
724011
void startThread() {

        m_reportPanel.setVisible(true);
        m_startPanel.setVisible(false);
        m_report.setVisible(false);
        CmsStaticExportThread thread = new CmsStaticExportThread(A_CmsUI.getCmsObject());
        CmsReportWidget report = new CmsReportWidget(thread);
        report.setHeight("500px");
        report.setWidth("100%");
        m_layout.addComponent(report);
        thread.start();
    }
99258
protected function startSheet()
    {
        $this->sheetFilePointer = fopen($this->worksheetFilePath, 'w');
        $this->throwIfSheetFilePointerIsNotAvailable();

        fwrite($this->sheetFilePointer, self::SHEET_XML_FILE_HEADER);
        fwrite($this->sheetFilePointer, '<sheetData>');
    }
102880
public function start(): void
    {
        $classAndMethodName = $this->classNameGenerator->getClassAndMethodNamesForCalling();

        $this->executor->exec(...$classAndMethodName);
    }
944006
protected void traceJobStart(String jobXMLName, Properties jobParameters) {

        if (logger.isLoggable(Level.FINE)) {
            StringWriter jobParameterWriter = new StringWriter();
            if (jobParameters != null) {
                try {
                    jobParameters.store(jobParameterWriter, "Job parameters on start: ");
                } catch (IOException e) {
                    jobParameterWriter.write("Job parameters on start: not printable");
                }
            } else {
                jobParameterWriter.write("Job parameters on start = null");
            }

            logger.fine("Starting job: jobXMLName = " + jobXMLName + "\n" + jobParameterWriter.toString());
        }
    }
551905
public function start(string $query): void
    {
        foreach ($this->monitors as $monitor) {
            $monitor->start($query);
        }
    }
276835
protected function onInit()
    {
        $key = Utility::get($this->params, "key", "");
        $reportSource = Utility::get($this->params, "report");
        $reportParams = Utility::get($this->params, "params", array());

        if ($reportSource==null) {
            throw new \Exception("ReportDataSource require 'source' parameter which is the classname of source report");
        }

        if (ReportDataSource::$reports==null) {
            ReportDataSource::$reports = array();
        }

        if (isset(ReportDataSource::$reports[$reportSource.$key])) {
            $this->report = ReportDataSource::$reports[$reportSource.$key];
        } else {
            try
            {
                $this->report = new $reportSource($reportParams);
            }
            catch(\Exception $e)
            {
                throw new \Exception("Could not create report '$reportSource'");
            }
            
            ReportDataSource::$reports[$reportSource.$key]=$this->report;
            $this->report->run();
        }
    }
730587
protected function handleJobSeekerStartLookingForWorkCommand(JobSeekerStartLookingForWorkCommand $command)
    {
        $jobSeeker = JobSeeker::startLookingForWork($command->jobSeekerId);

        $this->repository->save($jobSeeker);
    }
1211472
public function startAction() {
        $posts = $this->getImportBatch(-1);

        if($posts['total'] > 0) {
            try {
                $postIDs = [];
                foreach($posts['posts'] as $post) {
                    $postIDs[] = $post['id'];
                }

                BatchManager::instance()->addToBatchAndRun($this->batchIdentifier(), $postIDs);
            } catch (\Exception $ex) {
                json_response(["status"=>"error", "error" => $ex->getMessage()]);
            }
        } else {
            BatchManager::instance()->reset($this->batchIdentifier());
            json_response(['status' => 'finished']);
        }

        $data = [
            'status' => 'running',
            'total' => $posts['total'],
            'first' => $posts['posts'][0]
        ];

        json_response($data);
    }
241213
def start(self):
		
		if self._thread_running.is_set():
			raise RuntimeError('the JobManager has already been started')
		self._thread.start()
		self._thread_running.wait()
		return
1263620
protected function run()
    {
        $subReport = new Report(Report::TYPE_INFO);
        $removeKV = $this->getOption('deleteKV');
        $persistConfig = $this->getOption('persistConfig');
        $chunkSize = $this->getOption('chunkSize');
        $resume = $this->getOption('resume');

        /** @var MonitoringStorage $monitoringService */
        $monitoringService = $this->getServiceManager()->get(DeliveryMonitoringService::SERVICE_ID);
        $originalPrimaryColumns = $monitoringService->getOption(MonitoringStorage::OPTION_PRIMARY_COLUMNS);
        $fields = array_unique(explode(',', $this->getOption('fields')));
        $kvFields = array_diff($fields, $originalPrimaryColumns);
        foreach ($kvFields as $field) {
            $createColumnReport = $this->addColumn($field);
            $subReport->add($createColumnReport);
        }

        $total = $monitoringService->count([]);
        $offset = 0;

        if ($resume) {
            $offset = (int)$this->getCache()->get(__CLASS__ . 'offset');
        }

        $executionProcessed = 0;
        $removed = 0;

        while ($offset < $total || $total < $chunkSize) {
            $this->getCache()->set(__CLASS__ . 'offset', $offset);

            $options = [
                'limit' => $chunkSize,
                'offset' => $offset
            ];
            $monitoringService->setOption(MonitoringStorage::OPTION_PRIMARY_COLUMNS, $originalPrimaryColumns);
            $deliveryExecutionsData = $monitoringService->find([], $options, true);
            $monitoringService->setOption(MonitoringStorage::OPTION_PRIMARY_COLUMNS, array_merge($originalPrimaryColumns, $kvFields));
            foreach ($deliveryExecutionsData as $dd) {
                $monitoringService->save($dd);
                $executionProcessed++;

                if ($removeKV) {
                    $sql = 'DELETE FROM ' . MonitoringStorage::KV_TABLE_NAME . '
                    WHERE ' . MonitoringStorage::KV_COLUMN_KEY . ' IN (' . implode(',', array_fill(0, count($kvFields), '?')) . ')' .
                        'AND ' . MonitoringStorage::KV_COLUMN_PARENT_ID . ' =?';
                    $removed += $monitoringService->getPersistence()->exec($sql, array_merge($kvFields, [$dd->get()[DeliveryMonitoringService::DELIVERY_EXECUTION_ID]]));
                }
            }
            $offset += $chunkSize;
        }
        $subReport->add(Report::createSuccess(__('%s executions migrated', $executionProcessed)));

        if ($removeKV) {
            $subReport->add(Report::createSuccess(__('%s KV entries removed', $removed)));
        }

        if ($persistConfig) {
            $this->getServiceManager()->register(DeliveryMonitoringService::SERVICE_ID, $monitoringService);
            $subReport->add(Report::createSuccess('Config persisted'));
        }

        // And return a Report!
        $result = new Report(
            Report::TYPE_SUCCESS,
            'Thanks for using migration tool!'
        );
        $result->add($subReport);

        $this->getCache()->set(__CLASS__ . 'offset', 0);

        return $result;
    }
102295
private void run(ReportOperation operation) throws ReportException {
        Set<String> executedPlugins = new HashSet<>();
        run(selectedReportPlugins, operation, executedPlugins);
        run(defaultReportPlugins, operation, executedPlugins);
    }
512814
public function update(Report &$report)
    {
        $data = $report->exportData();
        $endpoint = '/admin/reports/'.$report->id.'.json';
        $response = $this->request(
            $endpoint, 'PUT', array(
            'report' => $data
            )
        );
        $report->setData($response['report']);
    }
605017
public function start(Job $job)
    {
        $jobData = new JobData();

        if ($this->exec) {
            $jobDir = $this->_getJobDirectory($job);
            $logFile = realpath($this->getDirectory()) . '/run.log';
            $lockFile = $this->_lockJob($jobDir);

            if ($lockFile) {
                // $jobdir = str_replace("/", DIRECTORY_SEPARATOR, $jobDir);

                $jobData->lockFile = $lockFile;
                $jobData->job = $job;
                $jobData->jobDir = $jobDir;

                $this->runningJobs[spl_object_hash($job)] = $jobData;

                $data = $job->getData();
                $data['___class'] = get_class($job);

                file_put_contents("$jobDir/in.serialize", serialize($data));

                $cmd = $this->getCmd('"'.realpath(__DIR__ . "/../../bin/AsynchronousJobsRun.php") . "\" $jobDir >> $logFile");
                if (substr(php_uname(), 0, 7) == "Windows") {
                    $WshShell = new \COM("WScript.Shell");
                    $WshShell->Run("$cmd /C dir /S %windir%", 0, false);
                } else {
                    exec($cmd . " &");
                }

            } else {
                $this->pendingJobs[] = $job;
            }
        }else {
            $job->run();
            $job->end($jobData);
        }
    }
1003313
protected function processDatabaseOptions (Report $report)
    {
        // NOTE: Check whether database connection details have been set
        if (false === $this->getDatabase('name') && false === $report->getDatabase('name')) {
            return '';
        }

        // NOTE: Initialize $value for each command option testing the individual 
        //       report values for emptiness and defaulting to controlling object
        $database = '';

        $value = empty($report->getDatabase('host')) ? $this->getDatabase('host') : $report->getDatabase('host');
        $database .= empty($value) ? '' : "-H $value ";

        $value = empty($report->getDatabase('user')) ? $this->getDatabase('user') : $report->getDatabase('user');
        $database .= empty($value) ? '' : "-u $value ";

        $value = empty($report->getDatabase('pass')) ? $this->getDatabase('pass') : $report->getDatabase('pass');
        $database .= empty($value) ? '' : "-p $value ";

        $value = empty($report->getDatabase('name')) ? $this->getDatabase('name') : $report->getDatabase('name');
        $database .= empty($value) ? '' : "-n $value ";

        $value = empty($report->getDatabase('port')) ? $this->getDatabase('port') : $report->getDatabase('port');
        $database .= empty($value) ? '' : "--db-port $value ";

        // JDBC options
        $value = empty($report->getDatabase('url')) ? $this->getDatabase('url') : $report->getDatabase('url');
        $database .= empty($value) ? '' : "--db-url $value";

        $value = empty($report->getDatabase('dir')) ? $this->getDatabase('dir') : $report->getDatabase('dir');
        $database .= empty($value) ? '' : "--jdbc-dir $value ";

        $value = empty($report->getDatabase('class')) ? $this->getDatabase('class') : $report->getDatabase('class');
        $database .= empty($value) ? '' : "--db-driver $value ";

        // Oracle SID
        $value = empty($report->getDatabase('sid')) ? $this->getDatabase('sid') : $report->getDatabase('sid');
        $database .= empty($value) ? '' : "--db-sid $value ";

        return $database;
    }
24398
public function start()
    {
        try {
            $this->createClientSocket();
            $this->createWorkerJobSocket();
            $this->createWorkerReplySocket();
            $this->startWorkerPools();
            $this->loop->addPeriodicTimer(5, [$this, 'monitorChildProcesses']);
            $this->loop->addPeriodicTimer(10, [$this, 'monitorQueue']);
            $this->loop->run();
        } catch (ServerException $e) {
            $errorMsgPattern = 'Server error: %s (%s:%d)';
            $this->logger->emergency(sprintf($errorMsgPattern, $e->getMessage(), $e->getFile(), $e->getLine()));
        }
    }