Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
5d5a38f1
Commit
5d5a38f1
authored
6 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
SW-488
: little tweaks and fixes from live testing on scu199
parent
6840eca3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
LCS/PyCommon/lcu_utils.py
+2
-1
2 additions, 1 deletion
LCS/PyCommon/lcu_utils.py
SAS/TriggerServices/lib/task_info_cache.py
+2
-3
2 additions, 3 deletions
SAS/TriggerServices/lib/task_info_cache.py
SAS/TriggerServices/lib/trigger_service.py
+6
-5
6 additions, 5 deletions
SAS/TriggerServices/lib/trigger_service.py
with
10 additions
and
9 deletions
LCS/PyCommon/lcu_utils.py
+
2
−
1
View file @
5d5a38f1
...
@@ -98,7 +98,8 @@ def stationname2hostname(station_name):
...
@@ -98,7 +98,8 @@ def stationname2hostname(station_name):
def
hostname2stationname
(
station_hostname
):
def
hostname2stationname
(
station_hostname
):
'''
Convert a lcu hostname to a parset-like station name , like cs001c or cs001c.control.lofar to CS001
'''
'''
Convert a lcu hostname to a parset-like station name , like cs001c or cs001c.control.lofar to CS001
'''
# assume a hostname is encoded as stationname in lowercase with a c appended, like cs001c for CS001
# assume a hostname is encoded as stationname in lowercase with a c appended, like cs001c for CS001
return
station_hostname
.
split
(
'
.
'
)[
0
].
strip
()[:
-
1
].
upper
()
stationname
=
station_hostname
.
split
(
'
.
'
)[
0
].
strip
().
upper
()
return
stationname
[:
-
1
]
if
stationname
.
endswith
(
'
C
'
)
else
stationname
def
get_stations_rcu_mode
(
stations
=
None
):
def
get_stations_rcu_mode
(
stations
=
None
):
'''
'''
...
...
This diff is collapsed.
Click to expand it.
SAS/TriggerServices/lib/task_info_cache.py
+
2
−
3
View file @
5d5a38f1
...
@@ -115,8 +115,7 @@ class TaskInfoCache(OTDBBusListener):
...
@@ -115,8 +115,7 @@ class TaskInfoCache(OTDBBusListener):
if
ti
.
radb_task
[
'
starttime
'
]
<=
active_at
and
ti
.
radb_task
[
'
endtime
'
]
>=
active_at
]
if
ti
.
radb_task
[
'
starttime
'
]
<=
active_at
and
ti
.
radb_task
[
'
endtime
'
]
>=
active_at
]
if
task_type
is
not
None
:
if
task_type
is
not
None
:
tasks
=
[
ti
for
ti
in
tasks
tasks
=
[
ti
for
ti
in
tasks
if
ti
.
radb_task
[
'
type
'
]
==
task_type
]
if
ti
.
radb_task
[
'
task_type
'
]
==
task_type
]
return
tasks
return
tasks
...
@@ -238,4 +237,4 @@ if __name__ == '__main__':
...
@@ -238,4 +237,4 @@ if __name__ == '__main__':
# start listening on all default messaging buses,
# start listening on all default messaging buses,
# and let the TaskInfoCache instance log the events as they come along.
# and let the TaskInfoCache instance log the events as they come along.
with
TaskInfoCache
()
as
cache
:
with
TaskInfoCache
()
as
cache
:
waitForInterrupt
()
waitForInterrupt
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
SAS/TriggerServices/lib/trigger_service.py
+
6
−
5
View file @
5d5a38f1
...
@@ -23,12 +23,12 @@
...
@@ -23,12 +23,12 @@
from
StringIO
import
StringIO
from
StringIO
import
StringIO
from
lxml
import
etree
from
lxml
import
etree
from
datetime
import
datetime
from
datetime
import
datetime
,
timedelta
from
lofar.messaging
import
Service
,
EventMessage
,
ToBus
from
lofar.messaging
import
Service
,
EventMessage
,
ToBus
from
lofar.messaging.Service
import
MessageHandlerInterface
from
lofar.messaging.Service
import
MessageHandlerInterface
from
lofar.common.util
import
waitForInterrupt
from
lofar.common.util
import
waitForInterrupt
from
lofar.common.lcu_utils
import
stationname2hostname
from
lofar.common.lcu_utils
import
stationname2hostname
,
hostname2stationname
from
lofar.mom.momqueryservice.momqueryrpc
import
MoMQueryRPC
from
lofar.mom.momqueryservice.momqueryrpc
import
MoMQueryRPC
from
lofar.specificationservices.specification_service_rpc
import
SpecificationRPC
from
lofar.specificationservices.specification_service_rpc
import
SpecificationRPC
...
@@ -409,7 +409,8 @@ class ALERTHandler(VOEventListenerInterface):
...
@@ -409,7 +409,8 @@ class ALERTHandler(VOEventListenerInterface):
logger
.
info
(
'
TBB is in correct operational mode: %s
'
%
DEFAULT_TBB_ALERT_MODE
)
logger
.
info
(
'
TBB is in correct operational mode: %s
'
%
DEFAULT_TBB_ALERT_MODE
)
# Any running observations?
# Any running observations?
active_tasks
=
self
.
_cache
.
get_active_tasks
(
stoptime
,
'
observation
'
)
#TODO: make stoptime a datetime instance eveywhere
active_tasks
=
self
.
_cache
.
get_active_tasks
(
datetime
(
1970
,
1
,
1
)
+
timedelta
(
seconds
=
stoptime
),
'
observation
'
)
if
active_tasks
:
if
active_tasks
:
otdb_ids
=
sorted
([
t
.
radb_task
[
'
otdb_id
'
]
for
t
in
active_tasks
])
otdb_ids
=
sorted
([
t
.
radb_task
[
'
otdb_id
'
]
for
t
in
active_tasks
])
logger
.
info
(
'
Observation(s) %s is/are running at time %s
'
,
otdb_ids
,
stoptime
)
logger
.
info
(
'
Observation(s) %s is/are running at time %s
'
,
otdb_ids
,
stoptime
)
...
@@ -417,8 +418,8 @@ class ALERTHandler(VOEventListenerInterface):
...
@@ -417,8 +418,8 @@ class ALERTHandler(VOEventListenerInterface):
logger
.
warning
(
'
No observations running at %s, so TBB
\'
s are not recording
'
,
stoptime
)
logger
.
warning
(
'
No observations running at %s, so TBB
\'
s are not recording
'
,
stoptime
)
return
False
return
False
active_stations
=
self
.
_cache
.
get_stations
()
active_stations
=
set
(
hostname2stationname
(
x
)
for
x
in
self
.
_cache
.
get_stations
()
)
active_tbb_stations
=
set
(
DEFAULT_TBB_STATIONS
).
intersection
(
active_stations
)
active_tbb_stations
=
set
(
hostname2stationname
(
x
)
for
x
in
DEFAULT_TBB_STATIONS
).
intersection
(
active_stations
)
if
len
(
active_tbb_stations
)
>
0
:
if
len
(
active_tbb_stations
)
>
0
:
logger
.
info
(
'
Enough TBB stations available: %s
'
,
active_tbb_stations
)
logger
.
info
(
'
Enough TBB stations available: %s
'
,
active_tbb_stations
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment