docstr: Runs optimization on the attached cluster
  :param train_function:
  :param nb_trials:
  :param job_name:
  :return:
docstr_tok: ["Runs","optimization","on","the","attached","cluster",":","param","train_function",":",":","param","nb_trials",":",":","param","job_name",":",":","return",":"]
code: def __optimize_parallel_cluster_internal(
      self,
      train_function,
      nb_trials,
      job_name,
      job_display_name,
      enable_auto_resubmit,
      on_gpu,
  ):
      """
      Runs optimization on the attached cluster
      :param train_function:
      :param nb_trials:
      :param job_name:
      :return:
      """
      self.job_name = job_name
      self.job_display_name = job_display_name
      self.on_gpu = on_gpu
      self.enable_auto_resubmit = enable_auto_resubmit
  
      # layout logging structure
      self.__layout_logging_dir()
  
      if self.is_from_slurm_object:
          # Script is called by slurm: it's an actual experiment.
          self.__run_experiment(train_function)
      else:
          # Launcher script. Generate trials and launch jobs.
  
          # generate hopt trials
          trials = self.hyperparam_optimizer.generate_trials(nb_trials)
  
          # get the max test tube exp version so far if it's there
          scripts_path = os.path.join(self.log_path, "slurm_out_logs")
          next_trial_version = self.__get_max_trial_version(
              scripts_path
          )
  
          # for each trial, generate a slurm command
          for i, trial_params in enumerate(trials):
              exp_i = i + next_trial_version
              self.schedule_experiment(trial_params, exp_i)
  
imports: import datetime
  import os
  import signal
  import sys
  import time
  import traceback
  from subprocess import call
  from .argparse_hopt import HyperOptArgumentParser
label_desc: Use image node_id 4 for calling the SlurmCluster obj's underlying member method code with example usage: obj.__optimize_parallel_cluster_internal(train_function, nb_trials, job_name, job_display_name, enable_auto_resubmit, on_gpu) without return types