File tree 1 file changed +24
-20
lines changed
1 file changed +24
-20
lines changed Original file line number Diff line number Diff line change @@ -289,26 +289,8 @@ def __init__(
289
289
290
290
# TODO: check that the type is one of the supported types
291
291
param_type = self .kwargs ["type" ] = self ._get_type (kwargs )
292
- reserved_params = [
293
- "params" ,
294
- "with" ,
295
- "max-num-splits" ,
296
- "max_num_splits" ,
297
- "max-workers" ,
298
- "max_workers" ,
299
- "tag" ,
300
- "run-id-file" ,
301
- "run_id_file" ,
302
- "namespace" ,
303
- "obj" ,
304
- "decospecs" ,
305
- "max-log-size" ,
306
- "max_log_size" ,
307
- "tags" ,
308
- "user_namespace" ,
309
- ]
310
-
311
- if self .name in reserved_params :
292
+
293
+ if self .name in _reserved_params ():
312
294
raise MetaflowException (
313
295
"Parameter name '%s' is a reserved "
314
296
"word. Please use a different "
@@ -383,6 +365,28 @@ def __getitem__(self, x):
383
365
pass
384
366
385
367
368
+ def _reserved_params ():
369
+ reserved_params = [
370
+ "params" ,
371
+ "with" ,
372
+ "tag" ,
373
+ "namespace" ,
374
+ "obj" ,
375
+ "tags" ,
376
+ "decospecs" ,
377
+ "run-id-file" ,
378
+ "max-num-splits" ,
379
+ "max-workers" ,
380
+ "max-log-size" ,
381
+ "user-namespace" ,
382
+ ]
383
+ reserved = set (reserved_params )
384
+ # due to the way Click maps cli args to function args we also want to add underscored params to the set
385
+ for param in reserved_params :
386
+ reserved .add (param .replace ("-" , "_" ))
387
+ return reserved
388
+
389
+
386
390
def add_custom_parameters (deploy_mode = False ):
387
391
# deploy_mode determines whether deploy-time functions should or should
388
392
# not be evaluated for this command
You can’t perform that action at this time.
0 commit comments