First, make sure your indentation is consistent (in your script above it is not and will throw an error).
Next, as Gabe says, I don’t think a move job hook would work. But then the egroup attribute is not set on a job until it’s entered an execution queue. In other words you cannot select on egroup in a queuejob hook, it’s to early in the job’s lifecycle.
I was thinking you might be able to do something with a routing queue but again, that’s pre-execution queue so egroup still isn’t set on the job.
smgoosen@linux-cvb0:~> qsub -l select=1 -q router job.script
5.linux-cvb0
smgoosen@linux-cvb0:~> qstat
Job id Name User Time Use S Queue
5.linux-cvb0 job.script smgoosen 0 Q router
smgoosen@linux-cvb0:~> qstat -f | grep group
smgoosen@linux-cvb0:~> su -
Password:
linux-cvb0:~ # qmgr
Max open servers: 49
Qmgr: s q router started=true
Qmgr: q
linux-cvb0:~ # qstat
Job id Name User Time Use S Queue
5.linux-cvb0 job.script smgoosen 00:00:00 R workq
linux-cvb0:~ # qstat -f | grep group
egroup = users
linux-cvb0:~ #
Maybe you could clear the queue attribute that a user might submit with (set it to None) in queuejob hook then:
- filter on job owner for entry from a route queue into the test queue?
smgoosen@linux-cvb0:~> qsub -l select=1 -q router job.script
9.linux-cvb0
smgoosen@linux-cvb0:~> qstat
Job id Name User Time Use S Queue
9.linux-cvb0 job.script smgoosen 0 Q router
smgoosen@linux-cvb0:~> qstat -f | grep Owner
Job_Owner = smgoosen@linux-cvb0
smgoosen@linux-cvb0:~>
- or require that users submit with -Wgroup_list (enforce/verify in queuejob hook), could even write a wrapper for qusub that sets it? In queuejob hook:
smgoosen@linux-cvb0:~> qsub -l select=1 -Wgroup_list=users job.script
pbs.logmsg(pbs.LOG_DEBUG, “egroup is = %s” % str(j.egroup))
pbs.logmsg(pbs.LOG_DEBUG, “group_list is = %s” % str(j.group_list))
if str(j.group_list) == “users”:
j.queue = pbs.server().queue(“test”)
03/22/2021 16:05:56;0006;Server@linux-cvb0;Hook;Server@linux-cvb0;egroup is = None
03/22/2021 16:05:56;0006;Server@linux-cvb0;Hook;Server@linux-cvb0;group_list is = users
smgoosen@linux-cvb0:~> qstat
Job id Name User Time Use S Queue
8.linux-cvb0 job.script smgoosen 0 Q test
smgoosen@linux-cvb0:~>
- or you could let all jobs go into an execution with started=false and then use a periodic hook to move the jobs into the appropriate “real” queue based on egroup (will be available at that point)?