Set group_list job attribute using pbs hook


#1

Hi All,

I am trying to specify the group_list attribute for all jobs using the following hook:

import pbs
e=pbs.event()
j=e.job
setattr(j, “group_list”, pbs.group_list(“some_group”))

I have tried setting the event type to queuejob.

While the hook compiles and I can see the group_list attribute when I do a qstat -f -F json <job_id> but the job does not run with the specified group’s permission. It defaults to the login group.

However, when I specify the group_list attribute in the command line while submitting each job, it works.

qsub -W group_list=some_group – /bin/hostname

How can I set the job attribute using hooks?


#2

I have tested the below queuejob hook as root user and it is working for me

import os,pbs,sys

e = pbs.event()
j = e.job

pbs.logmsg(pbs.LOG_DEBUG, "group_list=%s" % (j.group_list))
j.group_list = pbs.group_list("root@localhost,root@demos")
e.accept()


[root@demos Desktop]# qsub -- /bin/sleep 10 ;  qstat -fx 934  | grep group_list
934.demos
    group_list = root@localhost,root@demos

Hope this helps.