Skip to content

WINDOWS: enable and fix failures in test_runtime_env_complicated - #22449

Merged
pcmoritz merged 20 commits into
ray-project:masterfrom
mattip:test_runtime_env_complicated
Mar 29, 2022
Merged

pcmoritz merged 20 commits into
ray-project:masterfrom
mattip:test_runtime_env_complicated

Conversation

@mattip

@mattip mattip commented Feb 16, 2022

Copy link
Copy Markdown
Contributor

Continuation of #22342 to enable runtime_env tests on windows. Part of #22186

Enable runtime_env tests in test_runtime_env_complicated. The fixes involved getting paths correct in conda, virtualenvs, and base python, since there are differences between the layouts on linux and windows.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This change provides a nicer error message on windows when env is used but PATH is not provided. The default on windows is an empty PATH, which will almost always fail.

Comment thread python/ray/_private/runtime_env/pip.py Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Use the canonical method to find the top-level python directory. On windows python.exe can be either in the top-level directory or in Scripts, so using sys.prefix works around complicated logic.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

moved this to windows-only to make sure it does not break non-windows

Comment thread python/ray/_private/runtime_env/pip.py Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Remove the empty env={} which breaks windows (here and in other calls to exec_cmd_stream_to_logger)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

reverted this since it might be affecting linux

@mattip

mattip commented Feb 17, 2022

Copy link
Copy Markdown
Contributor Author

This passes for me locally after properly setting up conda. CI is failing left and right, the relevant part seems to be the windows run of test_runtime_env_complicated which complains

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If using 'conda activate' from a batch script, change your
invocation to 'CALL conda.bat activate'.

To initialize your shell, run
conda init <SHELL_NAME>

@mattip
mattip force-pushed the test_runtime_env_complicated branch from 8571888 to 274b19d Compare February 17, 2022 22:25
@architkulkarni architkulkarni self-assigned this Feb 22, 2022
@mattip
mattip force-pushed the test_runtime_env_complicated branch 3 times, most recently from 599da53 to f1ece21 Compare March 6, 2022 16:55
@mattip

mattip commented Mar 6, 2022

Copy link
Copy Markdown
Contributor Author

@architkulkarni thoughts? I think the failing tests do not involve the runtime environments and are flakey in general.

@architkulkarni

Copy link
Copy Markdown
Contributor

Thanks for your help with this! The test_runtime_env_complicated windows failure looks relevant, right? https://buildkite.com/ray-project/ray-builders-pr/builds/25859#eef1e1ca-7889-4407-ae62-ea32be487530/3103-8900

I've restarted the test just to get more data points.

@mattip

mattip commented Mar 7, 2022

Copy link
Copy Markdown
Contributor Author

Yes, of course it is relevant. I wonder how I missed that failure. Sorry, I will try to fix it.

@architkulkarni

Copy link
Copy Markdown
Contributor

No problem, I think we have too many other flaky tests which hide the real failures :( Anyways, thanks and I'm happy to pair program on this again any time!

@mattip
mattip force-pushed the test_runtime_env_complicated branch from 2fa1e3f to 43c6489 Compare March 8, 2022 14:15
@mattip

mattip commented Mar 8, 2022

Copy link
Copy Markdown
Contributor Author

Weird. The windows test is failing but are marked passing in the summary here.

@architkulkarni

Copy link
Copy Markdown
Contributor

Odd, could it be that windows Build & test buildkite job hasn't been set up to show up as a separate check mark in github, so it only shows up at the top level buildkite/ray-builders-pr check mark?

@mattip

mattip commented Mar 9, 2022

Copy link
Copy Markdown
Contributor Author

I enabled more tests from test_runtime_env_*.py and skipped a few tests that are still failing in runtime_env_complicated.py, in an effort to get this PR to a point where it can be reviewed.

@architkulkarni

Copy link
Copy Markdown
Contributor

Sounds good! I just reviewed it and it looks great. I guess we should hold off on merging anything that removes the NotImplementedError from conda/pip on Windows until a suitable fraction of the tests are passing. Or we can decide how to best signal it to users (maybe replacing NotImplementedError with a warning would be sufficient?)

@mattip

mattip commented Mar 9, 2022

Copy link
Copy Markdown
Contributor Author

Yes, we should have more tests passing. It may take a few iterations to get CI to be happy with just these changes. I tried a few different scenarios and the tests seemed to pass locally: running with only conda init, running with conda activated, running with RAY_CONDA_HOME set. CI sometimes has a mind of its own, so let's see how this shakes out

@mattip

mattip commented Mar 10, 2022

Copy link
Copy Markdown
Contributor Author

The calls to await PipProcessor(target_dir, runtime_env, logger) seem to be timing out. @architkulkarni do you know where any such timeout might be?

@mattip

mattip commented Mar 10, 2022

Copy link
Copy Markdown
Contributor Author

I am a bit at a loss here. Is there an easy way to get a summary of which tests are failing?

@mattip

mattip commented Mar 10, 2022

Copy link
Copy Markdown
Contributor Author

Also it seems test_cli on linux is failing with

2022-03-10 06:12:50,053 WARNING services.py:2022 -- WARNING: The object store is using /tmp instead of /dev/shm because /dev/shm has only 2684354560 bytes available. This will harm performance! You may be able to free up space by deleting files in /dev/shm. If you are inside a Docker container, you can increase /dev/shm size by passing '--shm-size=4.01gb' to 'docker run' (or add it to the run_options list in a Ray cluster config). Make sure to set this to more than 30% of available RAM.

Is it passing on HEAD? Is this because of a random combination of tests leaving too much cruft on /dev/shm?

@architkulkarni

Copy link
Copy Markdown
Contributor

serve:test_cli indeed seems to be flaky: https://flaky-tests.ray.io/

I'm not sure about the timeout in PipProcessor, is it passing locally?

@architkulkarni

Copy link
Copy Markdown
Contributor

The calls to await PipProcessor(target_dir, runtime_env, logger) seem to be timing out. @architkulkarni do you know where any such timeout might be?

Maybe @Catch-Bull has some idea about this?

@mattip

mattip commented Mar 10, 2022

Copy link
Copy Markdown
Contributor Author

PipProcessor passes locally.

@kfstorm

kfstorm commented Mar 13, 2022

Copy link
Copy Markdown
Member

‼️ ACTION REQUIRED ‼️

We've updated our formatting configuration for C++ code. (see #22725)

This PR includes C++ code change. To prevent issues with merging your code, here's what you'll need to do:

  1. Merge the latest changes from upstream/master branch into your branch.
git pull upstream master
git merge upstream/master
  1. Resolve merge conflicts (if necessary).

After running these steps, you'll have the updated C++ formatting configuration.

  1. Format changed files.
scripts/format.sh
  1. Commit your changes.
git add --all
git commit -m "Format C++ code"

@mattip
mattip force-pushed the test_runtime_env_complicated branch from 5c53f65 to ebff16f Compare March 13, 2022 16:50
@mattip
mattip force-pushed the test_runtime_env_complicated branch from a8c8ea3 to 6e738aa Compare March 21, 2022 18:22
@mattip

mattip commented Mar 21, 2022

Copy link
Copy Markdown
Contributor Author

I rebased to get #23373 and also changed the documentation.

Co-authored-by: Archit Kulkarni <[email protected]>
@mattip

mattip commented Mar 22, 2022

Copy link
Copy Markdown
Contributor Author

The bad news is that one of the windows shards is failing. The less bad news is that it is in a test tht seems to be unrelated to this PR, in test_worker_capping. I could not see any record of the test actually being collected and run, so this seems like a separate issue.

@mattip

mattip commented Mar 22, 2022

Copy link
Copy Markdown
Contributor Author

The setting-up-bootstrap-env-ml-dock failure is due to a download failure, apparently not connected to this PR.

@architkulkarni

Copy link
Copy Markdown
Contributor

Thanks--rerunning them for now to check if they're transient failures.

@mattip

mattip commented Mar 23, 2022

Copy link
Copy Markdown
Contributor Author

That failure is gone now there is a different one, again, not on windows: two_step_game_maddpg from //rllib:examples/recommender_system_with_recsim_and_slateq_tf2. It seems windows failed test_worker_stats in //python/ray/tests:test_metrics but the shard was re-run and it passed.

@architkulkarni

Copy link
Copy Markdown
Contributor

Thanks, rerunning the RLlib test but it's flaky on master and I think it should be unrelated.

@architkulkarni

Copy link
Copy Markdown
Contributor

Tests look good! @pcmoritz shall we merge this? I don't have merge privileges.

@pcmoritz
pcmoritz merged commit 77c4c1e into ray-project:master Mar 29, 2022
pcmoritz pushed a commit that referenced this pull request Mar 30, 2022
Continuation of #22449 

Fix pip activation so something like this will not crash
```
ray.init(runtime_env={"pip": ["toolz", "requests"]})
```

Also enable test that hit this code path.
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.

4 participants