Skip to content

Commit 5f5d464

Browse files
chore: sync code snippets via snipsync
1 parent 9cc85c1 commit 5f5d464

2 files changed

Lines changed: 3 additions & 21 deletions

File tree

docs/develop/python/best-practices/data-handling/external-storage.mdx

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ The Python SDK includes an S3 storage driver. Follow these steps to set it up:
4545
credentials from the environment (environment variables, IAM role, or AWS config file):
4646

4747
<!--SNIPSTART python-s3-driver-create-->
48-
49-
[features/snippets/external_storage/s3_setup/s3_driver_create.py](https://github.com/temporalio/features/blob/main/features/snippets/external_storage/s3_setup/s3_driver_create.py)
50-
48+
[features/snippets/external_storage/s3_setup/s3_driver_create.py](https://github.com/temporalio/features/blob/main/features/snippets/external_storage/s3_setup/s3_driver_create.py)
5149
```py
5250
session = aioboto3.Session(profile_name=AWS_PROFILE, region_name=AWS_REGION)
5351
async with session.client("s3") as s3_client:
@@ -56,15 +54,12 @@ async with session.client("s3") as s3_client:
5654
bucket="my-temporal-payloads",
5755
)
5856
```
59-
6057
<!--SNIPEND-->
6158

6259
2. Configure the driver on your `DataConverter` and pass the converter to your Client and Worker:
6360

6461
<!--SNIPSTART python-s3-external-storage-setup-->
65-
66-
[features/snippets/external_storage/s3_setup/s3_external_storage_setup.py](https://github.com/temporalio/features/blob/main/features/snippets/external_storage/s3_setup/s3_external_storage_setup.py)
67-
62+
[features/snippets/external_storage/s3_setup/s3_external_storage_setup.py](https://github.com/temporalio/features/blob/main/features/snippets/external_storage/s3_setup/s3_external_storage_setup.py)
6863
```py
6964
data_converter = dataclasses.replace(
7065
DataConverter.default,
@@ -82,7 +77,6 @@ worker = Worker(
8277
activities=[],
8378
)
8479
```
85-
8680
<!--SNIPEND-->
8781

8882
By default, payloads larger than 256 KiB are offloaded to external storage. You can adjust this with the
@@ -106,9 +100,7 @@ The following example shows a custom driver that uses local disk as the backing
106100
development and testing only. In production, use a durable storage system that is accessible to all Workers:
107101

108102
<!--SNIPSTART python-custom-storage-driver-->
109-
110103
[features/snippets/external_storage/custom_driver/custom_storage_driver.py](https://github.com/temporalio/features/blob/main/features/snippets/external_storage/custom_driver/custom_storage_driver.py)
111-
112104
```py
113105
class LocalDiskStorageDriver(StorageDriver):
114106
def __init__(self, store_dir: str = "/tmp/temporal-payload-store") -> None:
@@ -156,7 +148,6 @@ class LocalDiskStorageDriver(StorageDriver):
156148

157149

158150
```
159-
160151
<!--SNIPEND-->
161152

162153
The following sections walk through the key parts of the driver implementation.
@@ -197,9 +188,7 @@ Pass an `ExternalStorage` instance to your `DataConverter` and use the converter
197188
You can also package your driver as a [plugin](/develop/plugins-guide) for easier reuse across services:
198189

199190
<!--SNIPSTART python-custom-driver-data-converter-->
200-
201191
[features/snippets/external_storage/custom_driver/custom_driver_data_converter.py](https://github.com/temporalio/features/blob/main/features/snippets/external_storage/custom_driver/custom_driver_data_converter.py)
202-
203192
```py
204193
data_converter = dataclasses.replace(
205194
DataConverter.default,
@@ -208,7 +197,6 @@ data_converter = dataclasses.replace(
208197
),
209198
)
210199
```
211-
212200
<!--SNIPEND-->
213201

214202
## Configure payload size threshold
@@ -218,9 +206,7 @@ are offloaded to external storage. You can adjust this with the `payload_size_th
218206
externalize all payloads regardless of size.
219207

220208
<!--SNIPSTART python-external-storage-threshold-->
221-
222209
[features/snippets/external_storage/threshold/threshold_config.py](https://github.com/temporalio/features/blob/main/features/snippets/external_storage/threshold/threshold_config.py)
223-
224210
```py
225211
data_converter = dataclasses.replace(
226212
DataConverter.default,
@@ -230,7 +216,6 @@ data_converter = dataclasses.replace(
230216
),
231217
)
232218
```
233-
234219
<!--SNIPEND-->
235220

236221
## Use multiple storage drivers
@@ -252,9 +237,7 @@ The following example registers two drivers but always selects `preferred_driver
252237
is only registered so the Worker can retrieve payloads that were previously stored with it:
253238

254239
<!--SNIPSTART python-external-storage-multiple-drivers-->
255-
256240
[features/snippets/external_storage/multiple_drivers/multiple_drivers.py](https://github.com/temporalio/features/blob/main/features/snippets/external_storage/multiple_drivers/multiple_drivers.py)
257-
258241
```py
259242
preferred_driver = S3StorageDriver(client=s3_client, bucket="my-bucket")
260243
legacy_driver = LegacyStorageDriver()
@@ -264,5 +247,4 @@ ExternalStorage(
264247
driver_selector=lambda context, payload: preferred_driver,
265248
)
266249
```
267-
268250
<!--SNIPEND-->

docs/develop/python/integrations/langgraph.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,4 +461,4 @@ complete working examples using both Graph and Functional APIs.
461461
## Samples
462462

463463
The [LangGraph plugin samples](https://github.com/temporalio/samples-python/tree/main/langgraph_plugin)
464-
demonstrate all supported patterns across both APIs.
464+
demonstrate all supported patterns across both APIs.

0 commit comments

Comments
 (0)