@@ -1489,6 +1489,7 @@ def _prepare_training_task_inputs_and_output_dir(
1489
1489
enable_dashboard_access : bool = False ,
1490
1490
tensorboard : Optional [str ] = None ,
1491
1491
disable_retries : bool = False ,
1492
+ persistent_resource_id : Optional [str ] = None ,
1492
1493
) -> Tuple [Dict , str ]:
1493
1494
"""Prepares training task inputs and output directory for custom job.
1494
1495
@@ -1539,6 +1540,14 @@ def _prepare_training_task_inputs_and_output_dir(
1539
1540
Indicates if the job should retry for internal errors after the
1540
1541
job starts running. If True, overrides
1541
1542
`restart_job_on_worker_restart` to False.
1543
+ persistent_resource_id (str):
1544
+ Optional. The ID of the PersistentResource in the same Project
1545
+ and Location. If this is specified, the job will be run on
1546
+ existing machines held by the PersistentResource instead of
1547
+ on-demand short-live machines. The network, CMEK, and node pool
1548
+ configs on the job should be consistent with those on the
1549
+ PersistentResource, otherwise, the job will be rejected.
1550
+
1542
1551
Returns:
1543
1552
Training task inputs and Output directory for custom job.
1544
1553
"""
@@ -1565,6 +1574,8 @@ def _prepare_training_task_inputs_and_output_dir(
1565
1574
training_task_inputs ["enable_web_access" ] = enable_web_access
1566
1575
if enable_dashboard_access :
1567
1576
training_task_inputs ["enable_dashboard_access" ] = enable_dashboard_access
1577
+ if persistent_resource_id :
1578
+ training_task_inputs ["persistent_resource_id" ] = persistent_resource_id
1568
1579
1569
1580
if timeout or restart_job_on_worker_restart or disable_retries :
1570
1581
timeout = f"{ timeout } s" if timeout else None
@@ -2962,6 +2973,7 @@ def run(
2962
2973
sync = True ,
2963
2974
create_request_timeout : Optional [float ] = None ,
2964
2975
disable_retries : bool = False ,
2976
+ persistent_resource_id : Optional [str ] = None ,
2965
2977
) -> Optional [models .Model ]:
2966
2978
"""Runs the custom training job.
2967
2979
@@ -3249,6 +3261,13 @@ def run(
3249
3261
Indicates if the job should retry for internal errors after the
3250
3262
job starts running. If True, overrides
3251
3263
`restart_job_on_worker_restart` to False.
3264
+ persistent_resource_id (str):
3265
+ Optional. The ID of the PersistentResource in the same Project
3266
+ and Location. If this is specified, the job will be run on
3267
+ existing machines held by the PersistentResource instead of
3268
+ on-demand short-live machines. The network, CMEK, and node pool
3269
+ configs on the job should be consistent with those on the
3270
+ PersistentResource, otherwise, the job will be rejected.
3252
3271
3253
3272
Returns:
3254
3273
model: The trained Vertex AI Model resource or None if training did not
@@ -3311,6 +3330,7 @@ def run(
3311
3330
sync = sync ,
3312
3331
create_request_timeout = create_request_timeout ,
3313
3332
disable_retries = disable_retries ,
3333
+ persistent_resource_id = persistent_resource_id ,
3314
3334
)
3315
3335
3316
3336
def submit (
@@ -3362,6 +3382,7 @@ def submit(
3362
3382
sync = True ,
3363
3383
create_request_timeout : Optional [float ] = None ,
3364
3384
disable_retries : bool = False ,
3385
+ persistent_resource_id : Optional [str ] = None ,
3365
3386
) -> Optional [models .Model ]:
3366
3387
"""Submits the custom training job without blocking until completion.
3367
3388
@@ -3649,6 +3670,13 @@ def submit(
3649
3670
Indicates if the job should retry for internal errors after the
3650
3671
job starts running. If True, overrides
3651
3672
`restart_job_on_worker_restart` to False.
3673
+ persistent_resource_id (str):
3674
+ Optional. The ID of the PersistentResource in the same Project
3675
+ and Location. If this is specified, the job will be run on
3676
+ existing machines held by the PersistentResource instead of
3677
+ on-demand short-live machines. The network, CMEK, and node pool
3678
+ configs on the job should be consistent with those on the
3679
+ PersistentResource, otherwise, the job will be rejected.
3652
3680
3653
3681
Returns:
3654
3682
model: The trained Vertex AI Model resource or None if training did not
@@ -3711,6 +3739,7 @@ def submit(
3711
3739
create_request_timeout = create_request_timeout ,
3712
3740
block = False ,
3713
3741
disable_retries = disable_retries ,
3742
+ persistent_resource_id = persistent_resource_id ,
3714
3743
)
3715
3744
3716
3745
@base .optional_sync (construct_object_on_arg = "managed_model" )
@@ -3757,6 +3786,7 @@ def _run(
3757
3786
create_request_timeout : Optional [float ] = None ,
3758
3787
block : Optional [bool ] = True ,
3759
3788
disable_retries : bool = False ,
3789
+ persistent_resource_id : Optional [str ] = None ,
3760
3790
) -> Optional [models .Model ]:
3761
3791
"""Packages local script and launches training_job.
3762
3792
@@ -3946,6 +3976,13 @@ def _run(
3946
3976
Indicates if the job should retry for internal errors after the
3947
3977
job starts running. If True, overrides
3948
3978
`restart_job_on_worker_restart` to False.
3979
+ persistent_resource_id (str):
3980
+ Optional. The ID of the PersistentResource in the same Project
3981
+ and Location. If this is specified, the job will be run on
3982
+ existing machines held by the PersistentResource instead of
3983
+ on-demand short-live machines. The network, CMEK, and node pool
3984
+ configs on the job should be consistent with those on the
3985
+ PersistentResource, otherwise, the job will be rejected.
3949
3986
3950
3987
Returns:
3951
3988
model: The trained Vertex AI Model resource or None if training did not
@@ -3999,6 +4036,7 @@ def _run(
3999
4036
enable_dashboard_access = enable_dashboard_access ,
4000
4037
tensorboard = tensorboard ,
4001
4038
disable_retries = disable_retries ,
4039
+ persistent_resource_id = persistent_resource_id ,
4002
4040
)
4003
4041
4004
4042
model = self ._run_job (
@@ -4321,6 +4359,7 @@ def run(
4321
4359
sync = True ,
4322
4360
create_request_timeout : Optional [float ] = None ,
4323
4361
disable_retries : bool = False ,
4362
+ persistent_resource_id : Optional [str ] = None ,
4324
4363
) -> Optional [models .Model ]:
4325
4364
"""Runs the custom training job.
4326
4365
@@ -4601,6 +4640,13 @@ def run(
4601
4640
Indicates if the job should retry for internal errors after the
4602
4641
job starts running. If True, overrides
4603
4642
`restart_job_on_worker_restart` to False.
4643
+ persistent_resource_id (str):
4644
+ Optional. The ID of the PersistentResource in the same Project
4645
+ and Location. If this is specified, the job will be run on
4646
+ existing machines held by the PersistentResource instead of
4647
+ on-demand short-live machines. The network, CMEK, and node pool
4648
+ configs on the job should be consistent with those on the
4649
+ PersistentResource, otherwise, the job will be rejected.
4604
4650
4605
4651
Returns:
4606
4652
model: The trained Vertex AI Model resource or None if training did not
@@ -4662,6 +4708,7 @@ def run(
4662
4708
sync = sync ,
4663
4709
create_request_timeout = create_request_timeout ,
4664
4710
disable_retries = disable_retries ,
4711
+ persistent_resource_id = persistent_resource_id ,
4665
4712
)
4666
4713
4667
4714
def submit (
@@ -4713,6 +4760,7 @@ def submit(
4713
4760
sync = True ,
4714
4761
create_request_timeout : Optional [float ] = None ,
4715
4762
disable_retries : bool = False ,
4763
+ persistent_resource_id : Optional [str ] = None ,
4716
4764
) -> Optional [models .Model ]:
4717
4765
"""Submits the custom training job without blocking until completion.
4718
4766
@@ -4993,6 +5041,13 @@ def submit(
4993
5041
Indicates if the job should retry for internal errors after the
4994
5042
job starts running. If True, overrides
4995
5043
`restart_job_on_worker_restart` to False.
5044
+ persistent_resource_id (str):
5045
+ Optional. The ID of the PersistentResource in the same Project
5046
+ and Location. If this is specified, the job will be run on
5047
+ existing machines held by the PersistentResource instead of
5048
+ on-demand short-live machines. The network, CMEK, and node pool
5049
+ configs on the job should be consistent with those on the
5050
+ PersistentResource, otherwise, the job will be rejected.
4996
5051
4997
5052
Returns:
4998
5053
model: The trained Vertex AI Model resource or None if training did not
@@ -5054,6 +5109,7 @@ def submit(
5054
5109
create_request_timeout = create_request_timeout ,
5055
5110
block = False ,
5056
5111
disable_retries = disable_retries ,
5112
+ persistent_resource_id = persistent_resource_id ,
5057
5113
)
5058
5114
5059
5115
@base .optional_sync (construct_object_on_arg = "managed_model" )
@@ -5099,6 +5155,7 @@ def _run(
5099
5155
create_request_timeout : Optional [float ] = None ,
5100
5156
block : Optional [bool ] = True ,
5101
5157
disable_retries : bool = False ,
5158
+ persistent_resource_id : Optional [str ] = None ,
5102
5159
) -> Optional [models .Model ]:
5103
5160
"""Packages local script and launches training_job.
5104
5161
Args:
@@ -5284,6 +5341,13 @@ def _run(
5284
5341
Indicates if the job should retry for internal errors after the
5285
5342
job starts running. If True, overrides
5286
5343
`restart_job_on_worker_restart` to False.
5344
+ persistent_resource_id (str):
5345
+ Optional. The ID of the PersistentResource in the same Project
5346
+ and Location. If this is specified, the job will be run on
5347
+ existing machines held by the PersistentResource instead of
5348
+ on-demand short-live machines. The network, CMEK, and node pool
5349
+ configs on the job should be consistent with those on the
5350
+ PersistentResource, otherwise, the job will be rejected.
5287
5351
5288
5352
Returns:
5289
5353
model: The trained Vertex AI Model resource or None if training did not
@@ -5331,6 +5395,7 @@ def _run(
5331
5395
enable_dashboard_access = enable_dashboard_access ,
5332
5396
tensorboard = tensorboard ,
5333
5397
disable_retries = disable_retries ,
5398
+ persistent_resource_id = persistent_resource_id ,
5334
5399
)
5335
5400
5336
5401
model = self ._run_job (
@@ -7249,6 +7314,7 @@ def run(
7249
7314
sync = True ,
7250
7315
create_request_timeout : Optional [float ] = None ,
7251
7316
disable_retries : bool = False ,
7317
+ persistent_resource_id : Optional [str ] = None ,
7252
7318
) -> Optional [models .Model ]:
7253
7319
"""Runs the custom training job.
7254
7320
@@ -7530,6 +7596,13 @@ def run(
7530
7596
Indicates if the job should retry for internal errors after the
7531
7597
job starts running. If True, overrides
7532
7598
`restart_job_on_worker_restart` to False.
7599
+ persistent_resource_id (str):
7600
+ Optional. The ID of the PersistentResource in the same Project
7601
+ and Location. If this is specified, the job will be run on
7602
+ existing machines held by the PersistentResource instead of
7603
+ on-demand short-live machines. The network, CMEK, and node pool
7604
+ configs on the job should be consistent with those on the
7605
+ PersistentResource, otherwise, the job will be rejected.
7533
7606
7534
7607
Returns:
7535
7608
model: The trained Vertex AI Model resource or None if training did not
@@ -7586,6 +7659,7 @@ def run(
7586
7659
sync = sync ,
7587
7660
create_request_timeout = create_request_timeout ,
7588
7661
disable_retries = disable_retries ,
7662
+ persistent_resource_id = persistent_resource_id ,
7589
7663
)
7590
7664
7591
7665
@base .optional_sync (construct_object_on_arg = "managed_model" )
@@ -7630,6 +7704,7 @@ def _run(
7630
7704
sync = True ,
7631
7705
create_request_timeout : Optional [float ] = None ,
7632
7706
disable_retries : bool = False ,
7707
+ persistent_resource_id : Optional [str ] = None ,
7633
7708
) -> Optional [models .Model ]:
7634
7709
"""Packages local script and launches training_job.
7635
7710
@@ -7800,6 +7875,13 @@ def _run(
7800
7875
Indicates if the job should retry for internal errors after the
7801
7876
job starts running. If True, overrides
7802
7877
`restart_job_on_worker_restart` to False.
7878
+ persistent_resource_id (str):
7879
+ Optional. The ID of the PersistentResource in the same Project
7880
+ and Location. If this is specified, the job will be run on
7881
+ existing machines held by the PersistentResource instead of
7882
+ on-demand short-live machines. The network, CMEK, and node pool
7883
+ configs on the job should be consistent with those on the
7884
+ PersistentResource, otherwise, the job will be rejected.
7803
7885
7804
7886
Returns:
7805
7887
model: The trained Vertex AI Model resource or None if training did not
@@ -7847,6 +7929,7 @@ def _run(
7847
7929
enable_dashboard_access = enable_dashboard_access ,
7848
7930
tensorboard = tensorboard ,
7849
7931
disable_retries = disable_retries ,
7932
+ persistent_resource_id = persistent_resource_id ,
7850
7933
)
7851
7934
7852
7935
model = self ._run_job (
0 commit comments