saavannanavati commented on a change in pull request #12352: URL: https://github.com/apache/beam/pull/12352#discussion_r466168597
########## File path: sdks/python/apache_beam/runners/worker/opcounters.py ########## @@ -202,6 +209,37 @@ def __init__( self._sample_counter = 0 self._next_sample = 0 + self.producer_type_hints = None + self.producer_full_label = None + self.producer_parameter_name = None + + if producer and hasattr(producer, 'spec') and hasattr(producer.spec, + 'serialized_fn'): + fns = pickler.loads(producer.spec.serialized_fn) + if fns: + if hasattr(fns[0], '_runtime_type_hints'): + self.producer_type_hints = fns[0]._runtime_type_hints + if hasattr(fns[0], '_full_label'): + self.producer_full_label = fns[0]._full_label + if hasattr(fns[0], '_runtime_parameter_name'): + self.producer_parameter_name = fns[0]._runtime_parameter_name + + self.consumer_type_hints = [] + self.consumer_full_labels = [] + self.consumer_parameter_names = [] + + if consumers: Review comment: I moved as much logic as possible to the visitor (and removed the duplicated code) but kept the producer/consumer distinction because that determines whether we type check using the output types (for the producer) versus the input types (for the consumer) ---------------------------------------------------------------- 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