Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
calng
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
calibration
calng
Commits
449d7190
Commit
449d7190
authored
3 years ago
by
Philipp Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
manager: Add fatal device state and minor text fixes
parent
c8f59f47
No related branches found
No related tags found
2 merge requests
!12
Snapshot: field test deployed version as of end of run 202201
,
!3
Base correction device, CalCat interaction, DSSC and AGIPD devices
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/calng/CalibrationManager.py
+16
-8
16 additions, 8 deletions
src/calng/CalibrationManager.py
with
16 additions
and
8 deletions
src/calng/CalibrationManager.py
+
16
−
8
View file @
449d7190
...
...
@@ -26,12 +26,14 @@ from karabo.middlelayer import (
from
karabo
import
version
as
karaboVersion
from
._version
import
version
as
deviceVersion
'''
Device states:
- INIT: When the device is starting up
- ACTIVE: When the device is ready to manage a calibration pipeline
- CHANGING: When the device is actively changing the pipeline configuration
- ERROR: Recoverable error, only allows server restart
- UNKNOWN: Unrecoverable error
'''
...
...
@@ -335,6 +337,7 @@ class CalibrationManager(DeviceClientBase, Device):
detectorType
=
String
(
displayedName
=
'
Detector type
'
,
description
=
'
Type of the detector to manage.
'
,
options
=
[
'
AGIPD
'
,
'
LPD
'
,
'
DSSC
'
,
'
Jungfrau
'
,
'
ePix100
'
,
'
pnCCD
'
,
'
FastCCD
'
],
accessMode
=
AccessMode
.
INITONLY
,
...
...
@@ -561,8 +564,7 @@ class CalibrationManager(DeviceClientBase, Device):
else
:
break
else
:
self
.
state
=
State
.
UNKNOWN
self
.
_set_status
(
f
'
Topology not available after
{
i
+
1
}
tries
'
)
self
.
_set_fatal
(
f
'
Topology not available after
{
i
+
1
}
tries
'
)
return
self
.
logger
.
debug
(
f
'
Topology arrived after
{
i
+
1
}
tries
'
)
...
...
@@ -586,6 +588,12 @@ class CalibrationManager(DeviceClientBase, Device):
self
.
state
=
State
.
ERROR
self
.
_set_status
(
text
,
level
=
logging
.
ERROR
)
def
_set_fatal
(
self
,
text
):
"""
Set the device into unknown state and log an error message.
"""
self
.
state
=
State
.
UNKNOWN
self
.
_set_status
(
text
,
level
=
logging
.
CRITICAL
)
def
_set_exception
(
self
,
text
,
e
):
"""
Set the device into error upon an exception.
"""
...
...
@@ -662,11 +670,11 @@ class CalibrationManager(DeviceClientBase, Device):
body
=
json
.
dumps
({
'
server
'
:
{
'
command
'
:
command
}})))
except
(
ConnectionError
,
HTTPError
)
as
e
:
raise
RuntimeError
(
f
'
Failed sending
\'
{
command
}
\'
to
{
name
}
on
'
f
'
Failed sending
`
{
command
}
`
to
{
name
}
on
'
f
'
{
urlparse
(
self
.
_server_hosts
[
name
]).
hostname
}
:
{
e
}
'
)
if
not
json
.
loads
(
reply
.
body
)[
'
success
'
]:
raise
RuntimeError
(
'
Command
\'
{command}
\'
for {name} failed
'
)
raise
RuntimeError
(
'
Command
`
{command}
`
for {name} failed
'
)
while
True
:
await
sleep
(
self
.
webserverApi
.
statePollInterval
.
value
)
...
...
@@ -729,7 +737,7 @@ class CalibrationManager(DeviceClientBase, Device):
if
'
error
'
in
s
[
'
status
'
]}
if
servers_in_error
:
err
.
append
(
f
'
- Device server on
{
hostname
}
are in error state
'
err
.
append
(
f
'
- Device server
s
on
{
hostname
}
are in error state
'
+
'
,
'
.
join
(
servers_in_error
))
continue
...
...
@@ -737,7 +745,7 @@ class CalibrationManager(DeviceClientBase, Device):
if
not
s
[
'
control_allowed
'
]}
if
servers_disabled
:
err
.
append
(
f
'
- Device servers on
{
hostname
}
not controllable
'
err
.
append
(
f
'
- Device servers on
{
hostname
}
not controllable
'
f
'
via webserver:
'
+
'
,
'
.
join
(
servers_disabled
))
continue
...
...
@@ -1097,14 +1105,14 @@ class CalibrationManager(DeviceClientBase, Device):
for
device_id
in
device_ids
:
callNoWait
(
device_id
,
slot
,
*
args
)
self
.
logger
.
debug
(
f
'
Called
{
device_id
}
.
{
slot
}
(
{
args
}
)
'
)
self
.
logger
.
debug
(
f
'
Called
{
device_id
}
.
{
slot
}{
args
}
'
)
async
def
_call_on_corrections
(
self
,
slot
,
*
args
):
"""
Call a slot on all correction devices.
"""
if
self
.
_correction_device_ids
:
self
.
_call
(
self
.
_correction_device_ids
,
slot
,
*
args
)
self
.
logger
.
info
(
f
'
Called <CORR>.
{
slot
}
(
{
args
}
)
'
)
self
.
logger
.
info
(
f
'
Called <CORR>.
{
slot
}{
args
}
'
)
def
_set
(
self
,
device_ids
,
key
,
value
):
"""
Set the same property on a list of devices.
"""
...
...
This diff is collapsed.
Click to expand it.
David Hammer
@hammerd
mentioned in commit
3566342d
·
2 years ago
mentioned in commit
3566342d
mentioned in commit 3566342d031db1bb435b6430f100afdbaaa6c4bf
Toggle commit list
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