aiida.cmdline.params.options.commands package

Module containing predefined command specific CLI options.

Submodules

Reusable command line interface options for Code commands.

aiida.cmdline.params.options.commands.code.is_not_on_computer(ctx)[source]
aiida.cmdline.params.options.commands.code.is_on_computer(ctx)[source]
aiida.cmdline.params.options.commands.code.validate_label_uniqueness(ctx, _, value)[source]

Validate the uniqueness of the label of the code.

The exact uniqueness criterion depends on the type of the code, whether it is “local” or “remote”. For the former, the label itself should be unique, whereas for the latter it is the full label, i.e., label@computer.label.

Note

For this to work in the case of the remote code, the computer parameter already needs to have been parsed In interactive mode, this means that the computer parameter needs to be defined after the label parameter in the command definition. For non-interactive mode, the parsing order will always be determined by the order the parameters are specified by the caller and so this validator may get called before the computer is parsed. For that reason, this validator should also be called in the command itself, to ensure it has both the label and computer parameter available.

Reusable command line interface options for Computer commands.

aiida.cmdline.params.options.commands.computer.should_call_default_mpiprocs_per_machine(ctx)[source]

Return True if the scheduler can accept ‘default_mpiprocs_per_machine’, False otherwise.

If there is a problem in determining the scheduler, return True to avoid exceptions.

Reusable command line interface options for the setup commands.

aiida.cmdline.params.options.commands.setup.get_profile_attribute_default(attribute_tuple, ctx)[source]

Return the default value for the given attribute of the profile passed in the context.

Parameters
  • attribute – attribute for which to get the current value

  • ctx – click context which should contain the selected profile

Returns

profile attribute default value if set, or None

aiida.cmdline.params.options.commands.setup.get_quicksetup_database_name(ctx, param, value)[source]

Determine the database name to be used as default for the Postgres connection in verdi quicksetup

If a value is explicitly passed, that value is returned unchanged.

If no value is passed, the name will be <profile_name>_<os_user>_<hash>, where <os_user> is the name of the current operating system user and <hash> is a hash of the path of the configuration directory.

Note: This ensures that profiles named test_... will have databases named test_... .

Parameters

ctx – click context which should contain the contextual parameters

Returns

the database name

aiida.cmdline.params.options.commands.setup.get_quicksetup_password(ctx, param, value)[source]

Determine the password to be used as default for the Postgres connection in verdi quicksetup

If a value is explicitly passed, that value is returned. If there is no value, the current username in the context will be scanned for in currently existing profiles. If it does, the corresponding password will be used. If no such user already exists, a random password will be generated.

Parameters

ctx – click context which should contain the contextual parameters

Returns

the password

aiida.cmdline.params.options.commands.setup.get_quicksetup_repository_uri(ctx, param, value)[source]

Return the repository URI to be used as default in verdi quicksetup

Parameters

ctx – click context which should contain the contextual parameters

Returns

the repository URI

aiida.cmdline.params.options.commands.setup.get_quicksetup_username(ctx, param, value)[source]

Determine the username to be used as default for the Postgres connection in verdi quicksetup

If a value is explicitly passed, that value is returned. If there is no value, the name will be based on the name of the current operating system user and the hash of the path of the configuration directory.

Parameters

ctx – click context which should contain the contextual parameters

Returns

the username

aiida.cmdline.params.options.commands.setup.get_repository_uri_default(ctx)[source]

Return the default value for the repository URI for the current profile in the click context.

Parameters

ctx – click context which should contain the selected profile

Returns

default repository URI

aiida.cmdline.params.options.commands.setup.validate_profile_parameter(ctx)[source]

Validate that the context contains the option profile and it contains a Profile instance.

Parameters

ctx – click context which should contain the selected profile

Raises

BadParameter if the context does not contain a Profile instance for option profile