How to enforce only interactive or batch jobs on a specific queue


I am curious to know how to enforce that only interactive and/or batch jobs be accepted on a specific queue.

Torque has a setting I’ve always used but is not accepted on PBS Pro: “set queue queuename disallowed_types = interactive”

Any help is appreciated on this issue.


You can create a queuejob hook , that checks the specifications of the job request and accepts and rejects the job . Here is one:

[root@pbspro ]## cat

import pbs
import sys
# Get the hook event information and parameters
# This will be for the ‘queuejob’ event type.
e = pbs.event()

# Get the information for the job being queued
j = e.job
if ( hasattr(j.queue, "name")):
    pbs.logmsg(pbs.LOG_ERROR, "queue has name %s" %
    j.queue = pbs.server().queue(str(pbs.server().default_queue))
    pbs.logmsg(pbs.LOG_ERROR, "queue has name %s" %
if str(j.queue) in BATCH_QUEUE:
    if j.interactive:
        e.reject("Interactive Jobs are not allowed in this queue")

except SystemExit:

[root@pbspro ]#qmgr -c ‘c h intcheck event=queuejob’
[root@pbspro ]#qmgr -c ‘i h intcheck application/x-python default’

[root@pbspro ]# qsub -I -X -q workq
qsub: Interactive Jobs are not allowed in this queue

Hope this helps


Thanks for sharing this suggestion. However, this is much more involved that I was expecting. Are there any other options to implementing this enforcement?



  • all you need to do is copy the above code and save it as a python (.py) file
  • update the queue names in the BATCH_QUEUE and INTERACTIVE_QUEUE in the .py file
  • run those qmgr commands
  • you are all set

This is the best option and examples are given in the PBS Hooks Guide as well.

You get more fine-grained control on the jobs life cycle without users being aware of these controls and you can reject a job with information, so that end users are advised and trained at the same time. If you have controls and policies visible to the end users, the users will always have a workaround to get the resources circumventing the queue.

Hope this helps


You do have a point regarding users being able to circumvent resource controls.

And while I appreciate the finer control, it just feels a little cumbersome having to dig up scripts to do something which was just a single line command in Torque.

I guess I come from a background that just prefers some administrative controls, plain, and straightforward as can be. For example, qmgr -c ‘p s’ in my opinion should be the one-stop shop for most settings.

I know PBS Pro does have flags to hide certain settings from users. Maybe that should be used as much as possible, simplifying the admin’s life while restricting the user’s knowledge…

Thanks Siji, understand your point. Thanks again for sharing your feedback.