def EstablishSession(self, request, context): response = remote_pb2.EstablishSessionResponse() self.logger.debug('Establishing session with %i leases and %i inputs', len(request.leases), len(request.inputs)) with server_util.ResponseContext(response, request): with self.lock: self._establish_session_implementation(request, response) return response
def EstablishSession(self, request, context): response = remote_pb2.EstablishSessionResponse() with ResponseContext(response, request): response.status = remote_pb2.EstablishSessionResponse.STATUS_OK session_id = self._get_unique_random_session_id() self.sessions_by_id[session_id] = Session() self._used_session_ids.append(session_id) response.session_id = session_id if self.options.time_period: self.start_time = ( datetime.datetime.utcnow() - datetime.timedelta(minutes=self.options.time_period) ).strftime("%Y-%m-%dT%H:%M:%SZ") return response
def EstablishSession(self, request, context): response = remote_pb2.EstablishSessionResponse() with ResponseContext(response, request): self.logger.info('EstablishSession unimplemented!') response.status = remote_pb2.EstablishSessionResponse.STATUS_OK return response