From bc3fe61e20d5c80bc4774c075196018d73b39ba3 Mon Sep 17 00:00:00 2001 From: Shuchang Zheng Date: Fri, 3 Jan 2025 22:17:47 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20synced=20local=20'skyvern/'=20wi?= =?UTF-8?q?th=20remote=20'skyvern/'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > [!IMPORTANT] > Adds deletion of workflow run blocks during workflow run reset by introducing `delete_workflow_run_blocks` in `client.py` and updating `reset_workflow_run` in `workflows.py`. > > - **Behavior**: > - In `reset_workflow_run` in `workflows.py`, added call to `delete_workflow_run_blocks` to remove workflow run blocks during reset. > - **Database**: > - Added `delete_workflow_run_blocks` function in `client.py` to delete `WorkflowRunBlockModel` entries by `workflow_run_id` and `organization_id`. > > This description was created by [Ellipsis](https://www.ellipsis.dev?ref=Skyvern-AI%2Fskyvern-cloud&utm_source=github&utm_medium=referral) for 475d8eb41f51d7f9ebffae0290d7a15daa8a9e39. It will automatically update as commits are pushed. --- skyvern/forge/sdk/db/client.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/skyvern/forge/sdk/db/client.py b/skyvern/forge/sdk/db/client.py index ab1bdcda95..7662471166 100644 --- a/skyvern/forge/sdk/db/client.py +++ b/skyvern/forge/sdk/db/client.py @@ -2132,6 +2132,17 @@ async def create_workflow_run_block( task = await self.get_task(task_id, organization_id=organization_id) return convert_to_workflow_run_block(new_workflow_run_block, task=task) + async def delete_workflow_run_blocks(self, workflow_run_id: str, organization_id: str | None = None) -> None: + async with self.Session() as session: + stmt = delete(WorkflowRunBlockModel).where( + and_( + WorkflowRunBlockModel.workflow_run_id == workflow_run_id, + WorkflowRunBlockModel.organization_id == organization_id, + ) + ) + await session.execute(stmt) + await session.commit() + async def update_workflow_run_block( self, workflow_run_block_id: str,