Set scheduler

@param \CampaignChain\CoreBundle\Entity\Scheduler $scheduler
@return Job
426564
public function setScheduler(\CampaignChain\CoreBundle\Entity\Scheduler $scheduler = null)
    {
        $this->scheduler = $scheduler;

        return $this;
    }
462593
public function delay($delay, $scheduler = null)
    {
        return $this->lift(function () use ($delay, $scheduler) {
            return new DelayOperator($delay, $scheduler);
        });
    }
380900
public function setReferrer($referrer = '')
    {
        $this->referrer = $referrer;
        $this->debug->info(__FUNCTION__, 'setReferrer: ', $this->referrer);

        return $this;
    }
924852
public function addSchedule($scheduleId)
    {
        $schedule = new Schedule($this->customerKey, $this->key);
        $schedule->id = $scheduleId;
        return $schedule;
    }
866670
public function generateSchedulesForJob(Aoe_Scheduler_Model_Job $job)
    {
        if (!$job->canBeScheduled()) {
            return $this;
        }

        $exists = array();
        foreach ($this->getPendingSchedules(array($job->getJobCode()), array()) as $schedule) {
            /* @var Aoe_Scheduler_Model_Schedule $schedule */
            $exists[$schedule->getJobCode() . '/' . $schedule->getScheduledAt()] = 1;
        }

        $now = time();
        $scheduleAheadFor = Mage::getStoreConfig(Mage_Cron_Model_Observer::XML_PATH_SCHEDULE_AHEAD_FOR)*60;
        $timeAhead = $now + $scheduleAheadFor;

        $schedule = Mage::getModel('cron/schedule'); /* @var $schedule Aoe_Scheduler_Model_Schedule */
        $schedule->initializeFromJob($job);
        $schedule->setScheduledReason(Aoe_Scheduler_Model_Schedule::REASON_GENERATESCHEDULES);

        for ($time = $now + 60; $time < $timeAhead; $time += 60) {
            $ts = strftime('%Y-%m-%d %H:%M:00', $time);
            if (!empty($exists[$job->getJobCode().'/'.$ts])) {
                // already scheduled
                continue;
            }
            if (!$schedule->trySchedule($time)) {
                // time does not match cron expression
                continue;
            }
            $schedule->unsScheduleId()->save();
        }

        return $this;
    }
1076386
public static function timer(int $dueTime, AsyncSchedulerInterface $scheduler = null): TimerObservable
    {
        return new TimerObservable($dueTime, $scheduler ?: Scheduler::getAsync());
    }
906601
public static function fromParser(ScheduleParser $parser): self
    {
        $instance = new self();
        $instance->monday = $parser->getShedule('monday');
        $instance->tuesday = $parser->getShedule('tuesday');
        $instance->wednesday = $parser->getShedule('wednesday');
        $instance->thursday = $parser->getShedule('thursday');
        $instance->friday = $parser->getShedule('friday');
        $instance->saturday = $parser->getShedule('saturday');
        $instance->sunday = $parser->getShedule('sunday');
        $instance->other = $parser->getShedule('other');
        $instance->unknown = $parser->getShedule('unknown');

        return $instance;
    }
635846
public function setTransformer($transformer = null)
    {
        if (!$this->resource) {
            throw new MissingResourceException('Resource must be specified before setting a transformer');
        }
        $this->resource->setTransformer($transformer);

        return $this;
    }
1200223
public function setFrequency(int $value) : ScheduledJob
    {

        if ($this->data['frequency'] !== $value) {
            $this->data['frequency'] = $value;
            $this->setModified('frequency');
        }

        return $this;
    }
333811
protected function defineCallbackSchedule(Schedule $schedule, array $definition)
    {
        $arguments = $definition['arguments'] ?? [];

        $event = $schedule->call($definition['callback'], $arguments);

        $this->configureEvent($event, $definition);
    }
1316393
public Scheduler getScheduler() {
    if (scheduler == null) {
      scheduler = new Scheduler();
      scheduler.setDaemon(true);
      scheduler.start();
    }
    return scheduler;
  }
665851
public function schedule($when)
    {
        if (is_numeric($when)) {
            $dt = new DateTime;
            $dt->setTimestamp($when);
        } else {
            $dt = new DateTime($when);
        }

        $this->scheduled_at = $dt->format(DateTime::ISO8601);

        return $this;
    }
1230988
public function startWith($startValue, SchedulerInterface $scheduler = null): Observable
    {
        return $this->startWithArray([$startValue], $scheduler);
    }
330638
protected function schedule(Schedule $schedule)
    {
        if (!extension_active('automation')) {
            return false;
        }
        $queue = Jobs::all();
        foreach ($queue as $job) {
            if (!(int) $job->active) {
                continue;
            }
            $launch = $job->value['launch'];
            if (!is_array($launch)) {
                if (!is_string($launch)) {
                    continue;
                }
                $schedule->command($job->name)->$launch();
            } else {
                $command = $schedule->command($job->name);
                foreach ($launch as $method => $params) {
                    call_user_func_array(array($command, $method), $params);
                }
            }
        }
    }
560735
public function initializeFromJob(Aoe_Scheduler_Model_Job $job)
    {
        $this->setJobCode($job->getJobCode());
        $this->setCronExpr($job->getCronExpression());
        $this->setStatus(Aoe_Scheduler_Model_Schedule::STATUS_PENDING);
        return $this;
    }
757541
public static function start(callable $action, SchedulerInterface $scheduler = null)
    {
        $scheduler = $scheduler ?: new ImmediateScheduler();
        $subject   = new AsyncSubject();

        $scheduler->schedule(function () use ($subject, $action) {
            $result = null;
            try {
                $result = call_user_func($action);
            } catch (\Exception $e) {
                $subject->onError($e);
                return;
            }
            $subject->onNext($result);
            $subject->onCompleted();
        });

        return $subject->asObservable();
    }
1334881
public function setJobs($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\Scheduler\V1\Job::class);
        $this->jobs = $arr;

        return $this;
    }