Typo in file name #28
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: Run Simple R Script on HPC via Slurm | |
on: | |
push: | |
branches: | |
- feature/ci-cd-pipeline | |
jobs: | |
test-hpc: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set Up SSH Access | |
run: | | |
mkdir -p ~/.ssh | |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa | |
chmod 600 ~/.ssh/id_rsa | |
ssh-keyscan -H login-00.discovery.neu.edu >> ~/.ssh/known_hosts | |
- name: Transfer Files to HPC | |
run: | | |
scp benchmark/benchmark.R benchmark/config.slurm raina.ans@login-00.discovery.neu.edu:/home/raina.ans/R | |
- 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 is still running...' | |
sleep 10 | |
done | |
echo 'Job has completed.' | |
" | |
- name: Fetch Output | |
run: | | |
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: Upload Output as Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: benchmark-output | |
path: | | |
job_output.txt | |
job_error.txt |