我正在尝试创建一个自定义log_handler
脚本,可以将工作流的日志保存为 JSON 文件{workdir}/logs
。为此,我需要知道当前是什么,workdir
但我似乎无法从脚本内部访问。有谁知道如何workdir
从log_handler
脚本内部访问?
我也尝试过从Path.cwd()
脚本内部使用,但没有奏效。
编辑:为了澄清这一点,snakemake
允许指定一个--log-handler-script
. 根据文档:
Provide a custom script containing a function ‘def log_handler(msg):’. Snakemake will call this function for every logging output (given as a dictionary msg) allowing to e.g. send notifications in the form of e.g. slack messages or emails.
我正在尝试编写这样一个脚本(基于this)来解析日志消息并将它们保存在一个文件中,理想情况下,在workdir
. 但为此,脚本需要能够知道当前的工作目录。
谢谢,