class_docstr: Class for managing threads which run concurrent Spark jobs.
  
  This maintains a primary dispatcher thread, plus 1 thread per Hyperopt trial.
  Each trial's thread runs 1 Spark job with 1 task.
docstr: Call this method when a trial evaluation finishes. It will save results to the
  trial object and update task counters.
  :param is_success: whether the trial succeeded
  :param is_cancelled: whether the trial was cancelled
  :param data: If the trial succeeded, this is the return value from the trial
  task function. Otherwise, this is the exception raised when running the trial
  task.
docstr_tok: ["Call","this","method","when","a","trial","evaluation","finishes",".","It","will","save","results","to","the","trial","object","and","update","task","counters",".",":","param","is_success",":","whether","the","trial","succeeded",":","param","is_cancelled",":","whether","the","trial","was","cancelled",":","param","data",":","If","the","trial","succeeded",",","this","is","the","return","value","from","the","trial","task","function",".","Otherwise",",","this","is","the","exception","raised","when","running","the","trial","task","."]
code: def _finish_trial_run(self, is_success, is_cancelled, trial, data):
      """
      Call this method when a trial evaluation finishes. It will save results to the
      trial object and update task counters.
      :param is_success: whether the trial succeeded
      :param is_cancelled: whether the trial was cancelled
      :param data: If the trial succeeded, this is the return value from the trial
      task function. Otherwise, this is the exception raised when running the trial
      task.
      """
      if is_cancelled:
          logger.debug(
              "trial task {tid} cancelled, exception is {e}".format(
                  tid=trial["tid"], e=str(data)
              )
          )
          self._write_cancellation_back(trial, e=data)
      elif is_success:
          logger.debug(
              "trial task {tid} succeeded, result is {r}".format(
                  tid=trial["tid"], r=data
              )
          )
          self._write_result_back(trial, result=data)
      else:
          logger.error(
              "trial task {tid} failed, exception is {e}.\n {tb}".format(
                  tid=trial["tid"],
                  e=str(data),
                  tb=self._get_traceback(data),
              )
          )
          self._write_exception_back(trial, e=data)
  
imports: import copy
  import os
  import threading
  import time
  import timeit
  import traceback
  from hyperopt import base, fmin, Trials
  from hyperopt.base import validate_timeout, validate_loss_threshold, STATUS_OK
  from hyperopt.utils import coarse_utcnow, _get_logger, _get_random_id
label_desc: Use image node_id 5 for calling the _SparkFMinState obj's underlying member method code with example usage: obj._finish_trial_run(is_success, is_cancelled, trial, data) without return types