Skip to content
This repository was archived by the owner on Mar 26, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion hatchet_sdk/worker/runner/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
import ctypes
import functools
import json
import time
import traceback
from concurrent.futures import ThreadPoolExecutor
from enum import Enum
from multiprocessing import Queue
from threading import Thread, current_thread
from typing import Any, Callable, Dict, Literal, Type, TypeVar, cast, overload
from typing import Any, Callable, Dict, cast

from pydantic import BaseModel

Expand Down Expand Up @@ -421,6 +422,11 @@ async def handle_cancel_action(self, run_id: str) -> None:

# check if thread is still running, if so, print a warning
if run_id in self.threads:
thread = self.threads.get(run_id)
if thread:
self.force_kill_thread(thread)
time.sleep(1)

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."
)
Expand Down