Skip to content

Commit 20e4585

Browse files
seanbollinclaude
andcommitted
Rename CloudRunPlugin to WorkerIDPlugin in the Cloud Run sample
The SDK renamed the generic CloudRunPlugin to WorkerIDPlugin (Cloud Run can host multiple plugins). Update the sample's worker, README, and the pyproject comment to match the new class name. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent d943cf1 commit 20e4585

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

gcp_cloud_run_worker_id/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
This sample runs a long-lived Temporal Worker in a [Google Cloud Run worker
44
pool](https://cloud.google.com/run/docs/worker-pools) and uses the
55
[`temporalio.contrib.gcp.cloud_run`](https://python.temporal.io/temporalio.contrib.gcp.cloud_run.html)
6-
`CloudRunPlugin` to derive the worker's identity and its Worker Deployment
6+
`WorkerIDPlugin` to derive the worker's identity and its Worker Deployment
77
version from Cloud Run instance metadata.
88

99
Cloud Run runs a long-lived container rather than a per-invocation handler, so
1010
this is a small metadata-driven plugin -- not a worker wrapper. The worker
11-
registers `CloudRunPlugin()` on the client via `Client.connect(plugins=[...])`.
11+
registers `WorkerIDPlugin()` on the client via `Client.connect(plugins=[...])`.
1212
At connect time the plugin:
1313

1414
- reads the deployment name from `CLOUD_RUN_WORKER_POOL` (worker pools), falling
@@ -41,7 +41,7 @@ Workflow/Activity definitions.
4141

4242
| File | Description |
4343
|------|-------------|
44-
| `worker.py` | Long-lived worker: registers `CloudRunPlugin` to set identity + deployment version from Cloud Run metadata, then runs until SIGTERM |
44+
| `worker.py` | Long-lived worker: registers `WorkerIDPlugin` to set identity + deployment version from Cloud Run metadata, then runs until SIGTERM |
4545
| `workflows.py` | Sample Workflow that executes a greeting Activity (PINNED versioning behavior) |
4646
| `activities.py` | Sample Activity that returns a greeting string |
4747
| `settings.py` | Reads `TEMPORAL_*` connection settings from the environment |

gcp_cloud_run_worker_id/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dev = [
1818
package = false
1919

2020
# TEMPORARY: the Google Cloud Run plugin
21-
# (temporalio.contrib.gcp.cloud_run.CloudRunPlugin) is not
21+
# (temporalio.contrib.gcp.cloud_run.WorkerIDPlugin) is not
2222
# released yet, so this pins `temporalio` to the local SDK checkout on the
2323
# `cloud-run-worker-id` branch so the sample can be run and type-checked
2424
# locally. Remove this [tool.uv.sources] override and rely on the released

gcp_cloud_run_worker_id/worker.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Run a long-lived Temporal worker on a Google Cloud Run worker pool.
22
3-
The worker registers ``temporalio.contrib.gcp.cloud_run.CloudRunPlugin`` on the
3+
The worker registers ``temporalio.contrib.gcp.cloud_run.WorkerIDPlugin`` on the
44
client. The plugin reads Cloud Run instance metadata and automatically sets the
55
client identity and a PINNED Worker Deployment version, then propagates to the
66
worker. The worker runs until Cloud Run sends SIGTERM (for example, on
@@ -15,7 +15,7 @@
1515
from activities import compose_greeting
1616
from settings import load_settings
1717
from temporalio.client import Client
18-
from temporalio.contrib.gcp.cloud_run import CloudRunPlugin
18+
from temporalio.contrib.gcp.cloud_run import WorkerIDPlugin
1919
from temporalio.worker import Worker
2020
from workflows import GreetingWorkflow
2121

@@ -34,7 +34,7 @@ async def main() -> None:
3434
client = await Client.connect(
3535
settings.address,
3636
namespace=settings.namespace,
37-
plugins=[CloudRunPlugin()],
37+
plugins=[WorkerIDPlugin()],
3838
api_key=settings.api_key,
3939
tls=settings.tls,
4040
)
@@ -60,7 +60,7 @@ def request_shutdown() -> None:
6060
for signum in (signal.SIGTERM, signal.SIGINT):
6161
loop.add_signal_handler(signum, request_shutdown)
6262

63-
# identity was set by CloudRunPlugin from Cloud Run instance metadata.
63+
# identity was set by WorkerIDPlugin from Cloud Run instance metadata.
6464
print(
6565
"Worker starting "
6666
f"identity={client.identity} "

0 commit comments

Comments
 (0)