class_docstr: Hook for Google Cloud DataForm APIs.
class_docstr_tok: ["Hook","for","Google","Cloud","DataForm","APIs","."]
docstr: Helper method which polls a job to check if it finishes.
  
  :param workflow_invocation_id: Id of the Workflow Invocation
  :param repository_id: Id of the Dataform repository
  :param project_id: Required. The ID of the Google Cloud project the cluster belongs to.
  :param region: Required. The Cloud Dataproc region in which to handle the request.
  :param wait_time: Number of seconds between checks
  :param timeout: How many seconds wait for job to be ready. Used only if ``asynchronous`` is False
docstr_tok: ["Helper","method","which","polls","a","job","to","check","if","it","finishes",".",":","param","workflow_invocation_id",":","Id","of","the","Workflow","Invocation",":","param","repository_id",":","Id","of","the","Dataform","repository",":","param","project_id",":","Required",".","The","ID","of","the","Google","Cloud","project","the","cluster","belongs","to",".",":","param","region",":","Required",".","The","Cloud","Dataproc","region","in","which","to","handle","the","request",".",":","param","wait_time",":","Number","of","seconds","between","checks",":","param","timeout",":","How","many","seconds","wait","for","job","to","be","ready",".","Used","only","if","``","asynchronous","``","is","False"]
code: def wait_for_workflow_invocation(
      self,
      workflow_invocation_id: str,
      repository_id: str,
      project_id: str,
      region: str,
      wait_time: int = 10,
      timeout: int | None = None,
  ) -> None:
      """
      Helper method which polls a job to check if it finishes.
  
      :param workflow_invocation_id: Id of the Workflow Invocation
      :param repository_id: Id of the Dataform repository
      :param project_id: Required. The ID of the Google Cloud project the cluster belongs to.
      :param region: Required. The Cloud Dataproc region in which to handle the request.
      :param wait_time: Number of seconds between checks
      :param timeout: How many seconds wait for job to be ready. Used only if ``asynchronous`` is False
      """
      if region is None:
          raise TypeError(
              "missing 1 required keyword argument: 'region'"
          )
      state = None
      start = time.monotonic()
      while state not in (
          WorkflowInvocation.State.FAILED,
          WorkflowInvocation.State.SUCCEEDED,
          WorkflowInvocation.State.CANCELLED,
      ):
          if timeout and start + timeout < time.monotonic():
              raise AirflowException(
                  f"Timeout: workflow invocation {workflow_invocation_id} is not ready after {timeout}s"
              )
          time.sleep(wait_time)
          try:
              workflow_invocation = self.get_workflow_invocation(
                  project_id=project_id,
                  region=region,
                  repository_id=repository_id,
                  workflow_invocation_id=workflow_invocation_id,
              )
              state = workflow_invocation.state
          except Exception as err:
              self.log.info(
                  "Retrying. Dataform API returned error when waiting for workflow invocation: %s",
                  err,
              )
  
      if state == WorkflowInvocation.State.FAILED:
          raise AirflowException(
              f"Workflow Invocation failed:\n{workflow_invocation}"
          )
      if state == WorkflowInvocation.State.CANCELLED:
          raise AirflowException(
              f"Workflow Invocation was cancelled:\n{workflow_invocation}"
          )
  
imports: from __future__ import annotations
  import time
  from typing import TYPE_CHECKING, Sequence
  from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
  from google.cloud.dataform_v1beta1 import DataformClient
  from google.cloud.dataform_v1beta1.types import CompilationResult, InstallNpmPackagesResponse, Repository, WorkflowInvocation, Workspace, WriteFileResponse
  from airflow.exceptions import AirflowException
  from airflow.providers.google.common.hooks.base_google import GoogleBaseHook
label_desc: Use image node_id 3 for calling the DataformHook obj's underlying member method code with example usage: obj.wait_for_workflow_invocation(workflow_invocation_id, repository_id, project_id, region, wait_time, timeout) without return types