- Difficulty level: easy
- Time need to lean: 10 minutes or less
- Key points:
sos status
lists status of taskssos kill
terminates running taskssos queue
remove tasks from the systemsos execute
executes tasks on a specified host
Command
sos status [tasks] -q queue
checkes the status of tasks. You can specify any number of first characeters of a task to specify a task, for example,
sos task 7
sos task 77e
sos task 7736e
would all work for a task with ID 77e36e7404cf6c2ef7079a09e84a4d6d
, but multiple tasks could be identifies if they share the same leading digits. Actually,
sos task
would match all tasks and list the status of all local tasks.
Option -q
specifies the task queue to monitor. For example,
sos status -q docker
would check the status of all tasks on a remote host docker
. You can monitor the tasks on docker
on any machine with defined host docker
.
Option -v
controls the details of the output of command sos status
. For example,
sos status e7404cf6c2 -v0
would print just the status of the task (e.g. running
).
sos task 77e -v1
would print the task id and their status
77e36e7404cf6c2ef7079a09e84a4d6d running
77e3c2ef7079a236e7404cf6c2f343d3 completed
Option -v0
and -v1
could check the status of multiple tasks, as realized by SoS. Some tasks queues have their own task status command and option -v2
(and upper) will use these commands (if specified) to check the status of the jobs. That is to say
sos task 77e36 -v2
If you would like to know more about the tasks,
sos task 77e36 -v3
would list the script the task is running and all variables in abbreviated format, and
sos task 77e36 -v4
would list details of tasks.
Command
sos kill [tasks] [-q queue]
kills specified or all tasks on specified job queue queue
. Because the same job could be executed on different queues (you have have done so), you will have to specify the correct queue name to kill the job on different queues.
Command
sos execute [tasks] [-q queue]
is the command that is used internally by sos run
to execute tasks but you could use this command to execute tasks externally. For example, if a task failed on a server, you could use command
sos execute task_id -q server
to execute the command on another server. Note that task_id
specifies a local task with local paths. The task will be converted to a remote task (with path names converted for that host) if server
specifies a remote host. This makes it easy for you to re-submit tasks to the same server after changing server configuration, or submit the same task to a different server.
Command sos purge
is equivalent to magic %task purge
from SoS Notebook.
Command sos purge
removes specified tasks, tasks matching specified criteria, or all tasks from local or remote host (option -q
).
For example, command
sos purge --all -q cluster
removes all tasks from a remote cluster,
sos purge --all --age 2d
removes all tasks that are created more than 2 days ago, and
sos purge -all -q cluster -s completed
removes all completed tasks from the remote cluster.
You can also specify the IDs of tasks to be removed, e.g.
sos purge 38ef
removes all tasks with ID starting with 38ef
.
Finally, if you would like to remove all tasks related information, including tasks that are not generated by workflows from the current project (directory), you can use command
sos purge --all
to clear all information.