How to configure different prolog scripts for different hosts or host groups (2014-03-03)

When configuring Grid Engine a good tuning point is always to reduce the amount of queues (i.e. queue instances). When having a need for different machine type specific prolog and epilog scripts (for different heath-check for example) this does not require to configure multiple queues containing different prolog and epilog scripts. Instead you can configure them in the same queue using the bracket notation where you can define settings for queue instances (a queue setting for a host) and queue domains (a queue setting for a hostgroup).

Here is an example of how to configure different prolog scripts for different host groups

I‘ve configured two additional host groups: @centos and @suse11 for which I want to have different prolog scripts running before a job is started.

daniel@mint14:~$ qconf -shgrpl
@allhosts
@centos
@suse11

My prolog scripts just printing out something on stdout.

daniel@mint14:~$ cat /nfs/prolog_cent.sh 
#!/bin/sh
echo "I'm a CentOS box"
daniel@mint14:~$ cat /nfs/prolog_suse.sh 
#!/bin/sh
echo "I'm a SUSE box"

Now we can add those two prolog scripts in the prolog configuration of one queue. Here for the host-group @centos the /nfs/prolog_cent.sh script is set. The prolog for host-group @suse11 is set respectively(of course you can also just use an host name instead of a hostgroup).

daniel@mint14:~$ qconf -mattr queue prolog "NONE,[@centos=/nfs/prolog_cent.sh],[@suse11=/nfs/prolog_suse.sh]" all.q
daniel@mint14 modified "all.q" in cluster queue list

Now verify that the queue configuration was set in the right way.

daniel@mint14:~$ qconf -sq all.q | grep prolog
prolog                NONE,[@centos=/nfs prolog_cent.sh], \
                  [@suse11=/nfs/prolog_suse.sh]

Finally we submit two jobs to two different hostgroups (i.e. here queue domains since the job is required to run in all.q).

daniel@mint14:~$ qsub -b y -q all.q@@suse11 /bin/sleep 0
Your job 8 ("sleep") has been submitted

daniel@mint14:~$ qsub -b y -q all.q@@centos /bin/sleep 0
Your job 9 ("sleep") has been submitted

Now check the job output file. It must contain the prolog output.

daniel@mint14:~$ cat /home/daniel/sleep.o9 
I'm a CentOS box
daniel@mint14:~$ cat /home/daniel/sleep.o8
I'm a SUSE box