PROBLEM:. Given the number of jobs in Jenkins / Hudson, each is assigned a number, which we can call a level. This number varies from 1 to n, and several tasks can have the same level. Now I would like to define those (otherwise independent) tasks to run in such a way that level 1 should be created before level 2, and . I would like Jenkins / Hudson to run several tasks at the same level in parallel, if the subordinate performers on whom the tasks are set are free.
The fact that this level number does not matter, he simply identified to explain the problem.
IMPORTANT: I would like to automatically generate these tasks, because I know which tasks depend on them and which can be executed in parallel, so if the solution is some configuration in the config.xml file, it would be nice to hear about it so that I can The script will automatically generate these configuration files.

Thank you for your time.
EDIT: There is another question that I would like to know if there is some elegant solution: if task X is launched using the Build Flow Plugin and it fails. Is there a way if I want the Build Flow plugin to start the same job again (after I fixed it) and continue normally for tasks defined through the plugin?
Moni source share