Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
bliss
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
505
Issues
505
List
Boards
Labels
Service Desk
Milestones
Jira
Jira
Merge Requests
133
Merge Requests
133
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Bliss
bliss
Commits
c9555308
Commit
c9555308
authored
Feb 05, 2020
by
Wout De Nolf
Committed by
Matias Guijarro
Feb 12, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[writer] capture exceptions during finalization
parent
e61f7013
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
19 deletions
+30
-19
nexus_writer_service/subscribers/scan_writer_base.py
nexus_writer_service/subscribers/scan_writer_base.py
+28
-18
nexus_writer_service/subscribers/scan_writer_config.py
nexus_writer_service/subscribers/scan_writer_config.py
+2
-1
No files found.
nexus_writer_service/subscribers/scan_writer_base.py
View file @
c9555308
...
...
@@ -228,18 +228,10 @@ class NexusScanWriterBase(base_subscriber.BaseSubscriber):
"""
Executed at the end of the event loop
"""
try
:
with
self
.
_capture_finalize_exceptions
()
:
self
.
_finalize_hdf5
()
except
BaseException
as
e
:
self
.
_set_state
(
self
.
STATES
.
FAULT
,
e
)
self
.
logger
.
error
(
"Not properly finalized due to exception:
\n
{}"
.
format
(
traceback
.
format_exc
()
)
)
finally
:
self
.
log_progress
(
"Finished writing to {}"
.
format
(
repr
(
self
.
filename
)))
super
().
_event_loop_finalize
(
**
kwargs
)
self
.
log_progress
(
"Finished writing to {}"
.
format
(
repr
(
self
.
filename
)))
super
().
_event_loop_finalize
(
**
kwargs
)
def
_register_event_loop_tasks
(
self
,
nxroot
=
None
,
**
kwargs
):
"""
...
...
@@ -263,18 +255,22 @@ class NexusScanWriterBase(base_subscriber.BaseSubscriber):
self
.
logger
.
info
(
"Fetch last data"
)
for
node
in
self
.
_nodes
:
self
.
_fetch_data
(
node
,
last
=
True
)
with
self
.
_capture_finalize_exceptions
():
self
.
_fetch_data
(
node
,
last
=
True
)
# Skip because fix length scans can have variable data points
# self.logger.info(
# "Ensure all dataset have the same number of points"
# )
#
# for subscan in self._enabled_subscans:
# self._ensure_same_length(subscan)
# with self._capture_finalize_exceptions():
# self._ensure_same_length(subscan)
self
.
logger
.
info
(
"Link external data (VDS or raw)"
)
for
node
in
self
.
_nodes
:
self
.
_ensure_dataset_existance
(
node
)
with
self
.
_capture_finalize_exceptions
():
self
.
_ensure_dataset_existance
(
node
)
self
.
logger
.
info
(
"Save detector metadata"
)
skip
=
set
()
...
...
@@ -285,6 +281,16 @@ class NexusScanWriterBase(base_subscriber.BaseSubscriber):
self
.
_finalize_subscan
(
subscan
)
self
.
_mark_done
(
subscan
)
@
contextmanager
def
_capture_finalize_exceptions
(
self
):
try
:
yield
except
BaseException
as
e
:
self
.
_set_state
(
self
.
STATES
.
FAULT
,
e
)
self
.
logger
.
error
(
"Captured finalization exception:
\n
{}"
.
format
(
traceback
.
format_exc
())
)
def
get_subscan_info
(
self
,
subscan
,
key
,
default
=
None
,
cache
=
False
):
"""
Get from the subscan's info dictionary.
...
...
@@ -963,10 +969,14 @@ class NexusScanWriterBase(base_subscriber.BaseSubscriber):
:param Subscan subscan:
"""
self
.
_save_positioners
(
subscan
)
self
.
_create_plots
(
subscan
)
self
.
_fetch_subscan_metadata
(
subscan
)
self
.
_fetch_subscan_notes
(
subscan
)
with
self
.
_capture_finalize_exceptions
():
self
.
_save_positioners
(
subscan
)
with
self
.
_capture_finalize_exceptions
():
self
.
_create_plots
(
subscan
)
with
self
.
_capture_finalize_exceptions
():
self
.
_fetch_subscan_metadata
(
subscan
)
with
self
.
_capture_finalize_exceptions
():
self
.
_fetch_subscan_notes
(
subscan
)
@
property
def
current_bytes
(
self
):
...
...
nexus_writer_service/subscribers/scan_writer_config.py
View file @
c9555308
...
...
@@ -156,7 +156,8 @@ class NexusScanWriterConfigurable(scan_writer_base.NexusScanWriterBase):
:param Subscan subscan:
"""
super
().
_finalize_subscan
(
subscan
)
self
.
_save_applications
(
subscan
)
with
self
.
_capture_finalize_exceptions
():
self
.
_save_applications
(
subscan
)
def
mca_iter
(
self
,
subscan
):
"""
...
...
Write
Preview
Markdown
is supported
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