def markError(self, msg, reportAsNew=True): """Mark active instance as being in error state. If reportAsNew is True, the error will be reported as new, otherwise it is an existing error that is being re-read""" with self.lock: self.msg.setError(msg) self.state=ActiveInstance.error for task in self.tasks: task.deactivateCommands() #print msg if reportAsNew: log.error(u"Instance %s (fn %s): %s"%(self.instance.getName(), self.function.getName(), self.msg.getError()))
def deactivate(self): """Set the state of this active instance to held, if active.""" log.debug("Deactivating active instance %s of fn %s"% (self.instance.getName(), self.function.getName())) changed=False with self.inputLock: with self.lock: if self.state == ActiveInstance.active: changed=True if self.subnet is not None: self.subnet.deactivateAll() self.state=ActiveInstance.held for task in self.tasks: task.deactivateCommands() return changed