From a4eeb69ad88426c9034780e15187bd225e7141a2 Mon Sep 17 00:00:00 2001 From: zjgemi Date: Fri, 24 May 2024 16:35:46 +0800 Subject: [PATCH] fix: add dispatcher_debug Signed-off-by: zjgemi --- src/dflow/config.py | 1 + src/dflow/plugins/dispatcher.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/dflow/config.py b/src/dflow/config.py index 560e1df2..20ed79c2 100644 --- a/src/dflow/config.py +++ b/src/dflow/config.py @@ -79,6 +79,7 @@ def split_headers(s): "debug_save_copy_method": os.environ.get("DFLOW_DEBUG_SAVE_COPY_METHOD", "symlink"), "raise_for_group": boolize(os.environ.get("DFLOW_RAISE_FOR_GROUP", False)), + "dispatcher_debug": boolize(os.environ.get("DISPATCHER_DEBUG", False)), } diff --git a/src/dflow/plugins/dispatcher.py b/src/dflow/plugins/dispatcher.py index 72c7aa15..e04eb678 100644 --- a/src/dflow/plugins/dispatcher.py +++ b/src/dflow/plugins/dispatcher.py @@ -336,6 +336,10 @@ def render(self, template): machine_dict["local_root"] = self.work_root new_template.script += "import json, shlex\n" + if config["dispatcher_debug"]: + new_template.script += "import logging\n" + new_template.script += "from dpdispatcher.dlog import dlog\n" + new_template.script += "dlog.setLevel(logging.DEBUG)\n" new_template.script += "from dpdispatcher import Machine, Resources,"\ " Task, Submission\n" new_template.script += "machine = Machine.load_from_dict(json.loads("\