A utility module with a factory of standard QueryBuilder instances for Calculation nodes.
aiida.cmdline.utils.query.calculation.
CalculationQueryBuilder
Bases: object
object
Utility class to construct a QueryBuilder instance for Calculation nodes and project the query set.
__dict__
__init__
Initialize self. See help(type(self)) for accurate signature.
__module__
__weakref__
list of weak references to the object (if defined)
_compound_projections
_default_projections
_valid_projections
default_projections
get_filters
Return a set of QueryBuilder filters based on typical command line options.
node_types – a tuple of node classes to filter for (must be sub classes of Calculation)
all_entries – boolean to negate filtering for process state
process_state – filter for this process state attribute
process_label – filter for this process label attribute
exit_status – filter for this exit status
failed – boolean to filter only failed processes
dictionary of filters suitable for a QueryBuilder.append() call
get_projected
Project the query set for the given set of projections
get_query_set
Return the query set of calculations for the given filters and query parameters
relationships – a mapping of relationships to join on, e.g. {‘with_node’: Group} to join on a Group. The keys in this dictionary should be the keyword used in the append method of the QueryBuilder to join the entity on that is defined as the value.
filters – rules to filter query results with
order_by – order the query set by this criterion
past_days – only include entries from the last past days
limit – limit the query set to this number of entries
the query set, a list of dictionaries
mapper
valid_projections
A utility module with simple functions to format variables into strings for cli outputs.
aiida.cmdline.utils.query.formatting.
format_process_state
Return a string formatted representation of the given process state
process_state – the process state
string representation of process state
format_relative_time
Return a string formatted timedelta of the given datetime with respect to the current datetime
datetime – the datetime to format
string representation of the relative time since the given datetime
format_sealed
Return a string formatted representation of a node’s sealed status
sealed – the value for the sealed attribute of the node
string representation of seal status
format_state
Return a string formatted representation of a process’ state, which consists of its process state and exit status
exit_status – the process’ exit status
string representation of the process’ state
A utility module with mapper objects that map database entities projections on attributes and labels.
aiida.cmdline.utils.query.mapping.
CalculationProjectionMapper
Bases: aiida.cmdline.utils.query.mapping.ProjectionMapper
aiida.cmdline.utils.query.mapping.ProjectionMapper
The CLI projection mapper for Calculation derived entities.
ProjectionMapper
Class to map projection names from the CLI to entity labels, attributes and formatters.
The command line interface will often have to display database entities and their attributes. The names of the attributes exposed on the CLI do not always match one-to-one with the attributes in the ORM and often they need to be formatted for the screen in some way. Additionally, for commands that display lists of entries, often a header needs to be printed with a label for each attribute, which also are not necessarily identical.
For any given entity, the CLI typically exposes a set of projections, which are the keywords to reference certain attributes. This mapper class serves to map these projections onto the corresponding label and attribute names, as well as formatter functions to format the attribute values into strings, suitable to be printed by the CLI.
format
get_attribute
get_formatter
get_label