[
https://issues.apache.org/jira/browse/BEAM-6778?focusedWorklogId=213458&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-213458
]
ASF GitHub Bot logged work on BEAM-6778:
----------------------------------------
Author: ASF GitHub Bot
Created on: 14/Mar/19 22:42
Start Date: 14/Mar/19 22:42
Worklog Time Spent: 10m
Work Description: boyuanzz 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_r265793867
##########
File path: sdks/python/apache_beam/runners/portability/fn_api_runner_test.py
##########
@@ -753,6 +753,81 @@ def create_pipeline(self):
runner=fn_api_runner.FnApiRunner(bundle_repeat=3))
+class EventRecorder(object):
+ def __init__(self):
+ self.work_path = os.getcwd() + '/EventRecorder'
+ if os.path.exists(self.work_path):
+ self.cleanup()
+ os.mkdir(self.work_path)
+
+ def record(self, file_name):
+ file_path = os.path.join(self.work_path, str(file_name) + '.txt')
Review comment:
For https://docs.python.org/2/library/tempfile.html:
I tried to use tempfile.NamedTemporaryFile but it made ParDo fail to
initialize:
```
Traceback (most recent call last):
File
"/usr/local/google/home/boyuanz/beam/sdks/python/apache_beam/runners/portability/fn_api_runner_test.py",
line 820, in test_register_finalizations
fn = beam.ParDo(FinalizableDoFn())
File
"/usr/local/google/home/boyuanz/beam/sdks/python/apache_beam/transforms/core.py",
line 953, in __init__
super(ParDo, self).__init__(fn, *args, **kwargs)
File
"/usr/local/google/home/boyuanz/beam/sdks/python/apache_beam/transforms/ptransform.py",
line 688, in __init__
self.fn = pickler.loads(pickler.dumps(self.fn))
File
"/usr/local/google/home/boyuanz/beam/sdks/python/apache_beam/internal/pickler.py",
line 258, in loads
return dill.loads(s)
File
"/usr/local/google/home/boyuanz/beam/sdks/python/.eggs/dill-0.2.9-py2.7.egg/dill/_dill.py",
line 317, in loads
return load(file, ignore)
File
"/usr/local/google/home/boyuanz/beam/sdks/python/.eggs/dill-0.2.9-py2.7.egg/dill/_dill.py",
line 305, in load
obj = pik.load()
File "/usr/lib/python2.7/pickle.py", line 864, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1221, in load_build
setstate = getattr(inst, "__setstate__", None)
File "/usr/lib/python2.7/tempfile.py", line 401, in __getattr__
file = self.__dict__['file']
KeyError: 'file'
```
Planing using tempfile to create a tmp dir for EventRecorder
----------------------------------------------------------------
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: 213458)
Time Spent: 3h 50m (was: 3h 40m)
> 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: 3h 50m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)