-
Notifications
You must be signed in to change notification settings - Fork 6.6k
[core] Deflake test_runtime_env_pip_and_conda_4.py
#52750
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
import pytest | ||
import sys | ||
import platform | ||
import time | ||
from ray._private.test_utils import ( | ||
wait_for_condition, | ||
chdir, | ||
|
@@ -16,6 +15,7 @@ | |
MAX_INTERNAL_PIP_FILENAME_TRIES, | ||
) | ||
from ray.runtime_env import RuntimeEnv | ||
from ray.util.state import list_tasks | ||
|
||
import yaml | ||
import tempfile | ||
|
@@ -116,7 +116,7 @@ class TestGC: | |
reason="Needs PR wheels built in CI, so only run on linux CI machines.", | ||
) | ||
@pytest.mark.parametrize("field", ["conda", "pip"]) | ||
@pytest.mark.parametrize("spec_format", ["file", "python_object"]) | ||
@pytest.mark.parametrize("spec_format", ["python_object"]) | ||
def test_job_level_gc( | ||
self, runtime_env_disable_URI_cache, start_cluster, field, spec_format, tmp_path | ||
): | ||
|
@@ -139,10 +139,12 @@ def f(): | |
|
||
# Ensure that the runtime env has been installed. | ||
assert ray.get(f.remote()) | ||
# Sleep some seconds before checking that we didn't GC. Otherwise this | ||
# check may spuriously pass. | ||
time.sleep(2) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i'm assuming the sleep existed to make sure some code ran after the get. Otherwise the following assert will always pass if you run directly after, removing the sleep makes the test not test that behavior There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the check on the following line doesn't really need to be there at all IMO except as a sanity check for the testing utils themselves. it's asserting that we don't GC runtime_envs for active jobs. note that:
out of an abundance of caution, I updated the PR to perform the check in a more deterministic way: wait for the task to be marked There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool makes sense |
||
assert not check_local_files_gced(cluster) | ||
|
||
# Check that after the task is finished, the runtime_env is not GC'd | ||
# because the job is still alive. | ||
wait_for_condition(lambda: list_tasks()[0].state == "FINISHED") | ||
for _ in range(5): | ||
assert not check_local_files_gced(cluster) | ||
|
||
ray.shutdown() | ||
|
||
|
@@ -163,7 +165,7 @@ def f(): | |
reason="Requires PR wheels built in CI, so only run on linux CI machines.", | ||
) | ||
@pytest.mark.parametrize("field", ["conda", "pip"]) | ||
@pytest.mark.parametrize("spec_format", ["file", "python_object"]) | ||
@pytest.mark.parametrize("spec_format", ["python_object"]) | ||
def test_detached_actor_gc( | ||
self, runtime_env_disable_URI_cache, start_cluster, field, spec_format, tmp_path | ||
): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a few minor speedups in this file. no need to test GC logic against the file and object behavior and the sleep was unneeded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why don't you need to test against file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no meaningful difference in the GC implementation across the two conditions