# # HTCondor Week 2015 Machine Policy Tutorial Example # # In this example startd policy configuration, we create # a set of "suspendable slots" that will only run jobs tagged with the # job classad attribute +IsSuspendableJob=True, and a set of # "non-suspendable slots" that will only run non-suspendable jobs. # The idea here is long running suspendable jobs can 'backfill' a # machine by essentially checkpointing to RAM. # So for example, on a 4-core server, 8 slots will be created. # Non-suspendable jobs will run on slots 1-4, suspendable jobs on # slots 5-8. Whenever a non-suspendable job arrives, the startd # will suspend (via SIGSTOP) one suspendable slot; likewise, when # a non-suspendable job leaves, the startd will continue (via SIGCONT) # one suspendable job. # # Lie to HTCondor, to achieve 2 slots for each real slot NUM_CPUS = $(DETECTED_CORES)*2 # There is no good way to tell HTCondor that the two slots should be treated # as though they share the same real memory, so lie about how much # memory we have. MEMORY = $(DETECTED_MEMORY)*2 # Slots 1 through DETECTED_CORES are nonsuspendable and the rest are # suspendable IsSuspendableSlot = SlotID > $(DETECTED_CORES) # If I am a suspendable slot, my corresponding nonsuspendable slot is # my SlotID minus $(DETECTED_CORES) NonSuspendableSlotState = eval(strcat("slot",SlotID-$(DETECTED_CORES),"_State")) # The above expression looks at slotX_State, so we need to add # State to the list of slot attributes to advertise STARTD_SLOT_ATTRS = $(STARTD_SLOT_ATTRS) State # For convenience, advertise these expressions in the machine ad. STARTD_ATTRS = $(STARTD_ATTRS) IsSuspendableSlot NonSuspendableSlotState MyNonSuspendableSlotIsIdle = \ (NonSuspendableSlotState =!= "Claimed" && \ NonSuspendableSlotState =!= "Preempting") #NonSuspendable slots are always willing to start jobs. #Suspendable slots are only willing to start if the NonSuspendable slot is idle START = \ IsSuspendableSlot!=True && IsSuspendableJob=!=True || \ IsSuspendableSlot && IsSuspendableJob==True && $(MyNonSuspendableSlotIsIdle) # Suspend the suspendable slot if the other slot is busy. SUSPEND = \ IsSuspendableSlot && $(MyNonSuspendableSlotIsIdle)!=True CONTINUE = ($(SUSPEND)) != True