Skip to content

Commit

Permalink
[service] Reduce severity of logging messages on reset() retry.
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisCummins committed Mar 4, 2022
1 parent 93eafa3 commit 45590cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion compiler_gym/envs/compiler_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,14 @@ def reset( # pylint: disable=arguments-differ

def _retry(error) -> Optional[ObservationType]:
"""Abort and retry on error."""
logger.warning("%s during reset(): %s", type(error).__name__, error)
# Log the error that we are recovering from, but treat
# ServiceIsClosed errors as unimportant since we know what causes
# them.
log_severity = (
logger.debug if isinstance(error, ServiceIsClosed) else logger.warning
)
log_severity("%s during reset(): %s", type(error).__name__, error)

if self.service:
try:
self.service.close()
Expand Down
2 changes: 1 addition & 1 deletion compiler_gym/service/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def __call__(
except ValueError as e:
if str(e) == "Cannot invoke RPC on closed channel!":
raise ServiceIsClosed(
f"RPC communication failed with message: {e}"
"RPC communication failed because channel is closed"
) from None
raise e
except grpc.RpcError as e:
Expand Down

0 comments on commit 45590cc

Please sign in to comment.