def __init__(self, config=None): """ Set up queue manager. """ self.config = config or {} self.proxy = None self.last_start = 0 self.LOG = pymagic.get_class_logger(self) if 'log_level' in self.config: self.LOG.setLevel(config.log_level) self.LOG.debug("Queue manager created with config %r" % self.config) bool_param = lambda key, default: matching.truth( self.config.get(key, default), "job.%s.%s" % (self.config.job_name, key)) self.config.quiet = bool_param("quiet", False) self.config.startable = matching.ConditionParser( engine.FieldDefinition.lookup, "name").parse( "[ %s ] [ %s ]" % (config_ini.torque['queue_startable_base'], self.config.startable)) self.LOG.info("Startable matcher for '%s' is: [ %s ]" % (self.config.job_name, self.config.startable)) self.config.downloading = matching.ConditionParser( engine.FieldDefinition.lookup, "name").parse("is_active=1 is_complete=0" + (" [ %s ]" % self.config.downloading if "downloading" in self.config else "")) self.LOG.info("Downloading matcher for '%s' is: [ %s ]" % (self.config.job_name, self.config.downloading)) self.sort_key = formatting.validate_sort_fields( self.config.sort_fields) if self.config.sort_fields.strip( ) else None
def validate_sort_fields(self): """ Take care of sorting. """ sort_fields = self.options.sort_fields if sort_fields == '*': sort_fields = self.get_output_fields() return formatting.validate_sort_fields(sort_fields or config.sort_fields)
def __init__(self, config=None): """ Set up queue manager. """ self.config = config or {} self.proxy = None self.LOG = pymagic.get_class_logger(self) self.LOG.debug("Queue manager created with config %r" % self.config) bool_param = lambda key, default: matching.truth(self.config.get(key, default), "job.%s.%s" % (self.config.job_name, key)) self.config.quiet = bool_param("quiet", False) self.config.startable = matching.ConditionParser(engine.FieldDefinition.lookup, "name").parse( "is_open=0 is_active=0 is_complete=0 [ %s ]" % self.config.startable ) self.LOG.info("Startable matcher for '%s' is: [ %s ]" % (self.config.job_name, self.config.startable)) self.config.downloading = matching.ConditionParser(engine.FieldDefinition.lookup, "name").parse( "is_active=1 is_complete=0" + (" [ %s ]" % self.config.downloading if "downloading" in self.config else "") ) self.LOG.info("Downloading matcher for '%s' is: [ %s ]" % (self.config.job_name, self.config.downloading)) self.sort_key = formatting.validate_sort_fields(self.config.sort_fields) if self.config.sort_fields.strip() else None