Janet 1.37.1-83e8aab Documentation
(Other Versions: 1.36.0 1.35.0 1.34.0 1.31.0 1.29.1 1.28.0 1.27.0 1.26.0 1.25.1 1.24.0 1.23.0 1.22.0 1.21.0 1.20.0 1.19.0 1.18.1 1.17.1 1.16.1 1.15.0 1.13.1 1.12.2 1.11.1 1.10.1 1.9.1 1.8.1 1.7.0 1.6.0 1.5.1 1.5.0 1.4.0 1.3.1 )

Task Runner (Batch Job Scheduler)

Index

tasker/all-tasks tasker/cancel-task tasker/close-queues tasker/default-expiration tasker/default-priority tasker/default-task-directory tasker/err-file-name tasker/max-priority tasker/min-priority tasker/new-tasker tasker/out-file-name tasker/queue-task tasker/run-cleanup tasker/run-executors tasker/spawn-executors tasker/statuses tasker/task-file tasker/task-meta-name tasker/task-status


tasker/all-tasks function source
(all-tasks tasker &opt detailed)

Get an array of all task ids for which there is still data on disk. If `detailed` is truthy, return full task metadata instead of ids.

tasker/cancel-task function source
(cancel-task tasker task-id)

Cancel a queued or running task.

tasker/close-queues function source
(close-queues tasker)

Prevent any tasks from being added to queues. When an executor finishes its current job, if there are any, it will terminate. When all executors complete, the call to `run-executors` will complete.

tasker/default-expiration number source
Default expiration time (1 day)

tasker/default-priority number source
Default task priority

tasker/default-task-directory string source
Default location of task records

tasker/err-file-name string source
Name of the file for logging errors

tasker/max-priority number source
Maximum allowed priority (lower priority tasks will execute first)

tasker/min-priority number source
Minimum allowed priority (lower priority tasks will execute first)

tasker/new-tasker function source
(new-tasker &opt task-directory queues queue-size)

Create queues and various settings to run tasks. Create a new tasker table.

tasker/out-file-name string source
Name of the file for general logging

tasker/queue-task function source
(queue-task tasker argv &opt note priority qname timeout expiration input)

Add a task specification to a queue. Supply an argv string array that will be used to invoke a subprocess. The optional `note` parameter is just a textual note for task tracking. The `priority` parameter should be an integer between 0 and 9 inclusive, default is 4. Lower priority jobs in the same queue will be executed by higher priority. Use input to pass in generic, unstructured input to a task.

tasker/run-cleanup function source
(run-cleanup tasker)

Delete old expired jobs saved on disk

tasker/run-executors function source
(run-executors tasker &opt workers-per-queue pre-task post-task)

Start a number of executors to run tasks as with `tasker/spawn-executors`, and then wait for all executors to complete.

tasker/spawn-executors function source
(spawn-executors tasker &opt qnames workers-per-queue pre-task post-task)

Start a number of executors to run tasks. Tasks can be added to a queue by calling queue-task. A single tasker object can make multiple calls to spawn-executors.

tasker/statuses tuple source
A tuple of all possible statuses that a task can have.

tasker/task-file function source
(task-file tasker task-id &opt file-name)

Get a log file for a path. By default, will get a path to out.log.

tasker/task-meta-name string source
Name of the task metadata file

tasker/task-status function source
(task-status tasker task-id)

Look up the status of a given task by id.