aiida.cmdline.commands package

The verdi command line interface.

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'
ask = 'kca'
keep_existing = 'kcl'
mirror = 'ncu'
none = 'knl'
update_existing = 'kcu'
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(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 IncompatibleArchiveVersionError

verdi calcjob commands.

verdi code command.

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 comment command.

verdi completioncommand command, to return the string to insert into the bash script to activate completion.

verdi computer command.

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.

class aiida.cmdline.commands.cmd_config._DeprecateConfigCommandsGroup(name=None, commands=None, **attrs)[source]

Bases: click.core.Group

Overloads the get_command with one that identifies deprecated commands.

__module__ = 'aiida.cmdline.commands.cmd_config'
get_command(ctx, cmd_name)[source]

Override the default click.Group get_command with one that identifies deprecated commands.

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 export command.

verdi graph commands

verdi group commands

Command for verdi help.

verdi import command.

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.

verdi rehash command.

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_entrypoint_string(ctx, param, 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 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.

class aiida.cmdline.commands.cmd_verdi.MostSimilarCommandGroup(name=None, commands=None, **attrs)[source]

Bases: click.core.Group

Overloads the get_command to display a list of possible command candidates if the command could not be found with an exact match.

__module__ = 'aiida.cmdline.commands.cmd_verdi'
get_command(ctx, cmd_name)[source]

Override the default click.Group get_command with one giving the user a selection of possible commands if the exact command name could not be found.