We have a group of subtasks but we don't want all of them to run when the main task is run. That is, if you run "doit foo" we want to run "foo:bar" and "foo:baz" but not "foo:bap". Experimentally this can be achieved by using "task_dep" or "calc_dep" on the top-level task (the one with name set to None) as follows:
def task_foo():
yield {
'name': 'bar',
'actions': ['echo bar'],
}
yield {
'name': 'baz',
'actions': ['echo baz'],
}
yield {
'name': 'bap',
'actions': ['echo bap'],
}
yield {
'name': None,
'task_dep': ['foo:bar', 'foo:baz'],
}
The following seems to work:
$ doit list --all
foo
foo:bap
foo:bar
foo:baz
$ doit -v2 foo
. foo:bar
bar
. foo:baz
However, I don't see this behavior documented. The documentation seems to imply that running `doit foo` would always run all sub-tasks. Is the behavior shown above intended and will it remain supported in the future?
For the curious, our use case is various build steps to generate disk images for a hardware device. There's a few different image types and many build steps and we don't want to clutter our "doit list" too much so grouping the tasks into subtasks is appealing. But we need a "calc_dep" to determine which steps are actually required (e.g. pull a remote Docker image if it exists with the right version, if not build it and push it).
Thanks,
Oliver