m2
m2 copied to clipboard
Move bmi_infra hard-coded project into config file
Hi Guys,
I propose we move the following, from being hard-coded in ims/common/constants.py to the config file that usually resides in /etc/bmi/
:
BMI_ADMIN_PROJECT = "bmi_infra"
This causes issues with deployment to new environments.
To fix this, it requires changes to the following five files:
- In
/etc/bmi/bmiconfig*.cfg
with something like this:
[bmi]
uid = 5
service = False
BMI_ADMIN_PROJECT = bmi_infra
- In
ims/common/constants.py
with something like this:
# BMI
UID_OPT = 'uid'
SERVICE_OPT = 'service'
BMI_ADMIN_PROJECT_OPT = 'BMI_ADMIN_PROJECT'
- In
ims/common/bmi_config.py
with something like this:
cfg.option(constants.BMI_SECTION, constants.BMI_ADMIN_PROJECT_OPT)
-
In
ims/cli/cli.py
change allconstants.BMI_ADMIN_PROJECT
to_cfg.bmi.BMI_ADMIN_PROJECT
. -
In
ims/rpc/server/rpc_server.py
change the following two lines:server.remake_mappings()
->server.remake_mappings( server.remake_mappings( cfg.bmi.BMI_ADMIN_PROJECT )
with BMI("", "", constants.BMI_ADMIN_PROJECT) as bmi:
->with BMI("", "", BMI_ADMIN_PROJECT) as bmi:
Let me know, as I would like to have done fairly quickly for the 0.5 release.
Thanks, Paul
@pgrosu what issues in new environments ? Something like 2 BMIs using same HIL ?
@chemistry-sourabh exactly. Do you know of a better way of handling this issue?
Suffix the uid ?
Let's define as a group issue https://github.com/CCI-MOC/ims/issues/138 first, and then we can properly fix this. In any case, we will still have to move these hard-coded instantiations outside of the code-base.
@chemistry-sourabh @naved001 can we close this?