[ https://issues.apache.org/jira/browse/BEAM-9548?focusedWorklogId=408978&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-408978 ]
ASF GitHub Bot logged work on BEAM-9548: ---------------------------------------- Author: ASF GitHub Bot Created on: 24/Mar/20 17:47 Start Date: 24/Mar/20 17:47 Worklog Time Spent: 10m Work Description: rohdesamuel commented on pull request #11163: [BEAM-9548] Add better error handling to the TestStreamServiceController URL: https://github.com/apache/beam/pull/11163#discussion_r397344411 ########## 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: No, if we rethrow the exception, it will get handled by the GRPC layer above and get turned into gobbledygook. This does stop processing because it returns msg = None which breaks out of the loop. ---------------------------------------------------------------- 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: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 408978) Time Spent: 50m (was: 40m) > 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: 50m > 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)