@@ -193,43 +193,6 @@ def set_workload_parsers(workload_parser):
193193 ),
194194 )
195195
196- # Autoprovisioning workload arguments
197- workload_create_autoprovisioning_arguments .add_argument (
198- '--on-demand' ,
199- action = 'store_true' ,
200- help = (
201- 'Sets autoprovisioning to use on-demand resources for the workload'
202- ' request. See `--reservation` or `--spot` for other capacity types.'
203- ),
204- )
205- workload_create_autoprovisioning_arguments .add_argument (
206- '--reservation' ,
207- type = str ,
208- help = (
209- 'Sets autoprovisioning to use reservation resources for the workload'
210- ' request. This will attempt to find the provided reservation. See'
211- ' `--spot`, `--flex` or `--on-demand` for other capacity types.'
212- ),
213- )
214- workload_create_autoprovisioning_arguments .add_argument (
215- '--spot' ,
216- action = 'store_true' ,
217- help = (
218- 'Sets autoprovisioning to use spot resources. See `--reservation`,'
219- ' `--flex` or `--on-demand` for other capacity types.'
220- ),
221- )
222-
223- workload_create_autoprovisioning_arguments .add_argument (
224- '--flex' ,
225- action = 'store_true' ,
226- help = (
227- 'Sets autoprovisioning to use flex-start resources. See'
228- ' `--reservation`, `--spot` or `--on-demand` for other capacity'
229- ' types.'
230- ),
231- )
232-
233196 # "workload create-pathways" command parser.
234197 workload_create_pathways_parser = workload_subcommands .add_parser (
235198 'create-pathways' , help = 'Create a new job.'
@@ -257,6 +220,12 @@ def set_workload_parsers(workload_parser):
257220 '`--base-docker-image` is used by default. Set this argument if the'
258221 ' user wants the docker image to be used directly by the xpk workload.' ,
259222 )
223+ workload_create_pathways_autoprovisioning_arguments = (
224+ workload_create_pathways_parser .add_argument_group (
225+ 'Optional Autoprovisioning Arguments' ,
226+ 'Arguments for configuring autoprovisioning.' ,
227+ )
228+ )
260229 workload_create_pathways_vertex_tensorboard_arguments = (
261230 workload_create_pathways_parser .add_argument_group (
262231 'Vertex Tensorboard Arguments' ,
@@ -407,6 +376,10 @@ def set_workload_parsers(workload_parser):
407376 workload_vertex_tensorboard_arguments ,
408377 workload_create_pathways_vertex_tensorboard_arguments ,
409378 ])
379+ add_shared_workload_create_autoprovisioning_arguments ([
380+ workload_create_autoprovisioning_arguments ,
381+ workload_create_pathways_autoprovisioning_arguments ,
382+ ])
410383
411384 # Set defaults for both workload create and workload create-pathways after adding all shared args.
412385 workload_create_parser .set_defaults (func = workload_create )
@@ -770,3 +743,48 @@ def add_shared_workload_create_tensorboard_arguments(args_parsers):
770743 '<cluster>-<workload> will be created.'
771744 ),
772745 )
746+
747+
748+ def add_shared_workload_create_autoprovisioning_arguments (args_parsers ):
749+ """Add shared autoprovisioning arguments
750+
751+ Args:
752+ List of workload create optional arguments parsers
753+ """
754+ for custom_parser in args_parsers :
755+ custom_parser .add_argument (
756+ '--on-demand' ,
757+ action = 'store_true' ,
758+ help = (
759+ 'Sets autoprovisioning to use on-demand resources for the workload'
760+ ' request. See `--reservation` or `--spot` for other capacity'
761+ ' types.'
762+ ),
763+ )
764+ custom_parser .add_argument (
765+ '--reservation' ,
766+ type = str ,
767+ help = (
768+ 'Sets autoprovisioning to use reservation resources for the'
769+ ' workload request. This will attempt to find the provided'
770+ ' reservation. See `--spot`, `--flex` or `--on-demand` for other'
771+ ' capacity types.'
772+ ),
773+ )
774+ custom_parser .add_argument (
775+ '--spot' ,
776+ action = 'store_true' ,
777+ help = (
778+ 'Sets autoprovisioning to use spot resources. See `--reservation`,'
779+ ' `--flex` or `--on-demand` for other capacity types.'
780+ ),
781+ )
782+ custom_parser .add_argument (
783+ '--flex' ,
784+ action = 'store_true' ,
785+ help = (
786+ 'Sets autoprovisioning to use flex-start resources. See'
787+ ' `--reservation`, `--spot` or `--on-demand` for other capacity'
788+ ' types.'
789+ ),
790+ )
0 commit comments