AnandInguva commented on code in PR #29564:
URL: https://github.com/apache/beam/pull/29564#discussion_r1420845901


##########
sdks/python/apache_beam/ml/transforms/utils.py:
##########
@@ -28,8 +30,13 @@ class ArtifactsFetcher():
   to the TFTProcessHandlers in MLTransform.
   """
   def __init__(self, artifact_location):
-    self.artifact_location = artifact_location
-    self.transform_output = tft.TFTransformOutput(self.artifact_location)
+    files = os.listdir(artifact_location)
+    files.remove(base._ATTRIBUTE_FILE_NAME)
+    if len(files) > 1:
+      raise NotImplementedError(
+          'Multiple files in artifact location not supported yet.')

Review Comment:
   The current implementation of this class allows users to manually retrieve 
artifacts. 
   
   However, it introduces a potential conflict when a single job with identical 
artifact locations utilize 
MLTransform().with_transform(tft_operation).with_transform(embeddings).with_transform(tft_operation).
 This leads to the creation of two tft artifact sub-directories within the 
specified location. Unfortunately, ArtifactsFetcher lacks the capability to 
disambiguate between these directories, making it difficult to determine which 
artifacts to retrieve. Therefore, a more robust solution is necessary to 
address this issue.



##########
sdks/python/apache_beam/ml/transforms/utils.py:
##########
@@ -28,8 +30,13 @@ class ArtifactsFetcher():
   to the TFTProcessHandlers in MLTransform.
   """
   def __init__(self, artifact_location):
-    self.artifact_location = artifact_location
-    self.transform_output = tft.TFTransformOutput(self.artifact_location)
+    files = os.listdir(artifact_location)
+    files.remove(base._ATTRIBUTE_FILE_NAME)
+    if len(files) > 1:
+      raise NotImplementedError(
+          'Multiple files in artifact location not supported yet.')

Review Comment:
   The current implementation of this class allows users to manually retrieve 
artifacts. 
   
   However, it introduces a potential conflict when a single job with identical 
artifact locations utilize 
`MLTransform().with_transform(tft_operation).with_transform(embeddings).with_transform(tft_operation)`.
 This leads to the creation of two tft artifact sub-directories within the 
specified location. Unfortunately, ArtifactsFetcher lacks the capability to 
disambiguate between these directories, making it difficult to determine which 
artifacts to retrieve. Therefore, a more robust solution is necessary to 
address this issue.



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