How many times a Job priority is validated?
As per the documentation.
You can prioritize jobs when one or more jobs compete for the same resource. Each job has a priority between 0 and 100 (100 being the highest). The job with the highest value takes priority and obtains the resource first.
We have a parent job with two jobs say job1 and job2 scheduled at the same time. The job1 has job priority of 70 and Job2 has the job priority of 80. Both has the same renewable resource with a maximum availability of 1.
<Please see attached file for image>
Now Job2 will get the resource first because of the job priority of 80. If Job2 has a Successor Job3 which also has a priority of 80 for the same renewable resource.
Once the Job2 has completed We expect the Job3 to get the resource and run. But it is the Job1 which runs.
All the jobs would go to ready state and then they will go to PREDWAIT state if there are any predecessors. As the parent job has already completed Job1 and Job2 don't have any predecessors they will go to RESWAIT state. Now in this state, the resource manager would determines who gets the resource .
Here the job priority comes into picture and resource manger gives the resource to the job which has high job priority which is Job2. Now the other job Job1 is placed in RESWAIT state. Job3 is in PREDWAIT state as its predecessors job is running.
Now for the question of who will get the next resource, the resource would go to Job1 as the state of the job is in RESWAIT state and the state of the other job3 is in PREDWAIT state. Resource manager would give the next resource to the job that is waiting for RESWAIT instead of the one waiting for PREDWAIT. So this way, the job1 gets the next resource by the time Job3 job goes from PREDWAIT to RESWAIT the resource is already allocated to Job1. The order of status changes is PREDWAIT first and RESWAIT next. So the next job that would be started is Job1 instead of Job3.
So the order of execution is Job2 Job1 Job3
The job priority for the resource is evaluated only for the jobs which are in RESWAIT state.