[
https://issues.apache.org/jira/browse/BEAM-7389?focusedWorklogId=304657&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-304657
]
ASF GitHub Bot logged work on BEAM-7389:
----------------------------------------
Author: ASF GitHub Bot
Created on: 30/Aug/19 22:48
Start Date: 30/Aug/19 22:48
Worklog Time Spent: 10m
Work Description: davidcavazos commented on pull request #9257:
[BEAM-7389] Add DoFn methods sample
URL: https://github.com/apache/beam/pull/9257#discussion_r319693091
##########
File path:
sdks/python/apache_beam/examples/snippets/transforms/element_wise/pardo_test.py
##########
@@ -58,24 +58,44 @@ def check_dofn_params(actual):
type(window) -> <class 'apache_beam.transforms.window.IntervalWindow'>
window.start -> Timestamp(1584675660) (2020-03-20 03:41:00)
window.end -> Timestamp(1584675690) (2020-03-20 03:41:30)
-window.max_timestamp() -> Timestamp(1584675689.999999) (2020-03-20
03:41:29.999999)'''
- # [END dofn_params]
+window.max_timestamp() -> Timestamp(1584675689.999999) (2020-03-20
03:41:29.999999)
+[END dofn_params]'''.splitlines()[1:-1])
# pylint: enable=line-too-long
assert_that(actual, equal_to([dofn_params]))
+def check_dofn_methods(actual):
+ results = '''[START results]
+__init__
+setup
+start_bundle
+* process: 🍓
+* process: 🥕
+* process: 🍆
+* process: 🍅
+* process: 🥔
+* finish_bundle: 🌱🌳🌍
+teardown
+[END results]'''.splitlines()[1:-1]
+ results = [line for line in results if line.startswith('*')]
+ assert_that(actual, equal_to(results))
Review comment:
I'm changing the test to actually check for both the order of the methods
executed, as well as all the elements being present without ordering
constraints.
Regarding if `DoFn` methods work on all runners, looking at #7994 I could
only find that [BEAM-7885 `DoFn.setup` doesn't run for streaming jobs in the
DirectRunner](https://issues.apache.org/jira/browse/BEAM-7885), and [BEAM-7340
`DoFn.teardown` metrics are
lost](https://issues.apache.org/jira/browse/BEAM-7340). I'll add those notes
into the docs as well (rather than comments in the code, for screen clutter :).
I looked into Jira too, but that was all that I could find, are you aware of
any other issues with other runners?
----------------------------------------------------------------
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: 304657)
Time Spent: 53h 20m (was: 53h 10m)
> Colab examples for element-wise transforms (Python)
> ---------------------------------------------------
>
> Key: BEAM-7389
> URL: https://issues.apache.org/jira/browse/BEAM-7389
> Project: Beam
> Issue Type: Improvement
> Components: website
> Reporter: Rose Nguyen
> Assignee: David Cavazos
> Priority: Minor
> Time Spent: 53h 20m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.3.2#803003)