class_docstr: A class representing an H2O Job.
class_docstr_tok: ["A","class","representing","an","H2O","Job","."]
docstr: Wait until the job finishes.
  
  This method will continuously query the server about the status of the job, until the job reaches a
  completion. During this time we will display (in stdout) a progress bar with % completion status.
  :param poll_updates: a callback function called a each polling iteration with 2 arguments:
      (current_job: H2OJob, bar_progression: float)
docstr_tok: ["Wait","until","the","job","finishes",".","This","method","will","continuously","query","the","server","about","the","status","of","the","job",",","until","the","job","reaches","a","completion",".","During","this","time","we","will","display","(","in","stdout",")","a","progress","bar","with","%","completion","status",".",":","param","poll_updates",":","a","callback","function","called","a","each","polling","iteration","with","2","arguments",":","(","current_job",":","H2OJob",",","bar_progression",":","float",")"]
code: def poll(self, poll_updates=None):
      """
      Wait until the job finishes.
  
      This method will continuously query the server about the status of the job, until the job reaches a
      completion. During this time we will display (in stdout) a progress bar with % completion status.
      :param poll_updates: a callback function called a each polling iteration with 2 arguments:
          (current_job: H2OJob, bar_progression: float)
      """
      try:
          hidden = not H2OJob.__PROGRESS_BAR__
          pb = ProgressBar(
              widgets=self.__PROGRESS_WIDGETS__, hidden=hidden
          )
          if poll_updates:
              pb.execute(
                  self._refresh_job_status,
                  progress_monitor_fn=ft.partial(poll_updates, self),
              )
          else:
              pb.execute(self._refresh_job_status)
      except StopIteration as e:
          if str(e) == "cancelled":
              self.cancel()
          # Potentially we may want to re-raise the exception here
  
      assert (
          self.status in {"DONE", "CANCELLED", "FAILED"}
          or self._poll_count <= 0
      ), ("Polling finished while the job has status %s" % self.status)
      if self.warnings:
          for w in self.warnings:
              warnings.warn(w)
  
      # check if failed... and politely print relevant message
      if self.status == "CANCELLED":
          raise H2OJobCancelled(
              "Job<%s> was cancelled by the user." % self.job_key
          )
      if self.status == "FAILED":
          if (isinstance(self.job, dict)) and (
              "stacktrace" in list(self.job)
          ):
              raise EnvironmentError(
                  "Job with key {} failed with an exception: {}\nstacktrace: "
                  "\n{}".format(
                      self.job_key,
                      self.exception,
                      self.job["stacktrace"],
                  )
              )
          else:
              raise EnvironmentError(
                  "Job with key %s failed with an exception: %s"
                  % (self.job_key, self.exception)
              )
  
      return self
  
file_path: h2o-3/h2o-py/h2o/job.py
imports: import functools
  import warnings
  import time
  import h2o
  from h2o.exceptions import H2OJobCancelled, H2OConnectionError, H2OResponseError, H2OServerError
  from h2o.utils.progressbar import ProgressBar, PBWString, PBWBar, PBWPercentage
  from h2o.utils.shared_utils import clamp
label_desc: Use image node_id 2 for calling the H2OJob obj's underlying member method code with example usage: obj.poll(poll_updates) and returns: self