Skip to content

Commit

Permalink
Merge branch 'develop' into issue-5248-ase-cell
Browse files Browse the repository at this point in the history
  • Loading branch information
giovannipizzi authored Apr 10, 2022
2 parents 3660518 + d34c3ad commit 13019f5
Show file tree
Hide file tree
Showing 86 changed files with 1,388 additions and 1,208 deletions.
8 changes: 4 additions & 4 deletions .github/system_tests/test_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,15 @@ def validate_cached(cached_calcs):
print_report(calc.pk)
valid = False

if '_aiida_cached_from' not in calc.extras or calc.get_hash() != calc.get_extra('_aiida_hash'):
if '_aiida_cached_from' not in calc.base.extras or calc.get_hash() != calc.base.extras.get('_aiida_hash'):
print(f'Cached calculation<{calc.pk}> has invalid hash')
print_report(calc.pk)
valid = False

if isinstance(calc, CalcJobNode):
original_calc = load_node(calc.get_extra('_aiida_cached_from'))
files_original = original_calc.list_object_names()
files_cached = calc.list_object_names()
original_calc = load_node(calc.base.extras.get('_aiida_cached_from'))
files_original = original_calc.base.repository.list_object_names()
files_cached = calc.base.repository.list_object_names()

if not files_cached:
print(f'Cached calculation <{calc.pk}> does not have any raw inputs files')
Expand Down
2 changes: 1 addition & 1 deletion .molecule/default/files/polish/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def run_via_daemon(workchains, inputs, sleep, timeout):
except AttributeError:
click.secho('Failed: ', fg='red', bold=True, nl=False)
click.secho(f'the workchain<{workchain.pk}> did not return a result output node', bold=True)
click.echo(str(workchain.attributes))
click.echo(str(workchain.base.attributes.all))
return None

return result, workchain, total_time
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ repos:
aiida/orm/implementation/users.py|
aiida/orm/implementation/querybuilder.py|
aiida/orm/entities.py|
aiida/orm/extras.py|
aiida/orm/authinfos.py|
aiida/orm/comments.py|
aiida/orm/computers.py|
Expand All @@ -95,6 +96,7 @@ repos:
aiida/orm/users.py|
aiida/orm/nodes/data/enum.py|
aiida/orm/nodes/data/jsonable.py|
aiida/orm/nodes/attributes.py|
aiida/orm/nodes/node.py|
aiida/orm/nodes/process/.*py|
aiida/orm/nodes/repository.py|
Expand Down
8 changes: 4 additions & 4 deletions aiida/cmdline/commands/cmd_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@ def echo_node_dict(nodes, keys, fmt, identifier, raw, use_attrs=True):
id_value = node.uuid

if use_attrs:
node_dict = node.attributes
node_dict = node.base.attributes.all
dict_name = 'attributes'
else:
node_dict = node.extras
node_dict = node.base.extras.all
dict_name = 'extras'

if keys is not None:
Expand Down Expand Up @@ -479,7 +479,7 @@ def comment_add(nodes, content):
content = multi_line_input.edit_comment()

for node in nodes:
node.add_comment(content)
node.base.comments.add(content)

echo.echo_success(f'comment added to {len(nodes)} nodes')

Expand Down Expand Up @@ -517,7 +517,7 @@ def comment_show(user, nodes):
echo.echo(msg)
echo.echo('*' * len(msg))

all_comments = node.get_comments()
all_comments = node.base.comments.all()

if user is not None:
comments = [comment for comment in all_comments if comment.user.email == user.email]
Expand Down
5 changes: 4 additions & 1 deletion aiida/cmdline/utils/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ def format_flat_links(links, headers):
table = []

for link_triple in links:
table.append([link_triple.link_label, link_triple.node.pk, link_triple.node.get_attribute('process_label', '')])
table.append([
link_triple.link_label, link_triple.node.pk,
link_triple.node.base.attributes.get('process_label', '')
])

result = f'\n{tabulate(table, headers=headers)}'

Expand Down
2 changes: 1 addition & 1 deletion aiida/engine/processes/calcjobs/calcjob.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ def _perform_import(self):
)
retrieve_calculation(self.node, transport, retrieved_temporary_folder.abspath)
self.node.set_state(CalcJobState.PARSING)
self.node.set_attribute(orm.CalcJobNode.IMMIGRATED_KEY, True)
self.node.base.attributes.set(orm.CalcJobNode.IMMIGRATED_KEY, True)
return self.parse(retrieved_temporary_folder.abspath)

def parse(self, retrieved_temporary_folder: Optional[str] = None) -> ExitCode:
Expand Down
2 changes: 1 addition & 1 deletion aiida/engine/processes/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def _setup_db_record(self) -> None:
def _setup_metadata(self) -> None:
"""Store the metadata on the ProcessNode."""
version_info = self.runner.plugin_version_provider.get_version_info(self.__class__)
self.node.set_attribute_many(version_info)
self.node.base.attributes.set_many(version_info)

for name, metadata in self.metadata.items():
if name in ['store_provenance', 'dry_run', 'call_link_label']:
Expand Down
4 changes: 2 additions & 2 deletions aiida/engine/processes/workchains/restart.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ def run_process(self) -> ToContext:
# Add a new empty list to the `BaseRestartWorkChain._considered_handlers_extra` extra. This will contain the
# name and return value of all class methods, decorated with `process_handler`, that are called during
# the `inspect_process` outline step.
considered_handlers = self.node.get_extra(self._considered_handlers_extra, [])
considered_handlers = self.node.base.extras.get(self._considered_handlers_extra, [])
considered_handlers.append([])
self.node.set_extra(self._considered_handlers_extra, considered_handlers)
self.node.base.extras.set(self._considered_handlers_extra, considered_handlers)

self.report(f'launching {self.ctx.process_name}<{node.pk}> iteration #{self.ctx.iteration}')

Expand Down
4 changes: 2 additions & 2 deletions aiida/engine/processes/workchains/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def wrapper(wrapped, instance, args, kwargs):

# Append the name and return value of the current process handler to the `considered_handlers` extra.
try:
considered_handlers = instance.node.get_extra(instance._considered_handlers_extra, []) # pylint: disable=protected-access
considered_handlers = instance.node.base.extras.get(instance._considered_handlers_extra, []) # pylint: disable=protected-access
current_process = considered_handlers[-1]
except IndexError:
# The extra was never initialized, so we skip this functionality
Expand All @@ -132,7 +132,7 @@ def wrapper(wrapped, instance, args, kwargs):
if isinstance(serialized, ProcessHandlerReport):
serialized = {'do_break': serialized.do_break, 'exit_status': serialized.exit_code.status}
current_process.append((wrapped.__name__, serialized))
instance.node.set_extra(instance._considered_handlers_extra, considered_handlers) # pylint: disable=protected-access
instance.node.base.extras.set(instance._considered_handlers_extra, considered_handlers) # pylint: disable=protected-access

return result

Expand Down
5 changes: 3 additions & 2 deletions aiida/orm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from .comments import *
from .computers import *
from .entities import *
from .extras import *
from .groups import *
from .logs import *
from .nodes import *
Expand Down Expand Up @@ -51,8 +52,7 @@
'Data',
'Dict',
'Entity',
'EntityAttributesMixin',
'EntityExtrasMixin',
'EntityExtras',
'EntityTypes',
'EnumData',
'Float',
Expand All @@ -70,6 +70,7 @@
'List',
'Log',
'Node',
'NodeAttributes',
'NodeEntityLoader',
'NodeLinksManager',
'NodeRepository',
Expand Down
Loading

0 comments on commit 13019f5

Please sign in to comment.