[ https://issues.apache.org/jira/browse/BEAM-5953?focusedWorklogId=165151&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-165151 ]
ASF GitHub Bot logged work on BEAM-5953: ---------------------------------------- Author: ASF GitHub Bot Created on: 12/Nov/18 21:41 Start Date: 12/Nov/18 21:41 Worklog Time Spent: 10m Work Description: aaltay closed pull request #7011: [BEAM-5953] Fix DataflowRunner in Python 3 - type errors URL: https://github.com/apache/beam/pull/7011 This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/sdks/python/apache_beam/internal/gcp/json_value.py b/sdks/python/apache_beam/internal/gcp/json_value.py index ec85c288731..d4c4bfe7641 100644 --- a/sdks/python/apache_beam/internal/gcp/json_value.py +++ b/sdks/python/apache_beam/internal/gcp/json_value.py @@ -107,6 +107,8 @@ def to_json_value(obj, with_type=False): return to_json_value(get_typed_value_descriptor(obj), with_type=False) elif isinstance(obj, (str, unicode)): return extra_types.JsonValue(string_value=obj) + elif isinstance(obj, bytes): + return extra_types.JsonValue(string_value=obj.decode('utf8')) elif isinstance(obj, bool): return extra_types.JsonValue(boolean_value=obj) elif isinstance(obj, (int, long)): diff --git a/sdks/python/apache_beam/internal/gcp/json_value_test.py b/sdks/python/apache_beam/internal/gcp/json_value_test.py index e7cf7f15e36..e6d064a92d5 100644 --- a/sdks/python/apache_beam/internal/gcp/json_value_test.py +++ b/sdks/python/apache_beam/internal/gcp/json_value_test.py @@ -41,6 +41,9 @@ class JsonValueTest(unittest.TestCase): def test_string_to(self): self.assertEquals(JsonValue(string_value='abc'), to_json_value('abc')) + def test_bytes_to(self): + self.assertEquals(JsonValue(string_value='abc'), to_json_value(b'abc')) + def test_true_to(self): self.assertEquals(JsonValue(boolean_value=True), to_json_value(True)) diff --git a/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py b/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py index 30f466b40ef..a135251fa8e 100644 --- a/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py +++ b/sdks/python/apache_beam/runners/dataflow/dataflow_runner.py @@ -175,7 +175,7 @@ def rank_error(msg): for m in messages: message = '%s: %s: %s' % (m.time, m.messageImportance, m.messageText) - if m.time > last_message_time: + if not last_message_time or m.time > last_message_time: last_message_time = m.time current_seen_messages = set() @@ -522,7 +522,7 @@ def run_Impulse(self, transform_node): encoded_impulse_element = coders.WindowedValueCoder( coders.BytesCoder(), coders.coders.GlobalWindowCoder()).get_impl().encode_nested( - window.GlobalWindows.windowed_value('')) + window.GlobalWindows.windowed_value(b'')) step.add_property(PropertyNames.IMPULSE_ELEMENT, self.byte_array_to_json_string(encoded_impulse_element)) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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: 165151) Time Spent: 1h 10m (was: 1h) > Support DataflowRunner on Python 3 > ---------------------------------- > > Key: BEAM-5953 > URL: https://issues.apache.org/jira/browse/BEAM-5953 > Project: Beam > Issue Type: Sub-task > Components: sdk-py-core > Reporter: Mark Liu > Assignee: Mark Liu > Priority: Major > Time Spent: 1h 10m > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.3#76005)