diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f33011..fc4b3d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### New -- Support for orchestration custom status ([#31](https://github.com/microsoft/durabletask-python/pull/31)) - contributed by [@famarting](https://github.com/famarting) +- Added `set_custom_status` orchestrator API ([#31](https://github.com/microsoft/durabletask-python/pull/31)) - contributed by [@famarting](https://github.com/famarting) +- Added `purge_orchestration` client API ([#34](https://github.com/microsoft/durabletask-python/pull/34)) - contributed by [@famarting](https://github.com/famarting) ### Updates diff --git a/durabletask/client.py b/durabletask/client.py index 50b5d07..82f920a 100644 --- a/durabletask/client.py +++ b/durabletask/client.py @@ -199,3 +199,8 @@ def resume_orchestration(self, instance_id: str): req = pb.ResumeRequest(instanceId=instance_id) self._logger.info(f"Resuming instance '{instance_id}'.") self._stub.ResumeInstance(req) + + def purge_orchestration(self, instance_id: str, recursive: bool = True): + req = pb.PurgeInstancesRequest(instanceId=instance_id, recursive=recursive) + self._logger.info(f"Purging instance '{instance_id}'.") + self._stub.PurgeInstances() diff --git a/tests/test_orchestration_e2e.py b/tests/test_orchestration_e2e.py index 112737a..1cfc520 100644 --- a/tests/test_orchestration_e2e.py +++ b/tests/test_orchestration_e2e.py @@ -309,6 +309,9 @@ def child(ctx: task.OrchestrationContext, _): assert state is not None assert state.runtime_status == client.OrchestrationStatus.TERMINATED + task_hub_client.purge_orchestration(id) + state = task_hub_client.get_orchestration_state(id) + assert state is None def test_continue_as_new():