hi all, I have a task to call a client which used ...
# ask-the-community
y
hi all, I have a task to call a client which used to run the pipeline in certain platform, and I want to cancel the pipeline running when I click the terminate button in flyte UI, I have tried to use
atexist
to register
clinet.cancel_running
in the task, but termination of flyte workflow does not call
atexist
somehow, anyone knows why and how to fix? thanks!
Copy code
@task()
def client_task():
    import Client
    client = Client()
    client.execute_flow("a", "b")
    execid = client.execid
    import atexit
    atexit.register(client.cancel_execution, execid)

@workflow
def azkaban_client_workflow() -> None:
    azkaban_client_task()
s
@Yue Shang, since you want to terminate an execution that's running elsewhere, please make sure you're terminating it correctly. Is it working when you aren't including the same in a Flyte task?
k
@Yue Shang today we do not handle docker termination. https://docs.python.org/3/library/atexit.html Hence it does not. Get invoked. You can contribute a signal handler to pyflyte-execute
y
Is it working when you aren't including the same in a Flyte task?
it's working when I explicitly call the method of canceling. @Ketan (kumare3) I see, is there any other method to achieve the same effect?
k
if you are simply calling external services, recommend Agents