Define schedule callback.

@param \Illuminate\Console\Scheduling\Schedule $schedule
@param array $definition
333811
protected function defineCallbackSchedule(Schedule $schedule, array $definition)
    {
        $arguments = $definition['arguments'] ?? [];

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

        $this->configureEvent($event, $definition);
    }
429097
protected function defineConsoleSchedule()
    {
        Zilf::$container->register(Schedule::class,function (){
            return new Schedule();
        });

        $schedule = Zilf::$container->getShare(Schedule::class);

        $this->schedule($schedule);
    }
1338595
public function remove(string $schedule, array $params = [])
    {
        $path = $this->buildSchedulesPath($schedule);

        return $this->delete($path, $params);
    }
984265
public function schedule() {
		if (!empty($this->params['scheduled-wait-prev'])) {
			$this->_scheduleNextTaskDependsOnPrevious = ($this->params['scheduled-wait-prev'] === 'yes');
		}
		list($command, $path, $arguments, $options) = $this->_scheduleVars();
		$lastTaskId = null;
		foreach ($this->getScheduleSplitter()->split($arguments) as $_arguments) {
			$_options = $options;
			if ($this->_scheduleNextTaskDependsOnPrevious && !is_null($lastTaskId)) {
				$_options['dependsOn'][] = $lastTaskId;
			}
			$task = $this->_schedule($command, $path, $_arguments, $_options);
			$lastTaskId = $task['id'];
		}
	}
1286771
public function start(\Generator $routine, Controller $controller, callable $callBack = null)
    {
        $task  = $controller->getObject(Task::class, [$routine, $controller, $callBack]);
        $requestId = $controller->getContext()->getRequestId();
        $this->IOCallBack[$requestId] = [];
        $this->taskMap[$requestId]    = $task;
        $this->schedule($task);
    }
632413
public function removeAlias($record, $schedule = false)
    {
        if ($schedule) {
            // delay removal until flushed
            $this->scheduledRemoveAlias [] = $this->provider->url($record);
        } else {
            $this->aliasing->removeAlias($this->provider->url($record));
        }
    }
55387
def schedule(cron, name, params):
    '''
    
    '''
    if name not in celery.tasks:
        exit_with_error('Job %s not found', name)

    args = [p for p in params if '=' not in p]
    kwargs = dict(p.split('=') for p in params if '=' in p)
    label = 'Job {0}'.format(job_label(name, args, kwargs))

    try:
        task = PeriodicTask.objects.get(task=name, args=args, kwargs=kwargs)
        task.modify(crontab=PeriodicTask.Crontab.parse(cron))
    except PeriodicTask.DoesNotExist:
        task = PeriodicTask.objects.create(
            task=name,
            name=label,
            description='Periodic {0} job'.format(name),
            enabled=True,
            args=args,
            kwargs=kwargs,
            crontab=PeriodicTask.Crontab.parse(cron),
        )

    msg = 'Scheduled {label} with the following crontab: {cron}'
    log.info(msg.format(label=label, cron=task.schedule_display))
1274588
public function schedule(TimerInterface $timer)
    {

        // force handling the timer tasks now
        $this->synchronized(function (TimerInterface $t) {

            // store the timer-ID and the PK of the timer service => necessary to load the timer later
            $this->scheduledTimers[$timerId = $t->getId()] = $t->getTimerService()->getPrimaryKey();

            // create a wrapper instance for the timer task that we want to schedule
            $timerTaskWrapper = new \stdClass();
            $timerTaskWrapper->executeAt = microtime(true) + ($t->getTimeRemaining() / 1000000);
            $timerTaskWrapper->taskId = uniqid();
            $timerTaskWrapper->timerId = $timerId;

            // schedule the timer tasks as wrapper
            $this->tasksToExecute[$timerTaskWrapper->taskId] = $timerTaskWrapper;

        }, $timer);
    }
1342996
protected function registerScheduleRunCommand()
    {
        Zilf::$container->register(ScheduleRunCommand::class, function (){
            $schedule = Zilf::$container->getShare(Schedule::class);
            return new ScheduleRunCommand($schedule);
        });
    }
963607
private void createMaintenanceScheduleTranslatorControl() {
        scheduleTranslator = new LabelBuilder().id(UIComponentIdProvider.MAINTENANCE_WINDOW_SCHEDULE_TRANSLATOR_ID)
                .name(i18n.getMessage(CRON_VALIDATION_ERROR)).buildLabel();
        scheduleTranslator.addStyleName(ValoTheme.LABEL_TINY);
    }
924852
public function addSchedule($scheduleId)
    {
        $schedule = new Schedule($this->customerKey, $this->key);
        $schedule->id = $scheduleId;
        return $schedule;
    }
973465
public function getGanttDivAttributes(Aoe_Scheduler_Model_Schedule $schedule)
    {

        if ($schedule->getStatus() == Aoe_Scheduler_Model_Schedule::STATUS_RUNNING) {
            $duration = time() - strtotime($schedule->getStarttime());
        } else {
            $duration = $schedule->getDuration() ? $schedule->getDuration() : 0;
        }
        $duration = $duration / $this->zoom;
        $duration = ceil($duration / 4) * 4 - 1; // round to numbers dividable by 4, then remove 1 px border
        $duration = max($duration, 3);

        $offset = (strtotime($schedule->getStarttime()) - $this->starttime) / $this->zoom;

        if ($offset < 0) { // cut bar
            $duration += $offset;
            $offset = 0;
        }

        $result = sprintf(
            '<div class="task %s" id="id_%s" style="width: %spx; left: %spx;" ></div>',
            $schedule->getStatus(),
            $schedule->getScheduleId(),
            $duration,
            $offset
        );

        if ($schedule->getStatus() == Aoe_Scheduler_Model_Schedule::STATUS_RUNNING) {
            $offset += $duration;

            $duration = strtotime($schedule->getEta()) - time();
            $duration = $duration / $this->zoom;

            $result = sprintf(
                '<div class="estimation" style="width: %spx; left: %spx;" ></div>',
                $duration,
                $offset
            ) . $result;
        }

        return $result;
    }
1186634
public function setNextSchedule($scheduler)
    {
        $scheduler->next_run_due = $this->getNextRunDue($scheduler->schedule, $scheduler->timezone);
        $scheduler->next_check_due = $this->getNextCheckDue($scheduler->schedule, $scheduler->timezone, $scheduler->alert_run_time_greater_than);
        $scheduler->save();
    }
1251396
public function schedule($type, $details)
    {
        $schedule = array();
        $schedule[$type] = $details;
        return $this->setArgument("schedule", $schedule);
    }
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;
    }
911531
public static function schedules($options = array(), $publickey = null, $secretkey = null)
    {
        if (is_array($options)) {
            $options = '?' . http_build_query($options);
        }

        return parent::g_retrieve('OmiseScheduleList', self::getUrl('schedules' . $options), $publickey, $secretkey);
    }
353605
function scheduleToSentence(schedule) {
    var outputText = locale.Every + ' ';

    if (schedule['h'] && schedule['m'] && schedule['h'].length <= 2 && schedule['m'].length <= 2) {
      // If there are only one or two specified values for
      // hour or minute, print them in HH:MM format

      var hm = [];
      for (var i = 0; i < schedule['h'].length; i++) {
        for (var j = 0; j < schedule['m'].length; j++) {
          hm.push(zeroPad(schedule['h'][i]) + ':' + zeroPad(schedule['m'][j]));
        }
      }
      if (hm.length < 2) {
        outputText = hm[0];
      } else {
        var lastVal = hm.pop();
        outputText = hm.join(', ') + ` ${locale.and} ` + lastVal;
      }
      if (!schedule['d'] && !schedule['D']) {
        outputText += ` ${locale['every day']}`;
      }
    } else {
      // Otherwise, list out every specified hour/minute value.

      if (schedule['h']) { // runs only at specific hours
        if (schedule['m']) { // and only at specific minutes
          outputText += numberList(schedule['m']) + ` ${locale['minute past the']} ` + numberList(schedule['h']) + ` ${locale['hour']}`;
        } else { // specific hours, but every minute
          outputText += `${locale['minute of']} ` + numberList(schedule['h']) + ` ${locale['hour']}`;
        }
      } else if (schedule['m']) { // every hour, but specific minutes
        outputText += numberList(schedule['m']) + ` ${locale['minute every hour']}`;
      } else { // cronspec has "*" for both hour and minute
        outputText += locale['minute'];
      }
    }

    if (schedule['D']) { // runs only on specific day(s) of month
      outputText += (locale['on the'] ? ` ${locale['on the']} ` : ' ') + numberList(schedule['D']);
      if (!schedule['M']) {
        outputText += ` ${locale['of every month']}`;
      }
    }

    if (schedule['d']) { // runs only on specific day(s) of week
      if (schedule['D']) {
        // if both day fields are specified, cron uses both; superuser.com/a/348372
        outputText += ` ${locale['and every']} `;
      } else {
        outputText += ` ${locale['on']} `;
      }
      outputText += dateList(schedule['d'], 'dow');
    }

    if (schedule['M']) {
      // runs only in specific months; put this output last
      outputText += ` ${locale['in']} ` + dateList(schedule['M'], 'mon');
    }

    return outputText;
  }