PyFrag
|
Public Member Functions | |
def | __init__ (self, job) |
def | refresh (self) |
def | collect (self) |
def | wait (self) |
def | grep_file (self, filename, pattern='', options='') |
def | awk_file (self, filename, script='', progfile=None, kwargs) |
def | grep_output (self, pattern='', options='') |
def | awk_output (self, script='', progfile=None, kwargs) |
def | rename (self, old, new) |
def | __getitem__ (self, name) |
Public Attributes | |
job | |
files | |
finished | |
done | |
General concrete class for job results. ``job`` attribute stores a reference to associated job. ``files`` attribute is a list with contents of the job folder. ``_rename_map`` is a class attribute with the dictionary storing the default renaming scheme. Bracket notation (``myresults[filename]`` can be used to obtain full absolute paths to files in the job folder. Instance methods are automatically wrapped with access guardian which ensures thread safety (see :ref:`parallel`).
def qmworks.plams.core.results.Results.__getitem__ | ( | self, | |
name | |||
) |
Magic method to enable bracket notation. Elements from ``files`` can be used to get absolute paths.
def qmworks.plams.core.results.Results.awk_file | ( | self, | |
filename, | |||
script = '' , |
|||
progfile = None , |
|||
kwargs | |||
) |
awk_file(filename, script='', progfile=None, **kwargs) Execute an AWK script on a file given by *filename*. The AWK script can be supplied in two ways: either by directly passing the contents of the script (should be a single string) as a *script* argument, or by providing the path (absolute or relative to the file pointed by *filename*) to some external file containing the actual AWK script using *progfile* argument. If *progfile* is not ``None``, the *script* argument is ignored. Other keyword arguments (*\*\*kwargs*) can be used to pass additional variables to AWK (see ``-v`` flag in AWK manual) Returned value is a list of lines (strings). See ``man awk`` for details.
def qmworks.plams.core.results.Results.awk_output | ( | self, | |
script = '' , |
|||
progfile = None , |
|||
kwargs | |||
) |
awk_output(script='', progfile=None, **kwargs) Shortcut for :meth:`~Results.awk_file` on the output file.
def qmworks.plams.core.results.Results.collect | ( | self | ) |
Collect the files present in the job folder after execution of the job is finished. This method is simply :meth:`~Results.refresh` plus rename according to ``_rename_map``. If you wish to override this function, you have to call the parent version at the beginning.
def qmworks.plams.core.results.Results.grep_file | ( | self, | |
filename, | |||
pattern = '' , |
|||
options = '' |
|||
) |
grep_file(filename, pattern='', options='') Execute ``grep`` on a file given by *filename* and search for *pattern*. Additional ``grep`` flags can be passed with *options*, which should be a single string containing all flags, space separated. Returned value is a list of lines (strings). See ``man grep`` for details.
def qmworks.plams.core.results.Results.grep_output | ( | self, | |
pattern = '' , |
|||
options = '' |
|||
) |
grep_output(pattern='', options='') Shortcut for :meth:`~Results.grep_file` on the output file.
def qmworks.plams.core.results.Results.refresh | ( | self | ) |
Refresh the contents of ``files`` list. Traverse the job folder (and all its subfolders) and collect relative paths to all files found there, except files with ``.dill`` extension. This is a cheap and fast method that should be used every time there is some risk that contents of the job folder changed and ``files`` list is no longer up-to-date. For proper working of various PLAMS elements it is crucial that ``files`` always contains up-to-date information about contents of job folder. All functions and methods defined in PLAMS that could change the state of job folder take care about refreshing ``files``, so there is no need to manually call :meth:`~Results.refresh` after, for example, :meth:`~Results.rename`. If you are implementing new method of that kind, don't forget about refreshing.
def qmworks.plams.core.results.Results.rename | ( | self, | |
old, | |||
new | |||
) |
rename(old, new) Rename a file from ``files``. In both *old* and *new* shortcut ``$JN`` can be used.
def qmworks.plams.core.results.Results.wait | ( | self | ) |
wait() Wait for associated job to finish. .. technical:: This is **not** an abstract method. It does exactly what it should: nothing. All the work is done by :func:`_restrict` decorator that is wrapped around it.