code: def train_and_check_chdir(**kwargs):
      if "test_chdir" not in os.getcwd():
          try:
              os.makedirs("./test_chdir")
          except Exception as e:
              print(e)
          os.chdir("./test_chdir")
      run = wandb.init()
      with run:
          c = dict(run.config)
          run.name = "{}-{}-{}".format(
              c.get("param0"), c.get("param1"), c.get("param2")
          )
          print("SweepID", run.sweep_id)
          length = run.config.get("length", L)
          epochs = run.config.get("epochs", 27)
          for e in range(epochs):
              n = float(length) * (float(e + 1) / epochs)
              val = (
                  run.config.param0
                  + run.config.param1 * n
                  + run.config.param2 * n * n
              )
              wandb.log(dict(val_acc=val))
          files = os.listdir(run.dir)
          # TODO: Add a check to restoring from another run in this case, WB-3715. Should restore to run.dir
          # check files were saved to the right place
          assert set(files) == {
              "requirements.txt",
              "output.log",
              "config.yaml",
              "wandb-summary.json",
              "wandb-metadata.json",
          }, print(files)
          # ensure run dir does not contain test_chdir, and no files were saved there
          assert "test_chdir" not in run.dir
          for _, _, files in os.walk("."):
              assert files == [], print(files)
  
file_path: wandb/tests/standalone_tests/sweep_check.py
imports: import argparse
  import os
  import shutil
  import time
  import requests
  import wandb
label_desc: Use image node_id 3 for calling a global function with example usage: train_and_check_chdir() without return types