[ 
https://issues.apache.org/jira/browse/BEAM-2857?focusedWorklogId=253912&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-253912
 ]

ASF GitHub Bot logged work on BEAM-2857:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 04/Jun/19 18:25
            Start Date: 04/Jun/19 18:25
    Worklog Time Spent: 10m 
      Work Description: pabloem commented on pull request #8394: [BEAM-2857] 
Implementing WriteToFiles transform for fileio (Python)
URL: https://github.com/apache/beam/pull/8394#discussion_r290433597
 
 

 ##########
 File path: sdks/python/apache_beam/io/fileio.py
 ##########
 @@ -562,16 +569,21 @@ def process(self, element):
                        r.pane,
                        destination)
 
-    logging.info('Cautiously removing temporary files for destination %s',
-                 destination)
-    self._remove_temporary_files([r.file_name for r in file_results])
+    logging.info('Cautiously removing temporary files for'
+                 ' destination %s and window %s', destination, w)
+    writer_key = (destination, w)
+    self._remove_temporary_files(writer_key)
 
-  @staticmethod
-  def _remove_temporary_files(files):
+  def _remove_temporary_files(self, writer_key):
     try:
-      filesystems.FileSystems.delete(files)
+      prefix = filesystems.FileSystems.join(
+          self.temporary_directory.get(), str(abs(hash(writer_key))))
+      match_result = filesystems.FileSystems.match(['%s*' % prefix])
+      orphaned_files = [m.path for m in match_result[0].metadata_list]
+
+      logging.debug('Deleting orphaned files: %s', orphaned_files)
+      filesystems.FileSystems.delete(orphaned_files)
 
 Review comment:
   Yes. All we're doing is logging the failures (in debug level) to be aware of 
them.
 
----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 253912)
    Time Spent: 5h 50m  (was: 5h 40m)

> Create FileIO in Python
> -----------------------
>
>                 Key: BEAM-2857
>                 URL: https://issues.apache.org/jira/browse/BEAM-2857
>             Project: Beam
>          Issue Type: New Feature
>          Components: sdk-py-core
>            Reporter: Eugene Kirpichov
>            Assignee: Pablo Estrada
>            Priority: Major
>              Labels: gsoc, gsoc2019, mentor
>          Time Spent: 5h 50m
>  Remaining Estimate: 0h
>
> Beam Java has a FileIO with operations: match()/matchAll(), readMatches(), 
> which together cover the majority of needs for general-purpose file 
> ingestion. Beam Python should have something similar.
> An early design document for this: https://s.apache.org/fileio-beam-python



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to