class_docstr: Logs results to progress.csv under the trial directory.
  
  Automatically flattens nested dicts in the result dict before writing
  to csv:
  
      {"a": {"b": 1, "c": 2}} -> {"a/b": 1, "a/c": 2}
class_docstr_tok: ["Logs","results","to","progress.csv","under","the","trial","directory",".","Automatically","flattens","nested","dicts","in","the","result","dict","before","writing","to","csv",":","{","``","a","''",":","{","``","b","''",":","1",",","``","c","''",":","2","}","}","-",">","{","``","a\/b","''",":","1",",","``","a\/c","''",":","2","}"]
code: def _setup_trial(self, trial: "Trial"):
      if trial in self._trial_files:
          self._trial_files[trial].close()
  
      # Make sure logdir exists
      trial.init_local_path()
      local_file = os.path.join(trial.local_path, EXPR_PROGRESS_FILE)
  
      # Resume the file from remote storage.
      self._restore_from_remote(EXPR_PROGRESS_FILE, trial)
  
      self._trial_continue[trial] = (
          os.path.exists(local_file) and os.path.getsize(local_file) > 0
      )
  
      self._trial_files[trial] = open(local_file, "at")
      self._trial_csv[trial] = None
  
imports: import csv
  import logging
  import os
  from typing import TYPE_CHECKING, Dict, TextIO
  from ray.air.constants import EXPR_PROGRESS_FILE
  from ray.tune.logger.logger import _LOGGER_DEPRECATION_WARNING, Logger, LoggerCallback
  from ray.tune.utils import flatten_dict
  from ray.util.annotations import Deprecated, PublicAPI
label_desc: Use image node_id 2 for calling the CSVLoggerCallback obj's underlying member method code with example usage: obj._setup_trial(trial) without return types