jobber examples: stop-start-more
This example shows the interplay of
which can be used to interrupt processing of the task queue.jobber task_list stop jobber task_list start jobber task_list more
more
can be employed in a batch job chain to decide whether a subsequent job should be submitted.
- The
stop
action can be used to make all jobber processes that are actually running stop after finishing their current tasks. This works for jobber processes that are running in interactive and batch environments. In both casesstop
will be issued from a separate terminal session. In the examplestop
is issued in the same session (due to the sequential nature of the presentation format). However, the example demonstrates the effects ofstop
: a subsequent work action does nothing although there are 7 more unprocessed tasks, and the.cont
file disappears (which is practically irrelevant but is mentioned for the sake of completeness). - After the
start
action work actions will continue to process the task queue. (And the.cont
file exists again.) - The
more
action was implemented in order to simplify scripting, in particular for batch job chains where the typical usage is expected to be:jobber task_list more && submit same_jobber_job_again
From the command line above it is clear that the exit status is the essential outcome. In the example the exit status is translated into clear text with an if-else statement. Note that the exit status ofmore
is non-zero if all tasks are completed or processing was interrupted by thestop
action (and in either case no subsequent job would be submitted).
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:53:47] appended 10 tasks shell$jobber task.list 3
[2022-04-01T13:53:47] 1.1 task.worker: sleep 1; echo '### this is task 1 ###' ### this is task 1 ### [2022-04-01T13:53:48] 1.1 exit status: 0 [2022-04-01T13:53:48] 2.2 task.worker: sleep 1; echo '### this is task 2 ###' ### this is task 2 ### [2022-04-01T13:53:49] 2.2 exit status: 0 [2022-04-01T13:53:49] 3.3 task.worker: sleep 1; echo '### this is task 3 ###' ### this is task 3 ### [2022-04-01T13:53:50] 3.3 exit status: 0 shell$ls -l task.list*
-rw------- 1 user group 391 Apr 1 13:53 task.list -rw------- 1 user group 0 Apr 1 13:53 task.list.cont -rw------- 1 user group 596 Apr 1 13:53 task.list.queue shell$jobber task.list stop
shell$ls -l task.list*
-rw------- 1 user group 391 Apr 1 13:53 task.list -rw------- 1 user group 596 Apr 1 13:53 task.list.queue ifjobber task.list more
; then echo 'there is more work'; else echo 'there is nothing to do at the moment'; fi there is nothing to do at the moment shell$jobber task.list 3
shell$jobber task.list start
shell$ls -l task.list*
-rw------- 1 user group 391 Apr 1 13:53 task.list -rw------- 1 user group 0 Apr 1 13:53 task.list.cont -rw------- 1 user group 596 Apr 1 13:53 task.list.queue ifjobber task.list more
; then echo 'there is more work'; else echo 'there is nothing to do at the moment'; fi there is more work shell$jobber task.list 3
[2022-04-01T13:53:50] 4.4 task.worker: sleep 1; echo '### this is task 4 ###' ### this is task 4 ### [2022-04-01T13:53:51] 4.4 exit status: 0 [2022-04-01T13:53:51] 5.5 task.worker: sleep 1; echo '### this is task 5 ###' ### this is task 5 ### [2022-04-01T13:53:52] 5.5 exit status: 0 [2022-04-01T13:53:52] 6.6 task.worker: sleep 1; echo '### this is task 6 ###' ### this is task 6 ### [2022-04-01T13:53:53] 6.6 exit status: 0 shell$