Commit 2eebf807 authored by Jameson Rollins's avatar Jameson Rollins
Browse files

minor IFO handling cleanup

parent 94c16e3d
......@@ -9,6 +9,7 @@ else:
import __builtin__ as builtins
from . import cli
from . import const
from .log import get_logger
DAEMON_OP_INIT = ('PAUSE', 'EXEC')
......@@ -152,7 +153,7 @@ aLIGO Guardian Shell
--------------------
""".lstrip()
builtins._IFO_ = os.getenv('IFO')
builtins._IFO_ = const.IFO
user_ns = {
'IFO': _IFO_,
......
import os
# SITE and IFO designators
SITE = os.getenv('SITE', '')
IFO = os.getenv('IFO', '')
# main daemon step time in Hz
CPS = int(os.getenv('GUARD_CPS', 16))
TIME_STEP = 1./CPS
......
import os
from . import const
USERAPPS_DIR = os.getenv('USERAPPS_DIR', '/opt/rtcds/userapps/release').rstrip('/')
SUBSYSTEMS = [
......@@ -59,14 +61,12 @@ def userapps_guardian_paths(subsyss=SUBSYSTEMS, ifo=None):
"""
if not ifo:
ifo = os.getenv('IFO')
if ifo == '':
ifo = None
ifo = const.IFO
if ifo:
ifo = ifo.lower()
paths = []
for subsys in subsyss:
if ifo is not None:
if ifo:
paths += [os.path.join(USERAPPS_DIR, subsys, ifo, 'guardian')]
paths += [os.path.join(USERAPPS_DIR, subsys, 'common', 'guardian')]
return paths
......@@ -7,6 +7,7 @@ import tempfile
import subprocess
from .. import cli
from .. import const
from ..system import GuardSystem
from .screens import get_path
from . import resources
......@@ -97,9 +98,8 @@ def main():
############################################################
if args.stype == 'status':
ifo = os.getenv('IFO')
prefix = '%s:GRD.STATUS.' % ifo
cmd += ['-macro', 'IFO=%s' % ifo]
prefix = '{}:GRD.STATUS.'.format(const.IFO)
cmd += ['-macro', 'IFO={}'.format(const.IFO)]
screen = get_path('GRD_STATUSBAR.adl')
sheight = 29
border = 0
......@@ -147,9 +147,7 @@ composite {{
############################################################
cmd += ['-macro', 'IFO=%s,SYSTEM=%s' % (os.getenv('IFO'),
system.name,
)]
cmd += ['-macro', 'IFO={},SYSTEM={}'.format(const.IFO, system.name)]
wargs = ()
......
......@@ -50,14 +50,14 @@ class GuardSystem(object):
"""
def __init__(self,
module=None,
ifo=os.getenv('IFO'),
ifo=None,
name=None,
ca_prefix=None,
guardpath=None,
):
if not ifo:
ifo = const.IFO
self._ifo = ifo
if self._ifo in ['', None]:
raise GuardSystemError("IFO has not been specified.")
self._name = name
self._ca_prefix = ca_prefix
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment