def accounting(logger, acctfile): ''' Set up PyLSF and return accounting file name. Expects a logger and an accounting log file name. Returns the accounting log file name that has been decided upon (for book keeping purposes). ''' import pylsf lsb = pylsf.lsb_init("pylsf-lsb.acct") if lsb == -1: #logging.warning("lsb_init() returned -1 -- Fishy?") pass if acctfile: # Use suggested accounting file logger.info("Opening custom acct file: %s" % acctfile) else: # Try default accounting file acctfile = DFTACCT logger.info("No accounting file suggested") logger.info("Opening default acct file: %s" % acctfile) return acctfile
import pylsf a = pylsf.lsb_init("pylsf-lsb.acct") b = pylsf.lsb_geteventrec("/usr/share/lsf/work/makalu/logdir/lsb.events") while 1: c = b.read() if not c: break else: print c