damccorm commented on code in PR #35660:
URL: https://github.com/apache/beam/pull/35660#discussion_r2225675016


##########
sdks/python/apache_beam/transforms/ptransform.py:
##########
@@ -1030,11 +1031,27 @@ def expand(self, pcoll):
       pass
     return self._fn(pcoll, *args, **kwargs)
 
+  def set_options(self, options):
+    # Avoid circular import.
+    from apache_beam.transforms.util import is_compat_version_prior_to
+    self._use_backwards_compatible_label = is_compat_version_prior_to(
+        options, '2.67.0')
+
   def default_label(self):
+    # Attempt to give a reasonable name to this transform.
+    # We want it to be reasonably unique, but also not sensitive to
+    # irrelevent parameters to minimize pipeline-to-pipeline variance.
+    # For now, use only the first argument (if any), iff it would not make
+    # the name unwieldy.
     if self._args:
-      return '%s(%s)' % (
-          label_from_callable(self._fn), label_from_callable(self._args[0]))
-    return label_from_callable(self._fn)
+      first_arg_string = label_from_callable(self._args[0])
+      if self._use_backwards_compatible_label or len(first_arg_string) <= 16:

Review Comment:
   Minor note, but can we do this:
   
   ```suggestion
         if self._use_backwards_compatible_label or len(first_arg_string) <= 19:
   ```
   
   That way if we have a label of length = 16, we're not just adding `...`, and 
instead we're guaranteed to produce something <= the original in length



##########
sdks/python/apache_beam/transforms/ptransform.py:
##########
@@ -1030,11 +1031,27 @@ def expand(self, pcoll):
       pass
     return self._fn(pcoll, *args, **kwargs)
 
+  def set_options(self, options):
+    # Avoid circular import.
+    from apache_beam.transforms.util import is_compat_version_prior_to
+    self._use_backwards_compatible_label = is_compat_version_prior_to(
+        options, '2.67.0')

Review Comment:
   Noting that the release cut is today, so if we don't merge quickly we'll 
need to update this.



-- 
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.

To unsubscribe, e-mail: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to