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
stopaction 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 casesstopwill be issued from a separate terminal session. In the examplestopis 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.contfile disappears (which is practically irrelevant but is mentioned for the sake of completeness). - After the
startaction work actions will continue to process the task queue. (And the.contfile exists again.) - The
moreaction 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 ofmoreis non-zero if all tasks are completed or processing was interrupted by thestopaction (and in either case no subsequent job would be submitted).
shell$cat task.listsleep 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 stopshell$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 3shell$jobber task.list startshell$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$