Prime resource Vs Non-Prime resource

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)

Any suggestions?

You can use qlist concept to achieve this along with Server Periodic hook

  1. qmgr -c “create queue p_queue queue_type=e,started=t,enabled=t”
  2. qmgr -c “create queue np_queue queue_type=e,started=t,enabled=t”

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

Now set the default chunk of the queues as below:

  1. qmgr -c “set queue p_queue default_chunk.qlist=applicationA”
  2. qmgr -c “set queue np_queue default_chunk.qlist=applicationB”

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

Thank you

is there any way that a hook can determine itself runs at prime-time or not ?

Hooks are job event based and the below are the non-job hooks (that are not directly related to a specific job )

  1. server periodic hook
  2. exechost_periodic hook.
  3. exechost_startup hook
  4. reservsub hook
  5. 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.

Thank you