m2 icon indicating copy to clipboard operation
m2 copied to clipboard

Move bmi_infra hard-coded project into config file

Open pgrosu opened this issue 7 years ago • 5 comments

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:

  1. In /etc/bmi/bmiconfig*.cfg with something like this:
[bmi]
uid = 5
service = False
BMI_ADMIN_PROJECT = bmi_infra
  1. In ims/common/constants.py with something like this:
# BMI
UID_OPT = 'uid'
SERVICE_OPT = 'service'
BMI_ADMIN_PROJECT_OPT = 'BMI_ADMIN_PROJECT'
  1. In ims/common/bmi_config.py with something like this:

cfg.option(constants.BMI_SECTION, constants.BMI_ADMIN_PROJECT_OPT)

  1. In ims/cli/cli.py change all constants.BMI_ADMIN_PROJECT to _cfg.bmi.BMI_ADMIN_PROJECT.

  2. 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 avatar Jul 20 '17 01:07 pgrosu

@pgrosu what issues in new environments ? Something like 2 BMIs using same HIL ?

chemistry-sourabh avatar Jul 20 '17 15:07 chemistry-sourabh

@chemistry-sourabh exactly. Do you know of a better way of handling this issue?

naved001 avatar Jul 20 '17 15:07 naved001

Suffix the uid ?

chemistry-sourabh avatar Jul 20 '17 15:07 chemistry-sourabh

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.

pgrosu avatar Jul 20 '17 19:07 pgrosu

@chemistry-sourabh @naved001 can we close this?

apoorvemohan avatar Feb 12 '18 21:02 apoorvemohan