docstr: Simple example for a compute function
  The loss is just a the config + some noise (that decreases with the budget)
  For dramatization, the function can sleep for a given interval to emphasizes
  the speed ups achievable with parallel workers.
  Args:
      config: dictionary containing the sampled configurations by the optimizer
      budget: (float) amount of time/epochs/etc. the model can use to train.
          We assume budget is iteration, as time might not be stable from machine to machine.
  Returns:
      dictionary with mandatory fields:
          'loss' (scalar)
          'info' (dict)
docstr_tok: ["Simple","example","for","a","compute","function","The","loss","is","just","a","the","config","+","some","noise","(","that","decreases","with","the","budget",")","For","dramatization",",","the","function","can","sleep","for","a","given","interval","to","emphasizes","the","speed","ups","achievable","with","parallel","workers",".","Args",":","config",":","dictionary","containing","the","sampled","configurations","by","the","optimizer","budget",":","(","float",")","amount","of","time\/epochs\/etc",".","the","model","can","use","to","train",".","We","assume","budget","is","iteration",",","as","time","might","not","be","stable","from","machine","to","machine",".","Returns",":","dictionary","with","mandatory","fields",":","'loss","'","(","scalar",")","'info","'","(","dict",")"]
code: def compute(self, config, budget, **kwargs):
      # type: (dict, float, Any) -> dict
      """
      Simple example for a compute function
      The loss is just a the config + some noise (that decreases with the budget)
      For dramatization, the function can sleep for a given interval to emphasizes
      the speed ups achievable with parallel workers.
      Args:
          config: dictionary containing the sampled configurations by the optimizer
          budget: (float) amount of time/epochs/etc. the model can use to train.
              We assume budget is iteration, as time might not be stable from machine to machine.
      Returns:
          dictionary with mandatory fields:
              'loss' (scalar)
              'info' (dict)
      """
      self._current_job = self.optimizer.helper_create_job(
          self.base_task_id, parameter_override=config
      )
      # noinspection PyProtectedMember
      self.optimizer._current_jobs.append(self._current_job)
      if not self._current_job.launch(self.queue_name):
          return dict()
      iteration_value = None
      is_pending = True
  
      while not self._current_job.is_stopped():
          if is_pending and not self._current_job.is_pending():
              is_pending = False
              # noinspection PyProtectedMember
              self.optimizer.budget.jobs.update(
                  self._current_job.task_id(),
                  float(self.optimizer._min_iteration_per_job)
                  / self.optimizer._max_iteration_per_job,
              )
  
          # noinspection PyProtectedMember
          iteration_value = self.optimizer._objective_metric.get_current_raw_objective(
              self._current_job
          )
          if iteration_value:
              # update budget
              self.optimizer.budget.iterations.update(
                  self._current_job.task_id(), iteration_value[0]
              )
  
              # check if we exceeded this job budget
              if (
                  iteration_value[0][0]
                  >= self.budget_iteration_scale * budget
              ):
                  self._current_job.abort()
                  break
  
          sleep(self.sleep_interval)
  
      if iteration_value:
          # noinspection PyProtectedMember
          self.optimizer.budget.jobs.update(
              self._current_job.task_id(),
              float(iteration_value[0][0])
              / self.optimizer._max_iteration_per_job,
          )
  
      result = {
          # this is the a mandatory field to run hyperband
          # remember: HpBandSter always minimizes!
          "loss": float(
              self.objective.get_normalized_objective(self._current_job)
              * -1.0
          ),
          # can be used for any user-defined information - also mandatory
          "info": self._current_job.task_id(),
      }
      print(
          "TrainsBandsterWorker result {}, iteration {}".format(
              result, iteration_value[0]
          )
      )
      # noinspection PyProtectedMember
      self.optimizer._current_jobs.remove(self._current_job)
      return result
  
file_path: clearml/clearml/automation/hpbandster/bandster.py
imports: from time import sleep, time
  from typing import Any, Optional, Sequence
  from ..optimization import Objective, SearchStrategy
  from ..parameters import DiscreteParameterRange, UniformParameterRange, RandomSeed, UniformIntegerParameterRange, Parameter
  from ...task import Task
label_desc: Use image node_id 2 for calling the _TrainsBandsterWorker obj's underlying member method code with example usage: obj.compute(config, budget) and returns: result, dict