aiidateam / aiida-core

The official repository for the AiiDA code
https://aiida-core.readthedocs.io
Other
435 stars 189 forks source link

Provide cli for modifying existing profiles #4243

Open ltalirz opened 4 years ago

ltalirz commented 4 years ago

Both verdi setup and verdi quicksetup are currently limited to creating new profiles.

There is no interface for modifying the settings of an existing profile (other than editing the config.json file directly, but such an interface has been requested at least twice during the 2020 July tutorial.

I think we should consider introducing such an API, with a clear statement on the scope: it only changes the setting and does nothing to "migrate" the profile data behind. I.e. it is almost the same as editing the config.json file by hand, except it may do some additional validation on inputs (e.g. does the path to the new file repo exist, ...).

Copying the list of settings from the verdi setup help for context:

  --profile PROFILE               The name of the new profile.  [required]
  --email EMAIL                   Email address associated with the data you
                                  generate. The email address is exported
                                  along with the data, when sharing it.
                                  [required]

  --first-name NONEMPTYSTRING     First name of the user.  [required]
  --last-name NONEMPTYSTRING      Last name of the user.  [required]
  --institution NONEMPTYSTRING    Institution of the user.  [required]
  --db-engine [postgresql_psycopg2]
                                  Engine to use to connect to the database.
  --db-backend [django|sqlalchemy]
                                  Database backend to use.
  --db-host HOSTNAME              Database server host. Leave empty for "peer"
                                  authentication.

  --db-port INTEGER               Database server port.
  --db-name NONEMPTYSTRING        Name of the database to create.  [required]
  --db-username NONEMPTYSTRING    Name of the database user to create.
                                  [required]

  --db-password TEXT              Password of the database user.  [required]
  --repository DIRECTORY          Absolute path to the file repository.

pinging @sphuber @giovannipizzi

P.S. A viable alternative to this may be the switch to the yaml format for the configuration file, making it easier to edit by hand and suggesting to do so in the documentation.

sphuber commented 4 years ago

I see the point of the feature, but I think the behavior you propose is actually dangerous and counter productive. If users want to change something, they most likely want everything to work as expected afterwards. If this is not guaranteed, but all the command does is just update the config.json, why do we need a command for this? If users are anyway expected to understand the inner workings of AiiDA to make these kinds of changes work, why not just let them manually update the config file? Its location is not hidden after all, it is shown in multiple places.

ltalirz commented 4 years ago

I did mention editing the configuration file as an alternative, in particular after we've switched to the yaml format which then allows to add comments etc. I think this is a viable alternative - it just means there will be no validation of inputs, which can be a downside compared to having a dedicated API.

Whatever we decide, I do think we will need a (little) bit of documentation on how to do this.