tvalentyn commented on code in PR #36300:
URL: https://github.com/apache/beam/pull/36300#discussion_r2383230039


##########
sdks/python/apache_beam/internal/cloudpickle/cloudpickle.py:
##########
@@ -1300,6 +1327,12 @@ def _function_getnewargs(self, func):
     base_globals = self.globals_ref.setdefault(id(func.__globals__), {})
 
     if base_globals == {}:
+      if "__file__" in func.__globals__:
+        # Apply normalization ONLY to the __file__ attribute
+        file_path = func.__globals__["__file__"]
+        if self.config.use_relative_filepaths:
+          file_path = _get_relative_path(file_path)
+        base_globals["__file__"] = file_path

Review Comment:
   (as discussed offline, we need to adjust line 1338)



##########
sdks/python/apache_beam/internal/cloudpickle/cloudpickle.py:
##########
@@ -111,6 +112,7 @@ class CloudPickleConfig:
   """Configuration for cloudpickle behavior."""
   id_generator: typing.Optional[callable] = uuid_generator
   skip_reset_dynamic_type_state: bool = False
+  use_relative_filepaths: bool = False

Review Comment:
   Could we add  some docstring-like content for these settings? 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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to