aiida-core icon indicating copy to clipboard operation
aiida-core copied to clipboard

Allow for `verdi --config`

Open chrisjsewell opened this issue 2 years ago • 3 comments

It should be possible to supply a YAML file to verdi at the top-level This would be similar to how you use e.g. verdi code core.installed --config config.yaml, but the YAML would also provide the parts of the verdi path, i.e. code and core.installed.

The reasoning for the addition is that, especially with additions like Code types and potential changes like #6023, you can no longer store the "full" information about a code/profile configuration in the YAML, e.g. the core.installed and core.sqlite_dos

Such a YAML might look like then (note the command key):

command:
- profile
- setup
- core.sqlite_dos
profile: test_aiida
email: aiida@localhost
first_name: Giuseppe
last_name: Verdi
institution: Khedivial
db_path: some/path/db.sqlite
repository: /tmp/test_repository_test_aiida/
broker_protocol: amqp
broker_username: guest
broker_password: guest
broker_host: 127.0.0.1
broker_port: 5672
broker_virtual_host: ''

and you would just run verdi config --yaml config.yaml

chrisjsewell avatar Jul 06 '23 15:07 chrisjsewell

as discussed with @giovannipizzi

chrisjsewell avatar Jul 06 '23 15:07 chrisjsewell

Since this would only really be relevant for commands that already support the --config option and especially for those commands whose subcommands are generated dynamically based on entry points, I wonder if we should add this globally, or just for those commands. For example, I wonder if it is possible to add the --config option to verdi code create and you can pass the following YAML to it:

subcommand: core.code.installed
arguments:
  computer: localhost
  filepath_executable: pw.x
  default_calc_job_plugin: quantumespresso.pw
  ...

It would then be invoked with verdi code create --config config.yml and that group command would fetch the subcommand and invoke it with the provided arguments.

sphuber avatar Jul 07 '23 16:07 sphuber

yep that would be cool as well 👍 However, we can capture the full information about a code, profile, etc in the YAML

chrisjsewell avatar Jul 07 '23 16:07 chrisjsewell