-
Notifications
You must be signed in to change notification settings - Fork 187
/
test_polish_workchains.yml
82 lines (69 loc) · 2.68 KB
/
test_polish_workchains.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
- name: Test the runnning of complex polish notation workchains
hosts: all
gather_facts: false
# run as aiida user
become: true
become_method: "{{ become_method }}"
become_user: "{{ aiida_user | default('aiida') }}"
environment:
AIIDA_PATH: "{{ aiida_path }}"
tasks:
- name: "Check if add code is already present"
command: "{{ venv_bin }}/verdi -p {{ aiida_backend }} code show add@localhost"
ignore_errors: true
changed_when: false
no_log: true
register: aiida_check_code
- name: verdi add code setup
when: aiida_check_code.rc != 0
command: >
{{ venv_bin }}/verdi -p {{ aiida_backend }} code setup
-D "simple script that adds two numbers"
-n -L add -P core.arithmetic.add
-Y localhost --remote-abs-path=/bin/bash
- name: Copy workchain files
copy:
src: polish
dest: "${HOME}/{{ aiida_backend }}"
- name: get python path including workchains
command: echo "${PYTHONPATH}:${HOME}/{{ aiida_backend }}/polish"
register: echo_pythonpath
- set_fact:
aiida_pythonpath: "{{ echo_pythonpath.stdout }}"
- name: Reset pythonpath of daemon ({{ aiida_workers }} workers)
# note `verdi daemon restart` did not seem to update the environmental variables?
shell: |
{{ venv_bin }}/verdi -p {{ aiida_backend }} daemon stop
{{ venv_bin }}/verdi -p {{ aiida_backend }} daemon start {{ aiida_workers }}
environment:
PYTHONPATH: "{{ aiida_pythonpath }}"
- when: aiida_query_stats | default(false) | bool
include_tasks: tasks/reset_query_stats.yml
- name: "run polish workchains"
# Note the exclamation point after the code is necessary to force the value to be interpreted as LABEL type identifier
shell: |
set -e
declare -a EXPRESSIONS=({{ polish_expressions | map('quote') | join(' ') }})
for expression in "${EXPRESSIONS[@]}"; do
{{ venv_bin }}/verdi -p {{ aiida_backend }} run --auto-group -l polish -- "{{ polish_script }}" -X add! -C -F -d -t {{ polish_timeout }} -r 2 "$expression"
done
args:
executable: /bin/bash
vars:
polish_script: "${HOME}/{{ aiida_backend }}/polish/cli.py"
polish_timeout: 600
polish_expressions:
- "1 -2 -1 4 -5 -5 * * * * +"
- "2 1 3 3 -1 + ^ ^ +"
- "3 -5 -1 -4 + * ^"
- "2 4 2 -4 * * +"
- "3 1 1 5 ^ ^ ^"
# - "3 1 3 4 -4 2 * + + ^ ^" # this takes a longer time to run
environment:
PYTHONPATH: "{{ aiida_pythonpath }}"
register: polish_output
- name: print polish workchain output
debug:
msg: "{{ polish_output.stdout }}"
- when: aiida_query_stats | default(false) | bool
include_tasks: tasks/log_query_stats.yml