Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 def get_conductor(self, hostname):
     try:
         return model_query(models.Conductor).\
                         filter_by(hostname=hostname).\
                         one()
     except NoResultFound:
         raise exception.ConductorNotFound(conductor=hostname)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 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)
Exemplo n.º 5
0
 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)
Exemplo n.º 6
0
 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)