forked from ALU-Schumacher/AUDITOR
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (80 loc) · 2.94 KB
/
htcondor-collector.yaml
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
83
84
85
name: htcondor-collector
on:
pull_request:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
outputs:
table: ${{ steps.table.outputs.table }}
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Build collector package
run: |
python3.9 -m venv pvenv
source pvenv/bin/activate
pip install --upgrade pip build
python -m build -o dist collectors/htcondor
- name: Start docker containers
working-directory: containers/htcondor
run: |
docker compose -f docker-compose.yaml up -d --build
sleep 5
- name: Install collector in container
run: |
docker cp dist/*whl htcondor-auditor-collector-1:/tmp/
docker exec -u submituser htcondor-auditor-collector-1 \
bash -c "pip install --upgrade pip && \
pip install --no-cache-dir --no-index /tmp/auditor_htcondor_collector-*.whl"
- name: Start collector
run: |
docker exec -d -u submituser -w /home/submituser htcondor-auditor-collector-1 \
bash -l -c "auditor-htcondor-collector -c /configs/collector.yaml -i 5"
- name: Submit test job
run: |
docker exec -u submituser -w /home/submituser htcondor-submit-1 \
bash -c "echo -e \"executable=/bin/sleep\narguments=2\n+VoName=testgroup\nqueue\" > job \
&& condor_submit job"
- name: Wait for job and collector
run: |
in_submit() {
docker exec -u submituser htcondor-submit-1 bash -c "$@"
}
echo "Waiting for job to start..."
while [ "$(in_submit 'condor_q 1 -af JobStatus')" == "1" ]; do
sleep 2
done
echo "Waiting for job to complete..."
while [ "$(in_submit 'condor_q 1 -af JobStatus')" == "2" ]; do
sleep 2
done
echo "Waiting for collector..."
sleep 10
- name: Query accounting table
id: table
run: |
TABLE=$(docker exec htcondor-postgres-1 \
bash -c "psql -U postgres -d auditor -c \" \
SELECT ac.runtime, sc.name, sc.value FROM accounting as ac \
JOIN records_components as rc ON ac.id=rc.record_id \
JOIN components AS co ON rc.component_id=co.id \
JOIN components_scores AS cs ON co.id=cs.component_id \
JOIN scores AS sc ON cs.score_id=sc.id \
ORDER BY sc.name; \
\"")
echo "table<<EOF" >> $GITHUB_OUTPUT
echo "$TABLE" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Check accounting table
run: |
echo "${{ steps.table.outputs.table }}" | grep -q "HEPscore23 | 45.6"
echo "${{ steps.table.outputs.table }}" | grep -q "HEPSPEC | 12.3"
- name: Stop docker containers
working-directory: containers/htcondor
run: docker compose -f docker-compose.yaml down