ryanthompson591 commented on a change in pull request #16154:
URL: https://github.com/apache/beam/pull/16154#discussion_r794666629
##########
File path: sdks/python/apache_beam/examples/complete/estimate_pi.py
##########
@@ -101,21 +101,27 @@ def expand(self, pcoll):
| 'Sum' >> beam.CombineGlobally(combine_results).without_defaults())
-def run(argv=None):
+def run(argv=None, save_main_session=True):
parser = argparse.ArgumentParser()
parser.add_argument(
'--output', required=True, help='Output file to write results to.')
+ parser.add_argument(
Review comment:
Prefer just using a constant to an extra argument unless we anticipate
anyone changing this for any reason.
##########
File path:
sdks/python/apache_beam/examples/complete/game/hourly_team_score_it_test.py
##########
@@ -90,6 +90,35 @@ def test_hourly_team_score_it(self):
self.test_pipeline.get_full_options_as_args(**extra_opts),
save_main_session=False)
+ @pytest.mark.examples_postcommit
+ def test_hourly_team_score_output_checksum_on_small_input(self):
+ # Small dataset to prevent OOM when running in local runners
Review comment:
I'm not sure what OOM is
##########
File path: sdks/python/apache_beam/examples/complete/game/user_score_test.py
##########
@@ -42,7 +40,6 @@ class UserScoreTest(unittest.TestCase):
'user1_team1,team1,14,1447697463000,2015-11-16 18:11:03.955',
]
- @pytest.mark.examples_postcommit
Review comment:
just curious why are we removing these?
##########
File path: sdks/python/apache_beam/examples/complete/autocomplete_test.py
##########
@@ -37,7 +41,11 @@ class AutocompleteTest(unittest.TestCase):
KINGLEAR_HASH_SUM = 268011785062540
KINGLEAR_INPUT = 'gs://dataflow-samples/shakespeare/kinglear.txt'
- @pytest.mark.examples_postcommit
+ def create_file(self, path, contents):
Review comment:
can we rename this to something more meaningful than create_file. Like
create_content_output_file or whatever this actually represents.
##########
File path: sdks/python/apache_beam/examples/complete/estimate_pi_test.py
##########
@@ -51,6 +54,20 @@ def test_basics(self):
# trials.
assert_that(result, in_between(3.125, 3.155))
+ @pytest.mark.examples_postcommit
+ def test_estimate_pi_output_file(self):
+ temp_folder = tempfile.mkdtemp()
+ estimate_pi.run(
+ ['--output', os.path.join(temp_folder, 'result'), '--tries', '5000'],
+ save_main_session=False)
+ # Load result file and compare.
+ with open_shards(os.path.join(temp_folder, 'result-*-of-*')) as
result_file:
+ result = json.loads(result_file.read().strip())[2]
Review comment:
Try to make this line more readable, maybe a constant to what [2]
means...
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]