jobber examples: time limit
In this example the --time
option is used to determine when to stop working (in a batch job).
- A time limit in seconds is set via
--time
. (Alternatively, an end time can be specified with the--endtime=YYYY-MM-DDThh:mm:ss
option, see the jobber batch job examples page.) --time-method
sets the method to determine the minimal time needed before the time limit is reached to allow the next task to be started. The value of--time-method
can be either a fixed number of seconds or a factor followed by one ofmin
,mean
, andmax
(like the default2max
) for using the minimal, mean, or maximal past task run times.
shell$cat task.list
sleep 1; echo '### this is task 1 ###' sleep 1; echo '### this is task 2 ###' sleep 1; echo '### this is task 3 ###' sleep 1; echo '### this is task 4 ###' sleep 1; echo '### this is task 5 ###' sleep 1; echo '### this is task 6 ###' sleep 1; echo '### this is task 7 ###' sleep 1; echo '### this is task 8 ###' sleep 1; echo '### this is task 9 ###' sleep 1; echo '### this is task 10 ###' shell$jobber task.list init
[2022-04-01T13:12:58] appended 10 tasks shell$jobber --time=5 --time-method=2max task.list all
[2022-04-01T13:12:58] 1.1 task.worker: sleep 1; echo '### this is task 1 ###' ### this is task 1 ### [2022-04-01T13:12:59] 1.1 exit status: 0 [2022-04-01T13:12:59] 2.2 task.worker: sleep 1; echo '### this is task 2 ###' ### this is task 2 ### [2022-04-01T13:13:00] 2.2 exit status: 0 [2022-04-01T13:13:00] 3.3 task.worker: sleep 1; echo '### this is task 3 ###' ### this is task 3 ### [2022-04-01T13:13:01] 3.3 exit status: 0 [2022-04-01T13:13:01] 4.4 task.worker: sleep 1; echo '### this is task 4 ###' ### this is task 4 ### [2022-04-01T13:13:02] 4.4 exit status: 0 shell$jobber --time=5 --time-method=2max task.list all
[2022-04-01T13:13:02] 5.5 task.worker: sleep 1; echo '### this is task 5 ###' ### this is task 5 ### [2022-04-01T13:13:03] 5.5 exit status: 0 [2022-04-01T13:13:03] 6.6 task.worker: sleep 1; echo '### this is task 6 ###' ### this is task 6 ### [2022-04-01T13:13:04] 6.6 exit status: 0 [2022-04-01T13:13:04] 7.7 task.worker: sleep 1; echo '### this is task 7 ###' ### this is task 7 ### [2022-04-01T13:13:05] 7.7 exit status: 0 [2022-04-01T13:13:05] 8.8 task.worker: sleep 1; echo '### this is task 8 ###' ### this is task 8 ### [2022-04-01T13:13:06] 8.8 exit status: 0 shell$jobber --time=5 --time-method=2max task.list all
[2022-04-01T13:13:06] 9.9 task.worker: sleep 1; echo '### this is task 9 ###' ### this is task 9 ### [2022-04-01T13:13:07] 9.9 exit status: 0 [2022-04-01T13:13:07] 10.10 task.worker: sleep 1; echo '### this is task 10 ###' ### this is task 10 ### [2022-04-01T13:13:08] 10.10 exit status: 0 shell$