|
55 | 55 | from google.cloud.aiplatform_v1.services.pipeline_service.pagers import ( |
56 | 56 | ListTrainingPipelinesPager, |
57 | 57 | ) |
58 | | - from google.cloud.aiplatform_v1.types import CustomJob, TrainingPipeline |
| 58 | + from google.cloud.aiplatform_v1.types import CustomJob, PscInterfaceConfig, TrainingPipeline |
59 | 59 |
|
60 | 60 |
|
61 | 61 | class CustomJobHook(GoogleBaseHook, OperationHelper): |
@@ -317,6 +317,7 @@ def _run_job( |
317 | 317 | is_default_version: bool | None = None, |
318 | 318 | model_version_aliases: list[str] | None = None, |
319 | 319 | model_version_description: str | None = None, |
| 320 | + psc_interface_config: PscInterfaceConfig | None = None, |
320 | 321 | ) -> tuple[models.Model | None, str, str]: |
321 | 322 | """Run a training pipeline job and wait until its completion.""" |
322 | 323 | model = job.run( |
@@ -350,6 +351,7 @@ def _run_job( |
350 | 351 | is_default_version=is_default_version, |
351 | 352 | model_version_aliases=model_version_aliases, |
352 | 353 | model_version_description=model_version_description, |
| 354 | + psc_interface_config=psc_interface_config, |
353 | 355 | ) |
354 | 356 | training_id = self.extract_training_id(job.resource_name) |
355 | 357 | custom_job_id = self.extract_custom_job_id( |
@@ -574,6 +576,7 @@ def create_custom_container_training_job( |
574 | 576 | timestamp_split_column_name: str | None = None, |
575 | 577 | tensorboard: str | None = None, |
576 | 578 | sync=True, |
| 579 | + psc_interface_config: PscInterfaceConfig | None = None, |
577 | 580 | ) -> tuple[models.Model | None, str, str]: |
578 | 581 | """ |
579 | 582 | Create Custom Container Training Job. |
@@ -837,6 +840,8 @@ def create_custom_container_training_job( |
837 | 840 | :param sync: Whether to execute the AI Platform job synchronously. If False, this method |
838 | 841 | will be executed in concurrent Future and any downstream object will |
839 | 842 | be immediately returned and synced when the Future has completed. |
| 843 | + :param psc_interface_config: Optional. Configuration for Private Service Connect interface used for |
| 844 | + training. |
840 | 845 | """ |
841 | 846 | self._job = self.get_custom_container_training_job( |
842 | 847 | project=project_id, |
@@ -896,6 +901,7 @@ def create_custom_container_training_job( |
896 | 901 | is_default_version=is_default_version, |
897 | 902 | model_version_aliases=model_version_aliases, |
898 | 903 | model_version_description=model_version_description, |
| 904 | + psc_interface_config=psc_interface_config, |
899 | 905 | ) |
900 | 906 |
|
901 | 907 | return model, training_id, custom_job_id |
@@ -958,6 +964,7 @@ def create_custom_python_package_training_job( |
958 | 964 | model_version_aliases: list[str] | None = None, |
959 | 965 | model_version_description: str | None = None, |
960 | 966 | sync=True, |
| 967 | + psc_interface_config: PscInterfaceConfig | None = None, |
961 | 968 | ) -> tuple[models.Model | None, str, str]: |
962 | 969 | """ |
963 | 970 | Create Custom Python Package Training Job. |
@@ -1220,6 +1227,8 @@ def create_custom_python_package_training_job( |
1220 | 1227 | :param sync: Whether to execute the AI Platform job synchronously. If False, this method |
1221 | 1228 | will be executed in concurrent Future and any downstream object will |
1222 | 1229 | be immediately returned and synced when the Future has completed. |
| 1230 | + :param psc_interface_config: Optional. Configuration for Private Service Connect interface used for |
| 1231 | + training. |
1223 | 1232 | """ |
1224 | 1233 | self._job = self.get_custom_python_package_training_job( |
1225 | 1234 | project=project_id, |
@@ -1280,6 +1289,7 @@ def create_custom_python_package_training_job( |
1280 | 1289 | is_default_version=is_default_version, |
1281 | 1290 | model_version_aliases=model_version_aliases, |
1282 | 1291 | model_version_description=model_version_description, |
| 1292 | + psc_interface_config=psc_interface_config, |
1283 | 1293 | ) |
1284 | 1294 |
|
1285 | 1295 | return model, training_id, custom_job_id |
@@ -1342,6 +1352,7 @@ def create_custom_training_job( |
1342 | 1352 | timestamp_split_column_name: str | None = None, |
1343 | 1353 | tensorboard: str | None = None, |
1344 | 1354 | sync=True, |
| 1355 | + psc_interface_config: PscInterfaceConfig | None = None, |
1345 | 1356 | ) -> tuple[models.Model | None, str, str]: |
1346 | 1357 | """ |
1347 | 1358 | Create Custom Training Job. |
@@ -1604,6 +1615,8 @@ def create_custom_training_job( |
1604 | 1615 | :param sync: Whether to execute the AI Platform job synchronously. If False, this method |
1605 | 1616 | will be executed in concurrent Future and any downstream object will |
1606 | 1617 | be immediately returned and synced when the Future has completed. |
| 1618 | + :param psc_interface_config: Optional. Configuration for Private Service Connect interface used for |
| 1619 | + training. |
1607 | 1620 | """ |
1608 | 1621 | self._job = self.get_custom_training_job( |
1609 | 1622 | project=project_id, |
@@ -1664,6 +1677,7 @@ def create_custom_training_job( |
1664 | 1677 | is_default_version=is_default_version, |
1665 | 1678 | model_version_aliases=model_version_aliases, |
1666 | 1679 | model_version_description=model_version_description, |
| 1680 | + psc_interface_config=psc_interface_config, |
1667 | 1681 | ) |
1668 | 1682 |
|
1669 | 1683 | return model, training_id, custom_job_id |
@@ -1725,6 +1739,7 @@ def submit_custom_container_training_job( |
1725 | 1739 | predefined_split_column_name: str | None = None, |
1726 | 1740 | timestamp_split_column_name: str | None = None, |
1727 | 1741 | tensorboard: str | None = None, |
| 1742 | + psc_interface_config: PscInterfaceConfig | None = None, |
1728 | 1743 | ) -> CustomContainerTrainingJob: |
1729 | 1744 | """ |
1730 | 1745 | Create and submit a Custom Container Training Job pipeline, then exit without waiting for it to complete. |
@@ -1985,6 +2000,8 @@ def submit_custom_container_training_job( |
1985 | 2000 | ``projects/{project}/locations/{location}/tensorboards/{tensorboard}`` |
1986 | 2001 | For more information on configuring your service account please visit: |
1987 | 2002 | https://cloud.google.com/vertex-ai/docs/experiments/tensorboard-training |
| 2003 | + :param psc_interface_config: Optional. Configuration for Private Service Connect interface used for |
| 2004 | + training. |
1988 | 2005 | """ |
1989 | 2006 | self._job = self.get_custom_container_training_job( |
1990 | 2007 | project=project_id, |
@@ -2043,6 +2060,7 @@ def submit_custom_container_training_job( |
2043 | 2060 | model_version_aliases=model_version_aliases, |
2044 | 2061 | model_version_description=model_version_description, |
2045 | 2062 | sync=False, |
| 2063 | + psc_interface_config=psc_interface_config, |
2046 | 2064 | ) |
2047 | 2065 | return self._job |
2048 | 2066 |
|
@@ -2104,6 +2122,7 @@ def submit_custom_python_package_training_job( |
2104 | 2122 | is_default_version: bool | None = None, |
2105 | 2123 | model_version_aliases: list[str] | None = None, |
2106 | 2124 | model_version_description: str | None = None, |
| 2125 | + psc_interface_config: PscInterfaceConfig | None = None, |
2107 | 2126 | ) -> CustomPythonPackageTrainingJob: |
2108 | 2127 | """ |
2109 | 2128 | Create and submit a Custom Python Package Training Job pipeline, then exit without waiting for it to complete. |
@@ -2363,6 +2382,8 @@ def submit_custom_python_package_training_job( |
2363 | 2382 | ``projects/{project}/locations/{location}/tensorboards/{tensorboard}`` |
2364 | 2383 | For more information on configuring your service account please visit: |
2365 | 2384 | https://cloud.google.com/vertex-ai/docs/experiments/tensorboard-training |
| 2385 | + :param psc_interface_config: Optional. Configuration for Private Service Connect interface used for |
| 2386 | + training. |
2366 | 2387 | """ |
2367 | 2388 | self._job = self.get_custom_python_package_training_job( |
2368 | 2389 | project=project_id, |
@@ -2422,6 +2443,7 @@ def submit_custom_python_package_training_job( |
2422 | 2443 | model_version_aliases=model_version_aliases, |
2423 | 2444 | model_version_description=model_version_description, |
2424 | 2445 | sync=False, |
| 2446 | + psc_interface_config=psc_interface_config, |
2425 | 2447 | ) |
2426 | 2448 |
|
2427 | 2449 | return self._job |
@@ -2484,6 +2506,7 @@ def submit_custom_training_job( |
2484 | 2506 | predefined_split_column_name: str | None = None, |
2485 | 2507 | timestamp_split_column_name: str | None = None, |
2486 | 2508 | tensorboard: str | None = None, |
| 2509 | + psc_interface_config: PscInterfaceConfig | None = None, |
2487 | 2510 | ) -> CustomTrainingJob: |
2488 | 2511 | """ |
2489 | 2512 | Create and submit a Custom Training Job pipeline, then exit without waiting for it to complete. |
@@ -2747,6 +2770,8 @@ def submit_custom_training_job( |
2747 | 2770 | ``projects/{project}/locations/{location}/tensorboards/{tensorboard}`` |
2748 | 2771 | For more information on configuring your service account please visit: |
2749 | 2772 | https://cloud.google.com/vertex-ai/docs/experiments/tensorboard-training |
| 2773 | + :param psc_interface_config: Optional. Configuration for Private Service Connect interface used for |
| 2774 | + training. |
2750 | 2775 | """ |
2751 | 2776 | self._job = self.get_custom_training_job( |
2752 | 2777 | project=project_id, |
@@ -2806,6 +2831,7 @@ def submit_custom_training_job( |
2806 | 2831 | model_version_aliases=model_version_aliases, |
2807 | 2832 | model_version_description=model_version_description, |
2808 | 2833 | sync=False, |
| 2834 | + psc_interface_config=psc_interface_config, |
2809 | 2835 | ) |
2810 | 2836 | return self._job |
2811 | 2837 |
|
|
0 commit comments