class_docstr: Interact with dbt Cloud using the V2 API.
  
  :param dbt_cloud_conn_id: The ID of the :ref:`dbt Cloud connection <howto/connection:dbt-cloud>`.
class_docstr_tok: ["Interact","with","dbt","Cloud","using","the","V2","API",".",":","param","dbt_cloud_conn_id",":","The","ID","of","the",":","ref",":","`","dbt","Cloud","connection","<","howto\/connection",":","dbt-cloud",">","`","."]
docstr: Wait for a dbt Cloud job run to match an expected status.
  
  :param run_id: The ID of a dbt Cloud job run.
  :param account_id: Optional. The ID of a dbt Cloud account.
  :param expected_statuses: Optional. The desired status(es) to check against a job run's current
      status. Defaults to the success status value.
  :param check_interval: Time in seconds to check on a pipeline run's status.
  :param timeout: Time in seconds to wait for a pipeline to reach a terminal status or the expected
      status.
  :return: Boolean indicating if the job run has reached the ``expected_status``.
docstr_tok: ["Wait","for","a","dbt","Cloud","job","run","to","match","an","expected","status",".",":","param","run_id",":","The","ID","of","a","dbt","Cloud","job","run",".",":","param","account_id",":","Optional",".","The","ID","of","a","dbt","Cloud","account",".",":","param","expected_statuses",":","Optional",".","The","desired","status","(","es",")","to","check","against","a","job","run","'s","current","status",".","Defaults","to","the","success","status","value",".",":","param","check_interval",":","Time","in","seconds","to","check","on","a","pipeline","run","'s","status",".",":","param","timeout",":","Time","in","seconds","to","wait","for","a","pipeline","to","reach","a","terminal","status","or","the","expected","status",".",":","return",":","Boolean","indicating","if","the","job","run","has","reached","the","``","expected_status","``","."]
code: def wait_for_job_run_status(
      self,
      run_id: int,
      account_id: int | None = None,
      expected_statuses: int
      | Sequence[int]
      | set[int] = DbtCloudJobRunStatus.SUCCESS.value,
      check_interval: int = 60,
      timeout: int = 60 * 60 * 24 * 7,
  ) -> bool:
      """
      Wait for a dbt Cloud job run to match an expected status.
  
      :param run_id: The ID of a dbt Cloud job run.
      :param account_id: Optional. The ID of a dbt Cloud account.
      :param expected_statuses: Optional. The desired status(es) to check against a job run's current
          status. Defaults to the success status value.
      :param check_interval: Time in seconds to check on a pipeline run's status.
      :param timeout: Time in seconds to wait for a pipeline to reach a terminal status or the expected
          status.
      :return: Boolean indicating if the job run has reached the ``expected_status``.
      """
      expected_statuses = (
          (expected_statuses,)
          if isinstance(expected_statuses, int)
          else expected_statuses
      )
  
      DbtCloudJobRunStatus.check_is_valid(expected_statuses)
  
      job_run_info = JobRunInfo(account_id=account_id, run_id=run_id)
      job_run_status = self.get_job_run_status(**job_run_info)
  
      start_time = time.monotonic()
  
      while (
          not DbtCloudJobRunStatus.is_terminal(job_run_status)
          and job_run_status not in expected_statuses
      ):
          # Check if the job-run duration has exceeded the ``timeout`` configured.
          if start_time + timeout < time.monotonic():
              raise DbtCloudJobRunException(
                  f"Job run {run_id} has not reached a terminal status after {timeout} seconds."
              )
  
          # Wait to check the status of the job run based on the ``check_interval`` configured.
          time.sleep(check_interval)
  
          job_run_status = self.get_job_run_status(**job_run_info)
  
      return job_run_status in expected_statuses
  
imports: from __future__ import annotations
  import asyncio
  import json
  import time
  from enum import Enum
  from functools import cached_property, wraps
  from inspect import signature
  from typing import TYPE_CHECKING, Any, Callable, Sequence, Set, TypeVar, cast
  import aiohttp
  from aiohttp import ClientResponseError
  from asgiref.sync import sync_to_async
  from requests.auth import AuthBase
  from requests.sessions import Session
  from airflow.exceptions import AirflowException
  from airflow.providers.http.hooks.http import HttpHook
  from airflow.typing_compat import TypedDict
label_desc: Use image node_id 19 for calling the DbtCloudHook obj's underlying member method code with example usage: obj.wait_for_job_run_status(run_id, account_id, expected_statuses, check_interval, timeout) and returns: unknown