Last active
March 23, 2024 13:40
-
-
Save pacarvalho/711e29ba538f89ee5fc721529e785221 to your computer and use it in GitHub Desktop.
Sample Github Action Workflow To Enqueue Job With SLURM Cluster
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: SLURM Enqueue Workflow | |
on: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
enqueue: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get a short version of the GIT commit SHA to use in naming files | |
id: getshortsha | |
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Copy files over to the cluster | |
uses: garygrossgarten/github-action-scp@v0.6.0 | |
with: | |
local: . | |
remote: "your-directory/${{ steps.getshortsha.outputs.sha_short }}" | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
- name: Execute script to enqueue job in cluster | |
uses: appleboy/ssh-action@v0.1.3 | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USERNAME }} | |
password: ${{ secrets.SSH_PASSWORD }} | |
script: | | |
cd "your-directory/${{ steps.getshortsha.outputs.sha_short }}" | |
mv job-sbatcher.sh ${{ steps.getshortsha.outputs.sha_short }}-job-sbatcher.sh | |
sbatch ${{ steps.getshortsha.outputs.sha_short }}-job-sbatcher.sh.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment