prefect_gcp.workers.vertex
<!— # noqa —>
Module containing the custom worker used for executing flow runs as Vertex AI Custom Jobs.
Get started by creating a Cloud Run work pool:
Configuration
Read more about configuring work pools here.Classes
VertexAIWorkerVariables
Default variables for the Vertex AI worker.
The schema for this class is used to populate the variables section of the default
base job template.
VertexAIWorkerJobConfiguration
Configuration class used by the Vertex AI Worker to create a Job.
An instance of this class is passed to the Vertex AI Worker’s run method
for each flow run. It contains all information necessary to execute
the flow run as a Vertex AI Job.
Attributes:
region: The region where the Vertex AI Job resides.credentials: The GCP Credentials used to connect to Vertex AI.job_spec: The Vertex AI Job spec used to create the Job.job_watch_poll_interval: The interval between GCP API calls to check Job state.
job_name
prepare_for_flow_run
project
VertexAIWorkerResult
Contains information about the final state of a completed process
VertexAIWorker
Prefect worker that executes flow runs within Vertex AI Jobs.
Methods:
kill_infrastructure
infrastructure_pid: The full job name (e.g., “projects/123/locations/us-central1/customJobs/456”).configuration: The job configuration used to connect to GCP.grace_seconds: Not used for Vertex AI (GCP handles graceful shutdown).
InfrastructureNotFound: If the job doesn’t exist.
run
flow_run: The flow run to executeconfiguration: The configuration to use when executing the flow run.task_status: The task status object for the current flow run. If provided, the task will be marked as started.
- A result object containing information about the final state of the flow run