Skip to content

Commit

Permalink
Merge pull request #3501 from aiidateam/merge_master
Browse files Browse the repository at this point in the history
Merge master after release `v1.0.0`
  • Loading branch information
sphuber authored Nov 1, 2019
2 parents 6c1391f + 43334f0 commit f19298a
Show file tree
Hide file tree
Showing 23 changed files with 319 additions and 868 deletions.
11 changes: 11 additions & 0 deletions .ci/pytest/test_unittest_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# #
# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core #
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
"""Test running unittest test cases through pytest."""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import unittest
import pytest
Expand Down
72 changes: 43 additions & 29 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -1,65 +1,79 @@
This file lists the authors of the AiiDA code (i.e., the members of the AiiDA team)
This file lists the authors of the AiiDA code (i.e. the members of the AiiDA team)
as well as the known contributors to the code.

The current members of the AiiDA team are, in alphabetical order:
#################################################################
* Casper Andersen
* Oscar Arbelaez
* Marco Borelli
* Carl S. Adorf
* Casper W. Andersen
* Sebastiaan P. Huber
* Leonid Kahle
* Boris Kozinsky
* Snehal Kumbhar
* Nicola Marzari
* Andrius Merkys
* Elsa Passaro
* Giovanni Pizzi
* Francisco F. Ramirez
* Leopold Talirz
* Aliaksandr Yakutovich
* Spyros Zoupanos


Former members of the AiiDA team
################################
* Spyros Zoupanos (2015-2019)
* Conrad Johnston (2018-2019)
* Martin Uhrin (2015-2019)
* Rico Häuselmann (2016-2018)
* Nicolas Mounet (2015-2018)
* Andrea Cepellotti (2012-2016)
* Fernando Gargiulo (2016-2017)
* Andrius Merkys (2015-2017)
* Andrea Cepellotti (2012-2016)
* Boris Kozinsky (2012-2016)
* Riccardo Sabatini (2013-2015)
* Rico Häuselmann (2016-2018)


Contributors
############
We would like to thank the following people for their contibution
(beside generic comments and bugfixes):
We would like to thank the following people for their major contibutions:

* Valentin Bersier (EPFL, Switzerland): for the early version of the
AiiDA web interface
* Jocelyn Boullier (EPFL, Switzerland): for the first version of the
SQLAlchemy implementation
* Jens Bröder: (FZ Jülich, Germany) contributions to the workflow engine
* Marco Dorigo (ICAMS, Germany): for the SGE scheduler plugin
* Marco Gibertini: for the Quantum ESPRESSO plugin for the NEB code and
the extension of the PW plugin to the ENVIRON code
* Dominik Gresch (ETHZ): for the caching mechanism and contributions to the workflow engine
* Eric Hontz (MIT, USA): for the Quantum Espresso pwimmigrant plugin
* Daniel Marchand (EPFL, Switzerland): for the Quantum ESPRESSO plugins
for PP, PROJWFC, and the first version of the Wannier90 plugin
* Tiziano Müller (ETHZ, Switzerland): for the first implementation of
the new plugin system (developed in 2017) and making the code python 3 compatible
* Philippe Schwaller (EPFL, Switzerland): for the ICSD importer
the new plugin system (developed in 2017) and making the code python 3 compatibl

And the following people for general improvements to the code, fixing bugs,
corrections and improvements to the documentation and useful suggestions:

Ivano E. Castelli, Ian Lee, Gianluca Prandini, Jianxing Huang, Antimo Marrazzo, Nicola Varini, Mario Zic,
Vladimir Dikan, Michael Atambo, Ole Schütt, Y.-W. Fang, Philipp Rüßmann, Bonan Zhu, Andreas Stamminger, Keija Cui,
Daniel Hollas, Espen Flage-Larsen, Chris Sewell, Jason Yu, Daniele Tomerini
* Oscar Arbelaez
* Michael Atambo
* Valentin Bersier
* Marco Borelli
* Jocelyn Boullier
* Jens Bröder
* Ivano E. Castelli
* Keija Cui
* Vladimir Dikan
* Marco Dorigo
* Y.-W. Fang
* Marco Gibertini
* Daniel Hollas
* Eric Hontz
* Jianxing Huang
* Espen Flage Larsen
* Ian Lee
* Daniel Marchand
* Antimo Marrazzo
* Simon Pintarelli
* Gianluca Prandini
* Philipp Rüßmann
* Philippe Schwaller
* Ole Schütt
* Chris Sewell
* Andreas Stamminger
* Atsushi Togo
* Daniele Tomerini
* Nicola Varini
* Jason Yu
* Bonan Zhu
* Mario Zic

---

Please, don't hesitate to contact the AiiDA team if you see that
information is wrong or missing in this file.
Please, don't hesitate to contact the AiiDA team if you see that information is wrong or missing in this file.
432 changes: 127 additions & 305 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion aiida/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
u'For further information please visit http://www.aiida.net/. All rights reserved.'
)
__license__ = 'MIT license, see LICENSE.txt file.'
__version__ = '1.0.0b6'
__version__ = '1.0.0'
__authors__ = 'The AiiDA team.'
__paper__ = (
u'G. Pizzi, A. Cepellotti, R. Sabatini, N. Marzari, and B. Kozinsky,'
Expand Down
5 changes: 4 additions & 1 deletion aiida/backends/djsite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import os
import django

from aiida.backends.utils import validate_attribute_key, SettingsManager, Setting
from aiida.backends.utils import validate_attribute_key, SettingsManager, Setting, validate_schema_generation
from aiida.common import NotExistent

SCHEMA_VERSION_DB_KEY = 'db|schemaversion'
Expand Down Expand Up @@ -121,6 +121,7 @@ def unload_dbenv():

def migrate_database():
"""Migrate the database to the latest schema version."""
validate_schema_generation()
from django.core.management import call_command
call_command('migrate')

Expand Down Expand Up @@ -151,6 +152,8 @@ def check_schema_version(profile_name):
if 'db_dbsetting' not in connection.introspection.table_names():
return

validate_schema_generation()

code_schema_version = aiida.backends.djsite.db.models.SCHEMA_VERSION
db_schema_version = get_db_schema_version()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
Create Date: 2019-07-25 14:58:39.866822
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

# Remove when https://github.com/PyCQA/pylint/issues/1931 is fixed
Expand Down
5 changes: 4 additions & 1 deletion aiida/backends/sqlalchemy/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from aiida.backends import sqlalchemy as sa
from aiida.backends.sqlalchemy import get_scoped_session
from aiida.backends.utils import validate_attribute_key, SettingsManager, Setting
from aiida.backends.utils import validate_attribute_key, SettingsManager, Setting, validate_schema_generation
from aiida.common import NotExistent


Expand Down Expand Up @@ -347,6 +347,7 @@ def migrate_database(alembic_cfg=None):
:param config: alembic configuration to use, will use default if not provided
"""
validate_schema_generation()
from aiida.backends import sqlalchemy as sa

if alembic_cfg is None:
Expand All @@ -368,6 +369,8 @@ def check_schema_version(profile_name):

alembic_cfg = get_alembic_conf()

validate_schema_generation()

# Getting the version of the code and the database, reusing the existing engine (initialized by AiiDA)
with sa.ENGINE.begin() as connection:
alembic_cfg.attributes['connection'] = connection
Expand Down
28 changes: 28 additions & 0 deletions aiida/backends/tests/cmdline/commands/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,34 @@ def test_node_tree_printer(self):
with Capturing():
NodeTreePrinter.print_node_tree(self.node, max_depth=1, follow_links=())

def test_node_show(self):
"""Test `verdi node show`"""
node = orm.Data().store()
node.label = 'SOMELABEL'
options = [str(node.pk)]
result = self.cli_runner.invoke(cmd_node.node_show, options)
self.assertClickResultNoException(result)

# Let's check some content in the output. At least the UUID and the label should be in there
self.assertIn(node.label, result.output)
self.assertIn(node.uuid, result.output)

## Let's now test the '--print-groups' option
options.append('--print-groups')
result = self.cli_runner.invoke(cmd_node.node_show, options)
self.assertClickResultNoException(result)
# I don't check the list of groups - it might be in an autogroup

# Let's create a group and put the node in there
group_name = 'SOMEGROUPNAME'
group = orm.Group(group_name).store()
group.add_nodes(node)

result = self.cli_runner.invoke(cmd_node.node_show, options)
self.assertClickResultNoException(result)
# Now the group should be in there
self.assertIn(group_name, result.output)

def test_node_attributes(self):
"""Test verdi node attributes"""
options = [str(self.node.uuid)]
Expand Down
10 changes: 10 additions & 0 deletions aiida/backends/tests/plugins/test_entry_point.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# #
# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core #
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
"""Tests for the :py:mod:`~aiida.plugins.entry_point` module."""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

from aiida.backends.testbase import AiidaTestCase
Expand Down
10 changes: 10 additions & 0 deletions aiida/backends/tests/plugins/test_factories.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# #
# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core #
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
"""Tests for the :py:mod:`~aiida.plugins.factories` module."""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

try:
Expand Down
9 changes: 9 additions & 0 deletions aiida/backends/tests/restapi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
###########################################################################
# Copyright (c), The AiiDA team. All rights reserved. #
# This file is part of the AiiDA code. #
# #
# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core #
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
2 changes: 2 additions & 0 deletions aiida/backends/tests/restapi/test_identifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# For further information please visit http://www.aiida.net #
###########################################################################
"""Tests for the `aiida.restapi.common.identifiers` module."""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from aiida.backends.testbase import AiidaTestCase
from aiida.restapi.common.identifiers import get_full_type_filters, FULL_TYPE_CONCATENATOR, LIKE_OPERATOR_CHARACTER
Expand Down
29 changes: 29 additions & 0 deletions aiida/backends/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

AIIDA_ATTRIBUTE_SEP = '.'

SCHEMA_GENERATION_KEY = 'schema_generation'
SCHEMA_GENERATION_VALUE = '1'


Setting = collections.namedtuple('Setting', ['key', 'value', 'description', 'time'])

Expand Down Expand Up @@ -68,6 +71,32 @@ def get_settings_manager():
return manager


def validate_schema_generation():
"""Verify that the database schema generation is compatible with the current code schema generation."""
from aiida.common.exceptions import ConfigurationError, NotExistent
try:
schema_generation_database = get_db_schema_generation().value
except NotExistent:
schema_generation_database = '1'

if schema_generation_database is None:
schema_generation_database = '1'

if schema_generation_database != SCHEMA_GENERATION_VALUE:
raise ConfigurationError(
'The schema generation of your database {} is newer than that of the code `{}` and is incompatible.'.format(
schema_generation_database, SCHEMA_GENERATION_VALUE
)
)


def get_db_schema_generation():
"""Get the schema generation of the current database."""
from aiida.backends.utils import get_settings_manager
manager = get_settings_manager()
return manager.get(SCHEMA_GENERATION_KEY)


def validate_attribute_key(key):
"""
Validate the key string to check if it is valid (e.g., if it does not
Expand Down
12 changes: 7 additions & 5 deletions aiida/cmdline/commands/cmd_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,19 @@ def node_show(nodes, print_groups):
# pylint: disable=invalid-name
qb = QueryBuilder()
qb.append(Node, tag='node', filters={'id': {'==': node.pk}})
qb.append(Group, tag='groups', with_node='node', project=['id', 'name'])
qb.append(Group, tag='groups', with_node='node', project=['id', 'label', 'type_string'])

echo.echo('#### GROUPS:')

if qb.count() == 0:
echo.echo('No groups found containing node {}'.format(node.pk))
echo.echo('Node {} does not belong to any group'.format(node.pk))
else:
echo.echo('Node {} belongs to the following groups:'.format(node.pk))
res = qb.iterdict()
for gr in res:
gr_specs = '{} {}'.format(gr['groups']['name'], gr['groups']['id'])
echo.echo(gr_specs)
table = [(gr['groups']['id'], gr['groups']['label'], gr['groups']['type_string']) for gr in res]
table.sort()

echo.echo(tabulate.tabulate(table, headers=['PK', 'Label', 'Group type']))


def echo_node_dict(nodes, keys, fmt, identifier, raw, use_attrs=True):
Expand Down
Loading

0 comments on commit f19298a

Please sign in to comment.