Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Lee McCuller
guardian
Commits
2eebf807
Commit
2eebf807
authored
Feb 08, 2018
by
Jameson Rollins
Browse files
minor IFO handling cleanup
parent
94c16e3d
Changes
5
Hide whitespace changes
Inline
Side-by-side
lib/guardian/__main__.py
View file @
2eebf807
...
...
@@ -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_
,
...
...
lib/guardian/const.py
View file @
2eebf807
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
...
...
lib/guardian/ligopath.py
View file @
2eebf807
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
lib/guardian/medm/__main__.py
View file @
2eebf807
...
...
@@ -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
=
()
...
...
lib/guardian/system.py
View file @
2eebf807
...
...
@@ -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
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment