[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HTCondor-users] Enforcing the policy of one job per user on a specific resource



On 11/26/2018 12:55 PM, Boris Sadkhin wrote:
> Hi Todd,
> Thanks again for the reply and the recipe.
> So we actually submit all jobs as the "condor_pool" user, and then set the AccountingGroup per job in lieu of actual users.
> 
> Is there a way to get the formula to use the accounting group instead of the user? 

Hi Boris,

So you are saying your submit files look like:

  executable = foo.exe
  +AccountingGroup = "something"
  queue

If so, indeed we just need to tweak the formula a bit.  The startd already should be advertising the AccountingGroup of the running job in each slot, but it appends the UID_DOMAIN as well.  So I suggest trying a condor_config like so :

      # Set this to be how many slots each user can have on this machine
      MAX_SLOTS_PER_ACCTGRP = 1
    
      # Tell the startd to cross-advertise AccountingGroup and Activity into each
      # slot, so every slot will have slot1_AccountingGroup, slot2_AccountingGroup, etc.
      STARTD_SLOT_ATTRS = $(STARTD_SLOT_ATTRS) AccountingGroup Activity
    
      # You will unfortunately need to extend this expression if you have more
      # than five slots... just follow the pattern.
      SLOTS_SERVING_THIS_ACCTGRP = ( \
       (TARGET.AccountingGroup =?= splitUserName(slot1_AccountingGroup)[0] && slot1_Activity == "Busy") + \
       (TARGET.AccountingGroup =?= splitUserName(slot2_AccountingGroup)[0] && slot2_Activity == "Busy") + \
       (TARGET.AccountingGroup =?= splitUserName(slot3_AccountingGroup)[0] && slot3_Activity == "Busy") + \
       (TARGET.AccountingGroup =?= splitUserName(slot4_AccountingGroup)[0] && slot4_Activity == "Busy") + \
       (TARGET.AccountingGroup =?= splitUserName(slot5_AccountingGroup)[0] && slot5_Activity == "Busy") + \
       0 )
    
      # Append to Start expression to only start jobs if this user is under 
      # the limit for this machine.
      START = $(START) && ( $(SLOTS_SERVING_THIS_ACCTGRP) < $(MAX_SLOTS_PER_ACCTGRP) )


Hope the above helps.
p.s. for an explanation of the classad function splitUserName() see the Manual at http://tinyurl.com/y7tcb5ed

regards,
Todd

-- 
Todd Tannenbaum <tannenba@xxxxxxxxxxx> University of Wisconsin-Madison
Center for High Throughput Computing   Department of Computer Sciences
HTCondor Technical Lead                1210 W. Dayton St. Rm #4257
Phone: (608) 263-7132                  Madison, WI 53706-1685