簡體   English   中英

IPython.parallel-我可以將自己的日志寫入引擎日志嗎?

[英]IPython.parallel - can I write my own log into the engine logs?

我希望能夠將傳遞給引擎的函數的輸出記錄在相關的引擎日志中。

即:

data = /* my list of data to operate on */
def fn(inval):
    import logging
    log = logging.getLogger()
    log.error('This is on the engine')
    // do stuff
    return result

calculated_data = []
for datum in data:
    calc = view.apply(fn, datum)
    calculated_data.append(calc)

我希望能夠在執行特定任務的相關引擎日志中看到日志語句。

您可以使用以下方法獲取當前應用程序的記錄器(在本例中為引擎):

from IPython.config import Application
log = Application.instance().log

然后照常記錄,它將轉到引擎日志。

暫無
暫無

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

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