Running in parallel
Some GAIn tools split their work into tasks and run the tasks in parallel: annotate_tabular, annotate_vcf, binning_tool and grr_manage. Each of these tools builds a task graph: a set of tasks and the order in which they must run. A task executor runs the task graph. The options on this page choose the task executor, the number of workers, and which tasks run again.
The table in Which tool takes what shows which options each tool takes.
How many workers
-j N (also --jobs) sets the number of workers.
-j 1runs the tasks one after another, in the tool’s own process. With--fork-tasks, each task runs in a new process instead.A run without
-jstarts the default named cluster. The bundled default islocal, a dask cluster on this machine. dask sizes its workers to the CPU count of the machine.-j NwithNabove 1 starts the default named cluster withNworkers. When-Nor-cnames a different cluster, the tool starts that cluster withNworkers.--process-pool(also--pp) together with-j Nruns a pool ofNprocesses on this machine instead of a dask cluster. Without-j, the pool has one process for each CPU of the machine.--fork-tasks(also--fork-taskand--fork) starts a new process for each task, with-j 1or on a dask cluster. With--process-poolit has no effect.
# Run the tasks one after another.
annotate_tabular input.tsv.bgz pipeline.yaml -j 1
# Run the tasks on the default named cluster with 8 workers.
annotate_tabular input.tsv.bgz pipeline.yaml -j 8
# Run the tasks in a pool of 8 processes.
annotate_tabular input.tsv.bgz pipeline.yaml -j 8 --process-pool
Do not give -N or -c together with -j 1 or --process-pool.
These two task executors do not use a dask cluster.
The annotate tools can split the input into regions only when the input has
a tabix index and --region-size is above 0. Otherwise they run the tasks
one after another, as with -j 1, whatever -j says. On such an input,
-N or -c makes the tool stop with an error.
Named clusters
A named cluster is a cluster definition that is stored under a name in the named cluster file.
-N <name>(also--dask-cluster-nameand--dcn) runs the tasks on the named cluster<name>.-c <file>(also--dccfand--dask-cluster-config-file) runs the tasks on the cluster that<file>defines. The file holds one cluster definition without a name.
annotate_tabular input.tsv.bgz pipeline.yaml -N slurm_large -j 100
Named clusters describes the named cluster file, its shape and how your own file merges with the bundled file.
Reruns
The annotate tools and binning_tool record each finished task in the
task status directory. When you run the same command again, the tool skips
the tasks that finished and runs only the rest. Thus a run that stopped
halfway continues where it stopped.
A run that succeeds removes the work directory that it created, and the
default task status directory with it. So after a successful run, the same
command runs all the tasks again. The task status directory stays after a
failed run, with --keep-work-dir or --keep-parts, when -w names a
work directory that already exists, or when -d names a directory outside
the work directory.
-d <dir>(also--task-status-dirand--tsd) names the task status directory. By default it is.task-statusin the work directory of the tool.--force(also-f) ignores the task status directory and runs all the tasks again.-t <id> ...(also--task-ids) runs only the tasks with the given task ids and all the tasks that they depend on. The tool still skips a task that the task status directory records as finished. With--force, or with no task status directory, the tool runs all these dependencies again, and for a late task that can be most of the task graph.--keep-goingcontinues with the other tasks after a task fails. Thegrr_managesubcommands always continue, so for them the option changes nothing.--task-log-dir <dir>names a directory for the logs of the tasks. By default it is.task-login the work directory of the tool. Forgrr_manage, the default is.task-login the repository.
# Run again only the tasks that did not finish.
annotate_vcf input.vcf.gz pipeline.yaml -j 8
# Run all the tasks again.
annotate_vcf input.vcf.gz pipeline.yaml -j 8 --force
The annotate tools also take an optional command after the positional arguments:
runruns the task graph. This is the default.listlists the tasks and does not run them.statusis the same aslist.
Which tool takes what
Tool |
Options |
|---|---|
|
All the options on this page, and the optional command |
|
All the options on this page, and the optional command |
|
All the options on this page. It takes no command. |
|
The subcommands |
grr_cache_repo has a -j of its own, with the default 4, and none of
the other options on this page.