docstr: return metric value for a specified set of parameter, pulled from the trail object
  
  :param optuna.Trial trial: optuna.Trial object
  :return: metric value float
docstr_tok: ["return","metric","value","for","a","specified","set","of","parameter",",","pulled","from","the","trail","object",":","param","optuna.Trial","trial",":","optuna.Trial","object",":","return",":","metric","value","float"]
code: def objective(self, trial):
      # type: (optuna.Trial) -> Optional[float]
      """
      return metric value for a specified set of parameter, pulled from the trail object
  
      :param optuna.Trial trial: optuna.Trial object
      :return: metric value float
      """
      parameter_override = {}
      for name, (func_name, params) in self._config_space.items():
          suggest = getattr(trial, func_name)
          parameter_override[name] = suggest(name=name, **params)
  
      current_job = self.optimizer.helper_create_job(
          self.base_task_id, parameter_override=parameter_override
      )
      # noinspection PyProtectedMember
      self.optimizer._current_jobs.append(current_job)
      if not current_job.launch(self.queue_name):
          # failed launching the job
          return None
      iteration_value = None
      is_pending = True
      while True:
          if is_pending and not current_job.is_pending():
              is_pending = False
              self.optimizer.budget.jobs.update(
                  current_job.task_id(), 1.0
              )
          if not is_pending:
              # noinspection PyProtectedMember
              iteration_value = self.optimizer._objective_metric.get_current_raw_objective(
                  current_job
              )
              if not iteration_value:
                  if not self.optimizer.monitor_job(current_job):
                      break
                  continue
  
              # make sure we skip None objective values
              if not any(
                  val is None or val[1] is None
                  for val in iteration_value
              ):
                  iteration = max(iv[0] for iv in iteration_value)
                  # trial pruning based on intermediate values not supported when using multi-objective
                  # noinspection PyProtectedMember
                  if self.optimizer._objective_metric.len == 1:
                      # update budget
                      trial.report(
                          value=iteration_value[0][1], step=iteration
                      )
  
                      # Handle pruning based on the intermediate value.
                      if trial.should_prune() and (
                          not self.min_iteration_per_job
                          or iteration >= self.min_iteration_per_job
                      ):
                          current_job.abort()
                          raise optuna.TrialPruned()
  
                  # check if we exceeded this job budget
                  if (
                      self.max_iteration_per_job
                      and iteration >= self.max_iteration_per_job
                  ):
                      current_job.abort()
                      break
  
          if not self.optimizer.monitor_job(current_job):
              break
          sleep(self.sleep_interval)
  
      # noinspection PyProtectedMember
      objective_metric = self.optimizer._objective_metric.get_objective(
          current_job
      )
      # noinspection PyProtectedMember
      if self.optimizer._objective_metric.len == 1:
          objective_metric = objective_metric[0]
          iteration_value = iteration_value[0]
      print(
          "OptunaObjective result metric={}, iteration {}".format(
              objective_metric, iteration_value
          )
      )
      # noinspection PyProtectedMember
      self.optimizer._current_jobs.remove(current_job)
      return objective_metric
  
file_path: clearml/clearml/automation/optuna/optuna.py
imports: from time import sleep
  from typing import Any, Optional, Sequence
  from ..optimization import Objective, SearchStrategy
  from ..parameters import DiscreteParameterRange, Parameter, UniformIntegerParameterRange, UniformParameterRange, LogUniformParameterRange
  from ...task import Task
label_desc: Use image node_id 2 for calling the OptunaObjective obj's underlying member method code with example usage: obj.objective(trial) and returns: objective_metric, None