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
29ca3010
Commit
29ca3010
authored
3 years ago
by
Philipp Schmidt
Committed by
scsonc
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
manager: Optionally restore matcher sources and bridge status on instantation
parent
2c9caf0f
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
+44
-6
44 additions, 6 deletions
src/calng/CalibrationManager.py
with
44 additions
and
6 deletions
src/calng/CalibrationManager.py
+
44
−
6
View file @
29ca3010
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
from
asyncio
import
gather
,
wait_for
,
TimeoutError
as
AsyncTimeoutError
from
asyncio
import
gather
,
wait_for
,
TimeoutError
as
AsyncTimeoutError
from
collections
import
defaultdict
from
collections
import
defaultdict
from
datetime
import
datetime
from
traceback
import
format_exc
from
traceback
import
format_exc
from
urllib.parse
import
urlparse
from
urllib.parse
import
urlparse
import
json
import
json
...
@@ -20,7 +21,7 @@ from karabo.middlelayer import (
...
@@ -20,7 +21,7 @@ from karabo.middlelayer import (
AccessMode
,
AccessLevel
,
Assignment
,
DaqPolicy
,
State
,
Unit
,
AccessMode
,
AccessLevel
,
Assignment
,
DaqPolicy
,
State
,
Unit
,
UInt16
,
Int32
,
UInt32
,
Bool
,
Double
,
String
,
VectorString
,
VectorHash
,
UInt16
,
Int32
,
UInt32
,
Bool
,
Double
,
String
,
VectorString
,
VectorHash
,
background
,
callNoWait
,
setNoWait
,
sleep
,
instantiate
,
slot
,
coslot
,
background
,
callNoWait
,
setNoWait
,
sleep
,
instantiate
,
slot
,
coslot
,
get
Topology
)
get
Device
,
getTopology
,
getConfigurationFromPast
)
from
karabo
import
version
as
karaboVersion
from
karabo
import
version
as
karaboVersion
from
._version
import
version
as
deviceVersion
from
._version
import
version
as
deviceVersion
...
@@ -423,6 +424,21 @@ class CalibrationManager(DeviceClientBase, Device):
...
@@ -423,6 +424,21 @@ class CalibrationManager(DeviceClientBase, Device):
self
.
state
=
State
.
CHANGING
self
.
state
=
State
.
CHANGING
background
(
self
.
_instantiate_pipeline
())
background
(
self
.
_instantiate_pipeline
())
restoreMatcherSources
=
Bool
(
displayedName
=
'
Restore matcher sources
'
,
description
=
'
Attempt to retrieve and restore the last known
'
'
configuration for slow and fast sources of matcher
'
'
devices when the pipeline is instantiated.
'
,
defaultValue
=
False
,
accessMode
=
AccessMode
.
RECONFIGURABLE
)
autoActivateBridges
=
Bool
(
displayedName
=
'
Activate bridges automatically
'
,
description
=
'
Whether to activate all group bridges immediately
'
'
after instantation
'
,
defaultValue
=
True
,
accessMode
=
AccessMode
.
RECONFIGURABLE
)
# TODO: Inject at runtime by scanning correction device schema.
# TODO: Inject at runtime by scanning correction device schema.
runtimeParameters
=
Node
(
runtimeParameters
=
Node
(
RuntimeParametersNode
,
RuntimeParametersNode
,
...
@@ -799,13 +815,13 @@ class CalibrationManager(DeviceClientBase, Device):
...
@@ -799,13 +815,13 @@ class CalibrationManager(DeviceClientBase, Device):
msg
=
await
wait_for
(
instantiate
(
msg
=
await
wait_for
(
instantiate
(
server
,
class_id
,
device_id
,
config
),
5.0
)
server
,
class_id
,
device_id
,
config
),
5.0
)
except
AsyncTimeoutError
:
except
AsyncTimeoutError
:
return
self
.
_set_error
(
f
'
Instantiation timeout on
{
device_id
}
'
)
self
.
_set_error
(
f
'
Instantiation timeout on
{
device_id
}
'
)
return
False
except
KaraboError
as
e
:
except
KaraboError
as
e
:
return
self
.
_set_exception
(
self
.
_set_exception
(
f
'
Instantiation error on
{
device_id
}
'
,
e
)
f
'
Instantiation error on
{
device_id
}
'
,
e
)
return
False
else
:
self
.
logger
.
debug
(
f
'
Instantation result for
{
device_id
}
:
{
msg
}
'
)
self
.
logger
.
debug
(
f
'
Instantation result for
{
device_id
}
:
{
msg
}
'
)
return
True
return
True
async
def
_instantiate_pipeline
(
self
):
async
def
_instantiate_pipeline
(
self
):
...
@@ -921,6 +937,17 @@ class CalibrationManager(DeviceClientBase, Device):
...
@@ -921,6 +937,17 @@ class CalibrationManager(DeviceClientBase, Device):
for
vname
in
modules_by_group
[
group
]]
for
vname
in
modules_by_group
[
group
]]
config
[
'
pathToStack
'
]
=
'
image.data
'
config
[
'
pathToStack
'
]
=
'
image.data
'
if
self
.
restoreMatcherSources
:
try
:
old_config
=
await
getConfigurationFromPast
(
matcher_device_id
,
datetime
.
now
().
isoformat
())
except
KaraboError
:
pass
# Ignore configuration on error
else
:
config
[
'
channels
'
]
=
old_config
[
'
channels
'
]
config
[
'
slowSources
'
]
=
old_config
[
'
slowSources
'
]
config
[
'
fastSources
'
]
=
old_config
[
'
fastSources
'
]
if
not
await
self
.
_instantiate_device
(
if
not
await
self
.
_instantiate_device
(
server
,
class_ids
[
'
groupMatcher
'
],
server
,
class_ids
[
'
groupMatcher
'
],
matcher_device_id
,
config
matcher_device_id
,
config
...
@@ -943,6 +970,17 @@ class CalibrationManager(DeviceClientBase, Device):
...
@@ -943,6 +970,17 @@ class CalibrationManager(DeviceClientBase, Device):
server
,
class_ids
[
'
bridge
'
],
bridge_device_id
,
config
server
,
class_ids
[
'
bridge
'
],
bridge_device_id
,
config
):
):
return
return
elif
self
.
autoActivateBridges
:
# Delay the slot a bit since it will get lost during
# instantation.
async
def
_activate_bridge
(
device_id
):
with
await
getDevice
(
device_id
)
as
device
:
await
sleep
(
3
)
if
device
.
state
==
State
.
PASSIVE
:
await
device
.
activate
()
background
(
_activate_bridge
(
bridge_device_id
))
# Instantiate preview layer matchers and assemblers.
# Instantiate preview layer matchers and assemblers.
for
layer
,
output_pipeline
,
server
in
self
.
previewLayers
.
value
:
for
layer
,
output_pipeline
,
server
in
self
.
previewLayers
.
value
:
...
...
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