Exemplo n.º 1
0
 def unblock(self):
     """Unblock a task, forcing it to run"""
     changed=False
     with self.inputLock:
         with self.lock:
              if self.state == ActiveInstance.blocked:
                 # in this case, always run
                 self.state=ActiveInstance.active
                 for task in self.tasks:
                     task.activateCommands()
                 changed=True
         if changed:
             self._reactivate()
Exemplo n.º 2
0
 def activate(self):
     """Set the state of this active instance to active, if held."""
     log.debug("Activating active instance %s of fn %s"%
               (self.instance.getName(), self.function.getName()))
     changed=False
     with self.inputLock:
         with self.lock:
             if self.state == ActiveInstance.held:
                 if self.subnet is not None:
                     self.subnet.activateAll()
                 self.state=ActiveInstance.active
                 changed=True
         if changed:
             for task in self.tasks:
                 task.activateCommands()
             self._reactivate()
     return changed