Skip to content

Commit 9f94402

Browse files
committed
Forward show_progress param from arrow endpoints
1 parent 6152a24 commit 9f94402

27 files changed

+194
-75
lines changed

graphdatascience/arrow_client/v2/job_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ def wait_for_job(self, client: AuthenticatedArrowClient, job_id: str, show_progr
5050
progress_bar = TqdmProgressBar(
5151
task_name=base_task,
5252
relative_progress=job_status.progress_percent(),
53-
5453
bar_options=self._progress_bar_options,
5554
)
5655
if progress_bar:

graphdatascience/procedure_surface/arrow/articlerank_arrow_endpoints.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@
1818

1919
class ArticleRankArrowEndpoints(ArticleRankEndpoints):
2020
def __init__(
21-
self, arrow_client: AuthenticatedArrowClient, write_back_client: Optional[RemoteWriteBackClient] = None
21+
self,
22+
arrow_client: AuthenticatedArrowClient,
23+
write_back_client: Optional[RemoteWriteBackClient] = None,
24+
show_progress: bool = True,
2225
):
23-
self._node_property_endpoints = NodePropertyEndpoints(arrow_client, write_back_client)
26+
self._node_property_endpoints = NodePropertyEndpoints(
27+
arrow_client, write_back_client, show_progress=show_progress
28+
)
2429

2530
def mutate(
2631
self,

graphdatascience/procedure_surface/arrow/articulationpoints_arrow_endpoints.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@ class ArticulationPointsArrowEndpoints(ArticulationPointsEndpoints):
2020
"""Arrow-based implementation of ArticulationPoints algorithm endpoints."""
2121

2222
def __init__(
23-
self, arrow_client: AuthenticatedArrowClient, write_back_client: Optional[RemoteWriteBackClient] = None
23+
self,
24+
arrow_client: AuthenticatedArrowClient,
25+
write_back_client: Optional[RemoteWriteBackClient] = None,
26+
show_progress: bool = True,
2427
):
25-
self._node_property_endpoints = NodePropertyEndpoints(arrow_client, write_back_client)
28+
self._node_property_endpoints = NodePropertyEndpoints(
29+
arrow_client, write_back_client, show_progress=show_progress
30+
)
2631

2732
def mutate(
2833
self,

graphdatascience/procedure_surface/arrow/betweenness_arrow_endpoints.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@ class BetweennessArrowEndpoints(BetweennessEndpoints):
2020
"""Arrow-based implementation of Betweenness Centrality algorithm endpoints."""
2121

2222
def __init__(
23-
self, arrow_client: AuthenticatedArrowClient, write_back_client: Optional[RemoteWriteBackClient] = None
23+
self,
24+
arrow_client: AuthenticatedArrowClient,
25+
write_back_client: Optional[RemoteWriteBackClient] = None,
26+
show_progress: bool = True,
2427
):
25-
self._node_property_endpoints = NodePropertyEndpoints(arrow_client, write_back_client)
28+
self._node_property_endpoints = NodePropertyEndpoints(
29+
arrow_client, write_back_client, show_progress=show_progress
30+
)
2631

2732
def mutate(
2833
self,

graphdatascience/procedure_surface/arrow/catalog/node_label_arrow_endpoints.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,17 @@
1515

1616
class NodeLabelArrowEndpoints(NodeLabelEndpoints):
1717
def __init__(
18-
self, arrow_client: AuthenticatedArrowClient, write_back_client: Optional[RemoteWriteBackClient] = None
18+
self,
19+
arrow_client: AuthenticatedArrowClient,
20+
write_back_client: Optional[RemoteWriteBackClient] = None,
21+
show_progress: bool = True,
1922
):
23+
self._node_property_endpoints = NodePropertyEndpoints(
24+
arrow_client, write_back_client, show_progress=show_progress
25+
)
2026
self._arrow_client = arrow_client
2127
self._node_property_endpoints = NodePropertyEndpoints(arrow_client, write_back_client)
22-
self._show_progress = False # TODO add option to show progress
28+
self._show_progress = show_progress
2329

2430
def mutate(
2531
self,
@@ -46,7 +52,7 @@ def mutate(
4652
job_id=job_id,
4753
)
4854

49-
show_progress = self._show_progress and log_progress if log_progress is not None else self._show_progress
55+
show_progress = self._show_progress if log_progress is None else self._show_progress and log_progress
5056
job_id = JobClient.run_job_and_wait(
5157
self._arrow_client, "v2/graph.nodeLabel.mutate", config, show_progress=show_progress
5258
)

graphdatascience/procedure_surface/arrow/catalog/node_properties_arrow_endpoints.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,20 @@
2020

2121

2222
class NodePropertiesArrowEndpoints(NodePropertiesEndpoints):
23-
def __init__(self, arrow_client: AuthenticatedArrowClient, query_runner: Optional[QueryRunner] = None):
23+
def __init__(
24+
self,
25+
arrow_client: AuthenticatedArrowClient,
26+
query_runner: Optional[QueryRunner] = None,
27+
show_progress: bool = True,
28+
):
2429
self._arrow_client = arrow_client
2530
self._query_runner = query_runner
2631
self._write_back_client: Optional[RemoteWriteBackClient] = (
2732
RemoteWriteBackClient(arrow_client, query_runner) if query_runner is not None else None
2833
)
29-
self._node_property_endpoints = NodePropertyEndpoints(arrow_client, self._write_back_client)
34+
self._node_property_endpoints = NodePropertyEndpoints(
35+
arrow_client, self._write_back_client, show_progress=show_progress
36+
)
3037

3138
def stream(
3239
self,

graphdatascience/procedure_surface/arrow/catalog/relationship_arrow_endpoints.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,8 @@ def drop(
126126
*,
127127
fail_if_missing: Optional[bool] = None,
128128
) -> RelationshipsDropResult:
129-
# TODO enable once we have a propper graph implementation for arrow endpoints
130-
# if not relationship_type in G.relationship_types():
131-
# raise ValueError(f"Relationship type '{relationship_type}' does not exist in graph '{G.name()}'")
129+
if relationship_type not in G.relationship_types():
130+
raise ValueError(f"Relationship type '{relationship_type}' does not exist in graph '{G.name()}'")
132131

133132
config = ConfigConverter.convert_to_gds_config(
134133
graph_name=G.name(),
@@ -160,7 +159,7 @@ def index_inverse(
160159
job_id=job_id,
161160
)
162161

163-
show_progress = self._show_progress and log_progress if log_progress is not None else self._show_progress
162+
show_progress = self._show_progress if log_progress is None else self._show_progress and log_progress
164163
job_id = JobClient.run_job_and_wait(
165164
self._arrow_client, "v2/graph.relationships.indexInverse", config, show_progress=show_progress
166165
)
@@ -191,7 +190,7 @@ def to_undirected(
191190
username=username,
192191
job_id=job_id,
193192
)
194-
show_progress = self._show_progress and log_progress if log_progress is not None else self._show_progress
193+
show_progress = self._show_progress if log_progress is None else self._show_progress and log_progress
195194

196195
job_id = JobClient.run_job_and_wait(
197196
self._arrow_client, "v2/graph.relationships.toUndirected", config, show_progress=show_progress

graphdatascience/procedure_surface/arrow/catalog_arrow_endpoints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ def sample(self) -> GraphSamplingEndpoints:
218218
def node_labels(self) -> NodeLabelArrowEndpoints:
219219
write_client = RemoteWriteBackClient(self._arrow_client, self._query_runner) if self._query_runner else None
220220

221-
return NodeLabelArrowEndpoints(self._arrow_client, write_client)
221+
return NodeLabelArrowEndpoints(self._arrow_client, write_client, show_progress=self._show_progress)
222222

223223
@property
224224
def node_properties(self) -> NodePropertiesArrowEndpoints:

graphdatascience/procedure_surface/arrow/celf_arrow_endpoints.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,14 @@
1818

1919
class CelfArrowEndpoints(CelfEndpoints):
2020
def __init__(
21-
self, arrow_client: AuthenticatedArrowClient, write_back_client: Optional[RemoteWriteBackClient] = None
21+
self,
22+
arrow_client: AuthenticatedArrowClient,
23+
write_back_client: Optional[RemoteWriteBackClient] = None,
24+
show_progress: bool = True,
2225
):
23-
self._node_property_endpoints = NodePropertyEndpoints(arrow_client, write_back_client)
26+
self._node_property_endpoints = NodePropertyEndpoints(
27+
arrow_client, write_back_client, show_progress=show_progress
28+
)
2429

2530
def mutate(
2631
self,

graphdatascience/procedure_surface/arrow/closeness_arrow_endpoints.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,14 @@ class ClosenessArrowEndpoints(ClosenessEndpoints):
2020
"""Arrow-based implementation of Closeness Centrality algorithm endpoints."""
2121

2222
def __init__(
23-
self, arrow_client: AuthenticatedArrowClient, write_back_client: Optional[RemoteWriteBackClient] = None
23+
self,
24+
arrow_client: AuthenticatedArrowClient,
25+
write_back_client: Optional[RemoteWriteBackClient] = None,
26+
show_progress: bool = True,
2427
):
25-
self._node_property_endpoints = NodePropertyEndpoints(arrow_client, write_back_client)
28+
self._node_property_endpoints = NodePropertyEndpoints(
29+
arrow_client, write_back_client, show_progress=show_progress
30+
)
2631

2732
def mutate(
2833
self,

0 commit comments

Comments
 (0)