aiida.cmdline.commands package#

Sub commands of the verdi command line interface.

The commands need to be imported here for them to be registered with the top-level command group.

Submodules#

verdi archive command.

class aiida.cmdline.commands.cmd_archive.ExtrasImportCode(value)[source]#

Bases: enum.Enum

Exit codes for the verdi command line.

__module__ = 'aiida.cmdline.commands.cmd_archive'#
keep_existing = ('k', 'c', 'l')#
mirror = ('n', 'c', 'u')#
none = ('k', 'n', 'l')#
update_existing = ('k', 'c', 'u')#
aiida.cmdline.commands.cmd_archive._echo_exception(msg: str, exception, warn_only: bool = False)[source]#

Correctly report and exception.

Parameters
  • msg – The message prefix

  • exception – the exception raised

  • warn_only – If True only print a warning, otherwise calls sys.exit with a non-zero exit status

aiida.cmdline.commands.cmd_archive._gather_imports(archives, webpages) List[Tuple[str, bool]][source]#

Gather archives to import and sort into local files and URLs.

Returns

list of (archive path, whether it is web based)

aiida.cmdline.commands.cmd_archive._import_archive_and_migrate(ctx: click.core.Context, archive: str, web_based: bool, import_kwargs: dict, try_migration: bool)[source]#

Perform the archive import.

Parameters
  • archive – the path or URL to the archive

  • web_based – If the archive needs to be downloaded first

  • import_kwargs – keyword arguments to pass to the import function

  • try_migration – whether to try a migration if the import raises IncompatibleStorageSchema

verdi calcjob commands.

verdi code command.

aiida.cmdline.commands.cmd_code.create_code(cls, non_interactive, **kwargs)[source]#

Create a new Code instance.

aiida.cmdline.commands.cmd_code.get_computer_name(ctx)[source]#
aiida.cmdline.commands.cmd_code.get_default(key, ctx)[source]#

Get the default argument using a user instance property :param value: The name of the property to use :param ctx: The click context (which will be used to get the user) :return: The default value, or None

aiida.cmdline.commands.cmd_code.get_on_computer(ctx)[source]#
aiida.cmdline.commands.cmd_code.print_list_res(qb_query, show_owner)[source]#

Print a list of available codes.

aiida.cmdline.commands.cmd_code.set_code_builder(ctx, param, value)[source]#

Set the code spec for defaults of following options.

verdi computer command.

class aiida.cmdline.commands.cmd_computer.LazyConfigureGroup(name: Optional[str] = None, commands: Optional[Union[Dict[str, click.core.Command], Sequence[click.core.Command]]] = None, **attrs: Any)[source]#

Bases: aiida.cmdline.groups.verdi.VerdiCommandGroup

A click group that will lazily load the subcommands for each transport plugin.

__module__ = 'aiida.cmdline.commands.cmd_computer'#
get_command(ctx, name)[source]#

Return the command that corresponds to the requested cmd_name.

This method is overridden from the base class in order to two functionalities:

  • If the command is found, automatically add the verbosity option.

  • If the command is not found, attempt to provide a list of suggestions with existing commands that resemble the requested command name.

Note that if the command is not found and resilient_parsing is set to True on the context, then the latter feature is disabled because most likely we are operating in tab-completion mode.

list_commands(ctx)[source]#

Returns a list of subcommand names in the order they should appear.

aiida.cmdline.commands.cmd_computer._computer_create_temp_file(transport, scheduler, authinfo)[source]#

Internal test to check if it is possible to create a temporary file and then delete it in the work directory

Note

exceptions could be raised

Parameters
  • transport – an open transport

  • scheduler – the corresponding scheduler class

  • authinfo – the AuthInfo object (from which one can get computer and aiidauser)

Returns

tuple of boolean indicating success or failure and an optional string message

aiida.cmdline.commands.cmd_computer._computer_get_remote_username(transport, scheduler, authinfo)[source]#

Internal test to check if it is possible to determine the username on the remote.

Parameters
  • transport – an open transport

  • scheduler – the corresponding scheduler class

  • authinfo – the AuthInfo object

Returns

tuple of boolean indicating success or failure and an optional string message

aiida.cmdline.commands.cmd_computer._computer_test_get_jobs(transport, scheduler, authinfo)[source]#

Internal test to check if it is possible to check the queue state.

Parameters
  • transport – an open transport

  • scheduler – the corresponding scheduler class

  • authinfo – the AuthInfo object (from which one can get computer and aiidauser)

Returns

tuple of boolean indicating success or failure and an optional string message

aiida.cmdline.commands.cmd_computer._computer_test_no_unexpected_output(transport, scheduler, authinfo)[source]#

Test that there is no unexpected output from the connection.

This can happen if e.g. there is some spurious command in the .bashrc or .bash_profile that is not guarded in case of non-interactive shells.

Parameters
  • transport – an open transport

  • scheduler – the corresponding scheduler class

  • authinfo – the AuthInfo object (from which one can get computer and aiidauser)

Returns

tuple of boolean indicating success or failure and an optional string message

aiida.cmdline.commands.cmd_computer.get_computer_names()[source]#

Retrieve the list of computers in the DB.

aiida.cmdline.commands.cmd_computer.get_parameter_default(parameter, ctx)[source]#

Get the value for a specific parameter from the computer_builder or the default value of that option

Parameters
  • parameter – parameter name

  • ctx – click context of the command

Returns

parameter default value, or None

aiida.cmdline.commands.cmd_computer.prompt_for_computer_configuration(computer)[source]#
aiida.cmdline.commands.cmd_computer.set_computer_builder(ctx, param, value)[source]#

Set the computer spec for defaults of following options.

verdi config command.

verdi daemon commands.

aiida.cmdline.commands.cmd_daemon.validate_daemon_workers(ctx, param, value)[source]#

Validate the value for the number of daemon workers to start with default set by config.

verdi database commands.

verdi devel commands.

verdi group commands

Command for verdi help.

verdi node command.

aiida.cmdline.commands.cmd_node.echo_node_dict(nodes, keys, fmt, identifier, raw, use_attrs=True)[source]#

Show the attributes or extras of one or more nodes.

Command for verdi plugins.

verdi process command.

aiida.cmdline.commands.cmd_process.process_actions(futures_map, infinitive, present, past, wait=False, timeout=None)[source]#

Process the requested actions sent to a set of Processes given a map of the futures and the corresponding processes. This function will echo the correct information strings based on the outcomes of the futures and the given verb conjugations. You can optionally wait for any pending actions to be completed before the functions returns and use a timeout to put a maximum wait time on the actions.

Parameters
  • futures_map (dict) – the map of action futures and the corresponding processes

  • infinitive (str) – the infinitive form of the action verb

  • present (str) – the present tense form

  • past (str) – the past tense form

  • wait (bool) – if True, waits for pending actions to be competed, otherwise just returns

  • timeout (float) – the timeout (in seconds) to wait for actions to be completed

verdi profile command.

aiida.cmdline.commands.cmd_profile._strip_private_keys(dct: dict)[source]#

Remove private keys (starting _) from the dictionary.

This allows to hook-up the AiiDA built-in RESTful API. Main advantage of doing this by means of a verdi command is that different profiles can be selected at hook-up (-p flag).

verdi run command.

aiida.cmdline.commands.cmd_run.update_environment(argv)[source]#

Context manager that temporarily replaces sys.argv with argv and adds current working dir to the path.

aiida.cmdline.commands.cmd_run.validate_entry_point_strings(_, __, value)[source]#

Validate that value is a valid entrypoint string.

The verdi setup and verdi quicksetup commands.

The verdi shell command

verdi status command.

class aiida.cmdline.commands.cmd_status.ServiceStatus(value)[source]#

Bases: enum.IntEnum

Describe status of services for ‘verdi status’ command.

DOWN = 3#
ERROR = 1#
UP = 0#
WARNING = 2#
__module__ = 'aiida.cmdline.commands.cmd_status'#
aiida.cmdline.commands.cmd_status.print_status(status, service, msg='', exception=None, print_traceback=False)[source]#

Print status message.

Includes colored indicator.

Parameters
  • status – a ServiceStatus code

  • service – string for service name

  • msg – message string

verdi storage commands.

verdi user command.

aiida.cmdline.commands.cmd_user.get_user_attribute_default(attribute, ctx)[source]#

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

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

  • ctx – click context which should contain the selected user

Returns

user attribute default value if set, or None

aiida.cmdline.commands.cmd_user.set_default_user(profile, user)[source]#

Set the user as the default user for the given profile.

Parameters
  • profile – the profile

  • user – the user

The main verdi click group.