Skip to content

Commit fa5cf46

Browse files
seanbollinclaude
andauthored
Rename CloudRunIDPlugin to CloudRunIdPlugin (#1869)
* Rename CloudRunIDPlugin to CloudRunIdPlugin Uses lowercase Id (CloudRunId) per repo naming convention, matching the .NET review feedback and applied across all SDKs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Add CHANGELOG entry naming CloudRunIdPlugin Names the renamed client plugin in the existing Unreleased entry so the changelog reflects the final CloudRunIdPlugin name and satisfies the changelog checkpoint. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent f74399d commit fa5cf46

5 files changed

Lines changed: 20 additions & 20 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ to include examples, links to docs, or any other relevant information.
2020

2121
### Added
2222

23-
- Added the `temporalio.contrib.gcp.cloud_run.id` module plugin to help set the worker identity on Cloud Run.
23+
- Added the `temporalio.contrib.gcp.cloud_run.id` module with the `CloudRunIdPlugin` client plugin to set the worker identity on Cloud Run.
2424
### Changed
2525

2626
### Deprecated

‎temporalio/contrib/gcp/cloud_run/id/README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
> ⚠️ **This package is currently at an experimental release stage.** ⚠️
44
5-
A plugin for running [Temporal](https://temporal.io) workers on Google Cloud Run. `CloudRunIDPlugin`
5+
A plugin for running [Temporal](https://temporal.io) workers on Google Cloud Run. `CloudRunIdPlugin`
66
reads Cloud Run instance metadata and sets the client identity. Both Cloud Run **worker pools** and
77
**services** are supported.
88

@@ -15,7 +15,7 @@ derived from the Cloud Run instance (unless you already passed an `identity`).
1515
import asyncio
1616

1717
from temporalio.client import Client
18-
from temporalio.contrib.gcp.cloud_run.id import CloudRunIDPlugin
18+
from temporalio.contrib.gcp.cloud_run.id import CloudRunIdPlugin
1919
from temporalio.worker import Worker
2020

2121
from my_workflows import MyWorkflow
@@ -26,7 +26,7 @@ async def main() -> None:
2626
# Install the plugin on the client; it propagates to workers automatically.
2727
client = await Client.connect(
2828
"localhost:7233",
29-
plugins=[CloudRunIDPlugin()],
29+
plugins=[CloudRunIdPlugin()],
3030
)
3131

3232
worker = Worker(
@@ -55,7 +55,7 @@ the
5555
at `http://metadata.google.internal/computeMetadata/v1/instance/id`, which requires the
5656
`Metadata-Flavor: Google` request header.
5757

58-
When the client connects, `CloudRunIDPlugin` resolves the worker pool name from
58+
When the client connects, `CloudRunIdPlugin` resolves the worker pool name from
5959
`CLOUD_RUN_WORKER_POOL` (falling back to the service name `K_SERVICE`) and the revision from
6060
`CLOUD_RUN_REVISION` (falling back to
6161
`K_REVISION`), then performs a single synchronous HTTP GET to the metadata server for the instance
@@ -74,10 +74,10 @@ For advanced scenarios or unit tests you can bypass the metadata server by passi
7474
metadata object, or steer the fetch with `getenv` / `metadata_url` / `timeout`:
7575

7676
```python
77-
from temporalio.contrib.gcp.cloud_run.id import CloudRunIDPlugin, get_google_cloud_run_metadata
77+
from temporalio.contrib.gcp.cloud_run.id import CloudRunIdPlugin, get_google_cloud_run_metadata
7878

7979
metadata = get_google_cloud_run_metadata()
80-
plugin = CloudRunIDPlugin(metadata=metadata)
80+
plugin = CloudRunIdPlugin(metadata=metadata)
8181

8282
# metadata.identity exposes the same value the plugin applies, for use
8383
# without the plugin if needed.

‎temporalio/contrib/gcp/cloud_run/id/__init__.py‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
"""Run Temporal workers on Google Cloud Run.
22
3-
:py:class:`CloudRunIDPlugin` reads Cloud Run instance metadata (from a worker pool or a service) and
3+
:py:class:`CloudRunIdPlugin` reads Cloud Run instance metadata (from a worker pool or a service) and
44
sets the client identity from the Cloud Run instance.
55
66
Quick start::
77
88
import asyncio
99
1010
from temporalio.client import Client
11-
from temporalio.contrib.gcp.cloud_run.id import CloudRunIDPlugin
11+
from temporalio.contrib.gcp.cloud_run.id import CloudRunIdPlugin
1212
from temporalio.worker import Worker
1313
1414
async def main() -> None:
1515
# Install the plugin on the client; it propagates to workers automatically.
1616
client = await Client.connect(
1717
"localhost:7233",
18-
plugins=[CloudRunIDPlugin()],
18+
plugins=[CloudRunIdPlugin()],
1919
)
2020
2121
worker = Worker(
@@ -29,7 +29,7 @@ async def main() -> None:
2929
asyncio.run(main())
3030
"""
3131

32-
from temporalio.contrib.gcp.cloud_run.id._cloud_run_id_plugin import CloudRunIDPlugin
32+
from temporalio.contrib.gcp.cloud_run.id._cloud_run_id_plugin import CloudRunIdPlugin
3333
from temporalio.contrib.gcp.cloud_run.id._metadata import (
3434
CLOUD_RUN_METADATA_URL,
3535
GoogleCloudRunMetadata,
@@ -39,6 +39,6 @@ async def main() -> None:
3939
__all__ = [
4040
"CLOUD_RUN_METADATA_URL",
4141
"GoogleCloudRunMetadata",
42-
"CloudRunIDPlugin",
42+
"CloudRunIdPlugin",
4343
"get_google_cloud_run_metadata",
4444
]

‎temporalio/contrib/gcp/cloud_run/id/_cloud_run_id_plugin.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from temporalio.service import ConnectConfig, ServiceClient
1616

1717

18-
class CloudRunIDPlugin(temporalio.plugin.SimplePlugin):
18+
class CloudRunIdPlugin(temporalio.plugin.SimplePlugin):
1919
"""Set a Temporal client's identity from Google Cloud Run instance metadata.
2020
2121
Install this plugin once when connecting the client; the identity it sets
@@ -58,7 +58,7 @@ def __init__(
5858
``os.environ.get`` and exists primarily for testing. Ignored when
5959
``metadata`` is supplied.
6060
"""
61-
super().__init__("CloudRunIDPlugin")
61+
super().__init__("CloudRunIdPlugin")
6262
self._metadata = metadata
6363
self._timeout = timeout
6464
self._metadata_url = metadata_url

‎tests/contrib/gcp/cloud_run/id/test_cloud_run_id_plugin.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import pytest
1111

1212
from temporalio.contrib.gcp.cloud_run.id import (
13-
CloudRunIDPlugin,
13+
CloudRunIdPlugin,
1414
GoogleCloudRunMetadata,
1515
)
1616
from temporalio.service import ConnectConfig, ServiceClient
@@ -48,7 +48,7 @@ def _service_client() -> ServiceClient:
4848
class TestClientIdentity:
4949
@pytest.mark.asyncio
5050
async def test_sets_identity_when_unset(self) -> None:
51-
plugin = CloudRunIDPlugin(
51+
plugin = CloudRunIdPlugin(
5252
metadata=_metadata(instance_id="abc", revision="rev-1")
5353
)
5454
# ConnectConfig auto-fills identity with <pid>@<hostname> when none is given.
@@ -65,7 +65,7 @@ async def connect(input: ConnectConfig) -> ServiceClient:
6565

6666
@pytest.mark.asyncio
6767
async def test_preserves_caller_identity(self) -> None:
68-
plugin = CloudRunIDPlugin(
68+
plugin = CloudRunIdPlugin(
6969
metadata=_metadata(instance_id="abc", revision="rev-1")
7070
)
7171
config = ConnectConfig(target_host="localhost:7233", identity="my-identity")
@@ -85,14 +85,14 @@ async def connect(input: ConnectConfig) -> ServiceClient:
8585
class TestMetadataFetch:
8686
def test_construction_does_not_fetch(self) -> None:
8787
# A bad metadata URL must not raise at construction -- the fetch is lazy.
88-
CloudRunIDPlugin(
88+
CloudRunIdPlugin(
8989
metadata_url=f"http://127.0.0.1:{_closed_port()}/instance/id",
9090
getenv={}.get, # type: ignore[arg-type]
9191
)
9292

9393
@pytest.mark.asyncio
9494
async def test_connect_fails_fast_off_platform(self) -> None:
95-
plugin = CloudRunIDPlugin(
95+
plugin = CloudRunIdPlugin(
9696
timeout=1.0,
9797
metadata_url=f"http://127.0.0.1:{_closed_port()}/instance/id",
9898
getenv={}.get, # type: ignore[arg-type]
@@ -114,7 +114,7 @@ async def test_metadata_fetched_from_server_at_connect(
114114
"temporalio.contrib.gcp.cloud_run.id._cloud_run_id_plugin.get_google_cloud_run_metadata",
115115
fetch,
116116
)
117-
plugin = CloudRunIDPlugin()
117+
plugin = CloudRunIdPlugin()
118118
config = ConnectConfig(target_host="localhost:7233")
119119

120120
async def connect(_input: ConnectConfig) -> ServiceClient:

0 commit comments

Comments
 (0)