@@ -1526,6 +1526,7 @@ def _prepare_training_task_inputs_and_output_dir( |
1526 | 1526 | worker_pool_specs: _DistributedTrainingSpec, |
1527 | 1527 | base_output_dir: Optional[str] = None, |
1528 | 1528 | service_account: Optional[str] = None, |
| 1529 | + network: Optional[str] = None, |
1529 | 1530 | ) -> Tuple[Dict, str]: |
1530 | 1531 | """Prepares training task inputs and output directory for custom job. |
1531 | 1532 |
|
@@ -1538,6 +1539,11 @@ def _prepare_training_task_inputs_and_output_dir( |
1538 | 1539 | service_account (str): |
1539 | 1540 | Specifies the service account for workload run-as account. |
1540 | 1541 | Users submitting jobs must have act-as permission on this run-as account. |
| 1542 | + network (str): |
| 1543 | + The full name of the Compute Engine network to which the job |
| 1544 | + should be peered. For example, projects/12345/global/networks/myVPC. |
| 1545 | + Private services access must already be configured for the network. |
| 1546 | + If left unspecified, the job is not peered with any network. |
1541 | 1547 | Returns: |
1542 | 1548 | Training task inputs and Output directory for custom job. |
1543 | 1549 | """ |
@@ -1556,6 +1562,8 @@ def _prepare_training_task_inputs_and_output_dir( |
1556 | 1562 |
|
1557 | 1563 | if service_account: |
1558 | 1564 | training_task_inputs["serviceAccount"] = service_account |
| 1565 | + if network: |
| 1566 | + training_task_inputs["network"] = network |
1559 | 1567 |
|
1560 | 1568 | return training_task_inputs, base_output_dir |
1561 | 1569 |
|
@@ -1803,6 +1811,7 @@ def run( |
1803 | 1811 | model_display_name: Optional[str] = None, |
1804 | 1812 | base_output_dir: Optional[str] = None, |
1805 | 1813 | service_account: Optional[str] = None, |
| 1814 | + network: Optional[str] = None, |
1806 | 1815 | bigquery_destination: Optional[str] = None, |
1807 | 1816 | args: Optional[List[Union[str, float, int]]] = None, |
1808 | 1817 | environment_variables: Optional[Dict[str, str]] = None, |
@@ -1891,6 +1900,11 @@ def run( |
1891 | 1900 | service_account (str): |
1892 | 1901 | Specifies the service account for workload run-as account. |
1893 | 1902 | Users submitting jobs must have act-as permission on this run-as account. |
| 1903 | + network (str): |
| 1904 | + The full name of the Compute Engine network to which the job |
| 1905 | + should be peered. For example, projects/12345/global/networks/myVPC. |
| 1906 | + Private services access must already be configured for the network. |
| 1907 | + If left unspecified, the job is not peered with any network. |
1894 | 1908 | bigquery_destination (str): |
1895 | 1909 | Provide this field if `dataset` is a BiqQuery dataset. |
1896 | 1910 | The BigQuery project location where the training data is to |
@@ -1981,6 +1995,7 @@ def run( |
1981 | 1995 | environment_variables=environment_variables, |
1982 | 1996 | base_output_dir=base_output_dir, |
1983 | 1997 | service_account=service_account, |
| 1998 | + network=network, |
1984 | 1999 | bigquery_destination=bigquery_destination, |
1985 | 2000 | training_fraction_split=training_fraction_split, |
1986 | 2001 | validation_fraction_split=validation_fraction_split, |
@@ -2008,6 +2023,7 @@ def _run( |
2008 | 2023 | environment_variables: Optional[Dict[str, str]] = None, |
2009 | 2024 | base_output_dir: Optional[str] = None, |
2010 | 2025 | service_account: Optional[str] = None, |
| 2026 | + network: Optional[str] = None, |
2011 | 2027 | bigquery_destination: Optional[str] = None, |
2012 | 2028 | training_fraction_split: float = 0.8, |
2013 | 2029 | validation_fraction_split: float = 0.1, |
@@ -2061,6 +2077,11 @@ def _run( |
2061 | 2077 | service_account (str): |
2062 | 2078 | Specifies the service account for workload run-as account. |
2063 | 2079 | Users submitting jobs must have act-as permission on this run-as account. |
| 2080 | + network (str): |
| 2081 | + The full name of the Compute Engine network to which the job |
| 2082 | + should be peered. For example, projects/12345/global/networks/myVPC. |
| 2083 | + Private services access must already be configured for the network. |
| 2084 | + If left unspecified, the job is not peered with any network. |
2064 | 2085 | bigquery_destination (str): |
2065 | 2086 | Provide this field if `dataset` is a BiqQuery dataset. |
2066 | 2087 | The BigQuery project location where the training data is to |
@@ -2130,7 +2151,10 @@ def _run( |
2130 | 2151 | training_task_inputs, |
2131 | 2152 | base_output_dir, |
2132 | 2153 | ) = self._prepare_training_task_inputs_and_output_dir( |
2133 | | - worker_pool_specs, base_output_dir, service_account |
| 2154 | + worker_pool_specs=worker_pool_specs, |
| 2155 | + base_output_dir=base_output_dir, |
| 2156 | + service_account=service_account, |
| 2157 | + network=network, |
2134 | 2158 | ) |
2135 | 2159 |
|
2136 | 2160 | model = self._run_job( |
@@ -2375,6 +2399,7 @@ def run( |
2375 | 2399 | model_display_name: Optional[str] = None, |
2376 | 2400 | base_output_dir: Optional[str] = None, |
2377 | 2401 | service_account: Optional[str] = None, |
| 2402 | + network: Optional[str] = None, |
2378 | 2403 | bigquery_destination: Optional[str] = None, |
2379 | 2404 | args: Optional[List[Union[str, float, int]]] = None, |
2380 | 2405 | environment_variables: Optional[Dict[str, str]] = None, |
@@ -2456,6 +2481,11 @@ def run( |
2456 | 2481 | service_account (str): |
2457 | 2482 | Specifies the service account for workload run-as account. |
2458 | 2483 | Users submitting jobs must have act-as permission on this run-as account. |
| 2484 | + network (str): |
| 2485 | + The full name of the Compute Engine network to which the job |
| 2486 | + should be peered. For example, projects/12345/global/networks/myVPC. |
| 2487 | + Private services access must already be configured for the network. |
| 2488 | + If left unspecified, the job is not peered with any network. |
2459 | 2489 | bigquery_destination (str): |
2460 | 2490 | Provide this field if `dataset` is a BiqQuery dataset. |
2461 | 2491 | The BigQuery project location where the training data is to |
@@ -2545,6 +2575,7 @@ def run( |
2545 | 2575 | environment_variables=environment_variables, |
2546 | 2576 | base_output_dir=base_output_dir, |
2547 | 2577 | service_account=service_account, |
| 2578 | + network=network, |
2548 | 2579 | bigquery_destination=bigquery_destination, |
2549 | 2580 | training_fraction_split=training_fraction_split, |
2550 | 2581 | validation_fraction_split=validation_fraction_split, |
@@ -2571,6 +2602,7 @@ def _run( |
2571 | 2602 | environment_variables: Optional[Dict[str, str]] = None, |
2572 | 2603 | base_output_dir: Optional[str] = None, |
2573 | 2604 | service_account: Optional[str] = None, |
| 2605 | + network: Optional[str] = None, |
2574 | 2606 | bigquery_destination: Optional[str] = None, |
2575 | 2607 | training_fraction_split: float = 0.8, |
2576 | 2608 | validation_fraction_split: float = 0.1, |
@@ -2621,6 +2653,11 @@ def _run( |
2621 | 2653 | service_account (str): |
2622 | 2654 | Specifies the service account for workload run-as account. |
2623 | 2655 | Users submitting jobs must have act-as permission on this run-as account. |
| 2656 | + network (str): |
| 2657 | + The full name of the Compute Engine network to which the job |
| 2658 | + should be peered. For example, projects/12345/global/networks/myVPC. |
| 2659 | + Private services access must already be configured for the network. |
| 2660 | + If left unspecified, the job is not peered with any network. |
2624 | 2661 | bigquery_destination (str): |
2625 | 2662 | The BigQuery project location where the training data is to |
2626 | 2663 | be written to. In the given project a new dataset is created |
@@ -2683,7 +2720,10 @@ def _run( |
2683 | 2720 | training_task_inputs, |
2684 | 2721 | base_output_dir, |
2685 | 2722 | ) = self._prepare_training_task_inputs_and_output_dir( |
2686 | | - worker_pool_specs, base_output_dir, service_account |
| 2723 | + worker_pool_specs=worker_pool_specs, |
| 2724 | + base_output_dir=base_output_dir, |
| 2725 | + service_account=service_account, |
| 2726 | + network=network, |
2687 | 2727 | ) |
2688 | 2728 |
|
2689 | 2729 | model = self._run_job( |
@@ -3709,6 +3749,7 @@ def run( |
3709 | 3749 | model_display_name: Optional[str] = None, |
3710 | 3750 | base_output_dir: Optional[str] = None, |
3711 | 3751 | service_account: Optional[str] = None, |
| 3752 | + network: Optional[str] = None, |
3712 | 3753 | bigquery_destination: Optional[str] = None, |
3713 | 3754 | args: Optional[List[Union[str, float, int]]] = None, |
3714 | 3755 | environment_variables: Optional[Dict[str, str]] = None, |
@@ -3790,6 +3831,11 @@ def run( |
3790 | 3831 | service_account (str): |
3791 | 3832 | Specifies the service account for workload run-as account. |
3792 | 3833 | Users submitting jobs must have act-as permission on this run-as account. |
| 3834 | + network (str): |
| 3835 | + The full name of the Compute Engine network to which the job |
| 3836 | + should be peered. For example, projects/12345/global/networks/myVPC. |
| 3837 | + Private services access must already be configured for the network. |
| 3838 | + If left unspecified, the job is not peered with any network. |
3793 | 3839 | bigquery_destination (str): |
3794 | 3840 | Provide this field if `dataset` is a BiqQuery dataset. |
3795 | 3841 | The BigQuery project location where the training data is to |
@@ -3874,6 +3920,7 @@ def run( |
3874 | 3920 | environment_variables=environment_variables, |
3875 | 3921 | base_output_dir=base_output_dir, |
3876 | 3922 | service_account=service_account, |
| 3923 | + network=network, |
3877 | 3924 | training_fraction_split=training_fraction_split, |
3878 | 3925 | validation_fraction_split=validation_fraction_split, |
3879 | 3926 | test_fraction_split=test_fraction_split, |
@@ -3900,6 +3947,7 @@ def _run( |
3900 | 3947 | environment_variables: Optional[Dict[str, str]] = None, |
3901 | 3948 | base_output_dir: Optional[str] = None, |
3902 | 3949 | service_account: Optional[str] = None, |
| 3950 | + network: Optional[str] = None, |
3903 | 3951 | training_fraction_split: float = 0.8, |
3904 | 3952 | validation_fraction_split: float = 0.1, |
3905 | 3953 | test_fraction_split: float = 0.1, |
@@ -3951,6 +3999,11 @@ def _run( |
3951 | 3999 | service_account (str): |
3952 | 4000 | Specifies the service account for workload run-as account. |
3953 | 4001 | Users submitting jobs must have act-as permission on this run-as account. |
| 4002 | + network (str): |
| 4003 | + The full name of the Compute Engine network to which the job |
| 4004 | + should be peered. For example, projects/12345/global/networks/myVPC. |
| 4005 | + Private services access must already be configured for the network. |
| 4006 | + If left unspecified, the job is not peered with any network. |
3954 | 4007 | training_fraction_split (float): |
3955 | 4008 | The fraction of the input data that is to be |
3956 | 4009 | used to train the Model. |
@@ -3999,7 +4052,10 @@ def _run( |
3999 | 4052 | training_task_inputs, |
4000 | 4053 | base_output_dir, |
4001 | 4054 | ) = self._prepare_training_task_inputs_and_output_dir( |
4002 | | - worker_pool_specs, base_output_dir, service_account |
| 4055 | + worker_pool_specs=worker_pool_specs, |
| 4056 | + base_output_dir=base_output_dir, |
| 4057 | + service_account=service_account, |
| 4058 | + network=network, |
4003 | 4059 | ) |
4004 | 4060 |
|
4005 | 4061 | model = self._run_job( |
|