I'd like to clean up the queue and remove pending jobs with the status DependencyNeverSatisfied.
Instead of executing scancel for each job ID in that status, I was wondering if there exists any option that allows it to do in batch.
There are multiple ways to address this with a Bash one-liner. One possible solution is:
squeue -h -t PD -O jobid,reason | awk '/DependencyNeverSatisfied/ {print $1}' | xargs scancel
The squeue
command is run with the -h
option to remove headers, -t
option to filter out jobs that are not in a PENDING state, and -O
is used to show only the job id and the reason. The list is fed to awk
that print job ids of those jobs that are pending for the "DependencyNeverSatisfied" reason, and then fed to xargs
to call scancel
on those job ids.
As a sanity check you can insert an echo
to see what would be executed rather than actually executing it:
squeue -h -t PD -O jobid,reason | awk '/DependencyNeverSatisfied/ {print $1}' | xargs echo scancel