Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Core][State Observability] Fix is_alive column with wrong column type that breaks filtering #26739

Merged
merged 3 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix is_alive column type
  • Loading branch information
rickyyx committed Jul 19, 2022
commit 6dd1a0995e829d0b330b9c2c13676ded946dd8a1
2 changes: 1 addition & 1 deletion dashboard/state_aggregator.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _filter(

Returns:
A list of filtered state data in dictionary. Each state data's
unncessary columns are filtered by the given state_dataclass schema.
unnecessary columns are filtered by the given state_dataclass schema.
"""
filters = _convert_filters_type(filters, state_dataclass)
result = []
Expand Down
2 changes: 1 addition & 1 deletion python/ray/experimental/state/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def filterable_columns(cls) -> Set[str]:
@dataclass(init=True)
class WorkerState(StateSchema):
worker_id: str = state_column(filterable=True)
is_alive: str = state_column(filterable=True)
is_alive: bool = state_column(filterable=True)
worker_type: str = state_column(filterable=True)
exit_type: str = state_column(filterable=True)
node_id: str = state_column(filterable=True)
Expand Down
20 changes: 19 additions & 1 deletion python/ray/tests/test_state_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2031,7 +2031,7 @@ def verify():
wait_for_condition(verify)

"""
Test filter with different types (integer).
Test filter with different types (integer/bool).
"""
obj_1 = ray.put(123) # noqa
ray.get(a.put.remote())
Expand All @@ -2046,6 +2046,24 @@ def verify():

wait_for_condition(verify)

def verify():
workers = list_workers()
live_workers = list_workers(filters=[("is_alive", "=", "true")])
non_alive_workers = list_workers(filters=[("is_alive", "!=", "true")])
assert len(live_workers) + len(non_alive_workers) == len(workers)

live_workers = list_workers(filters=[("is_alive", "=", "1")])
non_alive_workers = list_workers(filters=[("is_alive", "!=", "1")])
assert len(live_workers) + len(non_alive_workers) == len(workers)

live_workers = list_workers(filters=[("is_alive", "=", "True")])
non_alive_workers = list_workers(filters=[("is_alive", "!=", "True")])
assert len(live_workers) + len(non_alive_workers) == len(workers)

return True

wait_for_condition(verify)

"""
Test CLI
"""
Expand Down