Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

environment variables are ignored by default in scripts/fedbiomed_environment #504

Open
srcansiz opened this issue Apr 12, 2023 · 4 comments
Labels
bug this issue is about reporting and resolving a suspected bug candidate an individual developer submits a work request to the team (extension proposal, bug, other request)

Comments

@srcansiz
Copy link
Member

In GitLab by @sharkovsky on Apr 12, 2023, 16:12

In the script fedbiomed_environment we provide the option to set

  • UPLOADS_URL
  • MQTT_BROKER
  • MQTT_BROKER_PORT

through environment variables. This is very nice, and is common practice.
However, these variables are ignored by default unless the user also sets the undocumented FEDBIOMED_NO_RESET variable.

I personally found this confusing and it took me a long time to identify the problem.
I would prefer the following policy:

  • environment variables take priority over any other configuration
  • we optionally allow a FEDBIOMED_FORCE_RESET env variable to force resetting the environment (hence unsetting those env variables) at the beginning of the script execution.
@srcansiz
Copy link
Member Author

In GitLab by @mvesin on Apr 12, 2023, 17:13

IMHO this might be misleading, as you say, but this is not a bug.

Personally, I would say the current behaviour is coherent because when you run a source fedbiomed_environment XXX, you ask to setup the environment XXX which includes setting up the environment variables. So the variables are not ignored they are overwritten by the command you launch.

Or is there any specific scenario where the environment is activated automatically so that (for example) you run a MQTT_BROKER=yyy fedbiomed_run mycommand and the MQTT_BROKER is ignored ? (I would agree this one is really misleading !).

@srcansiz
Copy link
Member Author

In GitLab by @sharkovsky on Apr 20, 2023, 11:34

The issue is precisely that the variables are overwritten. Here is an example:

export MQTT_BROKER=yyy
source fedbiomed_environment node
fedbiomed_run node start

I would expect the node to use yyy as MQTT_BROKER, instead it uses the default.
This seems to me something that should be corrected, regardless of whether it is a bug or not.

@srcansiz
Copy link
Member Author

In GitLab by @sharkovsky on Apr 20, 2023, 13:50

The second scenario you suggested also results in unexpected behaviour, because inside fedbiomed_run we source fedbiomed_environment, which automatically resets the env variables.

@srcansiz
Copy link
Member Author

In GitLab by @mvesin on Apr 20, 2023, 14:26

Thanks Francesco for the details.
OK for me to change the behaviour as you suggest (ie: ensure that environment variable get precedence over variable reset by fedbiomed_run or fedbiomed_environment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug this issue is about reporting and resolving a suspected bug candidate an individual developer submits a work request to the team (extension proposal, bug, other request)
Projects
None yet
Development

No branches or pull requests

1 participant