use latest rust version in container #2249
Workflow file for this run
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@v5 | |
with: | |
python-version: 3.9 | |
- name: Create fake .cargo/config.toml | |
run: | | |
mkdir -p .cargo | |
echo -e "[env]\nSQLX_OFFLINE = \"true\"" >> .cargo/config.toml | |
- name: Build pyauditor | |
uses: messense/maturin-action@v1 | |
with: | |
target: x86_64 | |
manylinux: auto | |
command: build | |
args: --release -o dist --interpreter python3.9 --manifest-path pyauditor/Cargo.toml | |
- 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 pyauditor in container | |
run: | | |
docker cp dist/python_auditor-*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/python_auditor-*.whl" | |
- name: Install collector in container | |
run: | | |
docker cp dist/auditor_htcondor_collector-*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 2>&1 | tee auditor-htcondor-collector.log" | |
- 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: "Collector logs" | |
run: | | |
docker exec -u submituser -w /home/submituser htcondor-auditor-collector-1 bash -l -c "cat auditor-htcondor-collector.log" | |
- name: "Auditor logs" | |
run: | | |
docker logs htcondor-auditor-1 | |
- name: Query accounting table | |
id: table | |
run: | | |
TABLE=$(docker exec htcondor-postgres-1 \ | |
bash -c "psql -U postgres -d auditor -c \" \ | |
SELECT runtime, \ | |
(score->>'name') AS name, \ | |
(score->>'value')::double precision AS value \ | |
FROM auditor_accounting, \ | |
jsonb_array_elements(components) AS comp, \ | |
jsonb_array_elements(comp->'scores') AS score \ | |
ORDER BY 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 |