From 787e0692b5072de4fd89cb677278f2a24d83aa9b Mon Sep 17 00:00:00 2001 From: SP Mohanty <spmohanty91@gmail.com> Date: Mon, 22 Jul 2019 03:13:32 +0300 Subject: [PATCH] Add more error handlers for improper usage of the env_client.step functions --- flatland/evaluators/service.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/flatland/evaluators/service.py b/flatland/evaluators/service.py index 7adbd5b2..fd60c1fd 100644 --- a/flatland/evaluators/service.py +++ b/flatland/evaluators/service.py @@ -252,8 +252,13 @@ class FlatlandRemoteEvaluationService: command_response_channel = command['response_channel'] _payload = command['payload'] + if not self.env: + raise Exception( + "env_client.step called before env_client.env_create() call") if self.env.dones['__all__']: - raise Exception("Client attempted to perform an action on an Env which has done['__all__']==True") + raise Exception( + "Client attempted to perform an action on an Env which \ + has done['__all__']==True") action = _payload['action'] _observation, all_rewards, done, info = self.env.step(action) @@ -301,7 +306,8 @@ class FlatlandRemoteEvaluationService: if len(self.simulation_rewards) != len(self.env_file_paths): raise Exception( - """env.submit called before the agent had the chance to operate on all the test environments. + """env.submit called before the agent had the chance + to operate on all the test environments. """ ) -- GitLab