def handle_experiment_disconnected_ws(ws): ws_manager.remove_sockets(ws) if len(ws_manager.ws) == 0: logger.info('Stopping resources monitor for uuid {}'.format(experiment_uuid)) RedisToStream.remove_experiment_resources(experiment_uuid=experiment_uuid) request.app.experiment_resources_ws_mangers.pop(experiment_uuid, None) logger.info('Quitting resources socket for uuid {}'.format(experiment_uuid))
def handle_experiment_disconnected_ws(ws): ws_manager.remove_sockets(ws) if not ws_manager.ws: _logger.info('Stopping resources monitor for uuid %s', experiment_uuid) RedisToStream.remove_experiment_resources(experiment_uuid=experiment_uuid) request.app.experiment_resources_ws_mangers.pop(experiment_uuid, None) _logger.info('Quitting resources socket for uuid %s', experiment_uuid)
def test_monitor_experiment_resources(self): expeirment_uuid = uuid.uuid4().hex RedisToStream.monitor_experiment_resources(expeirment_uuid) assert RedisToStream.is_monitored_experiment_resources( expeirment_uuid) is True RedisToStream.remove_experiment_resources(expeirment_uuid) assert RedisToStream.is_monitored_experiment_resources( expeirment_uuid) is False
def handle_experiment_disconnected_ws(ws): ws_manager.remove_sockets(ws) if not ws_manager.ws: logger.info('Stopping resources monitor for uuid %s', experiment_uuid) RedisToStream.remove_experiment_resources(experiment_uuid=experiment_uuid) request.app.experiment_resources_ws_mangers.pop(experiment_uuid, None) logger.info('Quitting resources socket for uuid %s', experiment_uuid)
def test_experiment_monitoring(self): experiment_uuid = uuid.uuid4().hex assert RedisToStream.is_monitored_experiment_resources(experiment_uuid) is False RedisToStream.monitor_experiment_resources(experiment_uuid) assert RedisToStream.is_monitored_experiment_resources(experiment_uuid) is True RedisToStream.remove_experiment_resources(experiment_uuid) assert RedisToStream.is_monitored_experiment_resources(experiment_uuid) is False assert RedisToStream.is_monitored_experiment_logs(experiment_uuid) is False RedisToStream.monitor_experiment_logs(experiment_uuid) assert RedisToStream.is_monitored_experiment_logs(experiment_uuid) is True RedisToStream.remove_experiment_logs(experiment_uuid) assert RedisToStream.is_monitored_experiment_logs(experiment_uuid) is False