[
https://issues.apache.org/jira/browse/BEAM-9548?focusedWorklogId=408383&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-408383
]
ASF GitHub Bot logged work on BEAM-9548:
----------------------------------------
Author: ASF GitHub Bot
Created on: 23/Mar/20 23:07
Start Date: 23/Mar/20 23:07
Worklog Time Spent: 10m
Work Description: pabloem commented on pull request #11163: [BEAM-9548]
Add better error handling to the TestStreamServiceController
URL: https://github.com/apache/beam/pull/11163#discussion_r396767924
##########
File path:
sdks/python/apache_beam/runners/interactive/caching/streaming_cache.py
##########
@@ -202,14 +207,24 @@ def _emit_from_file(self, fh, tail):
# The first line at pos = 0 is always the header. Read the line without
# the new line.
to_decode = line[:-1]
- if pos == 0:
- header = TestStreamFileHeader()
- header.ParseFromString(self._coder.decode(to_decode))
- yield header
+ proto_cls = TestStreamFileHeader if pos == 0 else TestStreamFileRecord
+ msg = self._try_parse_as(proto_cls, to_decode)
+ if msg:
+ yield msg
else:
- record = TestStreamFileRecord()
- record.ParseFromString(self._coder.decode(to_decode))
- yield record
+ break
+
+ def _try_parse_as(self, proto_cls, to_decode):
+ try:
+ msg = proto_cls()
+ msg.ParseFromString(self._coder.decode(to_decode))
+ except DecodeError:
+ _LOGGER.error(
+ 'Could not parse as %s. This can indicate that the cache is '
+ 'corruputed. Please restart the kernel. '
+ '\nfile: %s \nmessage: %s', proto_cls, self._path, to_decode)
+ msg = None
Review comment:
Do we just skip? This may mean that the file is corrupted? Should we stop
consuming (i.e. rethrow the exception)?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 408383)
Time Spent: 20m (was: 10m)
> Bad error handling with errors from TestStreamService when using Interactive
> Beam
> ---------------------------------------------------------------------------------
>
> Key: BEAM-9548
> URL: https://issues.apache.org/jira/browse/BEAM-9548
> Project: Beam
> Issue Type: Bug
> Components: runner-py-interactive
> Reporter: Sam Rohde
> Assignee: Sam Rohde
> Priority: Major
> Time Spent: 20m
> Remaining Estimate: 0h
>
> The error handling when an error is generated on the GRPC server side is very
> verbose and hides the problem.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)