task-spooler icon indicating copy to clipboard operation
task-spooler copied to clipboard

'ts -S 0' should be allowed, to gracefully end current active jobs and not start any new jobs - feature request

Open codeisnotcode opened this issue 1 year ago • 1 comments

There is currently no way to allow all currently running jobs to end, and to not start any new jobs that are queued.

This would be a useful capability when a server needs to be brought down for maintenance but one does not want to kill currently running jobs.

An easy way to enable this would be to allow use of the the command 'ts - S 0' to prevent any new jobs from starting. Currently 'ts -S 0' returns an error of 'You should set at minimum 1 slot.' and does not reduce the slot count to zero. Can you add this as a feature request?

Thanks for your great work updating ts to make it GPU compatible!

codeisnotcode avatar Apr 23 '25 06:04 codeisnotcode

Here are the changes that seem to enable -S 0.
lines 293, 294 in main.c gets changed to:

            if (command_line.max_slots < 0) { /* -S 0 lets active jobs end without starting new ones. */
                fprintf(stderr, "You should set to 0 or more slots.\n"); /* was: You should set at minimum 1 slot.\n */

and line 1588 in jobs.c gets changed to:

if (new_max_slots >= 0)  /* -S 0 lets active jobs end without starting new ones. */

codeisnotcode avatar Apr 24 '25 04:04 codeisnotcode