簡體   English   中英

在bash腳本中捕獲Tensorflow輸出

[英]Capture Tensorflow output in bash script

帶有火車並評估火車規格的Tensorflow估算器的訓練課程有時會被殺死。

我想在閱讀輸出“殺死”(由tf.logging.INFO生成)后恢復培訓課程。 理想情況下,一次又一次地執行python腳本。 有沒有一種簡短的方法可以完成此任務?

沒有太多的經驗,但是據我有限的知識,您可以轉向在Linux中使用管道 像這樣,

tail -f xxx.log | grep --line-buffered killed_information | while read msg ; do python train.py ; done

注意:killed_information應該由train.py的實際錯誤輸出代替

while [ 1 ]; do

    if grep -Fxq "killed" logFile; then
       # code if found (Run your script again from here)
    fi

    #check every 5 minutes
    sleep 300

done

(從https://stackoverflow.com/a/4749368/10008499采納的代碼)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM