def validate_groupid_placement(job): ''' @return True if the job has a placement group of group_id Note we will set it to group_id if it isn't specified. ''' place = repr( job.Resource_List["place"]) if job.Resource_List["place"] else "" status, mj_place = get_groupid_placement(place) if mj_place != None: job.Resource_List["place"] = pbs.place(mj_place) return status
def validate_groupid_placement(job): ''' @return True if the job has a placement group of group_id Note we will set it to group_id if it isn't specified. ''' place = repr(job.Resource_List["place"]) if job.Resource_List["place"] else "" placement_grouping = None for expr in place.split(":"): placement_grouping = None if "=" in expr: key, value = [x.lower().strip() for x in expr.split("=", 1)] if key == "group": placement_grouping = value if placement_grouping is None: debug("The user didn't specify place=group, setting group=group_id") placement_grouping = "group_id" prefix = ":" if place else "" job.Resource_List["place"] = pbs.place(place + prefix + "group=group_id") if placement_grouping == "group_id": return True else: debug("User specified a placement group that is not group_id - skipping.") return False
# Set any mpplabels if (mpplabels != None): labellist = mpplabels.split(',') for label in labellist: newlabel="PBScraylabel_" + label select=select + "%s=True:" %newlabel # The user requested mpp* resources, which means they want to use Cray # compute nodes. So we set vntype=cray_compute automatically in the hook. select=select + "vntype=cray_compute" j.Resource_List["select"]=pbs.select(select) # Set place=scatter if mppnppn was requested if (hooksetnppn == 0): j.Resource_List["place"]=pbs.place("scatter") # If mppnodes is given: # Expand the nodelist keeping the given order of nodes. # Find the matching vnode name. # Build a list of matching vnode names. def pbs_expandrange(seq): # Deal with the ranges first range = list(seq.partition('-')) lower = int(range[0]) upper = int(range[2]) if (upper <= lower ): pbs.logmsg(pbs.LOG_ERROR, "translate mpp: ERROR: bad range '%s', " \ "the first number (%d) must be less than the " \
if e.type == pbs.QUEUEJOB: j = e.job if "scratch_shared" in j.Resource_List.keys(): e.reject("scratch_shared requires 'select' syntax") scratch_shared = False if "select" in j.Resource_List.keys(): for i in str(j.Resource_List["select"]).split("+"): m = re.search('.*scratch_shared.*', i) if m: scratch_shared = True if scratch_shared: if "place" in j.Resource_List.keys(): m = re.search('.*group=.*', str(j.Resource_List["place"])) if not m: j.Resource_List["place"] = pbs.place( str(j.Resource_List["place"]) + ":group=cluster") else: j.Resource_List["place"] = pbs.place("group=cluster") if e.type == pbs.EXECJOB_BEGIN: j = e.job scratch_type = None node = pbs.get_local_nodename() config = parse_cfg() pbs.logmsg(pbs.EVENT_DEBUG, "scratch hook, node: %s" % node) pbs.logmsg( pbs.EVENT_DEBUG, "scratch hook, %s has exec_vnode: %s" % (j.id, str(j.exec_vnode)))