CA Tuesday Tip by Lucy Zhang, Principal Support Engineer 16/04/2015
At times, users may want to make resource unavailable, so that jobs requiring this resource won't run. For renewable resources, if there are still running jobs using this resource, following command may not work as expected:
RESEF resource_name SET AVAIL(0)
As when the active jobs complete, the resource count will be returned, causing AVAIL value increased (>0).
With PTF RO50035 in 11.3 or 11.4 base, you can use DECREMENT option. Here is an example:
1. Renewable resource LUCY3:
resdef lucy3
Resource LUCY3 Enterprise Renewable
* * Max=10 Avail=10
2. Start one JOB using 1 count of this resource:
Note: the job will stay executing until manually complete it.
resdef lucy3
Resource LUCY3 Enterprise Renewable
* * Max=10 Avail=9
3. Issue command:
resdef lucy3 SET DECREMENT(10)
resdef lucy3
Resource LUCY3 Enterprise Renewable
* * Max=0 Avail=-1
As you can see, AVAIL value is -1. You may notice the MAX is 0, NOT 10; DECREMENT actually changes the MAX as well. So NO new jobs can run, even after the active job complete which will bring AVAIL to 0.
4. Make the resource available again:
resdef lucy3 SET INCREMENT(10)
ESP1908I Resource LUCY3 updated
resdef lucy3
Resource LUCY3 Enterprise Renewable
* * Max=10 Avail=9
As you can see, the AVAIL count is 9, NOT 10; as one is still used by an active job.
5. Complete the job and release the resource, now it shows:
resdef lucy3 SET INCREMENT(10)
ESP1908I Resource LUCY3 updated
resdef lucy3
Resource LUCY3 Enterprise Renewable
* * Max=10 Avail=10
Note: RESDEF resource_name SET MAX(value) can be used to achieve same result:
- To mark resource as unavailable:
RESDEF resource_name SET MAX(0) is the same as RESDEF resource_name SET DECREMENT(max_value);
- To mark the resource available again:
RESDEF resource_name SET MAX(max_value) is the same as RESDEF resource_name SET INCREMENT(max_value);