Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[service] Reduce severity of logging messages on reset() retry. #602

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 4 additions & 0 deletions tests/llvm/datasets/cbench_validate_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Test for cBench semantics validation."""
import pytest

from compiler_gym import ValidationResult
from compiler_gym.envs.llvm import LlvmEnv
from tests.test_main import main

pytest_plugins = ["tests.pytest_plugins.llvm"]


@pytest.mark.timeout(600)
def test_validate_benchmark_semantics(env: LlvmEnv, validatable_cbench_uri: str):
"""Run the validation routine on all benchmarks."""
env.reward_space = "IrInstructionCount"
Expand All @@ -29,6 +32,7 @@ def test_validate_benchmark_semantics(env: LlvmEnv, validatable_cbench_uri: str)
assert result.okay()


@pytest.mark.timeout(600)
def test_non_validatable_benchmark_validate(
env: LlvmEnv, non_validatable_cbench_uri: str
):
Expand Down