General classes and functions related to output files, in particular when running under jobcontrol.


Bases: Exception

__init__(*args, **kwargs)

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self. str, logfile: bool = False)

Convenience wrapper for FileLogger.register_file() when using “with FileLogger:” context management. See FileLogger docstring for more details.

class str, do_recover: bool)

Bases: object

Class to register output files. This is basically a wrapper for jobcontrol.

__init__(jobname: str, do_recover: bool)
  • jobname – jobname

  • do_recover – if False, update the .recover file

register_file(fname: str, logfile: bool)

Register file in CWD as a jobcontrol output file.

If the file already exists, this call will also request JC to copy it to the launch machine imminently, which is useful for returning intermediate results before the whole workflow ends. e.g. such output files could be re-used in a recover/restart in case of job failure.

To stream the file, use logfile=True. But note this doesn’t work well where the change cannot simply be appended.

  • fname – file name

  • logfile – register as a streamed log file str

Get the path from which the job was launched. If it’s a local job it will be the CWD. str

Return the path to the CWD, relative to the current job’s launch directory. If the CWD is the same as the launch directory, then the path is returned as an empty string (does not contain ‘.’) str)

Register the file fname as the output structure file with jobcontrol, assumes the file fname, is in the cwd. str)

Copy the file fname running under jobcontrol to the launch dir. <property object at 0x7fa9ffa9bae0>)

Register files held in a job record from the working dir to the launch dir associated with a jobcontrol backend. This function can handle jobs launched in subdirectories.


job_id – jobcontrol job id str, replace: bool = False) str str, infiles: List[str], status: dict, write_jname: bool = False, include_failures: bool = False)

Collect output CTs from Jaguar jobs into a single .mae file

  • outmaefile – name of output .mae file

  • infiles – subjob input files, including suffix, e.g.

  • status – status of each subjob indexed by filename

  • write_jname – add JNAME property to structure

  • include_failures – If True include failures in output maestro file and group structures by status. If False only successful jobs are retained. str, smapfile: str)

Write a .smap file containing the associations between CT index numbers in the outmaefile, and .vib, .vis, .spm files. This function relies on CT’s in the .mae file having a property s_j_jname (stored in JNAME) which maps to the name of the .vib etc file.