That can’t be right that I need the runtime context and possibly also the session dir. And I am not 100% sure if this even works on remotes.
Is that really the only way to get the working_dir files in a tune context?
At least as a workaround, could I download it via the gcs address? And how would I do that?
It seems likely that when using Ray Tune’s Tuner with a runtime_env(working_dir=…), the files from working_dir are not automatically copied into each trial’s local directory; instead, Ray sets the working directory for the process, but the files themselves are not duplicated into the trial’s log directory. This appears to be intentional: by default, Ray changes the working directory of each worker to a trial-specific directory, and the working_dir contents are available relative to that, but not copied into the trial directory itself. The recommended way to access files from working_dir is to use absolute or relative paths from the working directory, not by copying them into the trial directory. If you need to save trial-specific outputs, you should use tune.get_context().get_trial_dir() for writing, but for reading, access files as they exist in the working_dir, not by copying them manually. The workaround you describe is not the intended usage and may not be robust across environments. Downloading directly from the GCS address is not documented as a standard approach for this use case.
For more detail, see the discussion and code examples in the Ray Tune FAQ, which explains the working directory behavior and how to access files in Tune trials. The test_tuner.py file also demonstrates that the working directory is changed for each trial, and files should be accessed from the original working directory if needed, not by copying them into the trial directory.
Would you like a step-by-step breakdown or code example for accessing files in this context?