Package schrodinger :: Package application :: Package jaguar :: Module file_logger :: Class FileLogger
[hide private]
[frames] | no frames]

Class FileLogger

object --+
         |
        FileLogger

Class to store names of output files and archive them so that a single file can be registered with jobcontrol and returned from the work directory to the user.

Instance Methods [hide private]
 
__init__(self, name, debug)
x.__init__(...) initializes x; see help(type(x)) for signature
 
__enter__(self)
Support context management "with" statement.
 
__exit__(self, exc_type, exc_value, exc_traceback)
Support context management "with" statement.
 
add_archive_file(self, filename)
 
write_archive(self)
Write the archive with all the files added to the list.
 
register_file(self, fname, archive)
Register the file fname with jobcontrol as a log file, or if archive=True add it to an archive of output files to be returned as one (zip) file at the end of the job.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, name, debug)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • name (str) - name of archive file
Overrides: object.__init__

__enter__(self)

 

Support context management "with" statement. On entering the context, set a module variable so that we can conveniently use this class without passing a class instance around the backend scripts.

__exit__(self, exc_type, exc_value, exc_traceback)

 

Support context management "with" statement. On exiting context, this method calls a function to create and register the file archive.

add_archive_file(self, filename)

 
Parameters:
  • filename (str) - name of file to archive at end of job

write_archive(self)

 

Write the archive with all the files added to the list. Register the archive file with jobcontrol as an output file.

register_file(self, fname, archive)

 

Register the file fname with jobcontrol as a log file, or if archive=True add it to an archive of output files to be returned as one (zip) file at the end of the job.

Note that if self.debug is True, archiving is ignored.

Parameters:
  • archive (bool) - if True, the file is registered as an archive file.