diff --git a/python/morpheus/morpheus/_lib/src/messages/multi.cpp b/python/morpheus/morpheus/_lib/src/messages/multi.cpp index 72fddfa8ec..4ca7f5d839 100644 --- a/python/morpheus/morpheus/_lib/src/messages/multi.cpp +++ b/python/morpheus/morpheus/_lib/src/messages/multi.cpp @@ -396,17 +396,7 @@ void MultiMessageInterfaceProxy::set_meta(MultiMessage& self, pybind11::object c saved_index = py::none(); } - // Perform the update via slices - auto is_string_dtype = pybind11::module_::import("cudf.api.types").attr("is_string_dtype"); - auto series = pybind11::module_::import("cudf").attr("Series"); - - if (is_string_dtype(series(value)).cast()) { - df[columns] = pybind11::str(); - df[columns].attr("iloc")[row_indexer] = value; - } else { - df.attr("loc")[pybind11::make_tuple(df.attr("index")[row_indexer], columns)] = value; - } - + df.attr("loc")[pybind11::make_tuple(df.attr("index")[row_indexer], columns)] = value; // Reset the index if we changed it if (!saved_index.is_none()) diff --git a/python/morpheus/morpheus/messages/multi_message.py b/python/morpheus/morpheus/messages/multi_message.py index eb8f1863bf..44e1bb6cba 100644 --- a/python/morpheus/morpheus/messages/multi_message.py +++ b/python/morpheus/morpheus/messages/multi_message.py @@ -291,16 +291,7 @@ def set_meta(self, columns: typing.Union[None, str, typing.List[str]], value): saved_index = df.index df.reset_index(drop=True, inplace=True) - - # TODO: when value is strings, make all values empty strings - from cudf.api.types import is_string_dtype - - if is_string_dtype(cudf.Series(value)): - df[columns] = "" - df[columns].iloc[row_indexer] = value - else: - df.loc[df.index[row_indexer], columns] = value - + df.loc[df.index[row_indexer], columns] = value df.set_index(saved_index, inplace=True) else: # Need to determine the boolean mask to use indexes with df.loc diff --git a/python/morpheus/morpheus/parsers/ip.py b/python/morpheus/morpheus/parsers/ip.py index 706e1fe959..1fcb75ee81 100644 --- a/python/morpheus/morpheus/parsers/ip.py +++ b/python/morpheus/morpheus/parsers/ip.py @@ -39,7 +39,7 @@ def ip_to_int(values): >>> ip.ip_to_int(cudf.Series(["192.168.0.1","10.0.0.1"])) 0 3232235521 1 167772161 - dtype: int64 + dtype: uint32 """ return values.str.ip2int() @@ -52,7 +52,7 @@ def int_to_ip(values): Parameters ---------- values : cudf.Series - Integer representations of IP addresses + uint32 representations of IP addresses Returns ------- @@ -63,7 +63,7 @@ def int_to_ip(values): -------- >>> import morpheus.parsers.ip as ip >>> import cudf - >>> ip.int_to_ip(cudf.Series([3232235521, 167772161])) + >>> ip.int_to_ip(cudf.Series([3232235521, 167772161], dtype=cudf.api.types.dtype("uint32"))) 0 192.168.0.1 1 10.0.0.1 dtype: object diff --git a/python/morpheus/morpheus/stages/postprocess/generate_viz_frames_stage.py b/python/morpheus/morpheus/stages/postprocess/generate_viz_frames_stage.py index b2d059666c..ffab467541 100644 --- a/python/morpheus/morpheus/stages/postprocess/generate_viz_frames_stage.py +++ b/python/morpheus/morpheus/stages/postprocess/generate_viz_frames_stage.py @@ -294,8 +294,8 @@ def write_batch(x: MultiResponseMessage | ControlMessage): out_df = cudf.DataFrame() out_df["dt"] = (df["timestamp"] - time0).astype(np.int32) - out_df["src"] = df["src_ip"].str.ip_to_int().astype(np.int32) - out_df["dst"] = df["dest_ip"].str.ip_to_int().astype(np.int32) + out_df["src"] = df["src_ip"].str.ip_to_int().astype(np.uint32) + out_df["dst"] = df["dest_ip"].str.ip_to_int().astype(np.uint32) out_df["lvl"] = df["secret_keys"].astype(np.int32) out_df["data"] = df["data"] diff --git a/tests/test_multi_message.py b/tests/test_multi_message.py index 73d06adfa4..26e349e10d 100644 --- a/tests/test_multi_message.py +++ b/tests/test_multi_message.py @@ -266,28 +266,10 @@ def test_set_meta_issue_286(filter_probs_df: cudf.DataFrame, use_series: bool): if use_series: values = cudf.Series(values) - import cupy - - # hey = values[5:10].to_cupy() - mm1.set_meta('letters', values[0:5]) mm2.set_meta('letters', values[5:10]) -# def test_something(filter_probs_df: cudf.DataFrame): - -# values = list(string.ascii_letters) - -# values = - -# import cupy - -# cupy.asarray(cudf.Series(list(string.ascii_letters))) - -# # mm1.set_meta('letters', values[0:5]) -# # mm2.set_meta('letters', values[5:10]) - - def _test_copy_ranges(df: typing.Union[cudf.DataFrame, pd.DataFrame]): meta = MessageMeta(df)