@@ -50,6 +50,10 @@ def runtime_env_manager():
50
50
return mocked_runtime_env_manager
51
51
52
52
53
+ def custom_file_filter ():
54
+ pass
55
+
56
+
53
57
@pytest .fixture
54
58
def remote_decorator_config (sagemaker_session ):
55
59
return Mock (
@@ -73,6 +77,24 @@ def config_uploader(remote_decorator_config, runtime_env_manager):
73
77
return ConfigUploader (remote_decorator_config , runtime_env_manager )
74
78
75
79
80
+ @pytest .fixture
81
+ def remote_decorator_config_with_filter (sagemaker_session ):
82
+ return Mock (
83
+ _JobSettings ,
84
+ sagemaker_session = sagemaker_session ,
85
+ s3_root_uri = "some_s3_uri" ,
86
+ s3_kms_key = "some_kms" ,
87
+ spark_config = SparkConfig (),
88
+ dependencies = None ,
89
+ include_local_workdir = True ,
90
+ pre_execution_commands = "some_commands" ,
91
+ pre_execution_script = "some_path" ,
92
+ python_sdk_whl_s3_uri = SAGEMAKER_WHL_FILE_S3_PATH ,
93
+ environment_variables = {"REMOTE_FUNCTION_SECRET_KEY" : "some_secret_key" },
94
+ custom_file_filter = custom_file_filter ,
95
+ )
96
+
97
+
76
98
@patch ("sagemaker.feature_store.feature_processor._config_uploader.StoredFunction" )
77
99
def test_prepare_and_upload_callable (mock_stored_function , config_uploader , wrapped_func ):
78
100
mock_stored_function .save (wrapped_func ).return_value = None
@@ -113,6 +135,41 @@ def test_prepare_and_upload_dependencies(mock_upload, config_uploader):
113
135
)
114
136
115
137
138
+ @patch (
139
+ "sagemaker.feature_store.feature_processor._config_uploader._prepare_and_upload_dependencies" ,
140
+ return_value = "some_s3_uri" ,
141
+ )
142
+ def test_prepare_and_upload_dependencies_with_filter (
143
+ mock_job_upload , remote_decorator_config_with_filter , runtime_env_manager
144
+ ):
145
+ config_uploader_with_filter = ConfigUploader (
146
+ remote_decorator_config = remote_decorator_config_with_filter ,
147
+ runtime_env_manager = runtime_env_manager ,
148
+ )
149
+ remote_decorator_config = config_uploader_with_filter .remote_decorator_config
150
+ config_uploader_with_filter ._prepare_and_upload_dependencies (
151
+ local_dependencies_path = "some/path/to/dependency" ,
152
+ include_local_workdir = True ,
153
+ pre_execution_commands = remote_decorator_config .pre_execution_commands ,
154
+ pre_execution_script_local_path = remote_decorator_config .pre_execution_script ,
155
+ s3_base_uri = remote_decorator_config .s3_root_uri ,
156
+ s3_kms_key = remote_decorator_config .s3_kms_key ,
157
+ sagemaker_session = sagemaker_session ,
158
+ custom_file_filter = remote_decorator_config_with_filter .custom_file_filter ,
159
+ )
160
+
161
+ mock_job_upload .assert_called_once_with (
162
+ local_dependencies_path = "some/path/to/dependency" ,
163
+ include_local_workdir = True ,
164
+ pre_execution_commands = remote_decorator_config .pre_execution_commands ,
165
+ pre_execution_script_local_path = remote_decorator_config .pre_execution_script ,
166
+ s3_base_uri = remote_decorator_config .s3_root_uri ,
167
+ s3_kms_key = remote_decorator_config .s3_kms_key ,
168
+ sagemaker_session = sagemaker_session ,
169
+ custom_file_filter = custom_file_filter ,
170
+ )
171
+
172
+
116
173
@patch (
117
174
"sagemaker.feature_store.feature_processor._config_uploader._prepare_and_upload_runtime_scripts" ,
118
175
return_value = "some_s3_uri" ,
0 commit comments