sphuber / aiida-s3

AiiDA plugin that provides various storage backends that allow using cloud data storage services, such as AWS S3 and Azure Blob Storage.
MIT License
3 stars 2 forks source link

CLI: Add the `profile setup` command #8

Closed sphuber closed 2 years ago

sphuber commented 2 years ago

This command automatically generates a subcommand for each registered entry point in the aiida.storage group that starts with s3., i.e., all storage backend implemenations provided by aiida-s3.

Each command is dynamically built by loading the class corresponding to the entry point and getting the option specifications by calling the get_cli_options class method. Each implementation adds the options that are required to fully define the storage configuration in the profile which allows to instantiate an instance of the storage backend.

The current plugins, PsqlAwsS3 and PsqlAzureBlob both extend the PsqlDosBackend that ships with aiida-core and simply replace the repository. Each of them therefore requires the configuration of the PostgreSQL database. The options for the storage backends in the profile setup command in aiida-core are not yet dynamically generated but the command line options are hardcoded. To provide them here, the PsqlDosBackend is subclassed as BasePsqlDosBackend such that it can provide the CLI options necessary to configure PostgreSQL. The storage backend subclasses can then add their options to connect to AWS S3 or Azure Blob Storage, respectively.