def getHTPCInfo(cp, batch, queue, log): # return tuple: (non-Glue HTPC information, htpc_max_slots) # where htpc_max_slots is the admin-provided "maximum number of slots per job" htpcInfo = ('__GIP_DELETEME', 1) # defaults if not cp_getBoolean(cp, batch, 'htpc_enabled', False): log.info("HTPC is disabled for batch %s" % batch) return htpcInfo log.info("HTPC is enabled for batch %s" % batch) whitelist = cp_getList(cp, batch, 'htpc_queues', []) blacklist = cp_getList(cp, batch, 'htpc_blacklist_queues', []) log.debug("HTPC whitelist: %s; HTPC blacklist %s: " % (whitelist, blacklist)) if '*' not in whitelist and queue not in whitelist: log.info("HTPC Queue %s not in whitelist" % queue) return htpcInfo if queue in blacklist: log.info("HTPC Queue %s in blacklist" % queue) return htpcInfo defaultRSL = cp_get(cp, batch, 'htpc_rsl', '') log.debug("HTPC DefaultRSL: %s" % defaultRSL) queueRSL = cp_get(cp, batch, 'htpc_rsl_%s' % queue, '') if not queueRSL: queueRSL = defaultRSL if not queueRSL: log.info("HTPC RSL not found for queue %s" % queue) return htpcInfo htpcMaxSlots = cp_getInt(cp, batch, 'htpc_max_slots', 1) if htpcMaxSlots < 2: log.info("HTPC max slots equal to 1 or not set!") return htpcInfo # acbr stuff? return ('HTPCrsl: %s' % queueRSL, htpcMaxSlots)
def defaultGroupIsExcluded(cp): """ Check to see if the "default" group is excluded. """ excludedGroups = cp_getList(cp, "condor", "exclude_groups", []) excludedGroups = [x.strip() for x in excludedGroups] if 'default' in excludedGroups: return True else: return False
def _createSubmitterConstraint(cp): """ Create constraint for condor_status -submitters command """ exclude_schedds = cp_getList(cp, "condor", "exclude_schedds", []) if not exclude_schedds: return 'TRUE' submitConstraint = 'TRUE' for schedd in exclude_schedds: schedd = schedd.strip() submitConstraint += ' && Machine =!= "%s"' % schedd return submitConstraint
def getGroupInfo(vo_map, cp): #pylint: disable-msg=C0103,W0613 """ Get the group info from condor The return value is a dictionary; the key is the vo name, the values are another dictionary of the form {'quota': integer, 'prio': integer} @param vo_map: VoMapper object @param cp: A ConfigParse object with the GIP config information @returns: A dictionary whose keys are VO groups and values are the quota and priority of the group. """ configDaemon = '' if cp_getBoolean(cp, "condor", "query_only_local_condor", False): log.info("Only querying local Condor -- ignoring use_collector, if set!") else: if cp_getBoolean(cp, "condor", "use_collector", False): configDaemon = "-collector" else: configDaemon = "-negotiator" fp = condorCommand(condor_group, cp, {'daemon' : configDaemon}) output = fp.read().split(',') if fp.close(): log.info("No condor groups found.") return {} grouplist = [] for group in output: grouplist.append(group.strip()) excludedGroups = cp_getList(cp, "condor", "exclude_groups", []) log.debug("exclude_groups = %s" % excludedGroups) for excludedGroup in excludedGroups: excludedGroup = excludedGroup.strip() try: grouplist.remove(excludedGroup) log.debug("Removed excluded group %s" % excludedGroup) except ValueError: if excludedGroup != 'default': log.debug("Attempted to remove non-existent group %s" % excludedGroup) if not grouplist: log.info("No condor groups exist (after applying exclude_groups)") return{} retval = {} if (not (grouplist[0].startswith('Not defined'))) and \ (len(grouplist[0]) > 0): for group in grouplist: quota = condorCommand(condor_quota, cp, \ {'group': group, 'daemon': configDaemon}).read().strip() prio = condorCommand(condor_prio, cp, \ {'group': group, 'daemon': configDaemon}).read().strip() vos = guessVO(cp, group) if not vos: continue curInfo = {'quota': 0, 'prio': 0, 'vos': vos} try: curInfo['quota'] += int(quota) except: pass try: curInfo['prio'] += int(prio) except: pass retval[group] = curInfo log.debug("The condor groups are %s." % ', '.join(retval.keys())) return retval