def _check_expired(self, reservation_session_id): # Do not lock. If the user is doing something, the method # would get locked here. And if the user is doing something, # the information is stored in a transactional way, so it # shouldn't be a problem. Anyway, it would be nice that # after the "poll" method the UPS modified the (updated) # session without unlocking. reservation_session = self._session_manager.get_session(reservation_session_id) user_processor = ReservationProcessor( self._cfg_manager, reservation_session_id, reservation_session, self._coordinator, self._locator, self._commands_store) return user_processor.is_expired()
def create_reservation_processor(self, faking_response=False): if faking_response: self._fake_simple_lab_response() status = self.user_processor.reserve_experiment( ExperimentId('ud-dummy', 'Dummy experiments'), "{}", "{}", ClientAddress.ClientAddress("127.0.0.1"), 'uuid') self.reservation_processor = ReservationProcessor( self.cfg_manager, SessionId.SessionId(status.reservation_id.split(';')[0]), { 'session_polling': (time.time(), ReservationProcessor.EXPIRATION_TIME_NOT_SET), 'latest_timestamp': 0, 'experiment_id': ExperimentId('ud-dummy', 'Dummy experiments'), 'creator_session_id': '', 'reservation_id': SessionId.SessionId(status.reservation_id.split(';')[0]), }, self.coordinator, self.locator, self.commands_store)
def _load_reservation(self, session): reservation_id = session['reservation_id'] return ReservationProcessor(self._cfg_manager, reservation_id, session, self._coordinator, self._locator, self._commands_store)