@@ -44,6 +44,8 @@ def get_pathways_worker_args(args) -> str:
44
44
- --resource_manager_address={rm_address}
45
45
- --gcs_scratch_location={args.pathways_gcs_location}"""
46
46
if args .use_pathways :
47
+ if args .custom_pathways_worker_args :
48
+ yaml = append_custom_pathways_args (yaml , args .custom_pathways_worker_args )
47
49
return yaml .format (args = args , rm_address = get_rm_address (args ))
48
50
else :
49
51
return ''
@@ -62,6 +64,10 @@ def get_pathways_proxy_args(args) -> str:
62
64
- --gcs_scratch_location={args.pathways_gcs_location}"""
63
65
64
66
if args .use_pathways :
67
+ if args .custom_pathways_proxy_server_args :
68
+ yaml = append_custom_pathways_args (
69
+ yaml , args .custom_pathways_proxy_server_args
70
+ )
65
71
return yaml .format (args = args , rm_address = get_rm_address (args ))
66
72
else :
67
73
return ''
@@ -200,6 +206,8 @@ def get_pathways_rm_args(args, system: SystemCharacteristics) -> str:
200
206
- --instance_count={instance_count}
201
207
- --instance_type={instance_type}"""
202
208
if args .use_pathways :
209
+ if args .custom_pathways_server_args :
210
+ yaml = append_custom_pathways_args (yaml , args .custom_pathways_server_args )
203
211
return yaml .format (
204
212
args = args ,
205
213
instance_count = args .num_slices ,
@@ -209,6 +217,28 @@ def get_pathways_rm_args(args, system: SystemCharacteristics) -> str:
209
217
return ''
210
218
211
219
220
+ def append_custom_pathways_args (yaml , custom_args ) -> str :
221
+ """Append custom Pathways args to the YAML with proper indentation.
222
+
223
+ Args:
224
+ yaml (string): existing yaml containing args
225
+
226
+ Returns:
227
+ yaml (string): yaml with additional args appended.
228
+ """
229
+ second_line = yaml .split ('\n ' )[1 ]
230
+ if (
231
+ not second_line
232
+ ): # to cover edge case if only one arg remains, we would have to look at the entire YAML in this case.
233
+ return yaml
234
+ # Calculate the indentation based on the second line of existing YAML.
235
+ indentation = ' ' * (len (second_line ) - len (second_line .lstrip ()))
236
+ custom_args = custom_args .split (' ' )
237
+ for arg in custom_args :
238
+ yaml += '\n ' + indentation + '- ' + arg
239
+ return yaml
240
+
241
+
212
242
def get_user_workload_for_pathways (args , system : SystemCharacteristics ) -> str :
213
243
"""
214
244
Create a user workload container for Pathways.
0 commit comments