Skip to content

Commit

Permalink
Merge branch 'develop', drop python 3.4 support, bumpversion -> v1.1.10
Browse files Browse the repository at this point in the history
Dropped support for python 3.4 since the latest AiiDA-core requires graphviz==0.13 which is not available there
  • Loading branch information
PhilippRue committed Jan 27, 2020
2 parents 0a10f0c + 57816eb commit e1296b1
Show file tree
Hide file tree
Showing 15 changed files with 435 additions and 96 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.1.9
current_version = 1.1.10
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?
Expand Down
3 changes: 3 additions & 0 deletions .codacy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

exclude_paths:
- 'aiida_kkr/tests/**'
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ dist: trusty
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
matrix:
Expand All @@ -12,6 +11,7 @@ matrix:
include:
- python: 3.7
dist: xenial
env: NO_RMQ='t'
notifications:
slack:
on_success: never
Expand Down
2 changes: 1 addition & 1 deletion aiida_kkr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
AiiDA KKR
"""

__version__ = "1.1.9"
__version__ = "1.1.10"
12 changes: 9 additions & 3 deletions aiida_kkr/calculations/kkrimp.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
__copyright__ = (u"Copyright (c), 2018, Forschungszentrum Jülich GmbH, "
"IAS-1/PGI-1, Germany. All rights reserved.")
__license__ = "MIT license, see LICENSE.txt file"
__version__ = "0.5.0"
__version__ = "0.5.1"
__contributors__ = (u"Philipp Rüßmann", u"Fabian Bertoldo")

#TODO: implement 'ilayer_center' consistency check
Expand Down Expand Up @@ -693,7 +693,8 @@ def get_remote_symlink(self, local_copy_list):
with comp.get_transport() as connection:
# do this for GMAT
uuid_GF = GF_local_copy_info[0]
GF_remote_path = os.path.join(GFpath_remote, uuid_GF, GF_local_copy_info[1])
filename = GF_local_copy_info[1]
GF_remote_path = os.path.join(GFpath_remote, uuid_GF, filename)
# check if file exists on remote
if connection.isfile(GF_remote_path):
# remove GF from local copy list and add to remote symlink list
Expand All @@ -702,12 +703,17 @@ def get_remote_symlink(self, local_copy_list):

# do the same for TMAT
uuid_TM = TM_local_copy_info[0]
TM_remote_path = os.path.join(GFpath_remote, uuid_TM, TM_local_copy_info[1])
filename = TM_local_copy_info[1]
TM_remote_path = os.path.join(GFpath_remote, uuid_TM, filename)
# check if file exists on remote
if connection.isfile(TM_remote_path):
# remove TMAT from local copy list and add to remote symlink list
local_copy_list.remove(TM_local_copy_info)
remote_symlink_list.append((comp.uuid, TM_remote_path, filename))

# print symlink and local copy list (for debugging purposes)
print('local_copy_list: {}'.format(local_copy_list))
print('symlink_list: {}'.format(remote_symlink_list))

# now return updated remote_symlink and local_copy lists
return remote_symlink_list, local_copy_list
43 changes: 32 additions & 11 deletions aiida_kkr/tests/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,17 @@ mkdir -p '.aiida';
# if the environment variable is unset or the empty string then the corresponding tests will be ignored

usage(){
echo "$0 usage:" && grep " .)\ #" $0; exit 0;
echo "$0 usage:" && grep " .)\ #" $0;
echo
echo "Default behavior is to run only tests that do not require running an actual calculation (i.e. skip workflow tests)."
echo "Additional settings with the environment variables (set to something or unset to remove setting):";
echo " 'RUN_ALL': run all tests";
echo " 'SKIP_NOWORK': skip workflow tests";
echo " 'RUN_VORONOI': run voronoi tests";
echo " 'RUN_KKRHOST': run kkrhost tests";
echo " 'RUN_KKRIMP': run kkrimp tests";
echo
exit 0;
}

addopt=""
Expand Down Expand Up @@ -51,6 +61,11 @@ else
else
echo "skip workflows tests using KKRimp (set 'RUN_KKRIMP' env to activate this)"
fi
if [[ ! -z "$NO_RMQ" ]]; then
echo "do not run workflows and workfuntions that need rabbitMQ (unset 'NO_RMQ' env to prevent this)"
else
echo "run workflows and workfunctions also with rabbitMQ (set 'NO_RMQ' env to deactivate this)"
fi
fi
echo "============="
echo
Expand All @@ -63,18 +78,24 @@ if [[ ! -z "$RUN_ALL" ]]; then
pytest --cov-report=term-missing --cov=aiida_kkr --cov-append --ignore=jukkr --ignore=workflows --mpl -p no:warnings $addopt # then run non-workflow tests
else
# tests without running actual calculations
if [[ -z "$SKIP_NOWORK" ]]; then
if [[ -z "$SKIP_NOWORK" ]] && [[ -z "$NO_RMQ" ]]; then
echo "run non-workflow tests"
pytest --cov-report=term-missing --cov=aiida_kkr --ignore=workflows --ignore=jukkr --mpl -p no:warnings $addopt
else
echo "skipping tests that are not workflows"
# skip things that need rabbitMQ
if [[ -z "$SKIP_NOWORK" ]] && [[ ! -z "$NO_RMQ" ]]; then
echo "run non-workflow tests"
pytest --cov-report=term-missing --cov=aiida_kkr --ignore=workflows --ignore=jukkr --ignore=calculations --ignore=test_common_workfunctions_with_rmq.py --ignore=test_plot_kkr.py --mpl -p no:warnings $addopt
else
echo "skipping tests that are not workflows"
fi
fi

# test running full workflows, need compiled codes and execute them

# tests using only voronoi

if [[ ! -z "$RUN_VORONOI" ]]; then
if [[ ! -z "$RUN_VORONOI" ]] && [[ -z "$NO_RMQ" ]]; then
echo "run vorostart workflow test"
pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_vorostart_workflow $addopt
else
Expand All @@ -83,25 +104,25 @@ else

# tests using kkrhost (and voronoi)

if [[ ! -z "$RUN_KKRHOST" ]]; then
if [[ ! -z "$RUN_KKRHOST" ]] && [[ -z "$NO_RMQ" ]]; then
echo "run kkr_dos workflow test"
pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_dos_workflow $addopt
else
echo "skipping kkr_dos workflow test"
fi
if [[ ! -z "$RUN_KKRHOST" ]]; then
if [[ ! -z "$RUN_KKRHOST" ]] && [[ -z "$NO_RMQ" ]]; then
echo "run kkr_gf_writeout workflow test"
pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_gf_writeout_workflow $addopt
else
echo "skipping kkr_gf_writeout workflow test"
fi
if [[ ! -z "$RUN_VORONOI" ]] && [[ ! -z "$RUN_KKRHOST" ]]; then
if [[ ! -z "$RUN_VORONOI" ]] && [[ ! -z "$RUN_KKRHOST" ]] && [[ -z "$NO_RMQ" ]]; then
echo "run kkr_scf workflow test"
pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_scf_workflow $addopt
else
echo "skipping kkr_scf workflow test"
fi
if [[ ! -z "$RUN_VORONOI" ]] && [[ ! -z "$RUN_KKRHOST" ]]; then
if [[ ! -z "$RUN_VORONOI" ]] && [[ ! -z "$RUN_KKRHOST" ]] && [[ -z "$NO_RMQ" ]]; then
echo "run kkr_eos workflow test"
pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_eos_workflow $addopt
else
Expand All @@ -110,19 +131,19 @@ else

# tests using kkrimp (and kkrhost/voronoi)

if [[ ! -z "$RUN_KKRIMP" ]]; then
if [[ ! -z "$RUN_KKRIMP" ]] && [[ -z "$NO_RMQ" ]]; then
echo "run kkrimp_scf workflow test"
pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_kkrimp_scf_workflow $addopt
else
echo "skipping kkrimp_scf workflow test"
fi
if [[ ! -z "$RUN_KKRIMP" ]] && [[ ! -z "$RUN_KKRHOST" ]] && [[ ! -z "$RUN_VORONOI" ]]; then
if [[ ! -z "$RUN_KKRIMP" ]] && [[ ! -z "$RUN_KKRHOST" ]] && [[ ! -z "$RUN_VORONOI" ]] && [[ -z "$NO_RMQ" ]]; then
echo "run kkrimp_full workflow test"
pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_kkrimp_full_workflow $addopt
else
echo "skipping kkrimp_full workflow test"
fi
if [[ ! -z "$RUN_KKRIMP" ]] && [[ ! -z "$RUN_KKRHOST" ]]; then
if [[ ! -z "$RUN_KKRIMP" ]] && [[ ! -z "$RUN_KKRHOST" ]] && [[ -z "$NO_RMQ" ]]; then
echo "run kkrimp_dos workflow test"
pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_kkrimp_dos_workflow $addopt
else
Expand Down
56 changes: 0 additions & 56 deletions aiida_kkr/tests/test_common_workfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,62 +141,6 @@ def test_check_2Dinput_consistency_5(self):
assert list(input_check[1]).sort() == list("3D info given in parameters but structure is 2D\nstructure is 2D? {}\ninput has 2D info? {}\nset keys are: {}".format(False, True, ['ZPERIODL', '<NRBASIS>', '<RBLEFT>', 'INTERFACE', '<NLBASIS>', 'ZPERIODR', '<RBRIGHT>'])).sort()


def test_update_params_wf(self):
from aiida_kkr.tools.common_workfunctions import update_params_wf
from masci_tools.io.kkr_params import kkrparams
from aiida.plugins import DataFactory
Dict = DataFactory('dict')

k = kkrparams(LMAX=2)
node1 = Dict(dict=k.values)
node2 = Dict(dict={'nodename': 'my_changed_name', 'nodedesc': 'My description text', 'EMIN': -1, 'RMAX': 10.})

unode = update_params_wf(node1, node1)
assert unode.get_dict() == node1.get_dict()

unode = update_params_wf(node1, node2)

d0 = node1.get_dict()
for i in list(d0.keys()):
if d0[i] is None:
d0.pop(i)

d1 = unode.get_dict()
for i in list(d1.keys()):
if d1[i] is None:
d1.pop(i)

l_identical, l_diff = [], []
for i in list(d0.keys()):
if i in list(d1.keys()):
l_identical.append([i, d0[i], d1[i]])
else:
l_diff.append([0, i, d0[i]])
for i in list(d1.keys()):
if i not in list(d0.keys()):
l_diff.append([1, i, d1[i]])

assert l_identical == [[u'LMAX', 2, 2]]
assert l_diff.sort() == [[1, u'RMAX', 10.0], [1, u'EMIN', -1.0]].sort()
return node1, node2, unode


def test_neworder_potential_wf(self):
from numpy import loadtxt
from aiida.orm import load_node
from aiida.plugins import DataFactory
from aiida_kkr.tools.common_workfunctions import neworder_potential_wf
from aiida.tools.importexport import import_data
Dict = DataFactory('dict')
import_data('files/db_dump_kkrflex_create.tar.gz')
GF_host_calc = load_node('baabef05-f418-4475-bba5-ef0ee3fd5ca6').outputs
neworder_pot1 = [int(i) for i in loadtxt(GF_host_calc.retrieved.open('scoef'), skiprows=1)[:,3]-1]
settings_dict = {'pot1': 'out_potential', 'out_pot': 'potential_imp', 'neworder': neworder_pot1}
settings = Dict(dict=settings_dict)
startpot_imp_sfd = neworder_potential_wf(settings_node=settings, parent_calc_folder=GF_host_calc.remote_folder)
assert startpot_imp_sfd.get_object_content(startpot_imp_sfd.filename)[::1000] == u'C12807143D556463084.6+55 7D117 9D-87 0+25\n20.70351.75\n0521259.2+491.0-462. 02621D74112D03547T00 4D02116D502 6D39\n96.20261.50941.4944.7+30 98-29 .5-3625D07193.58104D0773D27252285417D341 9.506544D548447094.9+38 91063 54-08 6D28277.60909.98111'


def test_vca_check(self):
from aiida_kkr.tools.common_workfunctions import vca_check
pass
Expand Down
74 changes: 74 additions & 0 deletions aiida_kkr/tests/test_common_workfunctions_with_rmq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# -*- coding: utf-8 -*-
"""
@author: ruess
"""
from __future__ import print_function
from __future__ import absolute_import
from builtins import object
import pytest
from six.moves import range
from numpy import sort

@pytest.mark.usefixtures("aiida_env")
class Test_common_workfunctions_rmq(object):
"""
Tests for the common workfunctions from tools.common_workfunctions,
i.e. functions commonly used in this plugin that depend on aiida stuff to work
these tests use rabbitMQ
"""

def test_update_params_wf(self):
from aiida_kkr.tools.common_workfunctions import update_params_wf
from masci_tools.io.kkr_params import kkrparams
from aiida.plugins import DataFactory
Dict = DataFactory('dict')

k = kkrparams(LMAX=2)
node1 = Dict(dict=k.values)
node2 = Dict(dict={'nodename': 'my_changed_name', 'nodedesc': 'My description text', 'EMIN': -1, 'RMAX': 10.})

unode = update_params_wf(node1, node1)
assert unode.get_dict() == node1.get_dict()

unode = update_params_wf(node1, node2)

d0 = node1.get_dict()
for i in list(d0.keys()):
if d0[i] is None:
d0.pop(i)

d1 = unode.get_dict()
for i in list(d1.keys()):
if d1[i] is None:
d1.pop(i)

l_identical, l_diff = [], []
for i in list(d0.keys()):
if i in list(d1.keys()):
l_identical.append([i, d0[i], d1[i]])
else:
l_diff.append([0, i, d0[i]])
for i in list(d1.keys()):
if i not in list(d0.keys()):
l_diff.append([1, i, d1[i]])

assert l_identical == [[u'LMAX', 2, 2]]
assert l_diff.sort() == [[1, u'RMAX', 10.0], [1, u'EMIN', -1.0]].sort()
return node1, node2, unode


def test_neworder_potential_wf(self):
from numpy import loadtxt
from aiida.orm import load_node
from aiida.plugins import DataFactory
from aiida_kkr.tools.common_workfunctions import neworder_potential_wf
from aiida.tools.importexport import import_data
Dict = DataFactory('dict')
import_data('files/db_dump_kkrflex_create.tar.gz')
GF_host_calc = load_node('baabef05-f418-4475-bba5-ef0ee3fd5ca6').outputs
neworder_pot1 = [int(i) for i in loadtxt(GF_host_calc.retrieved.open('scoef'), skiprows=1)[:,3]-1]
settings_dict = {'pot1': 'out_potential', 'out_pot': 'potential_imp', 'neworder': neworder_pot1}
settings = Dict(dict=settings_dict)
startpot_imp_sfd = neworder_potential_wf(settings_node=settings, parent_calc_folder=GF_host_calc.remote_folder)
assert startpot_imp_sfd.get_object_content(startpot_imp_sfd.filename)[::1000] == u'C12807143D556463084.6+55 7D117 9D-87 0+25\n20.70351.75\n0521259.2+491.0-462. 02621D74112D03547T00 4D02116D502 6D39\n96.20261.50941.4944.7+30 98-29 .5-3625D07193.58104D0773D27252285417D341 9.506544D548447094.9+38 91063 54-08 6D28277.60909.98111'

1 change: 1 addition & 0 deletions aiida_kkr/tests/workflows/test_kkrimp_dos_wc.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ def test_dos_startpot_wc(self):
from aiida.engine import run
print(builder)
out = run(builder)
print(out)

assert 'last_calc_info' in out.keys()
assert 'last_calc_output_parameters' in out.keys()
Expand Down
Loading

0 comments on commit e1296b1

Please sign in to comment.