reanahub / reana-workflow-controller

REANA Workflow Controller
http://reana-workflow-controller.readthedocs.io/
MIT License
2 stars 38 forks source link

Passing WORKFLOW_RUNTIME_USER_UID #246

Open khurtado opened 5 years ago

khurtado commented 5 years ago

Hi guys,

I'm trying to set WORKFLOW_RUNTIME_USER_GID, WORKFLOW_RUNTIME_USER_UID in my cluster configuration as:

WORKFLOW_RUNTIME_USER_UID: 1002
WORKFLOW_RUNTIME_USER_GID: 1002

But these are passed as strings, which is an incompatible type in this method:

https://github.com/reanahub/reana-workflow-controller/blob/5e31c1536db56898542c1d9abca42451a0507d93/reana_workflow_controller/workflow_run_manager.py#L365-L366

The easy workaround for me is to just set int() above, but I'm guessing there is some way to declare these variables as integers (I tried !!int 1002, but thad didn't work).

How do I properly pass these variables as integers in my configuration?

diegodelemos commented 5 years ago

The type casting should be done in REANA-Commons which is the central place where we read the environment variable, that is because the variable is used also in RJC:

$ rg "WORKFLOW_RUNTIME_USER_GID"
reana-commons/reana_commons/config.py
150:WORKFLOW_RUNTIME_USER_GID = os.getenv(
151:    'WORKFLOW_RUNTIME_USER_GID',

reana-job-controller/reana_job_controller/kubernetes_job_manager.py
22:                                  WORKFLOW_RUNTIME_USER_GID,
159:                run_as_group=WORKFLOW_RUNTIME_USER_GID,

reana-workflow-controller/reana_workflow_controller/workflow_run_manager.py
20:                                  WORKFLOW_RUNTIME_USER_GID,
365:                run_as_group=WORKFLOW_RUNTIME_USER_GID,
446:                WORKFLOW_RUNTIME_USER_GID,

How to proceed with it depends:

In any case, we have to fix it in R-Commons, making a PR and adding a release commit, it would be great if you can do that, so you can also test it :)