From 37a4e9c0b94e00ef2c1fe8af065126abbb4f70db Mon Sep 17 00:00:00 2001 From: Kevin Rue-Albrecht Date: Wed, 17 Apr 2024 13:23:16 +0100 Subject: [PATCH] add logginf for task filter_mudata --- panpipes/panpipes/pipeline_preprocess.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/panpipes/panpipes/pipeline_preprocess.py b/panpipes/panpipes/pipeline_preprocess.py index 44bd9311..0fbdeedd 100644 --- a/panpipes/panpipes/pipeline_preprocess.py +++ b/panpipes/panpipes/pipeline_preprocess.py @@ -15,6 +15,14 @@ # import pandas as pd +import logging +L = logging.getLogger('panpipes') +L.setLevel(logging.INFO) +log_handler = logging.FileHandler("pipeline.log") +formatter = logging.Formatter('%(asctime)s: %(levelname)s - %(message)s') +log_handler.setFormatter(formatter) +L.addHandler(log_handler) + PARAMS = P.get_parameters( ["%s/pipeline.yml" % os.path.splitext(__file__)[0], "pipeline.yml"]) @@ -52,8 +60,16 @@ def filter_mudata(outfile): cmd += " --keep_barcodes %(filtering_keep_barcodes)s" if PARAMS['intersect_mods'] is not None: cmd += " --intersect_mods %(intersect_mods)s" - cmd += " > logs/filtering.log " + logfile = "logs/filtering.log" + cmd += f" > {logfile}" job_kwargs["job_threads"] = PARAMS['resources_threads_low'] + L.info( + "Task: 'filter_mudata'" + "\n" + + f"Input file(s): {unfiltered_obj}" + "\n" + + f"Output file(s): {outfile}" + "\n" + + f"Log file: {logfile}" + "\n" + + "In case of error, please refer to the log file(s) above for more information." + ) P.run(cmd, **job_kwargs) else: try: