2
2
3
3
from pandas import DataFrame
4
4
5
+ from .arrow_config_converter import ArrowConfigConverter
5
6
from ...arrow_client .authenticated_arrow_client import AuthenticatedArrowClient
6
7
from ...arrow_client .v2 .job_client import JobClient
7
8
from ...arrow_client .v2 .mutation_client import MutationClient
@@ -33,19 +34,18 @@ def mutate(
33
34
consecutive_ids : Optional [bool ] = None ,
34
35
relationship_weight_property : Optional [str ] = None ,
35
36
) -> WccMutateResult :
36
- config = self . _build_configuration (
37
+ config = ArrowConfigConverter . build_configuration (
37
38
G ,
38
- concurrency ,
39
- consecutive_ids ,
40
- job_id ,
41
- log_progress ,
42
- None ,
43
- node_labels ,
44
- relationship_types ,
45
- relationship_weight_property ,
46
- seed_property ,
47
- sudo ,
48
- threshold ,
39
+ concurrency = concurrency ,
40
+ consecutive_ids = consecutive_ids ,
41
+ job_id = job_id ,
42
+ log_progress = log_progress ,
43
+ node_labels = node_labels ,
44
+ relationship_types = relationship_types ,
45
+ relationship_weight_property = relationship_weight_property ,
46
+ seed_property = seed_property ,
47
+ sudo = sudo ,
48
+ threshold = threshold ,
49
49
)
50
50
51
51
job_id = JobClient .run_job_and_wait (self ._arrow_client , WCC_ENDPOINT , config )
@@ -79,19 +79,18 @@ def stats(
79
79
consecutive_ids : Optional [bool ] = None ,
80
80
relationship_weight_property : Optional [str ] = None ,
81
81
) -> WccStatsResult :
82
- config = self . _build_configuration (
82
+ config = ArrowConfigConverter . build_configuration (
83
83
G ,
84
- concurrency ,
85
- consecutive_ids ,
86
- job_id ,
87
- log_progress ,
88
- None ,
89
- node_labels ,
90
- relationship_types ,
91
- relationship_weight_property ,
92
- seed_property ,
93
- sudo ,
94
- threshold ,
84
+ concurrency = concurrency ,
85
+ consecutive_ids = consecutive_ids ,
86
+ job_id = job_id ,
87
+ log_progress = log_progress ,
88
+ node_labels = node_labels ,
89
+ relationship_types = relationship_types ,
90
+ relationship_weight_property = relationship_weight_property ,
91
+ seed_property = seed_property ,
92
+ sudo = sudo ,
93
+ threshold = threshold ,
95
94
)
96
95
97
96
job_id = JobClient .run_job_and_wait (self ._arrow_client , WCC_ENDPOINT , config )
@@ -122,19 +121,19 @@ def stream(
122
121
consecutive_ids : Optional [bool ] = None ,
123
122
relationship_weight_property : Optional [str ] = None ,
124
123
) -> DataFrame :
125
- config = self . _build_configuration (
124
+ config = ArrowConfigConverter . build_configuration (
126
125
G ,
127
- concurrency ,
128
- consecutive_ids ,
129
- job_id ,
130
- log_progress ,
131
- min_component_size ,
132
- node_labels ,
133
- relationship_types ,
134
- relationship_weight_property ,
135
- seed_property ,
136
- sudo ,
137
- threshold ,
126
+ concurrency = concurrency ,
127
+ consecutive_ids = consecutive_ids ,
128
+ job_id = job_id ,
129
+ log_progress = log_progress ,
130
+ min_component_size = min_component_size ,
131
+ node_labels = node_labels ,
132
+ relationship_types = relationship_types ,
133
+ relationship_weight_property = relationship_weight_property ,
134
+ seed_property = seed_property ,
135
+ sudo = sudo ,
136
+ threshold = threshold ,
138
137
)
139
138
140
139
job_id = JobClient .run_job_and_wait (self ._arrow_client , WCC_ENDPOINT , config )
@@ -158,19 +157,20 @@ def write(
158
157
relationship_weight_property : Optional [str ] = None ,
159
158
write_concurrency : Optional [int ] = None ,
160
159
) -> WccWriteResult :
161
- config = self ._build_configuration (
160
+
161
+ config = ArrowConfigConverter .build_configuration (
162
162
G ,
163
- concurrency ,
164
- consecutive_ids ,
165
- job_id ,
166
- log_progress ,
167
- min_component_size ,
168
- node_labels ,
169
- relationship_types ,
170
- relationship_weight_property ,
171
- seed_property ,
172
- sudo ,
173
- threshold ,
163
+ concurrency = concurrency ,
164
+ consecutive_ids = consecutive_ids ,
165
+ job_id = job_id ,
166
+ log_progress = log_progress ,
167
+ min_component_size = min_component_size ,
168
+ node_labels = node_labels ,
169
+ relationship_types = relationship_types ,
170
+ relationship_weight_property = relationship_weight_property ,
171
+ seed_property = seed_property ,
172
+ sudo = sudo ,
173
+ threshold = threshold ,
174
174
)
175
175
176
176
job_id = JobClient .run_job_and_wait (self ._arrow_client , WCC_ENDPOINT , config )
@@ -192,48 +192,4 @@ def write(
192
192
computation_result ["postProcessingMillis" ],
193
193
computation_result ["nodePropertiesWritten" ],
194
194
computation_result ["configuration" ],
195
- )
196
-
197
- @staticmethod
198
- def _build_configuration (
199
- G : Graph ,
200
- concurrency : Optional [int ],
201
- consecutive_ids : Optional [bool ],
202
- job_id : Optional [str ],
203
- log_progress : Optional [bool ],
204
- min_component_size : Optional [int ],
205
- node_labels : Optional [List [str ]],
206
- relationship_types : Optional [List [str ]],
207
- relationship_weight_property : Optional [str ],
208
- seed_property : Optional [str ],
209
- sudo : Optional [bool ],
210
- threshold : Optional [float ],
211
- ) -> dict [str , Any ]:
212
- config : dict [str , Any ] = {
213
- "graphName" : G .name (),
214
- }
215
-
216
- if min_component_size is not None :
217
- config ["minComponentSize" ] = min_component_size
218
- if threshold is not None :
219
- config ["threshold" ] = threshold
220
- if relationship_types is not None :
221
- config ["relationshipTypes" ] = relationship_types
222
- if node_labels is not None :
223
- config ["nodeLabels" ] = node_labels
224
- if sudo is not None :
225
- config ["sudo" ] = sudo
226
- if log_progress is not None :
227
- config ["logProgress" ] = log_progress
228
- if concurrency is not None :
229
- config ["concurrency" ] = concurrency
230
- if job_id is not None :
231
- config ["jobId" ] = job_id
232
- if seed_property is not None :
233
- config ["seedProperty" ] = seed_property
234
- if consecutive_ids is not None :
235
- config ["consecutiveIds" ] = consecutive_ids
236
- if relationship_weight_property is not None :
237
- config ["relationshipWeightProperty" ] = relationship_weight_property
238
-
239
- return config
195
+ )
0 commit comments