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

[RLlib] Base env checker, First see #21476 #21569

Merged
merged 5 commits into from
Jan 18, 2022

Conversation

avnishn
Copy link
Member

@avnishn avnishn commented Jan 13, 2022

Why are these changes needed?

Add BaseEnvChecker for BaseEnvs. Please first review #21476

Related issue number

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@avnishn avnishn requested a review from sven1977 January 13, 2022 04:43
@sven1977 sven1977 self-assigned this Jan 13, 2022
Copy link
Contributor

@sven1977 sven1977 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thanks for this PR @avnishn . Just a few nits before we can merge this.

rllib/tests/test_nested_observation_spaces.py Show resolved Hide resolved
rllib/utils/pre_checks/env.py Outdated Show resolved Hide resolved
rllib/utils/tests/test_check_env.py Show resolved Hide resolved
rllib/utils/tests/test_check_env.py Show resolved Hide resolved
rllib/utils/tests/test_check_env.py Show resolved Hide resolved
rllib/utils/tests/test_check_env.py Outdated Show resolved Hide resolved
Copy link
Member

@gjoliver gjoliver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 very quick question

@@ -37,6 +38,7 @@ def test_obs_and_action_spaces_are_gym_spaces(self):
with pytest.raises(
ValueError, match="Action space must be a gym.space"):
check_env(env)
del env
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the old review comments are lost (I can't find it anywhere). so start a new thread.
I wonder if this is necessary. not saying one way or another, but we should be consistent.
if there is a real need for explicitly deleting 3rd party env, we should do this everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops sorry about that -- I resolved it because I thought I had answered your question.

My answer was this:
"no magic here. Just habit, for preventing memory leaks in tests, a habit I formed when developing Metaworld"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, do you want to keep this habit?
I kind of think consistency is very important for a codebase. if there's actual benefit, we should use this convention everywhere.
otherwise, maybe we shouldn't del it explicit here either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, doing this doesn't make sense to me either. I mean, even if there was a memory leak in a test case like this, it wouldn't matter, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I'll go ahead and remove it. Thanks for the feedback.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's leave it for now and merge this! :)
We can discuss offline:

  • Do or not do del in test cases.
  • Whether we should consistently use unittest or pytest. I heavily prefer unittest as it's much easier to debug with in PyCharm (pytest does not produce output in the interactive shell in the debugger, etc..). But happy to learn otherwise.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you use "pytest -s ...", it will stream the output while running the test.

@sven1977 sven1977 merged commit 12b087a into ray-project:master Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants