Skip to content

Commit 0f46193

Browse files
authored
feat: DH-18493: Add Table.is_failed property (#6620)
Fixes DH-18493 This is a new property on Table. It wraps the Java Table.isFailed() method to let you check if the Table object is in a failure state and is no longer usable.
1 parent 1e1c924 commit 0f46193

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

py/server/deephaven/table.py

+5
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,11 @@ def is_blink(self) -> bool:
584584
"""Whether this table is a blink table."""
585585
return _JBlinkTableTools.isBlink(self.j_table)
586586

587+
@property
588+
def is_failed(self) -> bool:
589+
"""Whether this table is in a failure state and is no longer usable."""
590+
return self.j_table.isFailed()
591+
587592
@cached_property
588593
def update_graph(self) -> UpdateGraph:
589594
"""The update graph of the table."""

py/server/tests/test_barrage.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_subscribe(self):
9393
# TODO this test is flaky because of https://github.com/deephaven/deephaven-core/issues/5416, re-enable it
9494
# when the issue is fixed.
9595
# for _ in range(10):
96-
# if t.j_table.isFailed():
96+
# if t.is_failed():
9797
# break
9898
# time.sleep(1)
9999
# else:

py/server/tests/test_table.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -593,12 +593,12 @@ def test_snapshot_when_with_history(self):
593593
t = time_table("PT0.1S").update("X = i % 2 == 0 ? i : i - 1").sort("X").tail(10)
594594
with update_graph.shared_lock(t):
595595
snapshot_hist = self.test_table.snapshot_when(t, history=True)
596-
self.assertFalse(snapshot_hist.j_table.isFailed())
596+
self.assertFalse(snapshot_hist.is_failed)
597597
self.wait_ticking_table_update(t, row_count=10, timeout=2)
598598
# we have not waited for a whole cycle yet, wait for the shared lock to guarantee cycle is over
599599
# to ensure snapshot_hist has had the opportunity to process the update we just saw
600600
with update_graph.shared_lock(t):
601-
self.assertTrue(snapshot_hist.j_table.isFailed())
601+
self.assertTrue(snapshot_hist.is_failed)
602602

603603
def test_agg_all_by(self):
604604
test_table = empty_table(10)

py/server/tests/test_table_data_service.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ def test_partition_sub_failure(self):
348348
with self.assertRaises(Exception) as cm:
349349
# failure_cb will be called in the background thread after 2 PUG cycles, 3 seconds timeout should be enough
350350
self.wait_ticking_table_update(table, 600, 3)
351-
self.assertTrue(table.j_table.isFailed())
351+
self.assertTrue(table.is_failed)
352352

353353
def test_partition_size_sub_failure(self):
354354
pc_schema = pa.schema(
@@ -361,7 +361,7 @@ def test_partition_size_sub_failure(self):
361361
# failure_cb will be called in the background thread after 2 PUG cycles, 3 seconds timeout should be enough
362362
self.wait_ticking_table_update(table, 600, 3)
363363

364-
self.assertTrue(table.j_table.isFailed())
364+
self.assertTrue(table.is_failed)
365365

366366

367367
if __name__ == '__main__':

0 commit comments

Comments
 (0)