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

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

                Author: ASF GitHub Bot
            Created on: 19/Mar/19 11:45
            Start Date: 19/Mar/19 11:45
    Worklog Time Spent: 10m 
      Work Description: robertwb commented on pull request #7937: [BEAM-6778] 
Enable Bundle Finalization in Python SDK harness over FnApi
URL: https://github.com/apache/beam/pull/7937#discussion_r266844782
 
 

 ##########
 File path: sdks/python/apache_beam/runners/portability/fn_api_runner_test.py
 ##########
 @@ -1083,6 +1131,34 @@ def __reduce__(self):
 def _unpickle_element_counter(name):
   return _pickled_element_counters[name]
 
+class EventRecorder(object):
+  """Used to be registered as a callback in bundle finalization.
+
+  The reason why records are written into a tmp file is, the in-memory dataset
+  cannot keep callback records when passing into one DoFn.
+  """
+  def __init__(self, tmp_dir):
+    self.tmp_dir = tmp_dir
+    self.file_path = os.path.join(self.tmp_dir, uuid.uuid4().hex + '.txt')
+
+  def record(self, content):
+    tmp_file = open(self.file_path, 'a')
 
 Review comment:
   Nit: preferable to use with statements for file. E.g.
   
   with open(file_path, 'w') as f:
       f.write(...)
 
----------------------------------------------------------------
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: 215398)
    Time Spent: 6.5h  (was: 6h 20m)

> Enable Bundle Finalization in Python SDK
> ----------------------------------------
>
>                 Key: BEAM-6778
>                 URL: https://issues.apache.org/jira/browse/BEAM-6778
>             Project: Beam
>          Issue Type: New Feature
>          Components: sdk-py-harness
>            Reporter: Boyuan Zhang
>            Assignee: Boyuan Zhang
>            Priority: Major
>          Time Spent: 6.5h
>  Remaining Estimate: 0h
>




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

Reply via email to