replace datetime.utcfromtimestamp #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |