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
4f89a053
Commit
4f89a053
authored
7 months ago
by
Philipp Schmidt
Committed by
David Hammer
7 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Wait for all assemblers to be ACTIVE before sending geometry
parent
d7a4235d
No related branches found
No related tags found
1 merge request
!105
Wait for all assemblers to be ACTIVE before sending geometry
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/calng/CalibrationManager.py
+28
-2
28 additions, 2 deletions
src/calng/CalibrationManager.py
with
28 additions
and
2 deletions
src/calng/CalibrationManager.py
+
28
−
2
View file @
4f89a053
...
...
@@ -5,6 +5,7 @@
#############################################################################
from
asyncio
import
gather
,
wait_for
,
TimeoutError
as
AsyncTimeoutError
from
contextlib
import
ExitStack
from
collections
import
defaultdict
from
collections.abc
import
Hashable
from
datetime
import
datetime
...
...
@@ -25,8 +26,9 @@ from karabo.middlelayer import (
AccessMode
,
AccessLevel
,
Assignment
,
DaqPolicy
,
State
,
Unit
,
UInt16
,
UInt32
,
Bool
,
Float
,
Double
,
String
,
VectorString
,
VectorHash
,
background
,
call
,
callNoWait
,
setNoWait
,
sleep
,
instantiate
,
slot
,
coslot
,
get_property
,
getTopology
,
getConfiguration
,
getConfigurationFromPast
,
getConfigurationFromName
,
getInstanceInfo
)
get_property
,
getDevice
,
getTopology
,
getConfiguration
,
getConfigurationFromPast
,
getConfigurationFromName
,
getInstanceInfo
,
waitUntil
)
from
.
import
scenes
from
._version
import
version
as
deviceVersion
...
...
@@ -1056,6 +1058,22 @@ class CalibrationManager(DeviceClientBase, Device):
if
info
[
'
status
'
].
startswith
(
state
):
return
async
def
_ensure_assemblers_active
(
self
):
"""
Ensure assemblers are in ACTIVE state.
"""
# This coroutine may throw an AsyncTimeoutError to be handled
# by the calling site.
with
ExitStack
()
as
stack
:
assemblers
=
[
stack
.
enter_context
(
await
wait_for
(
getDevice
(
device_id
),
timeout
=
3
))
for
device_id
in
self
.
_assembler_device_ids
]
await
wait_for
(
gather
(
*
[
waitUntil
(
lambda
:
assembler
.
state
==
State
.
ACTIVE
)
for
assembler
in
assemblers
]),
timeout
=
3
)
async
def
_check_servers
(
self
):
"""
Validate device server configuration.
"""
...
...
@@ -1390,6 +1408,14 @@ class CalibrationManager(DeviceClientBase, Device):
# Force managed DAQ settings.
await
self
.
_apply_managed_values
(
daq
=
True
)
# Try waiting until assemblers are active.
try
:
await
self
.
_ensure_assemblers_active
()
except
AsyncTimeoutError
:
self
.
_set_status
(
'
One or more assemblers missing or not in
'
'
active state after timeout - geometry may
'
'
require manual update
'
)
# Ask the geometry device to re-send its geometry.
callNoWait
(
self
.
geometryDevice
.
value
,
'
sendGeometry
'
)
...
...
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