A new doc condor_config.html is being added showing the condor configuration
[burt-test.git] / factory / glideFactoryPidLib.py
blob9d8f376f2293ee5ca79a30e6255b880377cb4497
2 # Project:
3 # glideinWMS
5 # File Version:
6 # $Id: glideFactoryPidLib.py,v 1.11 2011/02/10 21:35:30 parag Exp $
8 # Description:
9 # Handle factory pids
11 # Author:
12 # Igor Sfiligoi
15 import sys,os,os.path
16 import pidSupport
18 ############################################################
20 class FactoryPidSupport(pidSupport.PidSupport):
21 def __init__(self,startup_dir):
22 lock_file=os.path.join(startup_dir,"lock/glideinWMS.lock")
23 pidSupport.PidSupport.__init__(self,lock_file)
25 #raise an exception if not running
26 def get_factory_pid(startup_dir):
27 pid_obj=FactoryPidSupport(startup_dir)
28 pid_obj.load_registered()
29 if pid_obj.mypid==None:
30 raise RuntimeError, "Factory not running"
31 return pid_obj.mypid
33 ############################################################
35 class EntryPidSupport(pidSupport.PidWParentSupport):
36 def __init__(self,startup_dir,entry_name):
37 lock_file=os.path.join(startup_dir,"%s/entry_%s/lock/factory.lock"%(startup_dir,entry_name))
38 pidSupport.PidWParentSupport.__init__(self,lock_file)
40 #raise an exception if not running
41 def get_entry_pid(startup_dir,entry_name):
42 pid_obj=EntryPidSupport(startup_dir,entry_name)
43 pid_obj.load_registered()
44 if pid_obj.mypid==None:
45 raise RuntimeError, "Entry not running"
46 if pid_obj.parent_pid==None:
47 raise RuntimeError, "Entry has no parent???"
48 return (pid_obj.mypid,pid_obj.parent_pid)