[
https://issues.apache.org/jira/browse/BEAM-562?focusedWorklogId=228031&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-228031
]
ASF GitHub Bot logged work on BEAM-562:
---------------------------------------
Author: ASF GitHub Bot
Created on: 15/Apr/19 22:57
Start Date: 15/Apr/19 22:57
Worklog Time Spent: 10m
Work Description: aaltay commented on pull request #7994: [BEAM-562] Add
DoFn.setup and DoFn.teardown to Python SDK
URL: https://github.com/apache/beam/pull/7994#discussion_r275572962
##########
File path: sdks/python/apache_beam/transforms/dofn_lifecycle_test.py
##########
@@ -0,0 +1,91 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+"""UnitTests for DoFn lifecycle and bundle methods"""
+
+from __future__ import absolute_import
+
+import unittest
+
+from nose.plugins.attrib import attr
+
+import apache_beam as beam
+from apache_beam.testing.test_pipeline import TestPipeline
+
+class CallSequenceEnforcingDoFn(beam.DoFn):
+ def __init__(self):
+ self._setup_called = False
+ self._start_bundle_calls = 0
+ self._finish_bundle_calls = 0
+ self._teardown_called = False
+
+ def setup(self):
+ # Use assert instead of unittest.TestCase.assert* methods because
Review comment:
You can drop the duplicate instances of this comment. (I actually think you
can actually drop all instances of this comment since, but if you think it is
confusing you can leave one.)
----------------------------------------------------------------
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: 228031)
Time Spent: 3h 20m (was: 3h 10m)
> DoFn Reuse: Add new methods to DoFn
> -----------------------------------
>
> Key: BEAM-562
> URL: https://issues.apache.org/jira/browse/BEAM-562
> Project: Beam
> Issue Type: New Feature
> Components: sdk-py-core
> Reporter: Ahmet Altay
> Priority: Major
> Labels: sdk-consistency, triaged
> Time Spent: 3h 20m
> Remaining Estimate: 0h
>
> Java SDK added setup and teardown methods to the DoFns. This makes DoFns
> reusable and provide performance improvements. Python SDK should add support
> for these new DoFn methods:
> Proposal doc:
> https://docs.google.com/document/d/1LLQqggSePURt3XavKBGV7SZJYQ4NW8yCu63lBchzMRk/edit?ts=5771458f#
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)