code: def test_tuner_relative_pathing_with_env_vars(
      shutdown_only, chdir_tmpdir, runtime_env
  ):
      """Tests that `TUNE_ORIG_WORKING_DIR` environment variable can be used to access
      relative paths to the original working directory.
      """
      # Write a data file that we want to read in our training loop
      with open("./read.txt", "w") as f:
          f.write("data")
  
      # Even if we set our runtime_env `{"working_dir": "."}` to the current directory,
      # Tune should still chdir to the trial directory.
      ray.init(num_cpus=1, runtime_env=runtime_env)
  
      def train_func(config):
          orig_working_dir = Path(os.environ["TUNE_ORIG_WORKING_DIR"])
          assert (
              str(orig_working_dir) != os.getcwd()
          ), f"Working directory should have changed from {orig_working_dir}"
  
          # Make sure we can access the data from the original working dir
          # Different from above: create an absolute path using the env variable
          data_path = orig_working_dir / "read.txt"
          assert (
              os.path.exists(data_path)
              and open(data_path, "r").read() == "data"
          )
  
          trial_dir = Path(train.get_context().get_trial_dir())
          # Tune should have changed the working directory to the trial directory
          assert str(trial_dir) == os.getcwd()
  
          with open(trial_dir / "write.txt", "w") as f:
              f.write(f"{config['id']}")
  
      tuner = Tuner(
          train_func,
          param_space={"id": tune.grid_search(list(range(4)))},
      )
      results = tuner.fit()
      assert not results.errors
      for result in results:
          artifact_data = open(
              os.path.join(result.path, "write.txt"), "r"
          ).read()
          assert artifact_data == f"{result.config['id']}"
  
imports: import os
  from pathlib import Path
  from unittest.mock import patch
  import pytest
  import unittest
  from typing import Optional
  from sklearn.datasets import load_breast_cancer
  from sklearn.utils import shuffle
  import ray
  from ray import train, tune
  from ray.train import CheckpointConfig, RunConfig, ScalingConfig
  from ray.train.constants import RAY_CHDIR_TO_TRIAL_DIR
  from ray.train.examples.pytorch.torch_linear_example import train_func
  from ray.data import Dataset, Datasource, ReadTask, from_pandas, read_datasource
  from ray.data.block import BlockMetadata
  from ray.train.data_parallel_trainer import DataParallelTrainer
  from ray.train.torch import TorchTrainer
  from ray.train.trainer import BaseTrainer
  from ray.train.xgboost import XGBoostTrainer
  from ray.tune import Callback, CLIReporter
  from ray.tune.tune_config import TuneConfig
  from ray.tune.tuner import Tuner
label_desc: Use image node_id 15 for calling a global function with example usage: test_tuner_relative_pathing_with_env_vars(shutdown_only, chdir_tmpdir, runtime_env) without return types