diff --git a/hatchet_sdk/clients/rest_client.py b/hatchet_sdk/clients/rest_client.py index b5f1f420..cd972610 100644 --- a/hatchet_sdk/clients/rest_client.py +++ b/hatchet_sdk/clients/rest_client.py @@ -1,5 +1,9 @@ from typing import Any, Dict +from hatchet_sdk.clients.rest.models.workflow_runs_cancel_request import ( + WorkflowRunsCancelRequest, +) + from .rest.api.log_api import LogApi from .rest.api.step_run_api import StepRunApi from .rest.api.workflow_api import WorkflowApi @@ -62,6 +66,14 @@ def workflow_run_get(self, workflow_run_id: str): workflow_run=workflow_run_id, ) + def workflow_run_cancel(self, workflow_run_id: str): + return self.workflow_run_api.workflow_run_cancel( + tenant=self.tenant_id, + workflow_runs_cancel_request=WorkflowRunsCancelRequest( + workflowRunIds=[workflow_run_id], + ), + ) + def workflow_run_create(self, workflow_id: str, input: Dict[str, Any]): return self.workflow_run_api.workflow_run_create( workflow=workflow_id, diff --git a/hatchet_sdk/worker.py b/hatchet_sdk/worker.py index f4c9c323..7c9c75ca 100644 --- a/hatchet_sdk/worker.py +++ b/hatchet_sdk/worker.py @@ -432,8 +432,7 @@ async def handle_cancel_action(self, run_id: str): # check if thread is still running, if so, print a warning if run_id in self.threads: logger.warning( - f"""Thread {self.threads[run_id].ident} with run id {run_id} is still running after cancellation. - This could cause the thread pool to get blocked and prevent new tasks from running.""" + f"Thread {self.threads[run_id].ident} with run id {run_id} is still running after cancellation. This could cause the thread pool to get blocked and prevent new tasks from running." ) finally: self.cleanup_run_id(run_id) diff --git a/pyproject.toml b/pyproject.toml index 68ef3b56..1d8b6e42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "hatchet-sdk" -version = "0.27.6" +version = "0.28.0" description = "" authors = ["Alexander Belanger "] readme = "README.md"