-
Notifications
You must be signed in to change notification settings - Fork 46
70 lines (60 loc) · 2.59 KB
/
benchmark.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
name: Run Simple R Script on HPC via Slurm
on:
push:
branches:
- feature/ci-cd-pipeline
jobs:
Benchmarking-pipeline:
runs-on: ubuntu-latest
env:
FDR_THRESHOLD: 0.2
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set Up SSH Access
run: |
mkdir -p ~/.ssh
touch ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
ssh-keyscan -H login-00.discovery.neu.edu >> ~/.ssh/known_hosts || exit 1
- name: Transfer Files to HPC
run: |
# scp benchmark/benchmark.R benchmark/config.slurm raina.ans@login-00.discovery.neu.edu:/work/VitekLab/Projects/Benchmarking || exit 1
scp benchmark/benchmark.R benchmark/config.slurm raina.ans@login-00.discovery.neu.edu:/home/raina.ans/R || exit 1
- name: Submit Slurm Job and Capture Job ID
id: submit_job
run: |
ssh raina.ans@login-00.discovery.neu.edu "cd R && sbatch config.slurm" | tee slurm_job_id.txt
slurm_job_id=$(grep -oP '\d+' slurm_job_id.txt)
echo "Slurm Job ID is $slurm_job_id"
echo "slurm_job_id=$slurm_job_id" >> $GITHUB_ENV
- name: Monitor Slurm Job
run: |
ssh raina.ans@login-00.discovery.neu.edu "
while squeue -j ${{ env.slurm_job_id }} | grep -q ${{ env.slurm_job_id }}; do
echo 'Job Id : ${{ env.slurm_job_id }} is still running...'
sleep 10
done
echo 'Job has completed.'
"
- name: Fetch Output
run: |
# scp raina.ans@login-00.discovery.neu.edu:/work/VitekLab/Projects/Benchmarking/job_output.txt job_output.txt
# scp raina.ans@login-00.discovery.neu.edu:/work/VitekLab/Projects/Benchmarking/job_error.txt job_error.txt
scp raina.ans@login-00.discovery.neu.edu:/home/raina.ans/R/job_output.txt job_output.txt
scp raina.ans@login-00.discovery.neu.edu:/home/raina.ans/R/job_error.txt job_error.txt
- name: Extract and Check FDR Values
run: |
# Extract the relevant lines containing FDR values and process them
grep -A 5 "FPR Accuracy Recall FDR" job_output.txt > results_section.txt
if awk -v threshold= $FDR_THRESHOLD 'NR > 1 { if ($5 > threshold) { print "Error: FDR too high in row " NR " with FDR=" $5; exit 1 } }' results_section.txt; then
echo "All FDR values are within acceptable range."
fi
- name: Upload Output as Artifact
uses: actions/upload-artifact@v4
with:
name: benchmark-output
path: |
job_output.txt
job_error.txt