|
45 | 45 | training_pipeline as gca_training_pipeline, |
46 | 46 | study as gca_study_compat, |
47 | 47 | custom_job as gca_custom_job_compat, |
| 48 | + service_networking as gca_service_networking, |
48 | 49 | ) |
49 | 50 |
|
50 | 51 | from google.cloud.aiplatform.utils import _timestamped_gcs_dir |
@@ -1553,6 +1554,9 @@ def _prepare_training_task_inputs_and_output_dir( |
1553 | 1554 | persistent_resource_id: Optional[str] = None, |
1554 | 1555 | scheduling_strategy: Optional[gca_custom_job_compat.Scheduling.Strategy] = None, |
1555 | 1556 | max_wait_duration: Optional[int] = None, |
| 1557 | + psc_interface_config: Optional[ |
| 1558 | + gca_service_networking.PscInterfaceConfig |
| 1559 | + ] = None, |
1556 | 1560 | ) -> Tuple[Dict, str]: |
1557 | 1561 | """Prepares training task inputs and output directory for custom job. |
1558 | 1562 |
|
@@ -1617,6 +1621,8 @@ def _prepare_training_task_inputs_and_output_dir( |
1617 | 1621 | This is the maximum duration that a job will wait for the |
1618 | 1622 | requested resources to be provisioned in seconds. If set to 0, |
1619 | 1623 | the job will wait indefinitely. The default is 30 minutes. |
| 1624 | + psc_interface_config (gca_service_networking.PscInterfaceConfig): |
| 1625 | + Optional. The PSC interface config for the job. |
1620 | 1626 | Returns: |
1621 | 1627 | Training task inputs and Output directory for custom job. |
1622 | 1628 | """ |
@@ -1645,6 +1651,8 @@ def _prepare_training_task_inputs_and_output_dir( |
1645 | 1651 | training_task_inputs["enable_dashboard_access"] = enable_dashboard_access |
1646 | 1652 | if persistent_resource_id: |
1647 | 1653 | training_task_inputs["persistent_resource_id"] = persistent_resource_id |
| 1654 | + if psc_interface_config: |
| 1655 | + training_task_inputs["psc_interface_config"] = psc_interface_config |
1648 | 1656 |
|
1649 | 1657 | if ( |
1650 | 1658 | timeout |
@@ -3055,6 +3063,9 @@ def run( |
3055 | 3063 | reservation_affinity_key: Optional[str] = None, |
3056 | 3064 | reservation_affinity_values: Optional[List[str]] = None, |
3057 | 3065 | max_wait_duration: Optional[int] = None, |
| 3066 | + psc_interface_config: Optional[ |
| 3067 | + gca_service_networking.PscInterfaceConfig |
| 3068 | + ] = None, |
3058 | 3069 | ) -> Optional[models.Model]: |
3059 | 3070 | """Runs the custom training job. |
3060 | 3071 |
|
@@ -3433,6 +3444,9 @@ def run( |
3433 | 3444 | This is the maximum duration that a job will wait for the |
3434 | 3445 | requested resources to be provisioned in seconds. If set to 0, |
3435 | 3446 | the job will wait indefinitely. The default is 30 minutes. |
| 3447 | + psc_interface_config (gca_service_networking.PscInterfaceConfig): |
| 3448 | + Optional. Configuration for Private Service Connect interface |
| 3449 | + used for training. |
3436 | 3450 |
|
3437 | 3451 | Returns: |
3438 | 3452 | The trained Vertex AI model resource or None if the training |
@@ -3504,6 +3518,7 @@ def run( |
3504 | 3518 | persistent_resource_id=persistent_resource_id, |
3505 | 3519 | scheduling_strategy=scheduling_strategy, |
3506 | 3520 | max_wait_duration=max_wait_duration, |
| 3521 | + psc_interface_config=psc_interface_config, |
3507 | 3522 | ) |
3508 | 3523 |
|
3509 | 3524 | def submit( |
@@ -3564,6 +3579,9 @@ def submit( |
3564 | 3579 | reservation_affinity_key: Optional[str] = None, |
3565 | 3580 | reservation_affinity_values: Optional[List[str]] = None, |
3566 | 3581 | max_wait_duration: Optional[int] = None, |
| 3582 | + psc_interface_config: Optional[ |
| 3583 | + gca_service_networking.PscInterfaceConfig |
| 3584 | + ] = None, |
3567 | 3585 | ) -> Optional[models.Model]: |
3568 | 3586 | """Submits the custom training job without blocking until completion. |
3569 | 3587 |
|
@@ -3887,6 +3905,9 @@ def submit( |
3887 | 3905 | This is the maximum duration that a job will wait for the |
3888 | 3906 | requested resources to be provisioned in seconds. If set to 0, |
3889 | 3907 | the job will wait indefinitely. The default is 30 minutes. |
| 3908 | + psc_interface_config (gca_service_networking.PscInterfaceConfig): |
| 3909 | + Optional. Configuration for Private Service Connect interface |
| 3910 | + used for training. |
3890 | 3911 |
|
3891 | 3912 | Returns: |
3892 | 3913 | model: The trained Vertex AI Model resource or None if training did not |
@@ -3958,6 +3979,7 @@ def submit( |
3958 | 3979 | persistent_resource_id=persistent_resource_id, |
3959 | 3980 | scheduling_strategy=scheduling_strategy, |
3960 | 3981 | max_wait_duration=max_wait_duration, |
| 3982 | + psc_interface_config=psc_interface_config, |
3961 | 3983 | ) |
3962 | 3984 |
|
3963 | 3985 | @base.optional_sync(construct_object_on_arg="managed_model") |
@@ -4007,6 +4029,9 @@ def _run( |
4007 | 4029 | persistent_resource_id: Optional[str] = None, |
4008 | 4030 | scheduling_strategy: Optional[gca_custom_job_compat.Scheduling.Strategy] = None, |
4009 | 4031 | max_wait_duration: Optional[int] = None, |
| 4032 | + psc_interface_config: Optional[ |
| 4033 | + gca_service_networking.PscInterfaceConfig |
| 4034 | + ] = None, |
4010 | 4035 | ) -> Optional[models.Model]: |
4011 | 4036 | """Packages local script and launches training_job. |
4012 | 4037 |
|
@@ -4209,6 +4234,8 @@ def _run( |
4209 | 4234 | This is the maximum duration that a job will wait for the |
4210 | 4235 | requested resources to be provisioned in seconds. If set to 0, |
4211 | 4236 | the job will wait indefinitely. The default is 30 minutes. |
| 4237 | + psc_interface_config (gca_service_networking.PscInterfaceConfig): |
| 4238 | + Optional. The PSC interface config for the job. |
4212 | 4239 |
|
4213 | 4240 | Returns: |
4214 | 4241 | model: The trained Vertex AI Model resource or None if training did not |
@@ -4265,6 +4292,7 @@ def _run( |
4265 | 4292 | persistent_resource_id=persistent_resource_id, |
4266 | 4293 | scheduling_strategy=scheduling_strategy, |
4267 | 4294 | max_wait_duration=max_wait_duration, |
| 4295 | + psc_interface_config=psc_interface_config, |
4268 | 4296 | ) |
4269 | 4297 |
|
4270 | 4298 | model = self._run_job( |
@@ -4596,6 +4624,9 @@ def run( |
4596 | 4624 | reservation_affinity_key: Optional[str] = None, |
4597 | 4625 | reservation_affinity_values: Optional[List[str]] = None, |
4598 | 4626 | max_wait_duration: Optional[int] = None, |
| 4627 | + psc_interface_config: Optional[ |
| 4628 | + gca_service_networking.PscInterfaceConfig |
| 4629 | + ] = None, |
4599 | 4630 | ) -> Optional[models.Model]: |
4600 | 4631 | """Runs the custom training job. |
4601 | 4632 |
|
@@ -4912,6 +4943,9 @@ def run( |
4912 | 4943 | This is the maximum duration that a job will wait for the |
4913 | 4944 | requested resources to be provisioned in seconds. If set to 0, |
4914 | 4945 | the job will wait indefinitely. The default is 30 minutes. |
| 4946 | + psc_interface_config (gca_service_networking.PscInterfaceConfig): |
| 4947 | + Optional. Configuration for Private Service Connect interface |
| 4948 | + used for training. |
4915 | 4949 |
|
4916 | 4950 | Returns: |
4917 | 4951 | model: The trained Vertex AI Model resource or None if training did not |
@@ -4982,6 +5016,7 @@ def run( |
4982 | 5016 | persistent_resource_id=persistent_resource_id, |
4983 | 5017 | scheduling_strategy=scheduling_strategy, |
4984 | 5018 | max_wait_duration=max_wait_duration, |
| 5019 | + psc_interface_config=psc_interface_config, |
4985 | 5020 | ) |
4986 | 5021 |
|
4987 | 5022 | def submit( |
@@ -5042,6 +5077,9 @@ def submit( |
5042 | 5077 | reservation_affinity_key: Optional[str] = None, |
5043 | 5078 | reservation_affinity_values: Optional[List[str]] = None, |
5044 | 5079 | max_wait_duration: Optional[int] = None, |
| 5080 | + psc_interface_config: Optional[ |
| 5081 | + gca_service_networking.PscInterfaceConfig |
| 5082 | + ] = None, |
5045 | 5083 | ) -> Optional[models.Model]: |
5046 | 5084 | """Submits the custom training job without blocking until completion. |
5047 | 5085 |
|
@@ -5358,6 +5396,9 @@ def submit( |
5358 | 5396 | This is the maximum duration that a job will wait for the |
5359 | 5397 | requested resources to be provisioned in seconds. If set to 0, |
5360 | 5398 | the job will wait indefinitely. The default is 30 minutes. |
| 5399 | + psc_interface_config (gca_service_networking.PscInterfaceConfig): |
| 5400 | + Optional. Configuration for Private Service Connect interface |
| 5401 | + used for training. |
5361 | 5402 |
|
5362 | 5403 | Returns: |
5363 | 5404 | model: The trained Vertex AI Model resource or None if training did not |
@@ -5428,6 +5469,7 @@ def submit( |
5428 | 5469 | persistent_resource_id=persistent_resource_id, |
5429 | 5470 | scheduling_strategy=scheduling_strategy, |
5430 | 5471 | max_wait_duration=max_wait_duration, |
| 5472 | + psc_interface_config=psc_interface_config, |
5431 | 5473 | ) |
5432 | 5474 |
|
5433 | 5475 | @base.optional_sync(construct_object_on_arg="managed_model") |
@@ -5476,6 +5518,9 @@ def _run( |
5476 | 5518 | persistent_resource_id: Optional[str] = None, |
5477 | 5519 | scheduling_strategy: Optional[gca_custom_job_compat.Scheduling.Strategy] = None, |
5478 | 5520 | max_wait_duration: Optional[int] = None, |
| 5521 | + psc_interface_config: Optional[ |
| 5522 | + gca_service_networking.PscInterfaceConfig |
| 5523 | + ] = None, |
5479 | 5524 | ) -> Optional[models.Model]: |
5480 | 5525 | """Packages local script and launches training_job. |
5481 | 5526 | Args: |
@@ -5674,6 +5719,9 @@ def _run( |
5674 | 5719 | This is the maximum duration that a job will wait for the |
5675 | 5720 | requested resources to be provisioned in seconds. If set to 0, |
5676 | 5721 | the job will wait indefinitely. The default is 30 minutes. |
| 5722 | + psc_interface_config (gca_service_networking.PscInterfaceConfig): |
| 5723 | + Optional. Configuration for Private Service Connect interface |
| 5724 | + used for training. |
5677 | 5725 |
|
5678 | 5726 | Returns: |
5679 | 5727 | model: The trained Vertex AI Model resource or None if training did not |
@@ -5724,6 +5772,7 @@ def _run( |
5724 | 5772 | persistent_resource_id=persistent_resource_id, |
5725 | 5773 | scheduling_strategy=scheduling_strategy, |
5726 | 5774 | max_wait_duration=max_wait_duration, |
| 5775 | + psc_interface_config=psc_interface_config, |
5727 | 5776 | ) |
5728 | 5777 |
|
5729 | 5778 | model = self._run_job( |
@@ -7755,6 +7804,9 @@ def run( |
7755 | 7804 | reservation_affinity_key: Optional[str] = None, |
7756 | 7805 | reservation_affinity_values: Optional[List[str]] = None, |
7757 | 7806 | max_wait_duration: Optional[int] = None, |
| 7807 | + psc_interface_config: Optional[ |
| 7808 | + gca_service_networking.PscInterfaceConfig |
| 7809 | + ] = None, |
7758 | 7810 | ) -> Optional[models.Model]: |
7759 | 7811 | """Runs the custom training job. |
7760 | 7812 |
|
@@ -8072,6 +8124,9 @@ def run( |
8072 | 8124 | This is the maximum duration that a job will wait for the |
8073 | 8125 | requested resources to be provisioned in seconds. If set to 0, |
8074 | 8126 | the job will wait indefinitely. The default is 30 minutes. |
| 8127 | + psc_interface_config (gca_service_networking.PscInterfaceConfig): |
| 8128 | + Optional. Configuration for Private Service Connect interface |
| 8129 | + used for training. |
8075 | 8130 |
|
8076 | 8131 | Returns: |
8077 | 8132 | model: The trained Vertex AI Model resource or None if training did not |
@@ -8137,6 +8192,7 @@ def run( |
8137 | 8192 | persistent_resource_id=persistent_resource_id, |
8138 | 8193 | scheduling_strategy=scheduling_strategy, |
8139 | 8194 | max_wait_duration=max_wait_duration, |
| 8195 | + psc_interface_config=psc_interface_config, |
8140 | 8196 | ) |
8141 | 8197 |
|
8142 | 8198 | @base.optional_sync(construct_object_on_arg="managed_model") |
@@ -8184,6 +8240,9 @@ def _run( |
8184 | 8240 | persistent_resource_id: Optional[str] = None, |
8185 | 8241 | scheduling_strategy: Optional[gca_custom_job_compat.Scheduling.Strategy] = None, |
8186 | 8242 | max_wait_duration: Optional[int] = None, |
| 8243 | + psc_interface_config: Optional[ |
| 8244 | + gca_service_networking.PscInterfaceConfig |
| 8245 | + ] = None, |
8187 | 8246 | ) -> Optional[models.Model]: |
8188 | 8247 | """Packages local script and launches training_job. |
8189 | 8248 |
|
@@ -8367,6 +8426,9 @@ def _run( |
8367 | 8426 | This is the maximum duration that a job will wait for the |
8368 | 8427 | requested resources to be provisioned in seconds. If set to 0, |
8369 | 8428 | the job will wait indefinitely. The default is 30 minutes. |
| 8429 | + psc_interface_config (gca_service_networking.PscInterfaceConfig): |
| 8430 | + Optional. Configuration for Private Service Connect interface |
| 8431 | + used for training. |
8370 | 8432 |
|
8371 | 8433 | Returns: |
8372 | 8434 | model: The trained Vertex AI Model resource or None if training did not |
@@ -8417,6 +8479,7 @@ def _run( |
8417 | 8479 | persistent_resource_id=persistent_resource_id, |
8418 | 8480 | scheduling_strategy=scheduling_strategy, |
8419 | 8481 | max_wait_duration=max_wait_duration, |
| 8482 | + psc_interface_config=psc_interface_config, |
8420 | 8483 | ) |
8421 | 8484 |
|
8422 | 8485 | model = self._run_job( |
|
0 commit comments