---------------- 
Given a schedule, generate a friendly sentence description.
@param {Object} schedule
@returns {string}
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;
  }
1047249
def turn_schedule_to_msg(schedule)

      return false unless @storage.reserve(schedule)

      msg = Ruote.fulldup(schedule['msg'])

      @storage.put_msg(msg.delete('action'), msg)

      true
    end
369474
def schedule_job(self, j):
        
        job_id = uuid.uuid4().hex
        j.job_id = job_id

        session = self.sessionmaker()
        orm_job = ORMJob(
            id=job_id,
            state=j.state,
            app=self.app,
            namespace=self.namespace,
            obj=j)
        session.add(orm_job)
        try:
            session.commit()
        except Exception as e:
            logging.error(
                "Got an error running session.commit(): {}".format(e))

        return job_id
1316906
protected function defineCommandSchedule(Schedule $schedule, array $definition)
    {
        $arguments = $definition['arguments'] ?? [];

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

        $this->configureEvent($event, $definition);
    }
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);
                }
            }
        }
    }
214518
def build_schedule_item(name, **kwargs):
    '''
    
    '''

    ret = {'comment': [],
           'result': True}

    if not name:
        ret['comment'] = 'Job name is required.'
        ret['result'] = False
        return ret

    schedule = {}
    schedule[name] = salt.utils.odict.OrderedDict()
    schedule[name]['function'] = kwargs['function']

    time_conflict = False
    for item in ['seconds', 'minutes', 'hours', 'days']:
        if item in kwargs and 'when' in kwargs:
            time_conflict = True

        if item in kwargs and 'cron' in kwargs:
            time_conflict = True

    if time_conflict:
        ret['result'] = False
        ret['comment'] = 'Unable to use "seconds", "minutes", "hours", or "days" with "when" or "cron" options.'
        return ret

    if 'when' in kwargs and 'cron' in kwargs:
        ret['result'] = False
        ret['comment'] = 'Unable to use "when" and "cron" options together.  Ignoring.'
        return ret

    for item in ['seconds', 'minutes', 'hours', 'days']:
        if item in kwargs:
            schedule[name][item] = kwargs[item]

    if 'return_job' in kwargs:
        schedule[name]['return_job'] = kwargs['return_job']

    if 'metadata' in kwargs:
        schedule[name]['metadata'] = kwargs['metadata']

    if 'job_args' in kwargs:
        schedule[name]['args'] = kwargs['job_args']

    if 'job_kwargs' in kwargs:
        schedule[name]['kwargs'] = kwargs['job_kwargs']

    if 'maxrunning' in kwargs:
        schedule[name]['maxrunning'] = kwargs['maxrunning']
    else:
        schedule[name]['maxrunning'] = 1

    if 'name' in kwargs:
        schedule[name]['name'] = kwargs['name']
    else:
        schedule[name]['name'] = name

    if 'enabled' in kwargs:
        schedule[name]['enabled'] = kwargs['enabled']
    else:
        schedule[name]['enabled'] = True

    if 'jid_include' not in kwargs or kwargs['jid_include']:
        schedule[name]['jid_include'] = True

    if 'splay' in kwargs:
        if isinstance(kwargs['splay'], dict):
            # Ensure ordering of start and end arguments
            schedule[name]['splay'] = salt.utils.odict.OrderedDict()
            schedule[name]['splay']['start'] = kwargs['splay']['start']
            schedule[name]['splay']['end'] = kwargs['splay']['end']
        else:
            schedule[name]['splay'] = kwargs['splay']

    if 'when' in kwargs:
        if not _WHEN_SUPPORTED:
            ret['result'] = False
            ret['comment'] = 'Missing dateutil.parser, "when" is unavailable.'
            return ret
        else:
            validate_when = kwargs['when']
            if not isinstance(validate_when, list):
                validate_when = [validate_when]
            for _when in validate_when:
                try:
                    dateutil_parser.parse(_when)
                except ValueError:
                    ret['result'] = False
                    ret['comment'] = 'Schedule item {0} for "when" in invalid.'.format(_when)
                    return ret

    for item in ['range', 'when', 'once', 'once_fmt', 'cron',
                 'returner', 'after', 'return_config', 'return_kwargs',
                 'until', 'run_on_start', 'skip_during_range']:
        if item in kwargs:
            schedule[name][item] = kwargs[item]

    return schedule[name]
998030
def scheduled():
    '''
    
    '''
    for job in sorted(schedulables(), key=lambda s: s.name):
        for task in PeriodicTask.objects(task=job.name):
            label = job_label(task.task, task.args, task.kwargs)
            echo(SCHEDULE_LINE.format(
                name=white(task.name.encode('utf8')),
                label=label,
                schedule=task.schedule_display
            ).encode('utf8'))
177337
public static List<Long> getDelayMillsList(String schedulePlans) {
		List<Long> result = new ArrayList<>();
		String[] plans = StringUtils.split(schedulePlans, ',');
		for (String plan : plans) {
			result.add(getDelayMillis(plan));
		}
		return result;
	}
267523
@Schedule(period = 5)
    @POST
    @Path("schedule")
    public Broadcastable schedule(@FormParam("message") String message) {
        return broadcast(message);
    }
788032
func (c *Cron) Schedule(schedule Schedule, cmd Job) {
	entry := &Entry{
		Schedule: schedule,
		Job:      cmd,
	}
	if !c.running {
		c.entries = append(c.entries, entry)
		return
	}

	c.add <- entry
}
642904
public function editScheduleAction(Schedule $schedule)
    {
        try {
            $schedule = execute(new UpdateScheduleCommand(
                $schedule,
                Binput::get('name', null),
                Binput::get('message', null),
                Binput::get('status', null),
                Binput::get('scheduled_at', null),
                Binput::get('completed_at', null),
                Binput::get('components', [])
            ));
        } catch (ValidationException $e) {
            return cachet_redirect('dashboard.schedule.edit', [$schedule->id])
                ->withInput(Binput::all())
                ->withTitle(sprintf('%s %s', trans('dashboard.notifications.whoops'), trans('dashboard.schedule.edit.failure')))
                ->withErrors($e->getMessageBag());
        }

        return cachet_redirect('dashboard.schedule.edit', [$schedule->id])
            ->withSuccess(sprintf('%s %s', trans('dashboard.notifications.awesome'), trans('dashboard.schedule.edit.success')));
    }
419769
def schedule_url(self, release):
        
        product, _ = release.split('-', 1)
        url = 'product/%s/release/%s/schedule/tasks' % (product, release)
        return posixpath.join(self.url, url)
996800
public Scheduler schedule(String id, String pattern, Task task) {
		return schedule(id, new CronPattern(pattern), task);
	}
270517
function matchSchedule (value, sequence) {
    for (var i = 0, c = sequence.length; i < c; i++) {
      if (sequence[i] >= value) {
        return sequence[i] === value;
      }
    }

    return sequence[0] === value;
  }
781108
function(start) {
      for(var id in rMap) {
        var res = rMap[id];

        if(res.schedule.exceptions) {
          var curExceptions = res.schedule.exceptions;
          res.schedule.exceptions = [];

          for(var i = 0, len = curExceptions.length; i < len; i++) {
            if(!curExceptions[i].fd_b || curExceptions[i].fd_b > start) {
              res.schedule.exceptions.push(curExceptions[i]);
            }
          }
          res.next = schedule.memoizedRangeFn(later.schedule(res.schedule).nextRange);
        }

        if(res.nextAvail[0] < start) {
          res.nextAvail = res.next(start);
        }
      }
    }
757284
function _schedule() {
    // do not _schedule when there are timeouts in progress
    // this can be the case with async timeouts in non-paced mode.
    // _schedule will be executed again when all async timeouts are finished.
    if (!paced && Object.keys(current).length > 0) {
      return;
    }

    var next = timeouts[0];

    // cancel timer when running
    if (timeoutId) {
      clearTimeout(timeoutId);
      timeoutId = null;
    }

    if (running && next) {
      // schedule next timeout
      var time = next.time;
      var delay = time - timer.now();
      var realDelay = paced ? delay / rate : 0;

      function onTimeout() {
        // when running in non-paced mode, update the hyperTime to
        // adjust the time of the current event
        if (!paced) {
          hyperTime = (time > hyperTime && isFinite(time)) ? time : hyperTime;
        }

        // grab all expired timeouts from the queue
        var expired = _getExpiredTimeouts(time);
        // note: expired.length can never be zero (on every change of the queue, we reschedule)

        // execute all expired timeouts
        if (paced) {
          // in paced mode, we fire all timeouts in parallel,
          // and don't await their completion (they can do async operations)
          expired.forEach(function (timeout) {
            _execTimeout(timeout);
          });

          // schedule the next round
          _schedule();
        }
        else {
          // in non-paced mode, we execute all expired timeouts serially,
          // and wait for their completion in order to guarantee deterministic
          // order of execution
          function next() {
            var timeout = expired.shift();
            if (timeout) {
              _execTimeout(timeout, next);
            }
            else {
              // schedule the next round
              _schedule();
            }
          }
          next();
        }
      }

      timeoutId = setTimeout(onTimeout, Math.round(realDelay));
      // Note: Math.round(realDelay) is to defeat a bug in node.js v0.10.30,
      //       see https://github.com/joyent/node/issues/8065
    }
  }
144040
public static String getOffsetCodeFromSchedule(Schedule schedule) {

		double doubleLength = 0;
		for(int i = 0; i < schedule.getNumberOfPeriods(); i ++) {
			doubleLength += schedule.getPeriodLength(i);
		}
		doubleLength /= schedule.getNumberOfPeriods();

		doubleLength *= 12;
		int periodLength = (int) Math.round(doubleLength);


		String offsetCode = periodLength + "M";
		return offsetCode;
	}