def __init__( self, service_args: Optional[Dict] = None, verbose: Optional[bool] = None, max_retry_delay_seconds: int = 3600 # 1 hour ) -> None: """Engine service client. Args: service_args: A dictionary of arguments that can be used to configure options on the underlying gRPC client. verbose: Suppresses stderr messages when set to False. Default is true. max_retry_delay_seconds: The maximum number of seconds to retry when a retryable error code is returned. """ self.max_retry_delay_seconds = max_retry_delay_seconds if verbose is None: verbose = True self.verbose = verbose if not service_args: service_args = {} # Suppress warnings about using Application Default Credentials. with warnings.catch_warnings(): warnings.simplefilter('ignore') self.grpc_client = quantum.QuantumEngineServiceClient( **service_args)
def __init__(self, project_id: str, proto_version: ProtoVersion = ProtoVersion.V1, service_args: Optional[Dict] = None, verbose: bool = True) -> None: """Engine service client. Args: project_id: A project_id string of the Google Cloud Project to use. API interactions will be attributed to this project and any resources created will be owned by the project. See https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects service_args: A dictionary of arguments that can be used to configure options on the underlying apiclient. See https://github.com/googleapis/google-api-python-client verbose: Supresses stderr messages when set to False. Default is true. """ self.project_id = project_id self.max_retry_delay = 3600 # 1 hour self.proto_version = proto_version self.verbose = verbose if not service_args: service_args = {} # Suppress warnings about using Application Default Credentials. with warnings.catch_warnings(): warnings.simplefilter('ignore') self.client = quantum.QuantumEngineServiceClient(**service_args)