From 5ac27ef0016be2f7049a919062e9cdb0fddf772d Mon Sep 17 00:00:00 2001 From: Marco Donadoni Date: Tue, 6 Aug 2024 16:45:44 +0200 Subject: [PATCH] perf(manager): reduce size of job-controller's db connection pool (#594) Closes reanahub/reana#819 --- reana_workflow_controller/workflow_run_manager.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/reana_workflow_controller/workflow_run_manager.py b/reana_workflow_controller/workflow_run_manager.py index 88b3d679..ec5ed776 100644 --- a/reana_workflow_controller/workflow_run_manager.py +++ b/reana_workflow_controller/workflow_run_manager.py @@ -658,8 +658,7 @@ def _create_job_spec( ), ) - job_controller_env_vars = copy.deepcopy(JOB_CONTROLLER_ENV_VARS) - job_controller_env_vars.extend( + job_controller_container.env.extend( [ {"name": "REANA_USER_ID", "value": owner_id}, {"name": "CERN_USER", "value": user}, @@ -670,6 +669,8 @@ def _create_job_spec( "name": "REANA_SQLALCHEMY_DATABASE_URI", "value": SQLALCHEMY_DATABASE_URI, }, + # reduce the number of open database connections kept in the pool + {"name": "SQLALCHEMY_POOL_SIZE", "value": "1"}, {"name": "REANA_STORAGE_BACKEND", "value": REANA_STORAGE_BACKEND}, {"name": "REANA_COMPONENT_PREFIX", "value": REANA_COMPONENT_PREFIX}, { @@ -713,7 +714,9 @@ def _create_job_spec( {"name": "WORKSPACE_PATHS", "value": json.dumps(WORKSPACE_PATHS)}, ] ) - job_controller_container.env.extend(job_controller_env_vars) + # env vars coming from Helm values are added after the ones from r-w-controller + # so that the former can override the latter in case of necessity + job_controller_container.env.extend(copy.deepcopy(JOB_CONTROLLER_ENV_VARS)) job_controller_container.env.extend(job_controller_env_secrets) if REANA_RUNTIME_JOBS_KUBERNETES_NODE_LABEL: job_controller_container.env.append(