[Ray Job] --runtime-env-json gives runtime_env error

See original GitHub issue

What happened + What you expected to happen

I was following along the code snippet in: https://docs.ray.io/en/latest/cluster/job-submission.html#job-cli-api

ray job submit --runtime-env-json='{"working_dir": "./", "pip": ["requests==2.26.0"]}' -- "python test_ray_jobs.py" gives an error

ray job submit --working-dir . -- python test_ray_jobs.py works fine

~/Documents/rayjobs » ray job submit --runtime-env-json='{"working_dir": "./", "pip": ["requests==2.26.0"]}' -- "python test_ray_jobs.py"
Job submission server address: anyscale://snickerdoodle/triciasfu-test
Authenticating
Loaded Anyscale authentication token from ANYSCALE_CLI_TOKEN.

Choosing a project
Using the project snickerdoodle:
  name:               snickerdoodle
  project id:         prj_7S7Os7XBvO6vdiVC1J0lgj

Preparing the cluster
Cluster triciasfu-test is currently running.
Connecting to this cluster:
  cluster id:                   ses_MG6kDKuQ73vX5a12myirRt5d
  cluster environment:          DEFAULT_APP_CONFIG_ID_1.12.0_py38:1
  cluster environment id:       anyscaleray1120-py38
  cluster compute:              triciasfu-test_cluster_compute_e796af58-9436-4b48-9e42-39cb39a65b46
  cluster compute id:           cpt_uLkDu4VZxffFZktmS3SYvyMw
  link:                         https://console.anyscale.com/projects/prj_7S7Os7XBvO6vdiVC1J0lgj/clusters/ses_MG6kDKuQ73vX5a12myirRt5d

2022-04-19 16:34:48,423	INFO dashboard_sdk.py:264 -- Uploading package gcs://_ray_pkg_958caa6e730a2108.zip.
2022-04-19 16:34:48,425	INFO packaging.py:388 -- Creating a file package for local directory './'.

-------------------------------------------------------
Job 'raysubmit_AjeyJJZNWQWhWKhL' submitted successfully
-------------------------------------------------------

Next steps
  Query the logs of the job:
    ray job logs raysubmit_AjeyJJZNWQWhWKhL
  Query the status of the job:
    ray job status raysubmit_AjeyJJZNWQWhWKhL
  Request the job to be stopped:
    ray job stop raysubmit_AjeyJJZNWQWhWKhL

Tailing logs until the job exits (disable with --no-wait):

---------------------------------------
Job 'raysubmit_AjeyJJZNWQWhWKhL' failed
---------------------------------------

Status message: runtime_env setup failed: Failed to setup runtime environment.
Could not create the actor because its associated runtime env failed to be created.
Traceback (most recent call last):
  File "/home/ray/anaconda3/lib/python3.8/site-packages/ray/dashboard/modules/runtime_env/runtime_env_agent.py", line 280, in CreateRuntimeEnv
    runtime_env_context = await asyncio.wait_for(
  File "/home/ray/anaconda3/lib/python3.8/asyncio/tasks.py", line 483, in wait_for
    return fut.result()
  File "/home/ray/anaconda3/lib/python3.8/site-packages/ray/dashboard/modules/runtime_env/runtime_env_agent.py", line 150, in _setup_runtime_env
    size_bytes = await manager.create(
  File "/home/ray/anaconda3/lib/python3.8/site-packages/ray/_private/runtime_env/working_dir.py", line 150, in create
    return await loop.run_in_executor(None, _create)
  File "/home/ray/anaconda3/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/ray/anaconda3/lib/python3.8/site-packages/ray/_private/runtime_env/working_dir.py", line 144, in _create
    local_dir = download_and_unpack_package(
  File "/home/ray/anaconda3/lib/python3.8/site-packages/ray/_private/runtime_env/packaging.py", line 480, in download_and_unpack_package
    raise IOError(f"Failed to fetch URI {pkg_uri} from GCS.")
OSError: Failed to fetch URI gcs://_ray_pkg_958caa6e730a2108.zip from GCS.

Versions / Dependencies

Python: 3.8.5 Ray: 1.12.0

Reproduction script

I was trying to run this sample job:

import ray
import requests

@ray.remote
class Counter:
    def __init__(self):
        self.counter = 0

    def inc(self):
        self.counter += 1

    def get_counter(self):
        return self.counter

counter = Counter.remote()

for _ in range(5):
    ray.get(counter.inc.remote())
    print(ray.get(counter.get_counter.remote()))

print(requests.__version__)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
triciasfucommented, Apr 20, 2022

@architkulkarni Every time as far as I know! I couldn’t get it to work even after multiple tries

0reactions
architkulkarnicommented, Sep 7, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Environment Dependencies — Ray 2.2.0
Job. A Ray job is a single application: it is the collection of Ray tasks, ... A runtime environment describes the dependencies your...
Read more >
Troubleshooting Ray jobs from logs - AWS Glue
AWS Glue provides access to logs emitted by Ray processes during the job run. If you encounter errors or unexpected behavior in Ray...
Read more >
Day 10: How to use Ray Runtime Environment Dependencies
Two things must happen to access any of the environment variables or artifacts accessible via the uploaded local directory. First, a runtime_env argument...
Read more >
Node.js Runtime Environment - App Engine - Google Cloud
js version in your package.json file, your deployment will fail with an error message. Dependencies. During deployment, the runtime installs your dependencies ...
Read more >
Jules S. Damji on LinkedIn: Day 10: How to use Ray Runtime ...
Day 10 of #30DaysOfRay explores using #Ray's Runtime Environments on a #Ray ... for some specific environment variables read meta-data or config files...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found