gigl.common.services.vertex_ai#

Class for interacting with Vertex AI.

Below are some brief definitions of the terminology used by Vertex AI Pipelines:

Resource name: A globally unique identifier for the pipeline, follows https://google.aip.dev/122 and is of the form projects/<project-id>/locations/<location>/pipelineJobs/<job-name> Job name: aka job_id aka PipelineJob.name the name of a pipeline run, must be unique for a given project and location Display name: AFAICT purely cosmetic name for a pipeline, can be filtered on but does not show up in the UI Pipeline name: The name for the pipeline supplied by the pipeline definition (pipeline.yaml).

And a walkthrough to explain how the terminology is used: ```py @kfp.dsl.component def source() -> int:

return 42

@kfp.dsl.component def doubler(a: int) -> int:

return a * 2

@kfp.dsl.component def adder(a: int, b: int) -> int:

return a + b

@kfp.dsl.pipeline def get_pipeline() -> int: # NOTE: get_pipeline here is the Pipeline name

source_task = source() double_task = doubler(a=source_task.output) adder_task = adder(a=source_task.output, b=double_task.output) return adder_task.output

tempdir = tempfile.TemporaryDirectory() tf = os.path.join(tempdir.name, “pipeline.yaml”) print(f”Writing pipeline definition to {tf}”) kfp.compiler.Compiler().compile(get_pipeline, tf) job = aip.PipelineJob(

display_name=”this_is_our_pipeline_display_name”, template_path=tf, pipeline_root=”gs://my-bucket/pipeline-root”,

)

job.submit(service_account=”my-sa@my-project.gserviceaccount.com”)

```

Which outputs the following: Creating PipelineJob PipelineJob created. Resource name: projects/my-project-id/locations/us-central1/pipelineJobs/<job-name> To use this PipelineJob in another session: pipeline_job = aiplatform.PipelineJob.get(‘projects/my-project-id/locations/us-central1/pipelineJobs/<job-name>’) View Pipeline Job: https://console.cloud.google.com/vertex-ai/locations/us-central1/pipelines/runs/<job-name>?project=my-project-id Associating projects/my-project-id/locations/us-central1/pipelineJobs/<job-name> to Experiment: example-experiment

And job has some properties set as well:

`py print(f"{job.display_name=}") # job.display_name='this_is_our_pipeline_display_name' print(f"{job.resource_name=}") # job.resource_name='projects/my-project-id/locations/us-central1/pipelineJobs/<job-name>' print(f"{job.name=}") # job.name='<job-name>' # NOTE: by default, the "job name" is the pipeline name + datetime `

Classes

VertexAIService

A class representing a Vertex AI service.

VertexAiJobConfig