How to set user priority factors automatically by domain or other username pattern

Known to work with HTCondor version: 7.0

Suppose you have a HTCondor pool that runs jobs from several different groups of users who submit their jobs from different domains:,, and Further suppose that there is an agreement between these departments about what their relative priority should be in the HTCondor pool. How can you implement it?

First, you must answer this question: do you want each department to get an agreed-upon share of the pool? If so, you probably instead want to use Group Accounting. If you really do want to adjust the user priority factors of individual users submitting from the different domains, then read on.

In the simple case where there are just two domains, there is a built-in method in the HTCondor configuration file that lets you boost the priority factor of all domains but one:

# prio factor for users in "" domain:
# prio factor for everyone else:

In the more general case where you want to set the priority factor in different ways for several domains or user name patters, there is no built-in method in the HTCondor configuration. You can either adjust priority factors manually with condor_userprio or automate this process with a script (to be run periodically by HTCondor or cron). Here is an example script:


condor_userprio -allusers | awk '/@/{print $1} {}' | while read user
  case "$user" in
    ( * ) factor=1 ;;
    ( * ) factor=10 ;;
    ( * ) factor=100 ;;
  condor_userprio -setfactor $user $factor

Be aware that if you run such a script, then any modifications to user priorities that you make manually with condor_userprio will be overwritten by the script when it runs!

Since a user may show up and claim machines before this script runs and adjusts their priority factor, you might way want to set the default priority factor quite high (i.e. very bad priority). This will prevent them from getting many resources until their factor is adjusted: