diff --git a/flatland/evaluators/service.py b/flatland/evaluators/service.py index 21cbd6844b42fb53542a8ab18c35591e3263e272..0ce65ccd5c4ff7c702fb222907e2af0baabd0484 100644 --- a/flatland/evaluators/service.py +++ b/flatland/evaluators/service.py @@ -522,8 +522,8 @@ class FlatlandRemoteEvaluationService: _redis = self.get_redis_connection() #command_response_channel = command['response_channel'] - if self.verbose and not suppress_logs: - print("Responding with : ", error_dict) + #if self.verbose and not suppress_logs: + print("Send error : ", error_dict) if self.use_pickle: sResponse = pickle.dumps(error_dict) @@ -757,21 +757,6 @@ class FlatlandRemoteEvaluationService: )) self.record_frame_step += 1 - def send_env_step_timeout(self, command): - print("handle_env_step_timeout") - error_dict = dict( - type=messages.FLATLAND_RL.ENV_STEP_TIMEOUT, - - # payload probably unnecessary - payload=dict( - observation=False, - env_file_path=False, - info=False, - random_seed=False - )) - - self.send_error(error_dict) - def save_actions(self): sfEnv = self.env_file_paths[self.simulation_count] @@ -995,11 +980,16 @@ class FlatlandRemoteEvaluationService: try: command = self.get_next_command() + except timeout_decorator.timeout_decorator.TimeoutError: if self.previous_command['type'] == messages.FLATLAND_RL.ENV_STEP: - self.send_env_step_timeout({"error":messages.FLATLAND_RL.ENV_STEP_TIMEOUT}) - self.state_env_timed_out = True - continue + self.send_error({"type":messages.FLATLAND_RL.ENV_STEP_TIMEOUT}) + + elif self.previous_command['type'] == messages.FLATLAND_RL.ENV_CREATE: + self.send_error({"type":messages.FLATLAND_RL.ENV_RESET_TIMEOUT}) + + self.state_env_timed_out = True + continue if "timestamp" in command.keys(): latency = time.time() - command["timestamp"] diff --git a/tests/manual_test_eval_timeout.sh b/tests/manual_test_eval_timeout.sh new file mode 100755 index 0000000000000000000000000000000000000000..b527b4f290483e96aa50aed97c0b8c010d3efb3d --- /dev/null +++ b/tests/manual_test_eval_timeout.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +export FLATLAND_DEFAULT_COMMAND_TIMEOUT=5 +export FLATLAND_DEFAULT_COMMAND_TIMEOUT=60 +export FLATLAND_INITIAL_PLANNING_TIMEOUT=8 + +export AICROWD_TESTS_FOLDER=../submission-scoring/Envs/neurips2020_round1_v0 + +redis-cli KEYS "*" | grep -i flatland | xargs redis-cli DEL + + +# you need to create the envs in the folder +# best to delete all but 10 small ones +gnome-terminal --window -- python -m flatland.evaluators.service --test_folder ../submission-scoring/Envs/neurips2020_round1_v0/ + +gnome-terminal --window -- python tests/test_eval_timeout.py + + +