Beispiel #1
0
    def test_minimal_runtime_with_synthetic_sdf_step_bundle_delay(self):
        start = time.time()
        with beam.Pipeline() as p:
            p | beam.Create(list(range(10))) | beam.ParDo(
                synthetic_pipeline.get_synthetic_sdf_step(0, 0.5, 10))

        elapsed = time.time() - start
        self.assertGreaterEqual(elapsed, 0.5, elapsed)
    def test_synthetic_sdf_step(self):
        start = time.time()
        with beam.Pipeline() as p:
            pcoll = p | beam.Create(list(range(10))) | beam.ParDo(
                synthetic_pipeline.get_synthetic_sdf_step(0, 0.5, 10))
            assert_that(pcoll | beam.combiners.Count.Globally(),
                        equal_to([100]))

        elapsed = time.time() - start
        # TODO(chamikaramj): Fix the flaky time based bounds.
        self.assertTrue(0.5 <= elapsed <= 3, elapsed)
Beispiel #3
0
 def test_synthetic_sdf_step_multiplies_output_elements_count(self):
     with beam.Pipeline() as p:
         pcoll = p | beam.Create(list(range(10))) | beam.ParDo(
             synthetic_pipeline.get_synthetic_sdf_step(0, 0, 10))
         assert_that(pcoll | beam.combiners.Count.Globally(),
                     equal_to([100]))