Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippRue committed Mar 15, 2019
2 parents 859aa32 + 5fbec4d commit bc42842
Show file tree
Hide file tree
Showing 31 changed files with 540 additions and 506 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.2
current_version = 1.1.3-dev
commit = True
tag = True
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?
Expand Down
30 changes: 21 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#rabbitMQ only works with trusty according to travis website
dist: trusty
language: python
python: 2.7
Expand All @@ -9,7 +10,7 @@ services:
- rabbitmq
addons:
postgresql: '9.5'
apt: # copied from wannier90's travis.yml
apt: # adapted from wannier90's travis.yml
packages:
- gfortran
- libblas-dev
Expand All @@ -21,6 +22,7 @@ before_install:
# now unpack the secrets (pypi_credentials and ssh key to download the KKR code
- tar -zxvf secrets.tar.gz && rm secrets.tar.gz
# Now we install the needed dependencies
#- sudo apt-get update && sudo apt-get upgrade && sudo apt-get install software-properties-common -y && sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && sudo apt-get update && sudo apt-get install gfortran-8 -y && sudo apt-get update
- sudo apt-get install locate
- sudo service postgresql stop
- sudo apt-get remove postgresql
Expand All @@ -42,16 +44,26 @@ script:
- echo "iffgit.fz-juelich.de,134.94.161.83 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBH2UDrT0bZP+WmJGGbtLPtFyC5FgQgOM1XvVJ6u5XBJrYMnKNVb9jAttL+k8VvDgcK6b3dFJnvt7eiXtG/hnqCo=" >> ~/.ssh/known_hosts
# clone the code and install
- cd aiida_kkr/tests && ./jukkr_installation.sh
# Now run all tests
- pwd && ./run_all.sh
allow_failures:
- pytest -s --cov-report=term-missing --cov=aiida_kkr -k Test_dos_workflow
- pytest -s --cov-report=term-missing --cov=aiida_kkr -k Test_gf_writeout_workflow
# (needs allow failure so that after_success is executed)
## First check if rabbitmq communication is working
#- ./check_pika-rabbitmq.py | tee out_rmq_check
#- ./verify_rmq_check.py
# Then run all tests
- ./run_all.sh
#- travis_wait 30 ./run_all.sh
matrix:
allow_failures: # (needs allow failure so that after_success is executed)
# these tests fail at the moment because gfortran is too old
- pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_dos_workflow
- pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_gf_writeout_workflow
- pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_scf_workflow
# these are fail because gfortran compilation of kkrimp does not work
- pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_kkrimp_scf_workflow
- pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_kkrimp_full_workflow

after_success:
- codecov
#deploy to pypi
#deploy to pypi using poetry
- cd ../../ && rm -rf aiida_kkr/tests/{submit_test/,__pycache__/,jukkr} id_rsa_travis #remove test output before publishing
- pip install poetry && ./publish_to_pypi.sh
- pip install poetry && ./publish_to_pypi.sh # publish_to_pypi script does poetry publish with autentification information
git:
depth: 3
2 changes: 1 addition & 1 deletion aiida_kkr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"""

__version__ = "1.1.2"
__version__ = "1.1.3-dev"
36 changes: 36 additions & 0 deletions aiida_kkr/tests/check_pika-rabbitmq.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/env python

import pika
from time import sleep, time
import timeout_decorator

@timeout_decorator.timeout(5)
def rmq_listen():
channel.start_consuming()

# Part 1: send message
print "Start sending message..."
connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
msg = 'Hello World! {}'.format(time())
channel.basic_publish(exchange='',routing_key='hello', body=msg)
print " [x] Sent '{}'".format(msg)
connection.close()

print "done sending message. Wait for 5 seconds and start receiving..."
sleep(5)

# Part 2: receive message
connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost'))
channel = connection.channel()
channel.queue_declare(queue='hello')
print ' [*] Waiting 5 seconds for messages.'
def callback(ch, method, properties, body):
print " [x] Received %r" % (body,)
channel.basic_consume(queue='hello',on_message_callback=callback,auto_ack=False)
try:
rmq_listen()
except timeout_decorator.timeout_decorator.TimeoutError:
print "Done waiting, now close connection"
connection.close()
81 changes: 81 additions & 0 deletions aiida_kkr/tests/dbsetup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@

import os


# some global settings

kkr_codename = 'kkrhost'
kkrimp_codename = 'kkrimp'
voro_codename = 'voronoi'
computername = 'localhost'
queuename = ''

cwd = os.getcwd()
workdir = cwd+'/jukkr/work'
codelocation = cwd+'/jukkr/'



def prepare_computer(computername, workdir):
"""Create new computer in db or read computer from db if it already exists."""
from aiida.orm import Computer
from aiida.orm.backend import construct_backend
from aiida.orm.querybuilder import QueryBuilder
#
# first check if computer exists already in database
qb = QueryBuilder()
qb.append(Computer, tag='computer')
all_computers = qb.get_results_dict()
computer_found_in_db = False
if len(all_computers)>0:
for icomp in range(len(all_computers)):
c = all_computers[icomp].get('computer').get('*')
if c.get_name() == computername:
computer_found_in_db = True
comp = c
# if it is not there create a new one
if not computer_found_in_db:
#comp = Computer(computername, 'test computer', transport_type='local', scheduler_type='direct', workdir=workdir)
b = construct_backend()
comp = b.computers.create(computername, 'test computer', transport_type='local', scheduler_type='direct', workdir=workdir)
comp.set_default_mpiprocs_per_machine(4)
comp.store()
print 'computer stored now cofigure'
comp.configure()
else:
print 'found computer in database'
# return computer
return comp


def prepare_code(codename, codelocation, computername, workdir):
"""."""
# first create or read computer
comp = prepare_computer(computername, workdir)
# now decide which code to add
if codename == 'kkrhost':
execname = 'kkr.x'
pluginname = 'kkr.kkr'
elif codename == 'voronoi':
execname = 'voronoi.exe'
pluginname = 'kkr.voro'
elif codename == 'kkrimp':
execname = 'kkrflex.exe'
pluginname = 'kkr.kkrimp'
else:
raise ValueError('unknown codename')
# then get code from database or create a new code
from aiida.orm import Code
from aiida.common.exceptions import NotExistent
try:
code = Code.get_from_string(codename+'@'+computername)
except NotExistent as exception:
code = Code()
code.label = codename
code.description = ''
code.set_remote_computer_exec((comp, codelocation+execname))
code.set_input_plugin_name(pluginname)
if codename == 'voronoi':
code.set_prepend_text('ln -s '+codelocation+'ElementDataBase .')
code.store()

18 changes: 9 additions & 9 deletions aiida_kkr/tests/jukkr_installation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ cd jukkr/

# build voronoi code
# cannot build with gfortran at the moment, needs fixing on jukkr side
./install.py --program=voronoi --compiler=ifort --parallelization=serial
#./install.py --program=voronoi --compiler=gfortran --parallelization=serial
#./install.py --program=voronoi --compiler=ifort --parallelization=serial
./install.py --program=voronoi --compiler=gfortran --parallelization=serial
cd build/ && make -j4 && cp voronoi.exe ../
cd ..

# build kkrhost code
./install.py --program=kkrhost --compiler=ifort --parallelization=serial
#./install.py --program=kkrhost --compiler=gfortran --parallelization=serial -d
cd build/ && make -j4 && cp kkr.x ../
cd ..
#./install.py --program=kkrhost --compiler=ifort --parallelization=serial
#./install.py --program=kkrhost --compiler=gfortran --parallelization=serial
#cd build/ && make -j4 && cp kkr.x ../
#cd ..

# build kkrimp code
# cannot build with gfortran at the moment, needs fixing on jukkr side
./install.py --program=kkrimp --compiler=ifort --parallelization=serial
#./install.py --program=kkrimp --compiler=ifort --parallelization=serial
#./install.py --program=kkrimp --compiler=gfortran --parallelization=serial
cd build/ && make -j4 && cp kkrflex.exe ../
cd ..
#cd build/ && make -j4 && cp kkrflex.exe ../
#cd ..
18 changes: 15 additions & 3 deletions aiida_kkr/tests/run_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
export AIIDA_PATH='.';
mkdir -p '.aiida';
#pytest -sv
#pytest -v
#pytest --cov-report=term-missing --cov=aiida_kkr --ignore=test_scf_wc_simple.py
pytest --cov-report=term-missing --cov=aiida_kkr --ignore=test_scf_wc_simple.py --ignore=test_vorostart_wc.py --ignore=test_dos_wc.py --ignore=test_gf_writeout_wc.py --ignore=test_kkrimp_sub_wc.py --ignore=test_kkrimp_full_wc.py --ignore=jukkr

# tests without running actual calculations
pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=workflows --ignore=jukkr

# test running full workflows, need compiled codes and execute them
pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_vorostart_workflow

# these tests fail at the moment because gfortran is too old
#pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_dos_workflow
#pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_gf_writeout_workflow
#pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_scf_workflow

# these are deactivated becaus gfortran compilation of kkrimp does not work
#pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_kkrimp_scf_workflow
#pytest --cov-report=term-missing --cov-append --cov=aiida_kkr --ignore=jukkr -k Test_kkrimp_full_workflow
2 changes: 1 addition & 1 deletion aiida_kkr/tests/run_all_covhtml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
#pytest -s --cov-report=html --cov=aiida_kkr --ignore=jukkr -k Test_dos_workflow
#pytest -s --cov-report=html --cov=aiida_kkr --ignore=jukkr -k Test_gf_writeout_workflow -k Test_dos_workflow
#pytest --cov-report=html --cov=aiida_kkr --ignore=jukkr --ignore=test_scf_wc_simple.py --ignore=test_vorostart_wc.py --ignore=test_kkrimp_sub_wc.py --ignore=test_kkrimp_full_wc.py
pytest -s --cov-report=html --cov=aiida_kkr --ignore=jukkr
pytest -v -s --cov-report=html --cov=aiida_kkr --ignore=jukkr
Loading

0 comments on commit bc42842

Please sign in to comment.