Skip to content

Commit

Permalink
Merge branch 'master' into 3978_add_retry_on_installation_steps_in_CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ajpotts authored Jan 22, 2025
2 parents ef3ef3d + 04cff11 commit bb3ebd2
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
45 changes: 45 additions & 0 deletions arkouda/comm_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from arkouda.client import generic_msg
from arkouda.pdarrayclass import create_pdarray
from arkouda.dataframe import DataFrame

__all__ = [
"start_comm_diagnostics",
Expand Down Expand Up @@ -30,6 +31,7 @@
"get_comm_diagnostics_cache_readahead_unused",
"get_comm_diagnostics_cache_readahead_waited",
"get_comm_diagnostics_wait_nb",
"get_comm_diagnostics",
]


Expand Down Expand Up @@ -101,10 +103,19 @@ def print_comm_diagnostics_table(print_empty_columns=False):
str
Completion message.
"""
from arkouda import sum as ak_sum

rep_msg = generic_msg(
cmd="printCommDiagnosticsTable",
args={"printEmptyCols": print_empty_columns},
)

df = get_comm_diagnostics()
if print_empty_columns:
print(df.to_markdown())
else:
print(df[[col for col in df.columns if ak_sum(df[col]) != 0]].to_markdown())

return typecast(str, rep_msg)


Expand Down Expand Up @@ -505,3 +516,37 @@ def get_comm_diagnostics_cache_readahead_waited():
args={},
)
return create_pdarray(typecast(str, rep_msg))


def get_comm_diagnostics() -> DataFrame:
"""
Return a DataFrame with the communication diagnostics statistics.
Returns
-------
DataFrame
"""
return DataFrame(
{
"put": get_comm_diagnostics_put(),
"get": get_comm_diagnostics_get(),
"put_nb": get_comm_diagnostics_put_nb(),
"get_nb": get_comm_diagnostics_get_nb(),
"try_nb": get_comm_diagnostics_try_nb(),
"amo": get_comm_diagnostics_amo(),
"execute_on": get_comm_diagnostics_execute_on(),
"execute_on_fast": get_comm_diagnostics_execute_on_fast(),
"execute_on_nb": get_comm_diagnostics_execute_on_nb(),
"cache_get_hits": get_comm_diagnostics_cache_get_hits(),
"cache_get_misses": get_comm_diagnostics_cache_get_misses(),
"cache_put_hits": get_comm_diagnostics_cache_put_hits(),
"cache_put_misses": get_comm_diagnostics_cache_put_misses(),
"cache_num_prefetches": get_comm_diagnostics_cache_num_prefetches(),
"cache_num_page_readaheads": get_comm_diagnostics_cache_num_page_readaheads(),
"cache_prefetch_unused": get_comm_diagnostics_cache_prefetch_unused(),
"cache_prefetch_waited": get_comm_diagnostics_cache_prefetch_waited(),
"cache_readahead_unused": get_comm_diagnostics_cache_readahead_unused(),
"cache_readahead_waited": get_comm_diagnostics_cache_readahead_waited(),
"wait_nb": get_comm_diagnostics_wait_nb(),
}
)
9 changes: 9 additions & 0 deletions tests/comm_diagnostics_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,12 @@ def test_comm_diagnostics_multi_locale(self, size):
print_comm_diagnostics_table(print_empty_columns=False)

stop_comm_diagnostics()

def test_get_comm_diagnostics(self):
start_comm_diagnostics()

df = get_comm_diagnostics()
assert isinstance(df, ak.DataFrame)
assert len(df) == pytest.nl

stop_comm_diagnostics()

0 comments on commit bb3ebd2

Please sign in to comment.