gpt4 book ai didi

python - 在 Luigi 的中央调度程序 Web 界面中跟踪长时间运行的任务状态

转载 作者:太空宇宙 更新时间:2023-11-04 02:36:22 27 4
gpt4 key购买 nike

在 Luigi 框架中,我尝试使用 set_tracking_urlset_progress_bar 在中央调度程序的 Web 界面中显示长时间运行任务的进度条在 run() 方法中设置状态,像这样:

def run(self):
self.set_tracking_url("127.0.0.1:8082")
for i in range(100):
self.do_long_calculation(i)
self.set_status_message("Analyzing Id %d" % i)
self.set_progress_percentage(i)

我正在使用

运行任务
PYTHONPATH='.' luigi --module AnalysisTasks LongTask --workers=5

其中AnalysisTasks是python源文件,LongTaskrun()方法所属的任务,luigid在后台运行.但是我没有看到任何进度条或状态报告。我没有在任何地方找到任何答案或例子。有可能吗?

最佳答案

class MyTestTask(Task):
name = "MyTestTask"
target = ["test"]

def run(self):
for i in range(100):
time.sleep(1)
self.set_progress_percentage(i / 10)
print i
return {self.target[0]: i}

Luigi UI where the red arrow indicates the buttons for progress bars

关于python - 在 Luigi 的中央调度程序 Web 界面中跟踪长时间运行的任务状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47808405/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com