code: def refresh(self):
      job_map = {}
  
      # -- carry over state for active engines
      for eid in self._client.ids:
          job_map[eid] = self.job_map.pop(eid, (None, None))
  
      # -- deal with lost engines, abandoned promises
      for eid, (p, tt) in list(self.job_map.items()):
          if self.job_error_reaction == "raise":
              raise LostEngineError(p)
          elif self.job_error_reaction == "log":
              tt["error"] = "LostEngineError (%s)" % str(p)
              tt["state"] = JOB_STATE_ERROR
          else:
              raise ValueError(self.job_error_reaction)
  
      # -- remove completed jobs from job_map
      for eid, (p, tt) in list(job_map.items()):
          if p is None:
              continue
          if p.ready():
              try:
                  tt["result"] = p.get()
                  tt["state"] = JOB_STATE_DONE
                  job_map[eid] = (None, None)
              except Exception as e:
                  if self.job_error_reaction == "raise":
                      raise
                  elif self.job_error_reaction == "log":
                      tt["error"] = str(e)
                      tt["state"] = JOB_STATE_ERROR
                  else:
                      raise ValueError(self.job_error_reaction)
              if self.save_ipy_metadata:
                  tt["ipy_metadata"] = p.metadata
              tt["refresh_time"] = coarse_utcnow()
              del job_map[eid]
  
      self.job_map = job_map
      Trials.refresh(self)
  
imports: from time import sleep, time
  import numpy
  from .base import Trials
  from .base import Domain
  from .base import JOB_STATE_NEW
  from .base import JOB_STATE_RUNNING
  from .base import JOB_STATE_DONE
  from .base import JOB_STATE_ERROR
  from .base import spec_from_misc
  from .base import Ctrl
  from .utils import coarse_utcnow
  import sys
label_desc: Use image node_id 3 for calling the IPythonTrials obj's underlying member method code with example usage: obj.refresh() without return types