gigl.common.services.VertexAIService#
- class gigl.common.services.vertex_ai.VertexAIService(project: str, location: str, service_account: str, staging_bucket: str)#
Bases:
object
A class representing a Vertex AI service.
- Args:
project (str): The project ID. location (str): The location of the service. service_account (str): The service account to use for authentication. staging_bucket (str): The staging bucket for the service.
Methods
Fetches the pipeline job with the given job name.
Returns the URL for the pipeline run.
Launch a Vertex AI CustomJob.
Runs a pipeline using the Vertex AI Pipelines service.
Waits for a run to complete.
- __init__(project: str, location: str, service_account: str, staging_bucket: str)#
- __weakref__#
list of weak references to the object (if defined)
- get_pipeline_job_from_job_name(job_name: str) PipelineJob #
Fetches the pipeline job with the given job name.
- static get_pipeline_run_url(project: str, location: str, job_name: str) str #
Returns the URL for the pipeline run.
- launch_job(job_config: VertexAiJobConfig) None #
Launch a Vertex AI CustomJob. See the docs for more info. https://cloud.google.com/python/docs/reference/aiplatform/latest/google.cloud.aiplatform.CustomJob
- Args:
job_config (VertexAiJobConfig): The configuration for the job.
- property project: str#
The GCP project that is being used for this service.
- run_pipeline(display_name: str, template_path: Uri, run_keyword_args: Dict[str, str], job_id: str | None = None, experiment: str | None = None) PipelineJob #
Runs a pipeline using the Vertex AI Pipelines service. For more info, see the Vertex AI docs https://cloud.google.com/python/docs/reference/aiplatform/latest/google.cloud.aiplatform.PipelineJob#google_cloud_aiplatform_PipelineJob_submit
- Args:
display_name (str): The display of the pipeline. template_path (Uri): The path to the compiled pipeline YAML. run_keyword_args (Dict[str, str]): Runtime arguements passed to your pipeline. job_id (Optional[str]): The ID of the job. If not provided will be the pipeline_name + datetime.
Note: The pipeline_name and display_name are not the same. Note: pipeline_name comes is defined in the template_path and ultimately comes from Python pipeline definition. If provided, must be unique.
experiment (Optional[str]): The name of the experiment to associate the run with.
- Returns:
The PipelineJob created.
- static wait_for_run_completion(resource_name: str, timeout: float = 129600, polling_period_s: int = 60) None #
Waits for a run to complete.
- Args:
resource_name (str): The resource name of the run. timeout (float): The maximum time to wait for the run to complete, in seconds. Defaults to 7200. polling_period_s (int): The time to wait between polling the run status, in seconds. Defaults to 60.
- Returns:
None