[ 
https://issues.apache.org/jira/browse/BEAM-9975?focusedWorklogId=432876&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-432876
 ]

ASF GitHub Bot logged work on BEAM-9975:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/May/20 22:30
            Start Date: 13/May/20 22:30
    Worklog Time Spent: 10m 
      Work Description: ibzib commented on a change in pull request #11696:
URL: https://github.com/apache/beam/pull/11696#discussion_r424767747



##########
File path: sdks/python/apache_beam/runners/job/utils.py
##########
@@ -23,14 +23,19 @@
 from __future__ import absolute_import
 
 import json
+import logging
 
 from google.protobuf import json_format
 from google.protobuf import struct_pb2
 
 
 def dict_to_struct(dict_obj):
   # type: (dict) -> struct_pb2.Struct
-  return json_format.ParseDict(dict_obj, struct_pb2.Struct())
+  try:
+    return json_format.ParseDict(dict_obj, struct_pb2.Struct())
+  except json_format.ParseError:
+    logging.error('Failed to parse dict {0}'.format(dict_obj))

Review comment:
       Thanks!




----------------------------------------------------------------
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: 432876)
    Time Spent: 40m  (was: 0.5h)

> PortableRunnerTest flake "ParseError: Unexpected type for Value message."
> -------------------------------------------------------------------------
>
>                 Key: BEAM-9975
>                 URL: https://issues.apache.org/jira/browse/BEAM-9975
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-py-core
>            Reporter: Brian Hulette
>            Priority: Major
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> Error looks similar to the one in BEAM-9907. Example from 
> https://builds.apache.org/job/beam_PreCommit_Python_Cron/2732
> {code}
> apache_beam/runners/portability/fn_api_runner/fn_runner_test.py:569: 
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> _ 
> apache_beam/pipeline.py:550: in __exit__
>     self.run().wait_until_finish()
> apache_beam/pipeline.py:529: in run
>     return self.runner.run_pipeline(self, self._options)
> apache_beam/runners/portability/portable_runner.py:426: in run_pipeline
>     job_service_handle.submit(proto_pipeline)
> apache_beam/runners/portability/portable_runner.py:107: in submit
>     prepare_response = self.prepare(proto_pipeline)
> apache_beam/runners/portability/portable_runner.py:184: in prepare
>     pipeline_options=self.get_pipeline_options()),
> apache_beam/runners/portability/portable_runner.py:174: in 
> get_pipeline_options
>     return job_utils.dict_to_struct(p_options)
> apache_beam/runners/job/utils.py:33: in dict_to_struct
>     return json_format.ParseDict(dict_obj, struct_pb2.Struct())
> target/.tox-py36-cython/py36-cython/lib/python3.6/site-packages/google/protobuf/json_format.py:450:
>  in ParseDict
>     parser.ConvertMessage(js_dict, message)
> target/.tox-py36-cython/py36-cython/lib/python3.6/site-packages/google/protobuf/json_format.py:479:
>  in ConvertMessage
>     methodcaller(_WKTJSONMETHODS[full_name][1], value, message)(self)
> target/.tox-py36-cython/py36-cython/lib/python3.6/site-packages/google/protobuf/json_format.py:667:
>  in _ConvertStructMessage
>     self._ConvertValueMessage(value[key], message.fields[key])
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
> _ 
> self = <google.protobuf.json_format._Parser object at 0x7f69eb5b59e8>
> value = <apache_beam.options.value_provider.RuntimeValueProvider object at 
> 0x7f69eb7b3ac8>
> message = 
>     def _ConvertValueMessage(self, value, message):
>       """Convert a JSON representation into Value message."""
>       if isinstance(value, dict):
>         self._ConvertStructMessage(value, message.struct_value)
>       elif isinstance(value, list):
>         self. _ConvertListValueMessage(value, message.list_value)
>       elif value is None:
>         message.null_value = 0
>       elif isinstance(value, bool):
>         message.bool_value = value
>       elif isinstance(value, six.string_types):
>         message.string_value = value
>       elif isinstance(value, _INT_OR_FLOAT):
>         message.number_value = value
>       else:
> >       raise ParseError('Unexpected type for Value message.')
> E       google.protobuf.json_format.ParseError: Unexpected type for Value 
> message.
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to