diff --git a/prefect_gcp/aiplatform.py b/prefect_gcp/aiplatform.py index ff31489..cb4678d 100644 --- a/prefect_gcp/aiplatform.py +++ b/prefect_gcp/aiplatform.py @@ -12,52 +12,52 @@ Examples: - Run a job using Vertex AI Custom Training: +Run a job using Vertex AI Custom Training: - ```python - from prefect_gcp.credentials import GcpCredentials - from prefect_gcp.aiplatform import VertexAICustomTrainingJob - - gcp_credentials = GcpCredentials.load("BLOCK_NAME") - job = VertexAICustomTrainingJob( - region="us-east1", - image="us-docker.pkg.dev/cloudrun/container/job:latest", - gcp_credentials=gcp_credentials, - ) - job.run() - ``` - - Run a job that runs the command `echo hello world` using Google Cloud Run Jobs: +```python +from prefect_gcp.credentials import GcpCredentials +from prefect_gcp.aiplatform import VertexAICustomTrainingJob - ```python - from prefect_gcp.credentials import GcpCredentials - from prefect_gcp.aiplatform import VertexAICustomTrainingJob +gcp_credentials = GcpCredentials.load("BLOCK_NAME") +job = VertexAICustomTrainingJob( + region="us-east1", + image="us-docker.pkg.dev/cloudrun/container/job:latest", + gcp_credentials=gcp_credentials, +) +job.run() +``` - gcp_credentials = GcpCredentials.load("BLOCK_NAME") - job = VertexAICustomTrainingJob( - command=["echo", "hello world"], - region="us-east1", - image="us-docker.pkg.dev/cloudrun/container/job:latest", - gcp_credentials=gcp_credentials, - ) - job.run() - ``` +Run a job that runs the command `echo hello world` using Google Cloud Run Jobs: - Preview job specs: +```python +from prefect_gcp.credentials import GcpCredentials +from prefect_gcp.aiplatform import VertexAICustomTrainingJob + +gcp_credentials = GcpCredentials.load("BLOCK_NAME") +job = VertexAICustomTrainingJob( + command=["echo", "hello world"], + region="us-east1", + image="us-docker.pkg.dev/cloudrun/container/job:latest", + gcp_credentials=gcp_credentials, +) +job.run() +``` - ```python - from prefect_gcp.credentials import GcpCredentials - from prefect_gcp.aiplatform import VertexAICustomTrainingJob +Preview job specs: - gcp_credentials = GcpCredentials.load("BLOCK_NAME") - job = VertexAICustomTrainingJob( - command=["echo", "hello world"], - region="us-east1", - image="us-docker.pkg.dev/cloudrun/container/job:latest", - gcp_credentials=gcp_credentials, - ) - job.preview() - ``` +```python +from prefect_gcp.credentials import GcpCredentials +from prefect_gcp.aiplatform import VertexAICustomTrainingJob + +gcp_credentials = GcpCredentials.load("BLOCK_NAME") +job = VertexAICustomTrainingJob( + command=["echo", "hello world"], + region="us-east1", + image="us-docker.pkg.dev/cloudrun/container/job:latest", + gcp_credentials=gcp_credentials, +) +job.preview() +``` """ # noqa @@ -291,9 +291,9 @@ async def generate_work_pool_base_job_template(self) -> dict: ), "Failed to generate default base job template for Cloud Run worker." for key, value in self.dict(exclude_unset=True, exclude_defaults=True).items(): if key == "command": - base_job_template["variables"]["properties"]["command"][ - "default" - ] = shlex.join(value) + base_job_template["variables"]["properties"]["command"]["default"] = ( + shlex.join(value) + ) elif key in [ "type", "block_type_slug",