From eb3174c7468323a0e900e9242ba7ac76786efa77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Tue, 7 Mar 2023 15:18:58 +0100 Subject: [PATCH 1/3] add default value for reframe venv location --- ansible/playbooks/roles/compatibility_layer/defaults/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml index d9e657a6..6069a93c 100644 --- a/ansible/playbooks/roles/compatibility_layer/defaults/main.yml +++ b/ansible/playbooks/roles/compatibility_layer/defaults/main.yml @@ -64,6 +64,8 @@ package_sets: prefix_packages: +reframe_venv_dir: /tmp/reframe_venv + # List of locations that should get a symlink $EPREFIX/$LOCATION -> $LOCATION. # This ensures that things like user/group ids are correct/looked up in the right way in the Prefix environment. symlinks_to_host: From f6aea322584638e9eeabb16958c731e96df5d836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Tue, 7 Mar 2023 15:20:09 +0100 Subject: [PATCH 2/3] check if reframe is installed, and if not, install it in a venv --- .../roles/compatibility_layer/tasks/test.yml | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/ansible/playbooks/roles/compatibility_layer/tasks/test.yml b/ansible/playbooks/roles/compatibility_layer/tasks/test.yml index 181fb0ed..631ad3e5 100644 --- a/ansible/playbooks/roles/compatibility_layer/tasks/test.yml +++ b/ansible/playbooks/roles/compatibility_layer/tasks/test.yml @@ -2,16 +2,32 @@ # of the compatibility layer installation. --- +- name: Check if ReFrame is installed + ansible.builtin.command: reframe --version >/dev/null 2>&1 + register: reframe_exists + ignore_errors: true + changed_when: false + tags: + - test + +- name: Install Reframe using pip if it's not installed yet + ansible.builtin.pip: + name: ReFrame-HPC + virtualenv: "{{ reframe_venv_dir }}" + virtualenv_command: python3 -m venv + when: reframe_exists.rc != 0 + - name: Copy ReFrame test file ansible.builtin.copy: src: "{{ playbook_dir }}/../../test/compat_layer.py" - dest: /tmp/compat_layer.py + dest: "{{ reframe_venv_dir }}/compat_layer.py" mode: 0644 tags: - test - name: Run ReFrame tests - ansible.builtin.command: reframe -r -v -c /tmp/compat_layer.py + ansible.builtin.command: + cmd: "{{ reframe_venv_dir + '/bin/' if reframe_exists.rc != 0 else '' }}reframe -r -v -c {{ reframe_venv_dir }}/compat_layer.py" environment: EESSI_VERSION: "{{ eessi_version }}" EESSI_OS: "{{ eessi_host_os }}" From e030e6a48d3a9b7fba98302df15e51f28bb63117 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bob=20Dr=C3=B6ge?= Date: Tue, 7 Mar 2023 15:23:04 +0100 Subject: [PATCH 3/3] update README for ReFrame variable --- ansible/playbooks/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ansible/playbooks/README.md b/ansible/playbooks/README.md index daadfd81..91ddc7c2 100644 --- a/ansible/playbooks/README.md +++ b/ansible/playbooks/README.md @@ -11,7 +11,8 @@ all functionality for installing the EESSI compatibility layer. It performs the - add a given overlay to the installation; - use the Portage configuration files from that overlay, if applicable, by making symlinks to them; - install a given list of package sets; - - install a given list of additional packages. + - install a given list of additional packages; + - test the installation using ReFrame. The playbook `install.yml` will execute this role on a given server. Note that if you want the role to install Gentoo Prefix, this particular task currently only supports Linux distributions based on RHEL 8 on the installation host. @@ -55,6 +56,7 @@ Before running the playbook, make sure the following settings are correct, and o | prefix_locales | List of locales to be generated | | package_sets | List of package sets to be installed | | prefix_packages | List of additional packages to be installed | +| reframe_venv | Path where a virtual environment will be created for the ReFrame installation | | symlinks_to_host | List of paths that should get a symlink to the corresponding host path | ### Logging