From 9d764eef3272f7095d6974858819e50cda3b75a7 Mon Sep 17 00:00:00 2001 From: nimishsantosh107 <nimishsantosh107@icloud.com> Date: Wed, 12 Jan 2022 12:55:17 +0300 Subject: [PATCH] changes to service and client for new evaluator --- flatland/evaluators/client.py | 23 ++++++++++++++--------- flatland/evaluators/service.py | 6 +++++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/flatland/evaluators/client.py b/flatland/evaluators/client.py index 4ce29cf8..f400deae 100644 --- a/flatland/evaluators/client.py +++ b/flatland/evaluators/client.py @@ -24,6 +24,12 @@ logger.setLevel(logging.INFO) m.patch() +# CONSTANTS +FLATLAND_RL_SERVICE_ID = os.getenv( + 'AICROWD_SUBMISSION_ID', + 'T12345') + + class TimeoutException(StopAsyncIteration): """ Custom exception for evaluation timeouts. """ pass @@ -46,11 +52,12 @@ class FlatlandRemoteClient(object): """ def __init__(self, + test_env_folder=None, + flatland_rl_service_id=FLATLAND_RL_SERVICE_ID, remote_host='127.0.0.1', remote_port=6379, remote_db=0, remote_password=None, - test_envs_root=None, verbose=False, use_pickle=False): self.use_pickle = use_pickle @@ -66,21 +73,19 @@ class FlatlandRemoteClient(object): self.redis_conn = redis.Redis(connection_pool=self.redis_pool) self.namespace = "flatland-rl" - self.service_id = os.getenv( - 'FLATLAND_RL_SERVICE_ID', - 'FLATLAND_RL_SERVICE_ID' - ) + self.service_id = flatland_rl_service_id self.command_channel = "{}::{}::commands".format( self.namespace, self.service_id ) - # for timeout messages sent out-of-band self.error_channel = "{}::{}::errors".format( - self.namespace, self.service_id) + self.namespace, + self.service_id + ) - if test_envs_root: - self.test_envs_root = test_envs_root + if test_env_folder: + self.test_envs_root = test_env_folder else: self.test_envs_root = os.getenv( 'AICROWD_TESTS_FOLDER', diff --git a/flatland/evaluators/service.py b/flatland/evaluators/service.py index a7dc1590..1afa089e 100644 --- a/flatland/evaluators/service.py +++ b/flatland/evaluators/service.py @@ -44,6 +44,10 @@ m.patch() # CONSTANTS ######################################################## +FLATLAND_RL_SERVICE_ID = os.getenv( + 'AICROWD_SUBMISSION_ID', + 'T12345') + # Don't proceed to next Test if the previous one didn't reach this mean completion percentage TEST_MIN_PERCENTAGE_COMPLETE_MEAN = float(os.getenv("TEST_MIN_PERCENTAGE_COMPLETE_MEAN", 0.25)) @@ -109,7 +113,7 @@ class FlatlandRemoteEvaluationService: def __init__( self, test_env_folder="/tmp", - flatland_rl_service_id='FLATLAND_RL_SERVICE_ID', + flatland_rl_service_id=FLATLAND_RL_SERVICE_ID, remote_host='127.0.0.1', remote_port=6379, remote_db=0, -- GitLab