angoenka commented on a change in pull request #14470:
URL: https://github.com/apache/beam/pull/14470#discussion_r609984292
##########
File path: sdks/python/apache_beam/pipeline.py
##########
@@ -1248,7 +1249,18 @@ def transform_to_runner_api(
environment_id=environment_id,
annotations=self.annotations,
# TODO(BEAM-366): Add display_data.
- display_data=None)
+ display_data=[
+ beam_runner_api_pb2.DisplayData(
+
urn=common_urns.StandardDisplayData.DisplayData.LABELLED_STRING.
Review comment:
There is only 1 enum defined for DisplayData types which is
beam:display_data:labelled_string:v1
I think the proto has it mostly for future extensibility.
Alternatively, we can have a DisplayData type which closely resemble v1beta3
display data so that we don't loose information like
{
"key": "fn",
"label": "Transform Function",
"namespace": "apache_beam.transforms.core.ParDo",
"shortValue": "_WriteBundleDoFn",
"type": "STRING",
"value": "apache_beam.io.iobase._WriteBundleDoFn"
},
##########
File path: sdks/python/apache_beam/pipeline.py
##########
@@ -1248,7 +1249,18 @@ def transform_to_runner_api(
environment_id=environment_id,
annotations=self.annotations,
# TODO(BEAM-366): Add display_data.
- display_data=None)
+ display_data=[
+ beam_runner_api_pb2.DisplayData(
+
urn=common_urns.StandardDisplayData.DisplayData.LABELLED_STRING.
+ urn,
+ payload=beam_runner_api_pb2.LabelledStringPayload(
+ label=dd.get_dict()['label']
+ if 'label' in dd.get_dict() else None,
+ value=str(
+ dd.get_dict()['value'] if 'value' in
+ dd.get_dict() else None)).SerializeToString())
+ for dd in DisplayData.create_from(self.transform).items if dd.label
Review comment:
Done
--
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]