Skip to content

Commit c17a3e8

Browse files
authored
add purge api (#34)
Signed-off-by: Fabian Martinez <[email protected]>
1 parent 8598f6b commit c17a3e8

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### New
1111

12-
- Support for orchestration custom status ([#31](https://github.com/microsoft/durabletask-python/pull/31)) - contributed by [@famarting](https://github.com/famarting)
12+
- Added `set_custom_status` orchestrator API ([#31](https://github.com/microsoft/durabletask-python/pull/31)) - contributed by [@famarting](https://github.com/famarting)
13+
- Added `purge_orchestration` client API ([#34](https://github.com/microsoft/durabletask-python/pull/34)) - contributed by [@famarting](https://github.com/famarting)
1314

1415
### Updates
1516

durabletask/client.py

+5
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,8 @@ def resume_orchestration(self, instance_id: str):
199199
req = pb.ResumeRequest(instanceId=instance_id)
200200
self._logger.info(f"Resuming instance '{instance_id}'.")
201201
self._stub.ResumeInstance(req)
202+
203+
def purge_orchestration(self, instance_id: str, recursive: bool = True):
204+
req = pb.PurgeInstancesRequest(instanceId=instance_id, recursive=recursive)
205+
self._logger.info(f"Purging instance '{instance_id}'.")
206+
self._stub.PurgeInstances()

tests/test_orchestration_e2e.py

+3
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,9 @@ def child(ctx: task.OrchestrationContext, _):
309309
assert state is not None
310310
assert state.runtime_status == client.OrchestrationStatus.TERMINATED
311311

312+
task_hub_client.purge_orchestration(id)
313+
state = task_hub_client.get_orchestration_state(id)
314+
assert state is None
312315

313316

314317
def test_continue_as_new():

0 commit comments

Comments
 (0)