Concrete class representing a job that is a container for other jobs.
In addition to constructor arguments and attributes defined by |Job|, the constructor of this class accepts two keyword arguments:
* ``children`` -- should be a list (or other iterable container) containing children jobs.
* ``childrunner`` -- by default all the children jobs are run using the same |JobRunner| as the parent job. If you wish to use a different |JobRunner| for children, you can pass it using this argument.
Values passed as ``children`` and ``childrunner`` are stored as instance attributes and can be adjusted later, but before the |run| method is called.
This class defines no new methods that could be directly called in your script.
When executed, a multijob runs all its children using the same |run| arguments. If you need to specify different run flags for children you can do it by manually setting them in children job |Settings|::
>>> childjob.settings.run.arg = 'value'
Since ``run`` branch of settings gets soft-updated by run flags, value set this way is not overwritten by parent job.
Job folder of a multijob gets cleaned independently of its children. See |cleaning| for details.
def qmworks.plams.core.basejob.MultiJob.new_children |
( |
|
self | ) |
|
Generate new children jobs.
This method is useful when some of children jobs are not known beforehand and need to be generated based on other children jobs, like for example in any kind of self-consistent procedure.
The goal of this method is to produce new portion of children jobs. Newly created jobs **have to** be manually added to ``self.children`` and, besides that, returned as a list by this method. No adjustment of newly created jobs' ``parent`` attribute is needed. This method **cannot** modify ``_active_children`` attribute.
The method defined here is a default template, returning an empty list, which means no new children jobs are generated and the entire execution of the parent job consists only of running jobs initially found in ``self.children``. To modify this behavior you can override this method in |MultiJob| subclass or use one of |binding_decorators|, just like with :ref:`prerun-postrun`.