def update(self, session, reservation_id):
        reservation = session.query(Reservation).filter(
            Reservation.id == reservation_id).first()
        if reservation is None:
            raise CoordExc.ExpiredSessionError("Expired reservation")

        reservation.update()
Exemple #2
0
 def get_experiment_id(self, reservation_id):
     reservation_data = self.get_reservation_data(reservation_id)
     if reservation_data is None:
         raise CoordExc.ExpiredSessionError(
             "Expired reservation: no experiment id found for that reservation (%s)"
             % reservation_id)
     return ExperimentId.parse(reservation_data[EXPERIMENT_TYPE])
    def confirm(self, session, reservation_id):
        reservation = session.query(Reservation).filter(
            Reservation.id == reservation_id).first()
        if reservation is None:
            raise CoordExc.ExpiredSessionError("Expired reservation")

        current_reservation = CurrentReservation(reservation.id)
        session.add(current_reservation)
Exemple #4
0
    def confirm(self, reservation_id):
        client = self._redis_maker()
        weblab_reservation = WEBLAB_RESERVATION % reservation_id
        weblab_reservation_status = WEBLAB_RESERVATION_STATUS % reservation_id
        if not client.exists(weblab_reservation):
            raise CoordExc.ExpiredSessionError("Expired reservation")

        return client.hset(weblab_reservation_status, CURRENT, 1) != 0
 def get_experiment_id(self, reservation_id):
     session = self._session_maker()
     try:
         reservation = session.query(Reservation).filter(
             Reservation.id == reservation_id).first()
         if reservation is None:
             raise CoordExc.ExpiredSessionError(
                 "Expired reservation: no experiment id found for that reservation (%s)"
                 % reservation_id)
         return reservation.experiment_type.to_experiment_id()
     finally:
         session.close()