Skip to content

Commit

Permalink
feat(manager): pass custom env variables to job controller (reanahub#571
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mdonadoni committed Feb 28, 2024
1 parent 7127dbc commit 32bccb7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions reana_workflow_controller/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ def _env_vars_dict_to_k8s_list(env_vars):
)
"""Default image for REANA Job Controller sidecar."""


JOB_CONTROLLER_ENV_VARS = _env_vars_dict_to_k8s_list(
json.loads(os.getenv("REANA_JOB_CONTROLLER_ENV_VARS", "{}"))
)
"""Environment variables to be passed to the job controller container."""

JOB_CONTROLLER_CONTAINER_PORT = 5000
"""Default container port for REANA Job Controller sidecar."""

Expand Down
3 changes: 2 additions & 1 deletion reana_workflow_controller/workflow_run_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
from reana_workflow_controller.config import ( # isort:skip
IMAGE_PULL_SECRETS,
JOB_CONTROLLER_CONTAINER_PORT,
JOB_CONTROLLER_ENV_VARS,
JOB_CONTROLLER_SHUTDOWN_ENDPOINT,
REANA_KUBERNETES_JOBS_MAX_USER_MEMORY_LIMIT,
REANA_KUBERNETES_JOBS_MEMORY_LIMIT,
Expand Down Expand Up @@ -484,7 +485,6 @@ def _create_job_spec(
overwrite_operational_options=overwrite_operational_options,
)
workflow_engine_env_vars = env_vars or self._workflow_engine_env_vars()
job_controller_env_vars = []
owner_id = str(self.workflow.owner_id)
command = format_cmd(command)
workspace_mount, workspace_volume = get_workspace_volume(
Expand Down Expand Up @@ -586,6 +586,7 @@ def _create_job_spec(
),
)

job_controller_env_vars = copy.deepcopy(JOB_CONTROLLER_ENV_VARS)
job_controller_env_vars.extend(
[
{"name": "REANA_USER_ID", "value": owner_id},
Expand Down

0 comments on commit 32bccb7

Please sign in to comment.