6 # $Id: glideFactoryPidLib.py,v 1.11 2011/02/10 21:35:30 parag Exp $
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"
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
)