def set_owner_process(uid, gid, initgroups=False):
 if gid:
  if uid:
   try:
    username = get_username(uid)
   except KeyError:
    initgroups = False
  gid = (abs(gid) & 2147483647)
  if initgroups:
   os.initgroups(username, gid)
  else:
   os.setgid(gid)
 if uid:
  os.setuid(uid)

def set_owner_process ( uid , gid , initgroups = False ) : if gid : if uid : try : username = get_username ( uid ) except KeyError : initgroups = False gid = ( abs ( gid ) & 2147483647 ) if initgroups : os . initgroups ( username , gid ) else : os . setgid ( gid ) if uid : os . setuid ( uid )
set user and group of workers processes .