@@ -44,7 +44,13 @@ class AmazonAlgorithmEstimatorBase(EstimatorBase):
44
44
repo_version = None
45
45
46
46
def __init__ (
47
- self , role , train_instance_count , train_instance_type , data_location = None , ** kwargs
47
+ self ,
48
+ role ,
49
+ train_instance_count ,
50
+ train_instance_type ,
51
+ data_location = None ,
52
+ enable_network_isolation = False ,
53
+ ** kwargs
48
54
):
49
55
"""Initialize an AmazonAlgorithmEstimatorBase.
50
56
@@ -63,6 +69,10 @@ def __init__(
63
69
"s3://example-bucket/some-key-prefix/". Objects will be saved in
64
70
a unique sub-directory of the specified location. If None, a
65
71
default data location will be used.
72
+ enable_network_isolation (bool): Specifies whether container will
73
+ run in network isolation mode. Network isolation mode restricts
74
+ the container access to outside networks (such as the internet).
75
+ Also known as internet-free mode (default: ``False``).
66
76
**kwargs: Additional parameters passed to
67
77
:class:`~sagemaker.estimator.EstimatorBase`.
68
78
@@ -71,14 +81,6 @@ def __init__(
71
81
You can find additional parameters for initializing this class at
72
82
:class:`~sagemaker.estimator.EstimatorBase`.
73
83
"""
74
-
75
- if "enable_network_isolation" in kwargs :
76
- logger .debug (
77
- "removing unused enable_network_isolation argument: %s" ,
78
- str (kwargs ["enable_network_isolation" ]),
79
- )
80
- del kwargs ["enable_network_isolation" ]
81
-
82
84
super (AmazonAlgorithmEstimatorBase , self ).__init__ (
83
85
role , train_instance_count , train_instance_type , ** kwargs
84
86
)
@@ -87,6 +89,7 @@ def __init__(
87
89
self .sagemaker_session .default_bucket ()
88
90
)
89
91
self ._data_location = data_location
92
+ self ._enable_network_isolation = enable_network_isolation
90
93
91
94
def train_image (self ):
92
95
"""Placeholder docstring"""
@@ -98,6 +101,14 @@ def hyperparameters(self):
98
101
"""Placeholder docstring"""
99
102
return hp .serialize_all (self )
100
103
104
+ def enable_network_isolation (self ):
105
+ """If this Estimator can use network isolation when running.
106
+
107
+ Returns:
108
+ bool: Whether this Estimator can use network isolation or not.
109
+ """
110
+ return self ._enable_network_isolation
111
+
101
112
@property
102
113
def data_location (self ):
103
114
"""Placeholder docstring"""
0 commit comments