PyFrag
Public Member Functions | Public Attributes | List of all members
qmworks.plams.core.basejob.MultiJob Class Reference
Inheritance diagram for qmworks.plams.core.basejob.MultiJob:
Inheritance graph
[legend]
Collaboration diagram for qmworks.plams.core.basejob.MultiJob:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, children=None, childrunner=None, kwargs)
 
def new_children (self)
 
def hash (self)
 
def check (self)
 
def __iter__ (self)
 
- Public Member Functions inherited from qmworks.plams.core.basejob.Job
def __init__ (self, name='plamsjob', settings=None, depend=None)
 
def __getstate__ (self)
 
def run (self, jobrunner=None, jobmanager=None, kwargs)
 
def pickle (self, filename=None)
 
def check (self)
 
def hash (self)
 
def prerun (self)
 
def postrun (self)
 

Public Attributes

 children
 
 childrunner
 
- Public Attributes inherited from qmworks.plams.core.basejob.Job
 status
 
 results
 
 name
 
 path
 
 jobmanager
 
 parent
 
 settings
 
 default_settings
 
 depend
 

Detailed Description

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.

Member Function Documentation

◆ __iter__()

def qmworks.plams.core.basejob.MultiJob.__iter__ (   self)
Iterate through ``children``. If it is a dictionary, iterate through its values.
Here is the call graph for this function:

◆ check()

def qmworks.plams.core.basejob.MultiJob.check (   self)
Check if the calculation was successful. Returns ``True`` if every children job has its ``status`` attribute set to ``'successful'``.

◆ hash()

def qmworks.plams.core.basejob.MultiJob.hash (   self)
Hashing for multijobs is disabled by default. Return ``None``.

◆ new_children()

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`.
Here is the caller graph for this function:

The documentation for this class was generated from the following file: