{endcode}
-Note that preempted jobs will go back to idle in the job queue and will potentially try to run again if they can match to a machine. If you instead wish to put the jobs on hold when they are evicted, either use the submit-side policy described later or, in Condor 7.3, use WANT_HOLD. Example:
+Note that preempted jobs will go back to idle in the job queue and will potentially try to run again if they can match to a machine. If you instead wish to put the jobs on hold when they are evicted, either use the submit-side policy described later or, in Condor 7.3+, use the expression WANT_HOLD. One advantage of using WANT_HOLD -vs- the submit-side policy example below is the startd will evaluate these attributes much more frequently than updates are sent to the schedd. An example using WANT_HOLD :
{code}
+VIRTUAL_MEMORY_AVAILABLE_MB = (VirtualMemory*0.9)
+MEMORY_EXCEEDED = ImageSize/1024 > $(VIRTUAL_MEMORY_AVAILABLE_MB)
+PREEMPT = ($(PREEMPT)) || ($(MEMORY_EXCEEDED))
+WANT_SUSPEND = ($(WANT_SUSPEND)) && ($(MEMORY_EXCEEDED)) =!= TRUE
WANT_HOLD = ($(MEMORY_EXCEEDED))
WANT_HOLD_REASON = \
- ifThenElse( ($(MEMORY_EXCEEDED)) && isUndefined(MemoryRequirementsMB), \
- "Your job used too much memory, as measured by ImageSize. If virtual memory usage is not a reliable estimate of real memory requirements for your job, please add the attribute MemoryRequirementsMB to your job to override this check.", \
- ifThenElse( ($(MEMORY_EXCEEDED)), \
- "Your job used too much memory.", \
- undefined ) )
-
+ ifThenElse( $(MEMORY_EXCEEDED), \
+ "Your job used too much virtual memory.", \
+ undefined )
{endcode}
{subsection: How to hold/remove a job that uses too much memory}