Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[runtime env] Close schema after loading and continue on error (ray-p…
…roject#33535) This PR fixes a few things: * A warning from not closing the file opened with `open()`. (We have these warnings as errors and Ray was causing some integration tests to blink) * Using a custom runtime env schema with `RAY_RUNTIME_ENV_PLUGIN_SCHEMAS` would result in a failure when the JSON file is incorrectly decoded or the file doesn't exist. * There was a test for invalid decoded JSON, but by chance it ran *after* a previous schema, meaning the missing `continue` wasn't noticed. **Steps to Reproduce** 1. Save this script as `test.py` ```python import ray @ray.remote(runtime_env={"env_vars": {}}) def my_fn(): return True ray.init() print(ray.get(my_fn.remote())) ``` 2. run with `RAY_RUNTIME_ENV_PLUGIN_SCHEMAS=./non-exist.json python test.py` 3. a. save `:` or other invalid JSON as `bad-json.json` b. run with `RAY_RUNTIME_ENV_PLUGIN_SCHEMAS=./bad-json.json python test.py` This PR fixes the issue and adds a new test case. Signed-off-by: James Clark <[email protected]> Signed-off-by: elliottower <[email protected]>
- Loading branch information