因此,我想創建一個函數,輸出重建的進度和完成此重建的時間。但一旦重建達到100%就需要結束。這是我到目前爲止有:我想在python中每5秒運行一個函數,直到變量達到100%
def progress():
# This prints out the time left until rebuild is done.
loudEchoCMD("storage::rebuild-eta")
# This prints out the % of the rebuild that is done.
rebuildProgress = loudEchoCMD("storage::rebuild-progress")
print rebuildProgress
if rebuildProgress != '100%':
global t
t = threading.Timer(5.0, progress)
t.start()
else:
t.cancel()
當我開始重建過程中,會先完成這一點,然後啓動線程而不是線程打印出來的進步和ETA每五秒鐘。
哎呀對不起固定。致命的謝謝你。 – Adilicious