code: def finish(self, maximize=True, status="FINISHED"):
      self.executor.shutdown(wait=True)
      best_result = super(CPUResourceManager, self).finish(status)
  
      self.connector.free_all_resources()
  
      if (
          self.save_model is True
          and best_result is not None
          and status == "FINISHED"
      ):
          logger.info("Experiment finished, starting best job")
  
          # re-run the best job, but also save the model on the disk
          self.executor = ResourceThreadPoolExecutor(max_workers=1)
          best_job_config_str = self.connector.get_best_result_config(
              self.eid, self.maximize
          )
          best_job_config = BasicConfig()
          best_job_config.update(json.loads(best_job_config_str[0]))
          best_job_config["save_model"] = True
          best_job_config["folder_name"] = "models_{}".format(self.eid)
  
          # todo improve
          _rtype = None
          for res, cname in _SupportResource.items():
              if cname == self.__class__.__name__:
                  _rtype = res
                  break
  
          # all should be free, but just in case
          rids = self.connector.get_available_resource(None, _rtype)
          free_rid = random.choice(rids) if rids else None
          best_job = Job(self.script, best_job_config, self.workingdir)
          # special job id for best job
          best_job.jid = best_result[0]
  
          def best_job_callback(score, jid):
              if score != "ERROR":
                  logger.info(
                      "Best job finished, please check aup_models/models_{} folder".format(
                          self.eid
                      )
                  )
  
          self.run(
              best_job,
              free_rid,
              None,
              best_job_callback,
              **self.runtime_args,
          )
  
          self.executor.shutdown(wait=True)
  
      return best_result
  
file_path: auptimizer/src/aup/EE/Resource/CPUResourceManager.py
imports: import logging
  import os
  import subprocess
  import threading
  import sys
  import json
  from numpy import random
  from .AbstractResourceManager import AbstractResourceManager
  from ...utils import parse_result, parse_one_line
  from .AbstractResourceManager import _SupportResource
  from ...aup import BasicConfig
  from ..Job import Job
  from .utils.ResourceThreadPoolExecutor import ResourceThreadPoolExecutor
label_desc: Use image node_id 2 for calling the CPUResourceManager obj's underlying member method code with example usage: obj.finish(maximize, status) and returns: best_result