@@ -905,6 +905,7 @@ def __init__(
905
905
train_max_wait = None ,
906
906
checkpoint_s3_uri = None ,
907
907
checkpoint_local_path = None ,
908
+ enable_network_isolation = False ,
908
909
):
909
910
"""Initialize an ``Estimator`` instance.
910
911
@@ -1008,9 +1009,18 @@ def __init__(
1008
1009
started. If the path is unset then SageMaker assumes the
1009
1010
checkpoints will be provided under `/opt/ml/checkpoints/`.
1010
1011
(default: ``None``).
1012
+ enable_network_isolation (bool): Specifies whether container will
1013
+ run in network isolation mode. Network isolation mode restricts
1014
+ the container access to outside networks (such as the Internet).
1015
+ The container does not make any inbound or outbound network
1016
+ calls. If ``True``, a channel named "code" will be created for any
1017
+ user entry script for training. The user entry script, files in
1018
+ source_dir (if specified), and dependencies will be uploaded in
1019
+ a tar to S3. Also known as internet-free mode (default: ``False``).
1011
1020
"""
1012
1021
self .image_name = image_name
1013
1022
self .hyperparam_dict = hyperparameters .copy () if hyperparameters else {}
1023
+ self ._enable_network_isolation = enable_network_isolation
1014
1024
super (Estimator , self ).__init__ (
1015
1025
role ,
1016
1026
train_instance_count ,
@@ -1036,6 +1046,14 @@ def __init__(
1036
1046
checkpoint_local_path = checkpoint_local_path ,
1037
1047
)
1038
1048
1049
+ def enable_network_isolation (self ):
1050
+ """If this Estimator can use network isolation when running.
1051
+
1052
+ Returns:
1053
+ bool: Whether this Estimator can use network isolation or not.
1054
+ """
1055
+ return self ._enable_network_isolation
1056
+
1039
1057
def train_image (self ):
1040
1058
"""Returns the docker image to use for training.
1041
1059
0 commit comments