Skip to content

Commit

Permalink
Merge b05a943 into ca18340
Browse files Browse the repository at this point in the history
  • Loading branch information
sphuber committed Mar 12, 2019
2 parents ca18340 + b05a943 commit 63676f6
Show file tree
Hide file tree
Showing 36 changed files with 644 additions and 241 deletions.
14 changes: 14 additions & 0 deletions .ci/install_conda.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# See https://conda.io/docs/user-guide/tasks/use-conda-with-travis-ci.html#the-travis-yml-file
if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
wget https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O miniconda.sh;
else
wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh;
fi
bash miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
hash -r
conda config --set always_yes yes --set changeps1 no
conda update -q conda
# Useful for debugging any issues with conda
conda info -a
8 changes: 8 additions & 0 deletions .ci/test_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,12 @@ case "$TEST_TYPE" in
pre-commit)
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
;;
conda)
# Note: Not added to install in order not to slow down other tests
source ${CI_DIR}/install_conda.sh

# Replace dep1 dep2 ... with your dependencies
conda env create -f environment.yml -n test-environment python=$TRAVIS_PYTHON_VERSION
source activate test-environment
;;
esac
19 changes: 15 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@
aiida/transports/plugins/test_local.py|
aiida/transports/plugins/test_ssh.py|
utils/create_requirements.py|
utils/validate_pyproject.py|
.ci/test_daemon.py|
.ci/workchains.py|
)$
Expand Down Expand Up @@ -226,13 +225,24 @@

- id: pyproject
name: Validating pyproject.toml
entry: python ./utils/validate_pyproject.py
entry: python ./utils/validate_consistency.py toml
language: system
files: >-
(?x)^(
setup.json|
setup.py|
utils/validate_pyproject|
utils/validate_consistency.py|
)$
pass_filenames: false
- id: conda
name: Validating environment.yml
entry: python ./utils/validate_consistency.py conda
language: system
files: >-
(?x)^(
setup_requirements.py|
utils/validate_consistency.py|
environment.yml|
)$
pass_filenames: false

Expand All @@ -245,11 +255,12 @@

- id: version-number
name: Check version numbers
entry: python ./utils/validate_version.py
entry: python ./utils/validate_consistency.py version
language: system
files: >-
(?x)^(
setup.json|
utils/validate_consistency.py|
aiida/__init__.py
)$
pass_filenames: false
Expand Down
1 change: 0 additions & 1 deletion .prospector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ ignore-paths:
pylint:
run: true


pyflakes:
run: false

Expand Down
3 changes: 2 additions & 1 deletion .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ ignored-classes=optparse.Values,thread._local,_thread._local
# (useful for modules/projects where namespaces are manipulated during runtime
# and thus existing member attributes cannot be deduced by static analysis. It
# supports qualified module names, as well as Unix pattern matching.
ignored-modules=
# This is a pylint issue https://github.com/PyCQA/pylint/issues/73
ignored-modules=distutils

# Show a hint with possible names when a member name was not found. The aspect
# of finding the hint is based on edit distance.
Expand Down
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ before_install:

install:
# Upgrade pip setuptools and wheel to be able to run the next command
- pip install -U pip==18.1 wheel setuptools
- pip install -U pip==18.1 wheel setuptools coveralls
- pip install coveralls
# Install AiiDA with some optional dependencies
- if [ "$TEST_TYPE" == "docs" ]; then pip install . && pip install -r docs/requirements_for_rtd.txt; else pip install --no-cache-dir .[all]; fi
Expand All @@ -64,6 +64,7 @@ env:
- TEST_AIIDA_BACKEND=django TEST_TYPE="docs"
- TEST_AIIDA_BACKEND=django TEST_TYPE="tests"
- TEST_AIIDA_BACKEND=sqlalchemy TEST_TYPE="tests"
# - TEST_TYPE="conda"

before_script:
- .ci/setup_profiles.sh
Expand Down
14 changes: 10 additions & 4 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ 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
* Sebastiaan P. Huber
* Conrad Johnston
* Leonid Kahle
Expand All @@ -13,12 +16,15 @@ The current members of the AiiDA team are, in alphabetical order:
* Elsa Passaro
* Giovanni Pizzi
* Leopold Talirz
* Martin Uhrin
* Aliaksandr Yakutovich
* Spyros Zoupanos


Former members of the AiiDA team
################################
* Martin Uhrin (2015-2019)
* Rico Häuselmann (2016-2018)
* Nicolas Mounet (2015-2018)
* Andrea Cepellotti (2012-2016)
* Fernando Gargiulo (2016-2017)
* Riccardo Sabatini (2013-2015)
Expand Down Expand Up @@ -50,9 +56,9 @@ We would like to thank the following people for their contibution
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, Marco Borelli,
Y.-W. Fang, Espen Flage-Larsen
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, Philipp Rüßmann, Keija Cui,
Daniel Hollas, Jianxing Huang, Espen Flage-Larsen

---

Expand Down
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,29 @@
- Enable tab-completion for `verdi devel tests` [[#1809]](https://github.com/aiidateam/aiida_core/pull/1809)
- Add `-v/--verbose` flag to `verdi devel tests` [[#1807]](https://github.com/aiidateam/aiida_core/pull/1807)

## v0.12.3
### Improvements
- Fast addition of nodes to groups with `skip_orm=True` [[#2471]](https://github.com/aiidateam/aiida_core/pull/2471)
- Add `environment.yml` for installing dependencies using conda; release of `aiida-core` on conda-forge channel [[#2081]](https://github.com/aiidateam/aiida_core/pull/2081)
- REST API: io tree response now includes link type and node label [[#2033]](https://github.com/aiidateam/aiida_core/pull/2033) [[#2511]](https://github.com/aiidateam/aiida_core/pull/2511)
- Backport postgres improvements for quicksetup [[#2433]](https://github.com/aiidateam/aiida_core/pull/2433)
- Backport `aiida.get_strict_version` (for plugin development) [[#2099]](https://github.com/aiidateam/aiida_core/pull/2099)

### Minor bug fixes
- Fix security vulnerability by upgrading `paramiko` to `2.4.2` [[#2043]](https://github.com/aiidateam/aiida_core/pull/2043)
- Disable caching for inline calculations (broken since move to ``workfunction``-based implementation) [[#1872]](https://github.com/aiidateam/aiida_core/pull/1872)
- Let `verdi help` return exit status 0 [[#2434]](https://github.com/aiidateam/aiida_core/pull/2434)
- Decode dict keys only if strings (backport) [[#2436]](https://github.com/aiidateam/aiida_core/pull/2436)
- Remove broken verdi-plug entry point [[#2356]](https://github.com/aiidateam/aiida_core/pull/2356)
- `verdi node delete` (without arguments) no longer tries to delete all nodes [[#2545]](https://github.com/aiidateam/aiida_core/pull/2545)
- Fix plotting of `BandsData` objects [[#2492]](https://github.com/aiidateam/aiida_core/pull/2492)

### Miscellaneous
- REST API: add tests for random sorting list entries of same type [[#2106]](https://github.com/aiidateam/aiida_core/pull/2106)
- Add various badges to README [[#1969]](https://github.com/aiidateam/aiida_core/pull/1969)
- Minor documentation improvements [[#1955]](https://github.com/aiidateam/aiida_core/pull/1955)
- Add license file to MANIFEST [[#2339]](https://github.com/aiidateam/aiida_core/pull/2339)
- Add instructions when `verdi import` fails [[#2420]](https://github.com/aiidateam/aiida_core/pull/2420)

## v0.12.2

Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ include setup.json
include AUTHORS.txt
include CHANGELOG.md
include pyproject.toml
include LICENSE.txt
2 changes: 1 addition & 1 deletion aiida/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_strict_version():
:returns: StrictVersion instance with the current version
"""
from distutils.version import StrictVersion # pylint: disable=import-error,no-name-in-module
from distutils.version import StrictVersion
return StrictVersion(__version__)


Expand Down
20 changes: 20 additions & 0 deletions aiida/backends/sqlalchemy/tests/test_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from aiida.backends.testbase import AiidaTestCase
from aiida.orm import Data, Node
from six.moves import range


class TestComputer(AiidaTestCase):
Expand Down Expand Up @@ -164,6 +165,25 @@ def test_group_general(self):
group.add_nodes([node_01], skip_orm=True)
self.assertEqual(set(_.pk for _ in nodes), set(_.pk for _ in group.nodes))

def test_group_batch_size(self):
"""
Test that the group addition in batches works as expected.
"""
from aiida.orm.groups import Group

# Create 100 nodes
nodes = []
for _ in range(100):
nodes.append(Data().store().backend_entity)

# Add nodes to groups using different batch size. Check in the end the
# correct addition.
batch_sizes = (1, 3, 10, 1000)
for batch_size in batch_sizes:
group = Group(name='test_batches_' + str(batch_size)).store()
group.backend_entity.add_nodes(nodes, skip_orm=True, batch_size=batch_size)
self.assertEqual(set(_.pk for _ in nodes), set(_.pk for _ in group.nodes))


class TestDbExtrasSqla(AiidaTestCase):
"""
Expand Down
20 changes: 17 additions & 3 deletions aiida/backends/tests/test_restapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,6 @@ def process_test(self,
from aiida.common.exceptions import InputValidationError
raise InputValidationError("Pass the expected range of the dummydata")

self.assertEqual(len(response["data"][result_name]), len(expected_data))

expected_node_uuids = [node['uuid'] for node in expected_data]
result_node_uuids = [node['uuid'] for node in response["data"][result_name]]
self.assertEqual(expected_node_uuids, result_node_uuids)
Expand All @@ -304,7 +302,6 @@ def test_computers_details(self):
Requests the details of single computer
"""
node_uuid = self.get_dummy_data()["computers"][1]["uuid"]

RESTApiTestCase.process_test(
self, "computers", "/computers/" + str(node_uuid), expected_list_ids=[1], uuid=node_uuid)

Expand Down Expand Up @@ -709,6 +706,23 @@ def test_calculation_input_filters(self):
result_node_type="data",
result_name="inputs")

def test_calculation_iotree(self):
"""
Get filtered inputs list for given calculations
"""
node_uuid = self.get_dummy_data()["calculations"][1]["uuid"]
url = self.get_url_prefix() + '/calculations/' + str(node_uuid) + '/io/tree?in_limit=1&out_limit=1'
with self.app.test_client() as client:
response_value = client.get(url)
response = json.loads(response_value.data)
self.assertEqual(len(response["data"]["nodes"]), 3)
self.assertEqual(len(response["data"]["edges"]), 2)
expected_attr = ["nodelabel", "nodetype", "linklabel", "linktype", "nodeuuid", "description"]
received_attr = response["data"]["nodes"][1].keys()
for attr in expected_attr:
self.assertIn(attr, received_attr)
RESTApiTestCase.compare_extra_response_data(self, "calculations", url, response, uuid=node_uuid)

############### calculation attributes #############
def test_calculation_attributes(self):
"""
Expand Down
1 change: 0 additions & 1 deletion aiida/cmdline/commands/cmd_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def cmd_import(archives, webpages, group, extras_mode_existing, extras_mode_new,
comment_mode=comment_mode)
except exceptions.IncompatibleArchiveVersionError as exception:
echo.echo_warning('{} cannot be imported: {}'.format(archive, exception))
echo.echo_warning('run `verdi export migrate {}` to update it'.format(archive))
continue
except Exception:
echo.echo_error('an exception occurred while importing the archive {}'.format(archive))
Expand Down
1 change: 1 addition & 0 deletions aiida/manage/external/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import

try:
import subprocess32 as subprocess
except ImportError:
Expand Down
15 changes: 7 additions & 8 deletions aiida/manage/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,19 @@ class FixtureManager(object): # pylint: disable=too-many-public-methods,useless
@pytest.fixture(scope='session')
def aiida_profile():
with aiida.manage.fixtures.fixture_manager() as fixture_mgr:
fixture_mgr.create_profile()
# set up a test profile for the duration of the tests
with aiida.manage.fixtures.fixture_manager() as fixture_manager:
yield fixture_manager
@pytest.fixture(scope='function')
def test_data(aiida_profile):
# load my test data
yield
fixture_manager.reset_db()
def new_database(aiida_profile):
# clear the database after each test
yield aiida_profile
aiida_profile.reset_db()
def test_my_stuff(test_data):
def test_my_stuff(new_database):
# run a test
"""

_test_case = None
Expand Down
33 changes: 23 additions & 10 deletions aiida/orm/importexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import six
from six.moves import zip
from six.moves.html_parser import HTMLParser
from distutils.version import StrictVersion
from aiida.common import exceptions
from aiida.common.utils import export_shard_uuid, get_class_string, grouper, get_new_uuid
from aiida.orm import Computer, Group, GroupTypeString, Node, QueryBuilder, User, Log, Comment
Expand Down Expand Up @@ -621,7 +622,7 @@ def import_data_dj(in_path, user_group=None, ignore_unknown_nodes=False,
from aiida.backends.djsite.db.models import suppress_auto_now

# This is the export version expected by this function
expected_export_version = '0.4'
expected_export_version = StrictVersion('0.4')

# The name of the subfolder in which the node files are stored
nodes_export_subfolder = 'nodes'
Expand Down Expand Up @@ -673,9 +674,16 @@ def import_data_dj(in_path, user_group=None, ignore_unknown_nodes=False,
######################
# PRELIMINARY CHECKS #
######################
if metadata['export_version'] != expected_export_version:
raise exceptions.IncompatibleArchiveVersionError('Archive schema version {} is incompatible with the '
'currently supported schema version {}'.format(metadata['export_version'], expected_export_version))
export_version = StrictVersion(str(metadata['export_version']))
if export_version != expected_export_version:
msg = "Export file version is {}, can import only version {}"\
.format(metadata['export_version'], expected_export_version)
if export_version < expected_export_version:
msg += "\nUse 'verdi export migrate' to update this export file."
else:
msg += "\nUpdate your AiiDA version in order to import this file."

raise exceptions.IncompatibleArchiveVersionError(msg)

##########################################################################
# CREATE UUID REVERSE TABLES AND CHECK IF I HAVE ALL NODES FOR THE LINKS #
Expand Down Expand Up @@ -1272,7 +1280,7 @@ def import_data_sqla(in_path, user_group=None, ignore_unknown_nodes=False,
from aiida.common import json

# This is the export version expected by this function
expected_export_version = '0.4'
expected_export_version = StrictVersion('0.4')

# The name of the subfolder in which the node files are stored
nodes_export_subfolder = 'nodes'
Expand Down Expand Up @@ -1319,9 +1327,16 @@ def import_data_sqla(in_path, user_group=None, ignore_unknown_nodes=False,
######################
# PRELIMINARY CHECKS #
######################
if metadata['export_version'] != expected_export_version:
raise exceptions.IncompatibleArchiveVersionError('Archive schema version {} is incompatible with the '
'currently supported schema version {}'.format(metadata['export_version'], expected_export_version))
export_version = StrictVersion(str(metadata['export_version']))
if export_version != expected_export_version:
msg = "Export file version is {}, can import only version {}"\
.format(metadata['export_version'], expected_export_version)
if export_version < expected_export_version:
msg += "\nUse 'verdi export migrate' to update this export file."
else:
msg += "\nUpdate your AiiDA version in order to import this file."

raise exceptions.IncompatibleArchiveVersionError(msg)

###################################################################
# CREATE UUID REVERSE TABLES AND CHECK IF #
Expand Down Expand Up @@ -1919,11 +1934,9 @@ def import_data_sqla(in_path, user_group=None, ignore_unknown_nodes=False,
else:
counter += 1

# Add all the nodes to the new group
# Adding nodes to group avoiding the SQLA ORM to increase speed
nodes = [entry[0].backend_entity for entry in QueryBuilder().append(Node, filters={'id': {'in': pks_for_group}}).all()]
group.backend_entity.add_nodes(nodes, skip_orm=True)

if not silent:
print("IMPORTED NODES GROUPED IN IMPORT GROUP NAMED '{}'".format(group.label))
else:
Expand Down

0 comments on commit 63676f6

Please sign in to comment.