First of all , in order to avoid X-Y problem, I’d like to describe the original purpose
Say we have node1-node16, and we want to run application (say App-A) on node1-node10, and reserve node11-node16 for App-B for prime time use,yet keep non-prime time for App-A available on node10-node16
For App-B it’s straight forward, just create a p_ suffixed queue is enough
but it’s somehow difficulty if we work on App-A
if we have a boolean resource which can indicate that if we are in prime-time (sure we can use hooks to set this resources, but it’s out of the sched_config, as we need to manage holiday file and hook configure file)
Create custom resource:
a. qmgr -c “create resource qlist type=string_array,flag=h”
b. add qlist to the resources: line of the sched_config and kill -HUP
for i in {1…10}; do qmgr -c “set node node${1} resources_available.qlist=applicationA” ; done
for i in {11…16}; do qmgr -c “set node node${1} resources_available.qlist=applicationB” ; done
Note the prime time and non-prime time is controlled by the holidays file, any changes to the holiday file requires kill -HUP of the PID of the pbs_sched process.
Now create a server periodic hook, that will run the below command at non-primetime and prime time ( make sure the below command in the if loops runs once per prime time and non-primetime respectively)
if time = prime:
count = 0
if count == 0:
for i in {11…16}; do qmgr -c “set node node${1} resources_available.qlist+=applicationA” ; done
count=count+1
else
count = 0
if count == 0:
for i in {11…16}; do qmgr -c “set node node${1} resources_available.qlist-=applicationA” ; done
count=count+1
Hooks are job event based and the below are the non-job hooks (that are not directly related to a specific job )
server periodic hook
exechost_periodic hook.
exechost_startup hook
reservsub hook
provision hook
We can decide to run a job in prime time or not.
Within a hook , we can program it to void if the current time is non-prime or prime base on that reject and accept the job (at every job event). This would not be an ideal solution, I think.
In the above explanation, server periodic hook (non-job event hook) is used to check the time at regular intervals ( frequency) , based on whether it is prime or non-prime, it will update the node attributes. The above mentioned configuration would 100% work.