class_docstr: Utility Class to help with the selection of the 'best' model
  during hypersearch for a particular job.
  
  The main interface method is updateResultsForJob(), which is to
  be called periodically from the hypersearch worker.
  
  When called, the model chooser first tries to update the
  _eng_last_selection_sweep_time field in the jobs table. If it
  is successful, it then tries to find the model with the maximum
  metric.
  
  Note : Altough that there are many model choosers for a
  given job, only 1 will update the results because only one
  chooser will be  able to update the _eng_last_selection_sweep_time
  within a given interval
code: def _jobUpdateCandidate(self, candidateID, metricValue, results):
      nullResults = results is None
      if nullResults:
          results = {"bestModel": None, "bestValue": None}
      else:
          results = json.loads(results)
          self.logger.debug("Updating old results %s" % (results))
  
      oldCandidateID = results["bestModel"]
      oldMetricValue = results["bestValue"]
  
      results["bestModel"] = candidateID
      results["bestValue"] = metricValue
      isUpdated = candidateID == oldCandidateID
  
      if isUpdated:
          self.logger.info(
              "Choosing new model. Old candidate: (id=%s, value=%s)"
              " New candidate: (id=%s, value=%f)"
              % (
                  oldCandidateID,
                  oldMetricValue,
                  candidateID,
                  metricValue,
              )
          )
  
      else:
          self.logger.info(
              "Same model as before. id=%s, "
              "metric=%f" % (candidateID, metricValue)
          )
  
      self.logger.debug("New Results %s" % (results))
      self._cjDB.jobUpdateResults(self._jobID, json.dumps(results))
  
file_path: nupic-legacy/src/nupic/swarming/model_chooser.py
imports: import json
  import time
  import logging
  from nupic.support import initLogging
label_desc: Use image node_id 3 for calling the ModelChooser obj's underlying member method code with example usage: obj._jobUpdateCandidate(candidateID, metricValue, results) without return types