def run(self): u""" <doc>The <code>run</code> method of the <code>Scheduler</code> class is the main loop that runs infinite, unless the <code>self.status</code> is set to a different value than <code>self.C.SCHEDULER_STATUS_RUN</code>. In every cycle a new <code>Task</code> is requested from the list of scheduler tasks. If the result is <code>None</code> (there are no pending tasks), then the scheduler mode. The method will involuntary sleep for <code> self.C.SCHEDULER_SLEEPTIME</code> amount of seconds, before querying the task list again. In the idle state, the method calls <code>self.doIdle()</code>, which defaults to do nothing.<br/> If there is a valid task pending, then <code>self.doTask(task)</code> is called. Note that while there are pending tasks, the loop will not sleep.</doc> """ self.status = C.SCHEDULER_STATUS_RUN while self.status == C.SCHEDULER_STATUS_RUN: task = Task.next() if task is not None: self.doTask(task) else: self.doIdle() # Involuntary sleep outside doIdle call, which may be inherited and changed, time.sleep(C.SCHEDULER_SLEEPTIME)
def run(self): u""" The ``run`` method of the ``Scheduler`` class is the main loop that runs infinite, unless the ``self.status`` is set to a different value than ``self.C.SCHEDULER_STATUS_RUN``. In every cycle a new ``Task`` is requested from the list of scheduler tasks. If the result is ``None`` (there are no pending tasks), then the scheduler mode. The method will involuntary sleep for `` self.C.SCHEDULER_SLEEPTIME`` amount of seconds, before querying the task list again. In the idle state, the method calls ``self.doIdle()``, which defaults to do nothing.<br/> If there is a valid task pending, then ``self.doTask(task)`` is called. Note that while there are pending tasks, the loop will not sleep. """ self.status = self.C.SCHEDULER_STATUS_RUN while self.status == self.C.SCHEDULER_STATUS_RUN: task = Task.next() if task is not None: self.doTask(task) else: self.doIdle() # Involuntary sleep outside doIdle call, which may be inherited and changed, time.sleep(self.C.SCHEDULER_SLEEPTIME)