From 78577571c3d1266ad66a690d9f6fbe8ff2ad2c52 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Mon, 21 Apr 2025 13:10:44 -0500 Subject: Build the environment from the application environment. --- gn_libs/jobs/jobs.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gn_libs/jobs/jobs.py b/gn_libs/jobs/jobs.py index cf44bd0..1f66772 100644 --- a/gn_libs/jobs/jobs.py +++ b/gn_libs/jobs/jobs.py @@ -116,6 +116,14 @@ def error_filename(jobid, error_dir): return f"{error_dir}/job_{jobid}.error" +def build_environment(extras: dict[str, str] = {}): + return { + **dict(os.environ), + "PYTHONPATH": ":".join(sys.path), + **extras + } + + def launch_job( the_job: dict, sqlite3_url: str, @@ -138,7 +146,7 @@ def launch_job( job_id, str(error_dir)], stderr=errorfile, - env={"PYTHONPATH": ":".join(sys.path)}) + env=build_environment()) return the_job -- cgit v1.2.3