Start scheduler loop
188865
def run(self):
        ''''''
        logger.info("scheduler starting...")

        while not self._quit:
            try:
                time.sleep(self.LOOP_INTERVAL)
                self.run_once()
                self._exceptions = 0
            except KeyboardInterrupt:
                break
            except Exception as e:
                logger.exception(e)
                self._exceptions += 1
                if self._exceptions > self.EXCEPTION_LIMIT:
                    break
                continue

        logger.info("scheduler exiting...")
        self._dump_cnt()
350220
def start(self):
        ""
        for i in xrange(self.size):
            scheduler.schedule(self._runner)
        self._closing = False
136360
public void start () throws SchedulerException
  {

    if (m_bShuttingDown || m_bClosed)
    {
      throw new SchedulerException ("The Scheduler cannot be restarted after shutdown() has been called.");
    }

    // QTZ-212 : calling new schedulerStarting() method on the listeners
    // right after entering start()
    notifySchedulerListenersStarting ();

    if (m_aInitialStart == null)
    {
      m_aInitialStart = new Date ();
      m_aResources.getJobStore ().schedulerStarted ();
      _startPlugins ();
    }
    else
    {
      m_aResources.getJobStore ().schedulerResumed ();
    }

    m_aSchedThread.togglePause (false);

    LOGGER.info ("Scheduler " + m_aResources.getUniqueIdentifier () + " started.");

    notifySchedulerListenersStarted ();
  }
1138793
def setup_scheduler(self, before_connect=False):
        '''
        
        '''
        self._setup_core()

        loop_interval = self.opts['loop_interval']
        new_periodic_callbacks = {}

        if 'schedule' not in self.periodic_callbacks:
            if 'schedule' not in self.opts:
                self.opts['schedule'] = {}
            if not hasattr(self, 'schedule'):
                self.schedule = salt.utils.schedule.Schedule(
                    self.opts,
                    self.functions,
                    self.returners,
                    utils=self.utils,
                    cleanup=[master_event(type='alive')])

            try:
                if self.opts['grains_refresh_every']:  # In minutes, not seconds!
                    log.debug(
                        'Enabling the grains refresher. Will run every %d minute(s).',
                        self.opts['grains_refresh_every']
                    )
                    self._refresh_grains_watcher(abs(self.opts['grains_refresh_every']))
            except Exception as exc:
                log.error(
                    'Exception occurred in attempt to initialize grain refresh '
                    'routine during minion tune-in: %s', exc
                )

            # TODO: actually listen to the return and change period
            def handle_schedule():
                self.process_schedule(self, loop_interval)
            new_periodic_callbacks['schedule'] = tornado.ioloop.PeriodicCallback(handle_schedule, 1000)

            if before_connect:
                # Make sure there is a chance for one iteration to occur before connect
                handle_schedule()

        if 'cleanup' not in self.periodic_callbacks:
            new_periodic_callbacks['cleanup'] = tornado.ioloop.PeriodicCallback(
                    self._fallback_cleanups, loop_interval * 1000)

        # start all the other callbacks
        for periodic_cb in six.itervalues(new_periodic_callbacks):
            periodic_cb.start()

        self.periodic_callbacks.update(new_periodic_callbacks)
969591
def run(self, **kwargs):
        
        super().run(**kwargs)
        scheduler = self.scheduler_plugins[self.active_scheduler]()

        if not kwargs['no_daemon']:
            self.log.info('Starting {} worker with {} threads checking for new messages every {} seconds'.format(
                scheduler.name,
                kwargs['threads'],
                kwargs['delay']
            ))

            for i in range(kwargs['threads']):
                thd = threading.Thread(
                    target=self.execute_worker_thread,
                    args=(scheduler.execute_worker, kwargs['delay'])
                )
                thd.start()
        else:
            self.log.info('Starting {} worker for a single non-daemon execution'.format(
                scheduler.name
            ))
            scheduler.execute_worker()
639324
async def start(self):
        

        self._loop.add_task(self._periodic_loop, name="periodic task for %s" % self._adapter.__class__.__name__,
                            parent=self._task)

        self._adapter.add_callback('on_scan', functools.partial(_on_scan, self._loop, self))
        self._adapter.add_callback('on_report', functools.partial(_on_report, self._loop, self))
        self._adapter.add_callback('on_trace', functools.partial(_on_trace, self._loop, self))
        self._adapter.add_callback('on_disconnect', functools.partial(_on_disconnect, self._loop, self))
967641
def start(self, *_):
        
        try:
            box_configurations = self.bc_dao.run_query(QUERY_PROCESSES_FOR_BOX_ID(self.box_id))

            for box_config in box_configurations:
                handler = RepeatTimer(TRIGGER_INTERVAL, self.manage_process, args=[box_config.process_name])
                self.thread_handlers[box_config.process_name] = handler
                handler.start()
                self.logger.info('Started Supervisor Thread for {0}, triggering every {1} seconds'
                                 .format(box_config.process_name, TRIGGER_INTERVAL))
        except LookupError as e:
            self.logger.error('Supervisor failed to start because of: {0}'.format(e))
1236275
def start(self, *_):
        
        self.logger.info('Starting Scheduler...')
        db_manager.synch_db()
        self._load_managed_entries()

        try:
            self._load_freerun_entries()
        except LookupError as e:
            self.logger.warning('DB Lookup: {0}'.format(e))

        # Scheduler is initialized and running. GarbageCollector can be safely started
        self.gc.start()

        # Job/UOW Status Listeners can be safely started
        self.uow_listener.start()
        self.job_listener.start()

        self.logger.info('Startup Sequence Completed. Starting MX.')
        # Management Extension (MX) should be the last to start
        self.mx.start()
850412
private void schedule(TaskScheduler scheduler) {
        scheduledFuture = scheduler.scheduleAtFixedRate(
                createTask(), (int)delayTime, (int)period, TimeUnit.MILLISECONDS);
    }
445266
def _start_loop(self):
        """"""
        # Create our main loop, get our bus, and add the signal handler
        loop = GObject.MainLoop()
        bus = SystemBus()
        manager = bus.get(".NetworkManager")
        manager.onPropertiesChanged = self._vpn_signal_handler

        # Loop forever
        loop.run()
960077
def every(time)
            ms = Scheduler.parse_in(time)
            event = Repeat.new(self, ms)
            event.progress &Proc.new if block_given?
            schedule(event)
            event
        end
776721
def start(check_time: int = 500) -> None:
    
    io_loop = ioloop.IOLoop.current()
    if io_loop in _io_loops:
        return
    _io_loops[io_loop] = True
    if len(_io_loops) > 1:
        gen_log.warning("tornado.autoreload started more than once in the same process")
    modify_times = {}  # type: Dict[str, float]
    callback = functools.partial(_reload_on_update, modify_times)
    scheduler = ioloop.PeriodicCallback(callback, check_time)
    scheduler.start()
90092
def _schedule(self):
        ''''''
        if self._running:
            _logger.debug('')
            self._call_later_handle = self._event_loop.call_later(
                self._timeout, self._check)
30274
private void startRoundTripMeasurement() {
        if (scheduler != null) {
            if (pingInterval > 0) {
                if (log.isDebugEnabled()) {
                    log.debug("startRoundTripMeasurement - {}", sessionId);
                }
                try {
                    // schedule with an initial delay of now + 2s to prevent ping messages during connect post processes
                    keepAliveTask = scheduler.scheduleWithFixedDelay(new KeepAliveTask(), new Date(System.currentTimeMillis() + 2000L), pingInterval);
                    if (log.isDebugEnabled()) {
                        log.debug("Keep alive scheduled for {}", sessionId);
                    }
                } catch (Exception e) {
                    log.error("Error creating keep alive job for {}", sessionId, e);
                }
            }
        } else {
            log.error("startRoundTripMeasurement cannot be executed due to missing scheduler. This can happen if a connection drops before handshake is complete");
        }
    }
1362618
def scheduler(ctx, xmlrpc, xmlrpc_host, xmlrpc_port,
              inqueue_limit, delete_time, active_tasks, loop_limit, fail_pause_num,
              scheduler_cls, threads, get_object=False):
    
    g = ctx.obj
    Scheduler = load_cls(None, None, scheduler_cls)

    kwargs = dict(taskdb=g.taskdb, projectdb=g.projectdb, resultdb=g.resultdb,
                  newtask_queue=g.newtask_queue, status_queue=g.status_queue,
                  out_queue=g.scheduler2fetcher, data_path=g.get('data_path', 'data'))
    if threads:
        kwargs['threads'] = int(threads)

    scheduler = Scheduler(**kwargs)
    scheduler.INQUEUE_LIMIT = inqueue_limit
    scheduler.DELETE_TIME = delete_time
    scheduler.ACTIVE_TASKS = active_tasks
    scheduler.LOOP_LIMIT = loop_limit
    scheduler.FAIL_PAUSE_NUM = fail_pause_num

    g.instances.append(scheduler)
    if g.get('testing_mode') or get_object:
        return scheduler

    if xmlrpc:
        utils.run_in_thread(scheduler.xmlrpc_run, port=xmlrpc_port, bind=xmlrpc_host)
    scheduler.run()
228514
def start!
      # Activate the monitor
      @active = true

      # Connect to the database
      Minicron.establish_db_connection(
        Minicron.config['server']['database'],
        Minicron.config['verbose']
      )

      # Set the start time of the monitir
      @start_time = Time.now.utc

      # Start a thread for the monitor
      @thread = Thread.new do
        # While the monitor is active run it in a loop ~every minute
        while @active
          # Get all the schedules
          schedules = Minicron::Hub::Model::Schedule.all

          # Loop every schedule we know about
          schedules.each do |schedule|
            begin
              # TODO: is it possible to monitor on boot schedules some other way?
              monitor(schedule) unless schedule.special == '@reboot'
            rescue Exception => e
              if Minicron.config['debug']
                puts e.message
                puts e.backtrace
              end
            end
          end

          sleep 59
        end
      end
    end
1016910
async def _scheduleLoop(self):
        '''
        
        '''
        while True:
            try:
                timeout = None if not self.apptheap else self.apptheap[0].nexttime - time.time()
                if timeout is None or timeout >= 0.0:
                    await asyncio.wait_for(self._wake_event.wait(), timeout=timeout)
            except asyncio.TimeoutError:
                pass
            if self.isfini:
                return
            self._wake_event.clear()

            now = time.time()
            while self.apptheap and self.apptheap[0].nexttime <= now:
                appt = heapq.heappop(self.apptheap)
                appt.updateNexttime(now)
                if appt.nexttime:
                    heapq.heappush(self.apptheap, appt)
                if not appt.enabled:
                    continue
                if appt.isrunning:
                    logger.warning(
                        'Appointment %s is still running from previous time when scheduled to run.  Skipping.',
                        appt.iden)
                else:
                    await self._execute(appt)