conductor-oss / conductor-oss/python-sdk

Workers graceful shutdown being sure that current executions are not truncated

未关闭
#243 3 条评论 2 个 reaction 已指派 1 人 已被 @coderabhigupta 认领 在 GitHub 查看
enhancement
主要语言
Python
星标
104
派生
42
平均合并
2 天 1 小时
30 天内合并 PR
3

描述

Hi everyone,

I have Conductor workers running on Kubernetes pods.
I would like to handle the graceful shutdown in this way:

1. stop worker polling (I achieved this by implementing the function `paused()` of the `WorkerInterface`)
2. before executing the `sys.exit()` to terminate the pod, I want to be sure that the current worker executions will be finished without being truncated after the SIGTERM (so all the processes associated to the `TaskHandler` end)
3. finally execute `sys.exit()` to terminate the pod

I noticed that in the `TaskRunner` class, when the worker is paused, `None` is returned to the function `run_once`, but the function `run` is in a `while True` loop and I didn't understand how can I be sure when a worker is stopped and finished performing his task,

Is it possible to achieve the behaviour described in the 2nd point?
Thank you in advance.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。