def __call__(self, logger): """ Method invoked after parsing the last text file. It automatically inherits the values of the following attributes: dbfile, directory, the sys namespace, the data namespace and the user namespace This method provides additional information in case the debug level has been requested. """ childlogger = logger.getChild(self.__class__.__module__ + '.' + self.__class__.__name__) childlogger.addFilter(logutils.ContextFilter()) childlogger.debug(""" %s * dbfile : %s * directory : %s * namespace : %s * data namespace : %s * user namespace : %s """ % (self.__class__.__name__, self.dbfile, self.directory, self.namespace, self.data, self.user))
def __call__(self, logger): """ Method invoked after parsing every text file. It automatically inherits the values of the following attributes: textfile, dbfile, direcftory, startparsetime, endparsetime, the sys namespace, the data namespace and the user namespace The Epilogue provides additional information in case the debug level is requested """ childlogger = logger.getChild(self.__class__.__module__ + '.' + self.__class__.__name__) childlogger.addFilter(logutils.ContextFilter()) childlogger.debug(""" %s * text file : %s * dbfile : %s * directory : %s * startparsetime : %s * endparsetime : %s * namespace : %s * data namespace : %s * user namespace : %s """ % (self.__class__.__name__, self.textfile, self.dbfile, self.directory, self.startparsetime, self.endparsetime, self.namespace, self.data, self.user))
def __call__(self, logger): """ Method invoked before the execution of the solver with the very first test case. It automatically inherits the values of the following attributes: solver, tstspec, dbspec, timeout, memory, check, basedir, resultsdir, compress, namespace, user namespace and stats. This method provides additional information in case the debug level is requested """ childlogger = logger.getChild(self.__class__.__module__ + '.' + self.__class__.__name__) childlogger.addFilter(logutils.ContextFilter()) childlogger.debug(""" %s: * solver : %s * timeout : %d seconds * memory : %d bytes * check : %.2f seconds * basedir : %s * resultsdir : %s * compress : %s * namespace : %s * user namespace: %s""" % (self.__class__.__name__, self.solver, self.timeout, self.memory, self.check, self.basedir, self.resultsdir, self.compress, self.namespace, self.user))
def __init__(self, solver, tstfile, dbfile, timeout, memory, output, check, directory, compress, jobname, nonice, notify, copyfiles, transfer_input_files, transfer_output_files, submit, logfile, loglevel, quiet): """ creates an instance of a new Condor Description File which is used to run testbot with the given parameters considering only a single solver """ # copy the attributes - note that both the directory and the logfile are # normalizedq (self._solver, self._tstfile, self._dbfile, self._timeout, self._memory, self._output, self._check, self._directory, self._compress, self._jobname, self._nonice, self._notify, self._copyfiles, self._transfer_input_files, self._transfer_output_files, self._submit, self._logfile, self._loglevel, self._quiet) = \ (solver, tstfile, dbfile, timeout, memory, output, check, os.path.normpath(directory), compress, jobname, nonice, notify, copyfiles, transfer_input_files, transfer_output_files, submit, logfile, loglevel, quiet) # make sure to process the logfile correctly in case it was given a # value if logfile: self._logfile = os.path.normpath(logfile) # likewise, normalize the directories given in # transfer_input/output_files as well self._transfer_input_files = map(lambda x: os.path.normpath(x), self._transfer_input_files) self._transfer_output_files = map(lambda x: os.path.normpath(x), self._transfer_output_files) # set up a logger logutils.configure_logger(os.getcwd(), None, args.level) self._logger = logging.getLogger("Main") self._logger.addFilter(logutils.ContextFilter()) # check that the given parameters are correct ---this is just done for the # sake of consistency but all that this function does is to show a warning # in case no-nice has been specified self.check_flags() # give this job a meaningful name if the user did not provide one - by # default, condor jobs are named after the executable. In case the user # provided a job name, it is appended to the exec name; otherwise, # '.condor' is added to it self._jobname = os.path.basename(self._solver) if jobname: self._jobname += '.' + jobname else: self._jobname += '.condor' # show the parameters provided by the command line on the console self.show_switches()
def __call__(self, logger): """ Method invoked after the execution of the solver with regard to every test case. It automatically inherits the values of the following attributes: solver, tstspec, itest, dbspec, timeout, memory, output, check, basedir, resultsdir, compress, namespace, data namespace, user namespace, param namespace, regexp namespace, stats, startruntime and endruntime. The Epilogue provides additional information in case the debug level is requested """ childlogger = logger.getChild(self.__class__.__module__ + '.' + self.__class__.__name__) childlogger.addFilter(logutils.ContextFilter()) childlogger.debug(""" %s: * solver : %s * itest : %s * timeout : %d seconds * memory : %d bytes * output : %s * check : %.2f seconds * basedir : %s * resultsdir : %s * compress : %s * startruntime: %i * endruntime : %i * namespace : %s * data namespace: %s * user namespace: %s * param namespace: %s * regexp namespace: %s""" % (self.__class__.__name__, self.solver, self.itest, self.timeout, self.memory, self.output, self.check, self.basedir, self.resultsdir, self.compress, self.startruntime, self.endruntime, self.namespace, self.data, self.user, self.param, self.regexp))
def test_case(self): """ test case - it just invokes the autobot with all the information passed in the command line """ # invoke the main service provided by autobot self.go(self.args.file, self.args.db, self.args.dbname, directory=self.args.directory, compress=self.args.bz2, argnamespace=self.args, output=self.args.output, logger=self.logger, logfilter=logutils.ContextFilter(), prologue=Prologue, epilogue=Epilogue, enter=Enter, windUp=WindUp, quiet=self.args.quiet)
def setUp(self): """ set up the environment. This method is executed only once before all the test_ methods """ # --- parsing # parse arguments using a parser specifically designed for testbot self.args = parsetools.BotParseArgParser().parse_args() # --- logging # configure the main logger logutils.configure_logger(self.args.directory, self.args.logfile, self.args.level) self.logger = logging.getLogger(self.__class__.__module__ + '.' + self.__class__.__name__) self.logger.addFilter(logutils.ContextFilter()) self.logger.debug(" setUp finished")