3.1 Jobs Using scheduleSweep() Might Need a Start Constraint

If you write a custom job that uses the scheduleSweep() JDL function to schedule joblets and that are either 1) marked as restartable in a high availability failover situation or 2) scheduled through the Job Scheduler to run at server startup, the job might fail to schedule any joblets and is easily noticeable with a 0 second run time. This is because scheduleSweep(), by default, creates joblets only for online nodes.

If the Job runs during failover, resources might not be readily available, so the job ends immediately.

To keep the Job from running until a resource is online, you can use a start constraint. For example, you could add the following to the job policy:

<constraint type="start" >
  <gt fact="jobinstance.matchingresources" value="0" />
</constraint>

If you implement this constraint, the Job is queued (not started) until at least one resource matches the policy resource constraint.

As alternatives to using the constraint approach, you can: