From 63f4aa3f5b3a831bae869617e63dcc5a129f7040 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Thu, 7 Mar 2024 19:02:12 -0800 Subject: [PATCH 1/6] Enable pytest failures on warnings from cudf --- .../centrality/betweenness_centrality.py | 6 ++--- .../cugraph/community/spectral_clustering.py | 22 +++++++++---------- .../cugraph/community/triangle_count.py | 4 ++-- .../cugraph/cugraph/dask/community/leiden.py | 4 ++-- .../cugraph/cugraph/dask/community/louvain.py | 4 ++-- .../cugraph/dask/link_analysis/pagerank.py | 6 ++--- .../cugraph/cugraph/link_analysis/pagerank.py | 4 ++-- .../cugraph/link_prediction/jaccard.py | 7 ++++-- .../cugraph/link_prediction/overlap.py | 9 +++++--- .../cugraph/link_prediction/sorensen.py | 9 +++++--- .../cugraph/cugraph/sampling/random_walks.py | 4 ++-- .../sampling/uniform_neighbor_sample.py | 4 ++-- .../test_edge_betweenness_centrality_mg.py | 4 ++-- .../cugraph/tests/layout/test_force_atlas2.py | 8 +++---- python/cugraph/pytest.ini | 3 +++ 15 files changed, 55 insertions(+), 43 deletions(-) diff --git a/python/cugraph/cugraph/centrality/betweenness_centrality.py b/python/cugraph/cugraph/centrality/betweenness_centrality.py index 80ad2e630bd..dd47b1e8df0 100644 --- a/python/cugraph/cugraph/centrality/betweenness_centrality.py +++ b/python/cugraph/cugraph/centrality/betweenness_centrality.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -160,7 +160,7 @@ def betweenness_centrality( if not isinstance(k, (cudf.DataFrame, cudf.Series)): if isinstance(k, list): - vertex_dtype = G.edgelist.edgelist_df.dtypes[0] + vertex_dtype = G.edgelist.edgelist_df.dtypes.iloc[0] k = cudf.Series(k, dtype=vertex_dtype) if isinstance(k, (cudf.DataFrame, cudf.Series)): @@ -300,7 +300,7 @@ def edge_betweenness_centrality( if not isinstance(k, (cudf.DataFrame, cudf.Series)): if isinstance(k, list): - vertex_dtype = G.edgelist.edgelist_df.dtypes[0] + vertex_dtype = G.edgelist.edgelist_df.dtypes.iloc[0] k = cudf.Series(k, dtype=vertex_dtype) if isinstance(k, (cudf.DataFrame, cudf.Series)): diff --git a/python/cugraph/cugraph/community/spectral_clustering.py b/python/cugraph/cugraph/community/spectral_clustering.py index 864c1005d20..c1970bbd07b 100644 --- a/python/cugraph/cugraph/community/spectral_clustering.py +++ b/python/cugraph/cugraph/community/spectral_clustering.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -92,8 +92,8 @@ def spectralBalancedCutClustering( G, isNx = ensure_cugraph_obj_for_nx(G) # Check if vertex type is "int32" if ( - G.edgelist.edgelist_df.dtypes[0] != np.int32 - or G.edgelist.edgelist_df.dtypes[1] != np.int32 + G.edgelist.edgelist_df.dtypes.iloc[0] != np.int32 + or G.edgelist.edgelist_df.dtypes.iloc[1] != np.int32 ): raise ValueError( "'spectralBalancedCutClustering' requires the input graph's vertex to be " @@ -186,8 +186,8 @@ def spectralModularityMaximizationClustering( G, isNx = ensure_cugraph_obj_for_nx(G) if ( - G.edgelist.edgelist_df.dtypes[0] != np.int32 - or G.edgelist.edgelist_df.dtypes[1] != np.int32 + G.edgelist.edgelist_df.dtypes.iloc[0] != np.int32 + or G.edgelist.edgelist_df.dtypes.iloc[1] != np.int32 ): raise ValueError( "'spectralModularityMaximizationClustering' requires the input graph's " @@ -271,8 +271,8 @@ def analyzeClustering_modularity( G, isNx = ensure_cugraph_obj_for_nx(G) if ( - G.edgelist.edgelist_df.dtypes[0] != np.int32 - or G.edgelist.edgelist_df.dtypes[1] != np.int32 + G.edgelist.edgelist_df.dtypes.iloc[0] != np.int32 + or G.edgelist.edgelist_df.dtypes.iloc[1] != np.int32 ): raise ValueError( "'analyzeClustering_modularity' requires the input graph's " @@ -354,8 +354,8 @@ def analyzeClustering_edge_cut( G, isNx = ensure_cugraph_obj_for_nx(G) if ( - G.edgelist.edgelist_df.dtypes[0] != np.int32 - or G.edgelist.edgelist_df.dtypes[1] != np.int32 + G.edgelist.edgelist_df.dtypes.iloc[0] != np.int32 + or G.edgelist.edgelist_df.dtypes.iloc[1] != np.int32 ): raise ValueError( "'analyzeClustering_edge_cut' requires the input graph's vertex to be " @@ -367,7 +367,7 @@ def analyzeClustering_edge_cut( clustering, "vertex", vertex_col_name, drop=True ) - if clustering.dtypes[0] != np.int32 or clustering.dtypes[1] != np.int32: + if clustering.dtypes.iloc[0] != np.int32 or clustering.dtypes.iloc[1] != np.int32: raise ValueError( "'analyzeClustering_edge_cut' requires both the clustering 'vertex' " "and 'cluster' to be of type 'int32'" @@ -437,7 +437,7 @@ def analyzeClustering_ratio_cut( clustering, "vertex", vertex_col_name, drop=True ) - if clustering.dtypes[0] != np.int32 or clustering.dtypes[1] != np.int32: + if clustering.dtypes.iloc[0] != np.int32 or clustering.dtypes.iloc[1] != np.int32: raise ValueError( "'analyzeClustering_ratio_cut' requires both the clustering 'vertex' " "and 'cluster' to be of type 'int32'" diff --git a/python/cugraph/cugraph/community/triangle_count.py b/python/cugraph/cugraph/community/triangle_count.py index 306cdb2333f..247327b6e4c 100644 --- a/python/cugraph/cugraph/community/triangle_count.py +++ b/python/cugraph/cugraph/community/triangle_count.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -24,7 +24,7 @@ # FIXME: Move this function to the utility module so that it can be # shared by other algos def ensure_valid_dtype(input_graph, start_list): - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] if isinstance(start_list, cudf.Series): start_list_dtypes = start_list.dtype else: diff --git a/python/cugraph/cugraph/dask/community/leiden.py b/python/cugraph/cugraph/dask/community/leiden.py index 10a266ed519..24a077d1845 100644 --- a/python/cugraph/cugraph/dask/community/leiden.py +++ b/python/cugraph/cugraph/dask/community/leiden.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -170,7 +170,7 @@ def leiden( part_mod_score = [client.submit(convert_to_cudf, r) for r in result] wait(part_mod_score) - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] empty_df = cudf.DataFrame( { "vertex": numpy.empty(shape=0, dtype=vertex_dtype), diff --git a/python/cugraph/cugraph/dask/community/louvain.py b/python/cugraph/cugraph/dask/community/louvain.py index e83d41811ea..2d894d9665f 100644 --- a/python/cugraph/cugraph/dask/community/louvain.py +++ b/python/cugraph/cugraph/dask/community/louvain.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -191,7 +191,7 @@ def louvain( part_mod_score = [client.submit(convert_to_cudf, r) for r in result] wait(part_mod_score) - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] empty_df = cudf.DataFrame( { "vertex": numpy.empty(shape=0, dtype=vertex_dtype), diff --git a/python/cugraph/cugraph/dask/link_analysis/pagerank.py b/python/cugraph/cugraph/dask/link_analysis/pagerank.py index 1dffb3cba78..62ae9109624 100644 --- a/python/cugraph/cugraph/dask/link_analysis/pagerank.py +++ b/python/cugraph/cugraph/dask/link_analysis/pagerank.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -76,7 +76,7 @@ def ensure_valid_dtype(input_graph, input_df, input_df_name): warnings.warn(warning_msg, UserWarning) input_df = input_df.astype({"values": edge_attr_dtype}) - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] input_df_vertex_dtype = input_df["vertex"].dtype if input_df_vertex_dtype != vertex_dtype: warning_msg = ( @@ -406,7 +406,7 @@ def pagerank( wait(result) - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] # Have each worker convert tuple of arrays and bool from PLC to cudf # DataFrames and bools. This will be a list of futures. diff --git a/python/cugraph/cugraph/link_analysis/pagerank.py b/python/cugraph/cugraph/link_analysis/pagerank.py index 3b39ac597ab..ef0705c6be9 100644 --- a/python/cugraph/cugraph/link_analysis/pagerank.py +++ b/python/cugraph/cugraph/link_analysis/pagerank.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -64,7 +64,7 @@ def ensure_valid_dtype(input_graph, input_df, input_df_name): warnings.warn(warning_msg, UserWarning) input_df = input_df.astype({"values": edge_attr_dtype}) - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] input_df_vertex_dtype = input_df["vertex"].dtype if input_df_vertex_dtype != vertex_dtype: warning_msg = ( diff --git a/python/cugraph/cugraph/link_prediction/jaccard.py b/python/cugraph/cugraph/link_prediction/jaccard.py index f114b4a6d03..06644a7e1b7 100644 --- a/python/cugraph/cugraph/link_prediction/jaccard.py +++ b/python/cugraph/cugraph/link_prediction/jaccard.py @@ -38,10 +38,13 @@ # FIXME: Move this function to the utility module so that it can be # shared by other algos def ensure_valid_dtype(input_graph, vertex_pair): - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] vertex_pair_dtypes = vertex_pair.dtypes - if vertex_pair_dtypes[0] != vertex_dtype or vertex_pair_dtypes[1] != vertex_dtype: + if ( + vertex_pair_dtypes.iloc[0] != vertex_dtype + or vertex_pair_dtypes.iloc[1] != vertex_dtype + ): warning_msg = ( "Jaccard requires 'vertex_pair' to match the graph's 'vertex' type. " f"input graph's vertex type is: {vertex_dtype} and got " diff --git a/python/cugraph/cugraph/link_prediction/overlap.py b/python/cugraph/cugraph/link_prediction/overlap.py index 3a25526679c..b6e9cfb58c4 100644 --- a/python/cugraph/cugraph/link_prediction/overlap.py +++ b/python/cugraph/cugraph/link_prediction/overlap.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019-2023, NVIDIA CORPORATION. +# Copyright (c) 2019-2024, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -38,10 +38,13 @@ # FIXME: Move this function to the utility module so that it can be # shared by other algos def ensure_valid_dtype(input_graph, vertex_pair): - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] vertex_pair_dtypes = vertex_pair.dtypes - if vertex_pair_dtypes[0] != vertex_dtype or vertex_pair_dtypes[1] != vertex_dtype: + if ( + vertex_pair_dtypes.iloc[0] != vertex_dtype + or vertex_pair_dtypes.iloc[1] != vertex_dtype + ): warning_msg = ( "Overlap requires 'vertex_pair' to match the graph's 'vertex' type. " f"input graph's vertex type is: {vertex_dtype} and got " diff --git a/python/cugraph/cugraph/link_prediction/sorensen.py b/python/cugraph/cugraph/link_prediction/sorensen.py index a8ccced1e68..cac8bfb9cc6 100644 --- a/python/cugraph/cugraph/link_prediction/sorensen.py +++ b/python/cugraph/cugraph/link_prediction/sorensen.py @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2023, NVIDIA CORPORATION. +# Copyright (c) 2021-2024, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -38,10 +38,13 @@ # FIXME: Move this function to the utility module so that it can be # shared by other algos def ensure_valid_dtype(input_graph, vertex_pair): - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] vertex_pair_dtypes = vertex_pair.dtypes - if vertex_pair_dtypes[0] != vertex_dtype or vertex_pair_dtypes[1] != vertex_dtype: + if ( + vertex_pair_dtypes.iloc[0] != vertex_dtype + or vertex_pair_dtypes.iloc[1] != vertex_dtype + ): warning_msg = ( "Sorensen requires 'vertex_pair' to match the graph's 'vertex' type. " f"input graph's vertex type is: {vertex_dtype} and got " diff --git a/python/cugraph/cugraph/sampling/random_walks.py b/python/cugraph/cugraph/sampling/random_walks.py index 7b04dba82a5..1bd7394164f 100644 --- a/python/cugraph/cugraph/sampling/random_walks.py +++ b/python/cugraph/cugraph/sampling/random_walks.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -145,7 +145,7 @@ def random_walks( if isinstance(start_vertices, list): # Ensure the 'start_vertices' have the same dtype as the edge list. # Failing to do that may produce erroneous results. - vertex_dtype = G.edgelist.edgelist_df.dtypes[0] + vertex_dtype = G.edgelist.edgelist_df.dtypes.iloc[0] start_vertices = cudf.Series(start_vertices, dtype=vertex_dtype) if G.renumbered is True: diff --git a/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py b/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py index 1832585c0ab..e1e27abe08c 100644 --- a/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py +++ b/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -38,7 +38,7 @@ # FIXME: Move this function to the utility module so that it can be # shared by other algos def ensure_valid_dtype(input_graph, start_list): - vertex_dtype = input_graph.edgelist.edgelist_df.dtypes[0] + vertex_dtype = input_graph.edgelist.edgelist_df.dtypes.iloc[0] if isinstance(start_list, cudf.Series): start_list_dtypes = start_list.dtype else: diff --git a/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality_mg.py b/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality_mg.py index 478b7e655d5..be9f287745f 100644 --- a/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality_mg.py +++ b/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality_mg.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -146,7 +146,7 @@ def input_expected_output(input_combo): weight = None if edge_ids: - dtype = ddf.dtypes[0] + dtype = ddf.dtypes.iloc[0] edge_id = "edge_id" ddf = ddf.assign(idx=1) ddf["edge_id"] = ddf.idx.cumsum().astype(dtype) - 1 diff --git a/python/cugraph/cugraph/tests/layout/test_force_atlas2.py b/python/cugraph/cugraph/tests/layout/test_force_atlas2.py index 6b1fd6bcc4e..1adfa104212 100644 --- a/python/cugraph/cugraph/tests/layout/test_force_atlas2.py +++ b/python/cugraph/cugraph/tests/layout/test_force_atlas2.py @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023, NVIDIA CORPORATION. +# Copyright (c) 2020-2024, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -122,9 +122,9 @@ def cugraph_call( BARNES_HUT_OPTIMIZE = [False, True] -class TestCallback(GraphBasedDimRedCallback): +class ExampleCallback(GraphBasedDimRedCallback): def __init__(self): - super(TestCallback, self).__init__() + super().__init__() self.on_preprocess_end_called_count = 0 self.on_epoch_end_called_count = 0 self.on_train_end_called_count = 0 @@ -145,7 +145,7 @@ def on_train_end(self, positions): @pytest.mark.parametrize("barnes_hut_optimize", BARNES_HUT_OPTIMIZE) def test_force_atlas2(graph_file, score, max_iter, barnes_hut_optimize): cu_M = graph_file.get_edgelist(download=True) - test_callback = TestCallback() + test_callback = ExampleCallback() cu_pos = cugraph_call( cu_M, max_iter=max_iter, diff --git a/python/cugraph/pytest.ini b/python/cugraph/pytest.ini index af15c94078c..a69646cb6bf 100644 --- a/python/cugraph/pytest.ini +++ b/python/cugraph/pytest.ini @@ -56,3 +56,6 @@ python_files = python_functions = bench_* test_* + +filterwarnings = + error:::cudf \ No newline at end of file From 9e6665174c11834c622315aaf0c8a28184c4d298 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Thu, 7 Mar 2024 19:03:39 -0800 Subject: [PATCH 2/6] newline --- python/cugraph/pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cugraph/pytest.ini b/python/cugraph/pytest.ini index a69646cb6bf..01e49b243c0 100644 --- a/python/cugraph/pytest.ini +++ b/python/cugraph/pytest.ini @@ -58,4 +58,4 @@ python_functions = test_* filterwarnings = - error:::cudf \ No newline at end of file + error:::cudf From 7c455efc4145be1136afb937990a1945deb907c6 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Fri, 8 Mar 2024 16:15:59 -0800 Subject: [PATCH 3/6] Update pytest.ini copyright --- python/cugraph/pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cugraph/pytest.ini b/python/cugraph/pytest.ini index 01e49b243c0..acc5d399685 100644 --- a/python/cugraph/pytest.ini +++ b/python/cugraph/pytest.ini @@ -1,4 +1,4 @@ -# Copyright (c) 2021-2022, NVIDIA CORPORATION. +# Copyright (c) 2021-2024, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at From 38f126f43418c0287f46117efb178ec62b70bf17 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Fri, 8 Mar 2024 16:26:46 -0800 Subject: [PATCH 4/6] Address casting --- .../cugraph/cugraph/gnn/dgl_extensions/dgl_uniform_sampler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cugraph/cugraph/gnn/dgl_extensions/dgl_uniform_sampler.py b/python/cugraph/cugraph/gnn/dgl_extensions/dgl_uniform_sampler.py index e4f6dd3745a..538f6426ac2 100644 --- a/python/cugraph/cugraph/gnn/dgl_extensions/dgl_uniform_sampler.py +++ b/python/cugraph/cugraph/gnn/dgl_extensions/dgl_uniform_sampler.py @@ -150,7 +150,7 @@ def _get_type_id_from_indices(indices, etype_id_range_dict): for etype_id, (start, stop) in etype_id_range_dict.items(): range_types = (start <= indices) & (indices < stop) - type_ser[range_types] = etype_id + type_ser[range_types] = type_ser.dtype.type(etype_id) return type_ser From 5cf544f88f84ec850512ecc095f1a473bbb48009 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Mon, 11 Mar 2024 12:28:16 -0700 Subject: [PATCH 5/6] Ignore array concatenation warning --- python/cugraph/pytest.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/python/cugraph/pytest.ini b/python/cugraph/pytest.ini index acc5d399685..ebbd6a7eaad 100644 --- a/python/cugraph/pytest.ini +++ b/python/cugraph/pytest.ini @@ -59,3 +59,5 @@ python_functions = filterwarnings = error:::cudf + # Called via dask. Not obviously addressable in cugraph. + ignore:The behavior of array concatenation with empty entries is deprecated:FutureWarning:cudf From ec2c718074b04207c24f654145899d80eaa673f3 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Tue, 12 Mar 2024 17:41:14 -0700 Subject: [PATCH 6/6] Fix a few more usages --- python/cugraph/cugraph/community/spectral_clustering.py | 2 +- python/cugraph/cugraph/dask/sampling/random_walks.py | 4 ++-- python/cugraph/cugraph/sampling/uniform_neighbor_sample.py | 2 +- .../tests/centrality/test_edge_betweenness_centrality_mg.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/python/cugraph/cugraph/community/spectral_clustering.py b/python/cugraph/cugraph/community/spectral_clustering.py index c1970bbd07b..8b4dbce830f 100644 --- a/python/cugraph/cugraph/community/spectral_clustering.py +++ b/python/cugraph/cugraph/community/spectral_clustering.py @@ -284,7 +284,7 @@ def analyzeClustering_modularity( clustering, "vertex", vertex_col_name, drop=True ) - if clustering.dtypes[0] != np.int32 or clustering.dtypes[1] != np.int32: + if clustering.dtypes.iloc[0] != np.int32 or clustering.dtypes.iloc[1] != np.int32: raise ValueError( "'analyzeClustering_modularity' requires both the clustering 'vertex' " "and 'cluster' to be of type 'int32'" diff --git a/python/cugraph/cugraph/dask/sampling/random_walks.py b/python/cugraph/cugraph/dask/sampling/random_walks.py index bb9baf2c92c..99996153d30 100644 --- a/python/cugraph/cugraph/dask/sampling/random_walks.py +++ b/python/cugraph/cugraph/dask/sampling/random_walks.py @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023, NVIDIA CORPORATION. +# Copyright (c) 2022-2024, NVIDIA CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -123,7 +123,7 @@ def random_walks( start_vertices_type = input_graph.edgelist.edgelist_df.dtypes[0] else: # FIXME: Get the 'src' column names instead and retrieve the type - start_vertices_type = input_graph.input_df.dtypes[0] + start_vertices_type = input_graph.input_df.dtypes.iloc[0] start_vertices = dask_cudf.from_cudf( start_vertices, npartitions=min(input_graph._npartitions, len(start_vertices)) ) diff --git a/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py b/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py index e1e27abe08c..86b33594ed7 100644 --- a/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py +++ b/python/cugraph/cugraph/sampling/uniform_neighbor_sample.py @@ -42,7 +42,7 @@ def ensure_valid_dtype(input_graph, start_list): if isinstance(start_list, cudf.Series): start_list_dtypes = start_list.dtype else: - start_list_dtypes = start_list.dtypes[0] + start_list_dtypes = start_list.dtypes.iloc[0] if start_list_dtypes != vertex_dtype: warning_msg = ( diff --git a/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality_mg.py b/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality_mg.py index be9f287745f..31eb1d50acb 100644 --- a/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality_mg.py +++ b/python/cugraph/cugraph/tests/centrality/test_edge_betweenness_centrality_mg.py @@ -103,7 +103,7 @@ def input_expected_output(input_combo): if not directed: # Edge ids not supported for undirected graph return - dtype = df.dtypes[0] + dtype = df.dtypes.iloc[0] edge_id = "edge_id" df["edge_id"] = df.index df = df.astype(dtype)