Skip to content

Commit

Permalink
Change docker base image to aiida-core. (#96)
Browse files Browse the repository at this point in the history
This PR replaces the base docker image with `aiida-core:latest`.

In addition, it fixes one test where the running time was too short
to produce an output structure.  A clear error message was added
to that case to allow quickly find out the origin of the problem.
  • Loading branch information
yakutovicha committed Apr 1, 2020
1 parent ed80b8c commit 4d33411
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
@@ -0,0 +1,2 @@
[run]
parallel=True
2 changes: 1 addition & 1 deletion .docker/my_init.d/add-codes.sh
Expand Up @@ -4,4 +4,4 @@ set -em
su -c /opt/add-codes.sh aiida

# Make /opt/aiida-cp2k folder editable for the $SYSTEM_USER.
chown -R aiida:aiida /opt/aiida-cp2k/
chown -R ${SYSTEM_USER}:${SYSTEM_USER} /opt/aiida-cp2k/
1 change: 1 addition & 0 deletions .docker/opt/add-codes.sh
Expand Up @@ -6,4 +6,5 @@ set -x
# Environment
export SHELL=/bin/bash

# Install cp2k code.
verdi code show cp2k@localhost || verdi code setup --config /opt/aiida-cp2k/.docker/cp2k-code.yml --non-interactive
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -7,10 +7,9 @@ before_install:
- python .ci/check_travis_tag.py
- docker build -t aiida_cp2k_test .
- export DOCKERID=`docker run -d aiida_cp2k_test`
- sleep 30 # wait until the container is launched

script:
- "echo \"Docker ID: $DOCKERID\""
- docker exec --tty $DOCKERID wait-for-services
- docker exec -it --user aiida $DOCKERID /bin/bash -l -c 'cd /opt/aiida-cp2k/ && pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )'
- docker exec -it --user aiida $DOCKERID /bin/bash -l -c 'cd /opt/aiida-cp2k/ && py.test --cov aiida_cp2k --cov-append .'
- docker exec -it --user aiida $DOCKERID /bin/bash -l -c 'cd /opt/aiida-cp2k/docs && make'
Expand Down
10 changes: 2 additions & 8 deletions Dockerfile
Expand Up @@ -5,11 +5,7 @@
# For further information on the license, see the LICENSE.txt file. #
###############################################################################

FROM aiidateam/aiida-docker-stack

# Set HOME and PATH variables.
ENV HOME="/home/aiida"
ENV PATH="${HOME}/.local/bin:${PATH}"
FROM aiidateam/aiida-core:latest

# To prevent the container to exit prematurely.
ENV KILL_ALL_RPOCESSES_TIMEOUT=50
Expand All @@ -28,6 +24,4 @@ RUN pip install coveralls

# Install the cp2k code.
COPY .docker/opt/add-codes.sh /opt/
COPY .docker/my_init.d/add-codes.sh /etc/my_init.d/40_add-codes.sh

RUN chown -R aiida:aiida ${HOME}
COPY .docker/my_init.d/add-codes.sh /etc/my_init.d/50_add-codes.sh
8 changes: 6 additions & 2 deletions examples/single_calculations/example_restart.py
Expand Up @@ -42,7 +42,7 @@ def example_restart(cp2k_code):
dict={
'GLOBAL': {
'RUN_TYPE': 'GEO_OPT',
'WALLTIME': '00:00:10', # too short
'WALLTIME': '00:00:20', # too short
},
'MOTION': {
'GEO_OPT': {
Expand Down Expand Up @@ -123,7 +123,11 @@ def example_restart(cp2k_code):
# Check walltime exceeded.
assert calc1['output_parameters']['exceeded_walltime'] is True
assert calc1['output_parameters']['energy'] is not None
assert 'output_structure' in calc1
if 'output_structure' not in calc1:
print("There is no 'output_structure' in the process outputs. "
"Most probably the calculation did not reach the first geometry optimization step.")
sys.exit(1)

print("OK, walltime exceeded as expected.")

# ------------------------------------------------------------------------------
Expand Down

0 comments on commit 4d33411

Please sign in to comment.