def unregister_conductor(self, hostname): with _session_for_write(): query = (model_query(models.Conductor).filter_by(hostname=hostname, online=True)) count = query.update({'online': False}) if count == 0: raise exception.ConductorNotFound(conductor=hostname)
def get_conductor(self, hostname): try: return model_query(models.Conductor).\ filter_by(hostname=hostname).\ one() except NoResultFound: raise exception.ConductorNotFound(conductor=hostname)
def unregister_conductor(self, hostname): session = get_session() with session.begin(): query = model_query(models.Conductor, session=session).\ filter_by(hostname=hostname) count = query.delete() if count == 0: raise exception.ConductorNotFound(conductor=hostname)
def unregister_conductor(self, hostname): session = get_session() with session.begin(): query = (model_query(models.Conductor, session=session) .filter_by(hostname=hostname, online=True)) count = query.update({'online': False}) if count == 0: raise exception.ConductorNotFound(conductor=hostname)
def touch_conductor(self, hostname): session = get_session() with session.begin(): query = model_query(models.Conductor, session=session).\ filter_by(hostname=hostname) # since we're not changing any other field, manually set updated_at count = query.update({'updated_at': timeutils.utcnow()}) if count == 0: raise exception.ConductorNotFound(conductor=hostname)
def touch_conductor(self, hostname): with _session_for_write(): query = (model_query(models.Conductor) .filter_by(hostname=hostname)) # since we're not changing any other field, manually set updated_at # and since we're heartbeating, make sure that online=True count = query.update({'updated_at': timeutils.utcnow(), 'online': True}) if count == 0: raise exception.ConductorNotFound(conductor=hostname)