class_docstr: Hook for Looker APIs.
class_docstr_tok: ["Hook","for","Looker","APIs","."]
docstr: Helper method which polls a PDT materialization job to check if it finishes.
  
  :param materialization_id: Required. The materialization id to wait for.
  :param wait_time: Optional. Number of seconds between checks.
  :param timeout: Optional. How many seconds wait for job to be ready.
      Used only if ``asynchronous`` is False.
docstr_tok: ["Helper","method","which","polls","a","PDT","materialization","job","to","check","if","it","finishes",".",":","param","materialization_id",":","Required",".","The","materialization","id","to","wait","for",".",":","param","wait_time",":","Optional",".","Number","of","seconds","between","checks",".",":","param","timeout",":","Optional",".","How","many","seconds","wait","for","job","to","be","ready",".","Used","only","if","``","asynchronous","``","is","False","."]
code: def wait_for_job(
      self,
      materialization_id: str,
      wait_time: int = 10,
      timeout: int | None = None,
  ) -> None:
      """
      Helper method which polls a PDT materialization job to check if it finishes.
  
      :param materialization_id: Required. The materialization id to wait for.
      :param wait_time: Optional. Number of seconds between checks.
      :param timeout: Optional. How many seconds wait for job to be ready.
          Used only if ``asynchronous`` is False.
      """
      self.log.info(
          "Waiting for PDT materialization job to complete. Job id: %s.",
          materialization_id,
      )
  
      status = None
      start = time.monotonic()
  
      while status not in (
          JobStatus.DONE.value,
          JobStatus.ERROR.value,
          JobStatus.CANCELLED.value,
          JobStatus.UNKNOWN.value,
      ):
          if timeout and start + timeout < time.monotonic():
              self.stop_pdt_build(materialization_id=materialization_id)
              raise AirflowException(
                  f"Timeout: PDT materialization job is not ready after {timeout}s. "
                  f"Job id: {materialization_id}."
              )
  
          time.sleep(wait_time)
  
          status_dict = self.pdt_build_status(
              materialization_id=materialization_id
          )
          status = status_dict["status"]
  
      if status == JobStatus.ERROR.value:
          msg = status_dict["message"]
          raise AirflowException(
              f'PDT materialization job failed. Job id: {materialization_id}. Message:\n"{msg}"'
          )
      if status == JobStatus.CANCELLED.value:
          raise AirflowException(
              f"PDT materialization job was cancelled. Job id: {materialization_id}."
          )
      if status == JobStatus.UNKNOWN.value:
          raise AirflowException(
              f"PDT materialization job has unknown status. Job id: {materialization_id}."
          )
  
      self.log.info(
          "PDT materialization job completed successfully. Job id: %s.",
          materialization_id,
      )
  
imports: from __future__ import annotations
  import json
  import time
  from enum import Enum
  from typing import TYPE_CHECKING
  from looker_sdk.rtl import api_settings, auth_session, requests_transport, serialize
  from looker_sdk.sdk.api40 import methods
  from packaging.version import parse
  from airflow.exceptions import AirflowException
  from airflow.hooks.base import BaseHook
  from airflow.version import version
label_desc: Use image node_id 6 for calling the LookerHook obj's underlying member method code with example usage: obj.wait_for_job(materialization_id, wait_time, timeout) without return types