Skip to content

Commit

Permalink
Log dataflow messages at appropriate levels (#27788)
Browse files Browse the repository at this point in the history
* Log dataflow messages at appropriate levels

* Use single-cast message importance for error case

* Add catch-all
  • Loading branch information
jrmccluskey authored Aug 2, 2023
1 parent 59880fe commit f9449b4
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions sdks/python/apache_beam/runners/dataflow/dataflow_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,21 @@ def rank_error(msg):
# Skip empty messages.
if m.messageImportance is None:
continue
_LOGGER.info(message)
if str(m.messageImportance) == 'JOB_MESSAGE_ERROR':
message_importance = str(m.messageImportance)
if (message_importance == 'JOB_MESSAGE_DEBUG' or
message_importance == 'JOB_MESSAGE_DETAILED'):
_LOGGER.debug(message)
elif message_importance == 'JOB_MESSAGE_BASIC':
_LOGGER.info(message)
elif message_importance == 'JOB_MESSAGE_WARNING':
_LOGGER.warning(message)
elif message_importance == 'JOB_MESSAGE_ERROR':
_LOGGER.error(message)
if rank_error(m.messageText) >= last_error_rank:
last_error_rank = rank_error(m.messageText)
last_error_msg = m.messageText
else:
_LOGGER.info(message)
if not page_token:
break

Expand Down

0 comments on commit f9449b4

Please sign in to comment.