Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scripts for controlling job times sbatch #35

Open
wwarriner opened this issue Sep 11, 2023 · 0 comments
Open

Scripts for controlling job times sbatch #35

wwarriner opened this issue Sep 11, 2023 · 0 comments

Comments

@wwarriner
Copy link
Contributor

wwarriner commented Sep 11, 2023

function slurm-job-add-timelimit() {
    timelimit="$1"
    jobids=("${@:2}")
    
    for job in "${jobids[@]}"; do
      echo "$job"
      scontrol show job $job | grep TimeLimit | awk '{print "  Before: " $2}'
      scontrol update jobid=$job TimeLimit+="$timelimit"
      scontrol show job $job | grep TimeLimit | awk '{print "  After:  " $2}'
    done
}

function slurm-job-check-timelimit() {
    jobids=("${@:1}")
    
    for job in "${jobids[@]}"; do
      echo "$job"
      scontrol show job $job | grep TimeLimit | awk '{print "  Time Limit: " $2}'
    done
}

The following code could be useful in niche usecases, but it can also force a job to terminate if the input timelimit is shorter than the currently elapsed time.

function slurm-job-set-timelimit() {
    timelimit="$1"
    jobids=("${@:2}")
    
    for job in "${jobids[@]}"; do
      echo "$job"
      scontrol show job $job | grep TimeLimit | awk '{print "  Before: " $2}'
      scontrol update jobid=$job TimeLimit="$timelimit"
      scontrol show job $job | grep TimeLimit | awk '{print "  After:  " $2}'
    done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant