def set_zombie_refresh_to_fail(self, refresh_job):
current_pid = refresh_job.pid
if current_pid is None:
return
p = psutil.Process(current_pid)
if p.status() != psutil.STATUS_ZOMBIE:
return
refresh = self.schematizer.get_refresh_by_id(
refresh_job.refresh_id
)
if refresh.status == RefreshStatus.IN_PROGRESS:
# Must update manually (not relying on the signal),
# as the process may not properly handle the signal
# if it's a zombie
self.schematizer.update_refresh(
refresh_id=refresh_job.refresh_id,
status=RefreshStatus.FAILED,
offset=0
)
source = refresh_job.source
del self.active_refresh_jobs[source]
os.kill(current_pid, signal.SIGINT)
评论列表
文章目录