Skip to content
Permalink
Browse files

Docker: Fix AiiDA test

  • Loading branch information...
oschuett committed Sep 8, 2019
1 parent 6900201 commit 92a38106d17a9221b8425da2d5441f89d534e077
Showing with 72 additions and 15 deletions.
  1. +9 −2 tools/docker/scripts/install_aiida.sh
  2. +63 −13 tools/docker/scripts/test_aiida.sh
@@ -18,8 +18,12 @@ apt-get install -qq --no-install-recommends \
ssh
rm -rf /var/lib/apt/lists/*

# install python packages
pip install --quiet flake8 aiida ase==3.17.0
# install dependencies of aiida-cp2k
cd /opt/
git clone --quiet https://github.com/aiidateam/aiida-cp2k.git
pip install --quiet ./aiida-cp2k/[pre-commit,test]
pip uninstall --yes --quiet aiida-cp2k


# create ubuntu user with sudo powers
adduser --disabled-password --gecos "" ubuntu
@@ -28,6 +32,9 @@ echo "ubuntu ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# shellcheck disable=SC1091
source /opt/cp2k-toolchain/install/setup

# link mpi executables into path
for i in $(dirname "$(which mpirun)")/* ; do ln -sf "$i" /usr/bin/; done

# setup arch files
cd /workspace/cp2k/arch
ln -vs /opt/cp2k-toolchain/install/arch/local* .
@@ -17,32 +17,82 @@ else
exit
fi

echo -e "\n========== Installing CP2K =========="
echo -e "\n========== Installing AiiDA-CP2K plugin =========="
cd /opt/aiida-cp2k/
git pull
pip install ./[pre-commit,test]

echo -e "\n========== Configuring AiiDA =========="
AS_UBUNTU_USER="sudo -u ubuntu -H"

#update reentry cache
$AS_UBUNTU_USER reentry scan

# start RabbitMQ
service rabbitmq-server start

# start and configure PostgreSQL
service postgresql start
sudo -u postgres psql -d template1 -c "CREATE USER aiida WITH PASSWORD 'aiida_db_passwd';"
sudo -u postgres psql -d template1 -c "CREATE DATABASE aiidadb OWNER aiida;"
sudo -u postgres psql -d template1 -c "GRANT ALL PRIVILEGES ON DATABASE aiidadb to aiida;"

# setup aiida user
$AS_UBUNTU_USER verdi setup \
--non-interactive \
--email aiida@localhost \
--first-name Some \
--last-name Body \
--institution XYZ \
--db-backend django \
--db-username aiida \
--db-password aiida_db_passwd \
--db-name aiidadb \
--db-host localhost \
--db-port 5432 \
--repository /home/ubuntu/aiida_repository \
--profile default

# start aiida daemon
$AS_UBUNTU_USER verdi profile setdefault default
$AS_UBUNTU_USER verdi daemon start

# setup local computer
$AS_UBUNTU_USER mkdir -p /home/ubuntu/aiida_run

$AS_UBUNTU_USER verdi computer setup \
--non-interactive \
--label localhost \
--hostname localhost \
--transport local \
--scheduler direct \
--work-dir /home/ubuntu/aiida_run

$AS_UBUNTU_USER verdi computer configure local localhost --non-interactive --safe-interval 0.0
$AS_UBUNTU_USER verdi computer test localhost

# setup code
cat > /usr/bin/cp2k << EndOfMessage
#!/bin/bash -e
source /opt/cp2k-toolchain/install/setup
/workspace/cp2k/exe/local/cp2k.pdbg "\$@"
EndOfMessage
chmod +x /usr/bin/cp2k

echo -e "\n========== Installing AiiDA-CP2K plugin =========="
cd /opt/
git clone --quiet https://github.com/cp2k/aiida-cp2k.git
pip install --quiet ./aiida-cp2k/[pre-commit,test]

echo -e "\n========== Configuring AiiDA =========="
for i in $(dirname "$(which mpirun)")/* ; do ln -sf "$i" /usr/bin/; done
SUDO="sudo -u ubuntu -H"
cd /opt/aiida-cp2k/test/
$SUDO ./configure_aiida.sh
$AS_UBUNTU_USER verdi code setup \
--non-interactive \
--label cp2k \
--computer localhost \
--remote-abs-path /usr/bin/cp2k \
--input-plugin cp2k

echo -e "\n========== Running AiiDA-CP2K Tests =========="
cd /opt/aiida-cp2k/test/
cd /opt/aiida-cp2k/

set +e # disable error trapping for remainder of script
(
set -e # abort on error
$SUDO ./run_tests.sh
$AS_UBUNTU_USER ./run_tests.sh
)

EXIT_CODE=$?

0 comments on commit 92a3810

Please sign in to comment.
You can’t perform that action at this time.