Skip to content

Commit 0bc6c99

Browse files
committed
Disable the failed event-time timer tests for FnApiRunner.
1 parent d3a83c1 commit 0bc6c99

File tree

2 files changed

+45
-11
lines changed

2 files changed

+45
-11
lines changed

sdks/python/apache_beam/runners/portability/fn_api_runner/fn_runner_test.py

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -769,11 +769,12 @@ def process_clear_timer(self):
769769
expected = [('fired', ts) for ts in (20, 200)]
770770
assert_that(actual, equal_to(expected))
771771

772-
def _run_pardo_timer_test(
772+
def _run_pardo_et_timer_test(
773773
self, n, timer_delay, reset_count=True, clear_timer=True, expected=None):
774-
class AnotherTimerDoFn(beam.DoFn):
774+
class EventTimeTimerDoFn(beam.DoFn):
775775
COUNT = userstate.ReadModifyWriteStateSpec(
776776
'count', coders.VarInt32Coder())
777+
# event-time timer
777778
TIMER = userstate.TimerSpec('timer', userstate.TimeDomain.WATERMARK)
778779

779780
def __init__(self):
@@ -790,21 +791,28 @@ def process(
790791
timer=beam.DoFn.TimerParam(TIMER)):
791792
local_count = count.read() or 0
792793
local_count += 1
794+
795+
_LOGGER.info(f"get element {element_pair[1]}, count={local_count}")
793796
if local_count == 1:
797+
_LOGGER.info(f"set timer to {t+self._timer_delay}")
794798
timer.set(t + self._timer_delay)
795799

796800
if local_count == self._n:
797801
if self._reset_count:
802+
_LOGGER.info("reset count")
798803
local_count = 0
799804

800805
# don't need the timer now
801806
if self._clear_timer:
807+
_LOGGER.info("clear timer")
802808
timer.clear()
803809

804810
count.write(local_count)
805811

806812
@userstate.on_timer(TIMER)
807813
def timer_callback(self, t=beam.DoFn.TimestampParam):
814+
_LOGGER.error("Timer should not fire here")
815+
_LOGGER.info(f"timer callback start (timestamp={t})")
808816
yield "fired"
809817

810818
with self.create_pipeline() as p:
@@ -814,28 +822,49 @@ def timer_callback(self, t=beam.DoFn.TimestampParam):
814822
stop_timestamp=timestamp.Timestamp.now() + 14,
815823
fire_interval=1)
816824
| beam.WithKeys(0)
817-
| beam.ParDo(AnotherTimerDoFn()))
825+
| beam.ParDo(EventTimeTimerDoFn()))
818826
assert_that(actual, equal_to(expected))
819827

820-
def test_pardo_timer_with_no_firing(self):
828+
def test_pardo_et_timer_with_no_firing(self):
829+
if type(self) in [FnApiRunnerTest,
830+
FnApiRunnerTestWithGrpc,
831+
FnApiRunnerTestWithGrpcAndMultiWorkers,
832+
FnApiRunnerTestWithDisabledCaching,
833+
FnApiRunnerTestWithMultiWorkers,
834+
FnApiRunnerTestWithBundleRepeat,
835+
FnApiRunnerTestWithBundleRepeatAndMultiWorkers,
836+
"PortableRunnerTest"]:
837+
raise unittest.SkipTest("https://github.com/apache/beam/issues/35168")
838+
821839
# The timer will not fire. It is initially set to T + 10, but then it is
822840
# cleared at T + 4 (count == 5), and reset to T + 5 + 10
823841
# (count is reset every 5 seconds).
824-
self._run_pardo_timer_test(5, 10, True, True, [])
842+
self._run_pardo_et_timer_test(5, 10, True, True, [])
843+
raise ValueError("ok")
825844

826-
def test_pardo_timer_with_early_firing(self):
845+
def test_pardo_et_timer_with_early_firing(self):
827846
# The timer will fire at T + 2, T + 7, T + 12.
828-
self._run_pardo_timer_test(5, 2, True, True, ["fired", "fired", "fired"])
847+
self._run_pardo_et_timer_test(5, 2, True, True, ["fired", "fired", "fired"])
848+
849+
def test_pardo_et_timer_with_no_reset(self):
850+
if type(self) in [FnApiRunnerTest,
851+
FnApiRunnerTestWithGrpc,
852+
FnApiRunnerTestWithGrpcAndMultiWorkers,
853+
FnApiRunnerTestWithDisabledCaching,
854+
FnApiRunnerTestWithMultiWorkers,
855+
FnApiRunnerTestWithBundleRepeat,
856+
FnApiRunnerTestWithBundleRepeatAndMultiWorkers,
857+
"PortableRunnerTest"]:
858+
raise unittest.SkipTest("https://github.com/apache/beam/issues/35168")
829859

830-
def test_pardo_timer_with_no_reset(self):
831860
# The timer will not fire. It is initially set to T + 10, and then it is
832861
# cleared at T + 4 and never set again (count is not reset).
833-
self._run_pardo_timer_test(5, 10, False, True, [])
862+
self._run_pardo_et_timer_test(5, 10, False, True, [])
834863

835-
def test_pardo_timer_with_no_reset_and_no_clear(self):
864+
def test_pardo_et_timer_with_no_reset_and_no_clear(self):
836865
# The timer will fire at T + 10. After the timer is set, it is never
837866
# cleared or set again.
838-
self._run_pardo_timer_test(5, 10, False, False, ["fired"])
867+
self._run_pardo_et_timer_test(5, 10, False, False, ["fired"])
839868

840869
def test_pardo_state_timers(self):
841870
self._run_pardo_state_timers(windowed=False)

sdks/python/apache_beam/runners/portability/portable_runner_test.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ def test_sdf_with_truncate(self):
222222
def test_draining_sdf_with_sdf_initiated_checkpointing(self):
223223
raise unittest.SkipTest("Portable runners don't support drain yet.")
224224

225+
def test_pardo_dynamic_timer(self):
226+
raise unittest.SkipTest("https://github.com/apache/beam/issues/20179")
227+
228+
def test_pardo_timer_with_no_firing(self):
229+
raise unittest.SkipTest("https://github.com/apache/beam/issues/20179")
225230

226231
@unittest.skip("https://github.com/apache/beam/issues/19422")
227232
class PortableRunnerOptimized(PortableRunnerTest):

0 commit comments

Comments
 (0)