sagemaker-mlflow 0.2.0.dev1__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. {sagemaker_mlflow-0.2.0.dev1/sagemaker_mlflow.egg-info → sagemaker_mlflow-0.3.0}/PKG-INFO +5 -2
  2. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/README.md +4 -1
  3. sagemaker_mlflow-0.3.0/VERSION +1 -0
  4. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow/auth.py +1 -1
  5. sagemaker_mlflow-0.2.0.dev1/sagemaker_mlflow/mlflow_sagemaker_store.py → sagemaker_mlflow-0.3.0/sagemaker_mlflow/host_creds.py +9 -14
  6. sagemaker_mlflow-0.3.0/sagemaker_mlflow/mlflow_sagemaker_registry_store.py +27 -0
  7. sagemaker_mlflow-0.3.0/sagemaker_mlflow/mlflow_sagemaker_scorer_store.py +28 -0
  8. sagemaker_mlflow-0.3.0/sagemaker_mlflow/mlflow_sagemaker_store.py +26 -0
  9. sagemaker_mlflow-0.3.0/sagemaker_mlflow/mlflow_sagemaker_workspace_store.py +24 -0
  10. sagemaker_mlflow-0.3.0/sagemaker_mlflow/s3_presigned_artifact_repo.py +186 -0
  11. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0/sagemaker_mlflow.egg-info}/PKG-INFO +5 -2
  12. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow.egg-info/SOURCES.txt +4 -0
  13. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow.egg-info/entry_points.txt +9 -0
  14. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/setup.py +8 -0
  15. sagemaker_mlflow-0.2.0.dev1/VERSION +0 -1
  16. sagemaker_mlflow-0.2.0.dev1/sagemaker_mlflow/mlflow_sagemaker_registry_store.py +0 -50
  17. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/LICENSE +0 -0
  18. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/MANIFEST.in +0 -0
  19. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/NOTICE +0 -0
  20. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/pyproject.toml +0 -0
  21. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/requirements/black_requirements.txt +0 -0
  22. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/requirements/flake8_requirements.txt +0 -0
  23. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/requirements/integration_test_requirements.txt +0 -0
  24. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/requirements/mypy_requirements.txt +0 -0
  25. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/requirements/prerelease_test_requirements.txt +0 -0
  26. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/requirements/twine_requirements.txt +0 -0
  27. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow/__init__.py +0 -0
  28. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow/auth_provider.py +0 -0
  29. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow/credential_cache.py +0 -0
  30. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow/exceptions.py +0 -0
  31. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow/mlflow_sagemaker_helpers.py +0 -0
  32. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow/mlflow_sagemaker_request_header_provider.py +0 -0
  33. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow/presigned_url.py +0 -0
  34. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow.egg-info/dependency_links.txt +0 -0
  35. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow.egg-info/requires.txt +0 -0
  36. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/sagemaker_mlflow.egg-info/top_level.txt +0 -0
  37. {sagemaker_mlflow-0.2.0.dev1 → sagemaker_mlflow-0.3.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sagemaker-mlflow
3
- Version: 0.2.0.dev1
3
+ Version: 0.3.0
4
4
  Summary: AWS Plugin for MLflow with SageMaker
5
5
  Home-page: https://github.com/aws/sagemaker-mlflow
6
6
  Author: Amazon Web Services
@@ -119,6 +119,9 @@ tox --skip-env "black.*|flake8|typing|twine" -- test/integration
119
119
  ```
120
120
 
121
121
  #### Available test environments by default
122
- tox.ini contains support for py39, py310, py311, with mlflow 2.11.* and 2.12.*.
122
+ tox.ini contains support for:
123
+ - Python 3.9: mlflow 2.8.*, 2.9.*, 2.10.*, 2.11.*, 2.12.*, 2.13.*, 2.16.*, 3.0.0
124
+ - Python 3.10/3.11: mlflow 2.8.*, 2.9.*, 2.10.*, 2.11.*, 2.12.*, 2.13.*, 2.16.*, 3.0.0, 3.4.0, 3.10.0
125
+
123
126
  To add test environments on tox for additional versions of python or mlflow, modify the
124
127
  environment configs in `envlist`, as well as `deps` and `depends` in `[testenv]`.
@@ -68,6 +68,9 @@ tox --skip-env "black.*|flake8|typing|twine" -- test/integration
68
68
  ```
69
69
 
70
70
  #### Available test environments by default
71
- tox.ini contains support for py39, py310, py311, with mlflow 2.11.* and 2.12.*.
71
+ tox.ini contains support for:
72
+ - Python 3.9: mlflow 2.8.*, 2.9.*, 2.10.*, 2.11.*, 2.12.*, 2.13.*, 2.16.*, 3.0.0
73
+ - Python 3.10/3.11: mlflow 2.8.*, 2.9.*, 2.10.*, 2.11.*, 2.12.*, 2.13.*, 2.16.*, 3.0.0, 3.4.0, 3.10.0
74
+
72
75
  To add test environments on tox for additional versions of python or mlflow, modify the
73
76
  environment configs in `envlist`, as well as `deps` and `depends` in `[testenv]`.
@@ -0,0 +1 @@
1
+ 0.3.0
@@ -114,7 +114,7 @@ class AuthBoto(AuthBase):
114
114
 
115
115
  # Mlflow encodes spaces as +, Auth prefers %20
116
116
  if method == "GET" or method == "DELETE":
117
- url = url.replace("+", "%20")
117
+ url = (url or "").replace("+", "%20")
118
118
 
119
119
  # Creating a new request with the SigV4 signed headers.
120
120
  aws_request = AWSRequest(method=method, url=url, data=r.body, headers=headers)
@@ -11,14 +11,11 @@
11
11
  # ANY KIND, either express or implied. See the License for the specific
12
12
  # language governing permissions and limitations under the License.
13
13
 
14
- from mlflow.store.tracking.rest_store import RestStore
15
- from mlflow.utils import rest_utils
16
14
  import os
17
- from functools import partial
18
15
 
19
- from sagemaker_mlflow.mlflow_sagemaker_helpers import SageMakerMLflowHostMetadataProvider
16
+ from mlflow.utils import rest_utils
20
17
 
21
- host_metadata_provider = SageMakerMLflowHostMetadataProvider()
18
+ from sagemaker_mlflow.mlflow_sagemaker_helpers import SageMakerMLflowHostMetadataProvider
22
19
 
23
20
  # Extra environment variables which take precedence for setting the basic/bearer
24
21
  # auth on http requests.
@@ -35,17 +32,16 @@ _TRACKING_SERVER_CERT_PATH_ENV_VAR = "MLFLOW_TRACKING_SERVER_CERT_PATH"
35
32
  # see https://requests.readthedocs.io/en/master/api/
36
33
  _TRACKING_CLIENT_CERT_PATH_ENV_VAR = "MLFLOW_TRACKING_CLIENT_CERT_PATH"
37
34
 
38
-
39
- class MlflowSageMakerStore(RestStore):
40
- store_uri = ""
41
-
42
- def __init__(self, store_uri, artifact_uri):
43
- self.store_uri = store_uri
44
- super().__init__(partial(get_host_creds, store_uri))
35
+ host_metadata_provider = SageMakerMLflowHostMetadataProvider()
45
36
 
46
37
 
47
38
  def get_host_creds(store_uri) -> rest_utils.MlflowHostCreds:
48
- """Configuring mlflow's client"""
39
+ """Build MlflowHostCreds for a SageMaker MLflow endpoint.
40
+
41
+ Resolves the store URI (ARN) into a URL via SageMakerMLflowHostMetadataProvider,
42
+ then returns MlflowHostCreds with auth="arn" to trigger SigV4 signing
43
+ via the AuthProvider entry point.
44
+ """
49
45
  host_metadata_provider.set_arn(store_uri)
50
46
 
51
47
  return rest_utils.MlflowHostCreds(
@@ -54,7 +50,6 @@ def get_host_creds(store_uri) -> rest_utils.MlflowHostCreds:
54
50
  password=os.environ.get(_TRACKING_PASSWORD_ENV_VAR),
55
51
  token=os.environ.get(_TRACKING_TOKEN_ENV_VAR),
56
52
  auth="arn",
57
- # aws_sigv4="False", # Auth provider is used instead for now
58
53
  ignore_tls_verification=os.environ.get(_TRACKING_INSECURE_TLS_ENV_VAR) == "true",
59
54
  client_cert_path=os.environ.get(_TRACKING_CLIENT_CERT_PATH_ENV_VAR),
60
55
  server_cert_path=os.environ.get(_TRACKING_SERVER_CERT_PATH_ENV_VAR),
@@ -0,0 +1,27 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+
14
+ from functools import partial
15
+
16
+ from mlflow.store.model_registry.rest_store import RestStore
17
+
18
+ from sagemaker_mlflow.host_creds import get_host_creds
19
+
20
+
21
+ class MlflowSageMakerRegistryStore(RestStore):
22
+
23
+ store_uri = ""
24
+
25
+ def __init__(self, store_uri):
26
+ self.store_uri = store_uri
27
+ super().__init__(partial(get_host_creds, store_uri))
@@ -0,0 +1,28 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+
14
+ from mlflow.genai.scorers.registry import MlflowTrackingStore
15
+
16
+
17
+ class MlflowSageMakerScorerStore(MlflowTrackingStore):
18
+ """Scorer store that enables the ``arn`` URI scheme for SageMaker MLflow.
19
+
20
+ MlflowTrackingStore delegates all scorer operations to the tracking store
21
+ resolved by ``_get_store(tracking_uri)``, which already handles the ``arn``
22
+ scheme via the ``mlflow.tracking_store`` entrypoint (MlflowSageMakerStore).
23
+ This wrapper only exists so the ``mlflow.scorer_store`` entrypoint registry
24
+ recognises the ``arn`` scheme.
25
+ """
26
+
27
+ def __init__(self, tracking_uri=None):
28
+ super().__init__(tracking_uri)
@@ -0,0 +1,26 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+
14
+ from functools import partial
15
+
16
+ from mlflow.store.tracking.rest_store import RestStore
17
+
18
+ from sagemaker_mlflow.host_creds import get_host_creds
19
+
20
+
21
+ class MlflowSageMakerStore(RestStore):
22
+ store_uri = ""
23
+
24
+ def __init__(self, store_uri, artifact_uri):
25
+ self.store_uri = store_uri
26
+ super().__init__(partial(get_host_creds, store_uri))
@@ -0,0 +1,24 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+
14
+ from functools import partial
15
+
16
+ from mlflow.store.workspace.rest_store import RestWorkspaceStore
17
+
18
+ from sagemaker_mlflow.host_creds import get_host_creds
19
+
20
+
21
+ class MlflowSageMakerWorkspaceStore(RestWorkspaceStore):
22
+
23
+ def __init__(self, workspace_uri):
24
+ super().__init__(partial(get_host_creds, workspace_uri))
@@ -0,0 +1,186 @@
1
+ # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License"). You
4
+ # may not use this file except in compliance with the License. A copy of
5
+ # the License is located at
6
+ #
7
+ # http://aws.amazon.com/apache2.0/
8
+ #
9
+ # or in the "license" file accompanying this file. This file is
10
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
+ # ANY KIND, either express or implied. See the License for the specific
12
+ # language governing permissions and limitations under the License.
13
+
14
+ import logging
15
+ import os
16
+ import posixpath
17
+ from typing import Optional
18
+ from urllib.parse import urlparse
19
+
20
+ from mlflow.store.artifact.s3_artifact_repo import S3ArtifactRepository
21
+ from mlflow.utils import rest_utils
22
+ from mlflow.utils.request_utils import cloud_storage_http_request
23
+
24
+ from sagemaker_mlflow.host_creds import get_host_creds as _get_host_creds
25
+
26
+ logger = logging.getLogger(__name__)
27
+
28
+ _SAGEMAKER_PRESIGNED_URL_UPLOAD_ENV_VAR = "SAGEMAKER_PRESIGNED_URL_UPLOAD_ENABLED"
29
+
30
+ _PRESIGNED_UPLOAD_ENDPOINT = "/api/2.0/mlflow/artifacts/presigned-upload-url"
31
+
32
+
33
+ class S3PresignedArtifactRepository(S3ArtifactRepository):
34
+ """S3 artifact repository with optional presigned URL upload support.
35
+
36
+ Extends S3ArtifactRepository to optionally upload artifacts via presigned URLs
37
+ obtained from the MLflow tracking server. This avoids the need for the client
38
+ to have direct S3 write credentials.
39
+
40
+ When the SAGEMAKER_PRESIGNED_URL_UPLOAD_ENABLED environment variable is set to
41
+ "true", all artifact uploads use presigned URLs. If the presigned upload fails
42
+ for any reason (server doesn't support the endpoint, network error, S3 PUT
43
+ failure), the exception propagates to the caller — there is no silent fallback
44
+ to direct S3.
45
+
46
+ When the environment variable is not set (the default), all behavior is
47
+ identical to the parent S3ArtifactRepository.
48
+ """
49
+
50
+ def __init__(self, *args, **kwargs):
51
+ super().__init__(*args, **kwargs)
52
+ self._use_presigned: bool = (
53
+ os.environ.get(_SAGEMAKER_PRESIGNED_URL_UPLOAD_ENV_VAR, "").lower() == "true"
54
+ )
55
+ self._run_id_warning_logged: bool = False
56
+
57
+ def _should_use_presigned(self) -> bool:
58
+ """Check whether presigned upload should be attempted for this call."""
59
+ return (
60
+ self._use_presigned
61
+ and self.tracking_uri is not None
62
+ and self._extract_run_id() is not None
63
+ )
64
+
65
+ def log_artifact(self, local_file: str, artifact_path: Optional[str] = None) -> None:
66
+ if self._should_use_presigned():
67
+ self._upload_via_presigned_url(local_file, artifact_path)
68
+ else:
69
+ super().log_artifact(local_file, artifact_path)
70
+
71
+ def log_artifacts(self, local_dir: str, artifact_path: Optional[str] = None) -> None:
72
+ if not self._should_use_presigned():
73
+ super().log_artifacts(local_dir, artifact_path)
74
+ return
75
+
76
+ local_dir = os.path.abspath(local_dir)
77
+ for root, _, filenames in os.walk(local_dir):
78
+ if root == local_dir:
79
+ rel_dir = ""
80
+ else:
81
+ rel_dir = os.path.relpath(root, local_dir)
82
+ for filename in filenames:
83
+ local_file = os.path.join(root, filename)
84
+ if artifact_path and rel_dir:
85
+ file_artifact_path = posixpath.join(artifact_path, rel_dir.replace(os.sep, "/"))
86
+ elif artifact_path:
87
+ file_artifact_path = artifact_path
88
+ elif rel_dir:
89
+ file_artifact_path = rel_dir.replace(os.sep, "/")
90
+ else:
91
+ file_artifact_path = None
92
+ self.log_artifact(local_file, file_artifact_path)
93
+
94
+ def _extract_run_id(self) -> Optional[str]:
95
+ """Extract run_id from artifact_uri using reverse scan for last 'artifacts' segment.
96
+
97
+ Pattern: s3://bucket/.../<run_id>/artifacts/...
98
+ Uses reverse scan because 'artifacts' may appear in the URI prefix path
99
+ (e.g., s3://bucket/ml-artifacts/<exp_id>/<run_id>/artifacts).
100
+ """
101
+ try:
102
+ parsed = urlparse(self.artifact_uri)
103
+ parts = parsed.path.strip("/").split("/")
104
+ for i in range(len(parts) - 1, 0, -1):
105
+ if parts[i] == "artifacts":
106
+ return parts[i - 1]
107
+ except Exception:
108
+ if self._use_presigned and not self._run_id_warning_logged:
109
+ self._run_id_warning_logged = True
110
+ logger.warning(
111
+ "Failed to parse run_id from artifact URI: %s",
112
+ self.artifact_uri, exc_info=True,
113
+ )
114
+ return None
115
+ if self._use_presigned and not self._run_id_warning_logged:
116
+ self._run_id_warning_logged = True
117
+ logger.warning(
118
+ "Could not extract run_id from artifact URI (no 'artifacts' segment): %s. "
119
+ "Presigned upload will not be used.",
120
+ self.artifact_uri,
121
+ )
122
+ return None
123
+
124
+ def _get_tracking_host_creds(self) -> rest_utils.MlflowHostCreds:
125
+ """Build MlflowHostCreds for the SageMaker tracking server."""
126
+ return _get_host_creds(self.tracking_uri)
127
+
128
+ def _build_upload_path(self, local_file: str, artifact_path: Optional[str]) -> str:
129
+ """Construct the relative path sent to the server as the 'path' parameter.
130
+
131
+ Must match how S3ArtifactRepository.log_artifact builds the S3 key:
132
+ artifact_path (if any) + basename of local_file.
133
+ """
134
+ filename = os.path.basename(local_file)
135
+ if artifact_path:
136
+ return posixpath.join(artifact_path, filename)
137
+ return filename
138
+
139
+ def _request_presigned_url(self, run_id: str, path: str, expiration: int = 900):
140
+ """Request a presigned upload URL from the tracking server (SigV4-authenticated)."""
141
+ host_creds = self._get_tracking_host_creds()
142
+ return rest_utils.http_request(
143
+ host_creds,
144
+ _PRESIGNED_UPLOAD_ENDPOINT,
145
+ "POST",
146
+ json={"run_id": run_id, "path": path, "expiration": expiration},
147
+ raise_on_status=False,
148
+ max_retries=0,
149
+ )
150
+
151
+ def _upload_via_presigned_url(self, local_file: str, artifact_path: Optional[str]) -> None:
152
+ """Upload a file via a presigned URL.
153
+
154
+ Two distinct HTTP paths:
155
+ 1. Tracking server API call (_request_presigned_url): SigV4-authenticated
156
+ via rest_utils.http_request.
157
+ 2. S3 presigned URL PUT: NO auth — authorization is embedded in the
158
+ presigned URL signature. Uses cloud_storage_http_request (same pattern
159
+ as presigned_url_artifact_repo.py and optimized_s3_artifact_repo.py).
160
+
161
+ Streams the file directly to avoid loading large artifacts into memory.
162
+ """
163
+ path = self._build_upload_path(local_file, artifact_path)
164
+ run_id = self._extract_run_id()
165
+
166
+ response = self._request_presigned_url(run_id, path)
167
+
168
+ if not response.ok:
169
+ raise Exception(
170
+ f"Presigned upload URL request failed (HTTP {response.status_code})"
171
+ )
172
+
173
+ response_json = response.json()
174
+ presigned_url = response_json.get("presigned_url")
175
+ headers = response_json.get("headers", {})
176
+
177
+ with open(local_file, "rb") as f:
178
+ put_response = cloud_storage_http_request(
179
+ "put",
180
+ presigned_url,
181
+ data=f,
182
+ headers=headers,
183
+ )
184
+ put_response.raise_for_status()
185
+
186
+ logger.debug("Artifact uploaded via presigned URL: %s", path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sagemaker-mlflow
3
- Version: 0.2.0.dev1
3
+ Version: 0.3.0
4
4
  Summary: AWS Plugin for MLflow with SageMaker
5
5
  Home-page: https://github.com/aws/sagemaker-mlflow
6
6
  Author: Amazon Web Services
@@ -119,6 +119,9 @@ tox --skip-env "black.*|flake8|typing|twine" -- test/integration
119
119
  ```
120
120
 
121
121
  #### Available test environments by default
122
- tox.ini contains support for py39, py310, py311, with mlflow 2.11.* and 2.12.*.
122
+ tox.ini contains support for:
123
+ - Python 3.9: mlflow 2.8.*, 2.9.*, 2.10.*, 2.11.*, 2.12.*, 2.13.*, 2.16.*, 3.0.0
124
+ - Python 3.10/3.11: mlflow 2.8.*, 2.9.*, 2.10.*, 2.11.*, 2.12.*, 2.13.*, 2.16.*, 3.0.0, 3.4.0, 3.10.0
125
+
123
126
  To add test environments on tox for additional versions of python or mlflow, modify the
124
127
  environment configs in `envlist`, as well as `deps` and `depends` in `[testenv]`.
@@ -17,11 +17,15 @@ sagemaker_mlflow/auth.py
17
17
  sagemaker_mlflow/auth_provider.py
18
18
  sagemaker_mlflow/credential_cache.py
19
19
  sagemaker_mlflow/exceptions.py
20
+ sagemaker_mlflow/host_creds.py
20
21
  sagemaker_mlflow/mlflow_sagemaker_helpers.py
21
22
  sagemaker_mlflow/mlflow_sagemaker_registry_store.py
22
23
  sagemaker_mlflow/mlflow_sagemaker_request_header_provider.py
24
+ sagemaker_mlflow/mlflow_sagemaker_scorer_store.py
23
25
  sagemaker_mlflow/mlflow_sagemaker_store.py
26
+ sagemaker_mlflow/mlflow_sagemaker_workspace_store.py
24
27
  sagemaker_mlflow/presigned_url.py
28
+ sagemaker_mlflow/s3_presigned_artifact_repo.py
25
29
  sagemaker_mlflow.egg-info/PKG-INFO
26
30
  sagemaker_mlflow.egg-info/SOURCES.txt
27
31
  sagemaker_mlflow.egg-info/dependency_links.txt
@@ -1,3 +1,6 @@
1
+ [mlflow.artifact_repository]
2
+ s3 = sagemaker_mlflow.s3_presigned_artifact_repo:S3PresignedArtifactRepository
3
+
1
4
  [mlflow.model_registry_store]
2
5
  arn = sagemaker_mlflow.mlflow_sagemaker_registry_store:MlflowSageMakerRegistryStore
3
6
 
@@ -7,5 +10,11 @@ arn = sagemaker_mlflow.auth_provider:AuthProvider
7
10
  [mlflow.request_header_provider]
8
11
  arn = sagemaker_mlflow.mlflow_sagemaker_request_header_provider:MlflowSageMakerRequestHeaderProvider
9
12
 
13
+ [mlflow.scorer_store]
14
+ arn = sagemaker_mlflow.mlflow_sagemaker_scorer_store:MlflowSageMakerScorerStore
15
+
10
16
  [mlflow.tracking_store]
11
17
  arn = sagemaker_mlflow.mlflow_sagemaker_store:MlflowSageMakerStore
18
+
19
+ [mlflow.workspace_provider]
20
+ arn = sagemaker_mlflow.mlflow_sagemaker_workspace_store:MlflowSageMakerWorkspaceStore
@@ -14,6 +14,7 @@
14
14
  """
15
15
  sagemaker-mlflow plugin installation.
16
16
  """
17
+
17
18
  import os
18
19
 
19
20
  from setuptools import setup, find_packages
@@ -82,6 +83,13 @@ setup(
82
83
  "mlflow.model_registry_store": (
83
84
  "arn=sagemaker_mlflow.mlflow_sagemaker_registry_store:" "MlflowSageMakerRegistryStore"
84
85
  ),
86
+ "mlflow.scorer_store": ("arn=sagemaker_mlflow.mlflow_sagemaker_scorer_store:MlflowSageMakerScorerStore"),
87
+ "mlflow.workspace_provider": (
88
+ "arn=sagemaker_mlflow.mlflow_sagemaker_workspace_store:MlflowSageMakerWorkspaceStore"
89
+ ),
90
+ "mlflow.artifact_repository": (
91
+ "s3=sagemaker_mlflow.s3_presigned_artifact_repo:S3PresignedArtifactRepository"
92
+ ),
85
93
  },
86
94
  version=read_version(),
87
95
  description="AWS Plugin for MLflow with SageMaker",
@@ -1 +0,0 @@
1
- 0.2.0.dev1
@@ -1,50 +0,0 @@
1
- from mlflow.store.model_registry.rest_store import RestStore
2
- from mlflow.utils import rest_utils
3
- from functools import partial
4
- import os
5
-
6
- from sagemaker_mlflow.mlflow_sagemaker_helpers import SageMakerMLflowHostMetadataProvider
7
-
8
- host_metadata_provider = SageMakerMLflowHostMetadataProvider()
9
-
10
-
11
- class MlflowSageMakerRegistryStore(RestStore):
12
-
13
- store_uri = ""
14
-
15
- def __init__(self, store_uri):
16
- self.store_uri = store_uri
17
- super().__init__(partial(get_host_creds, store_uri))
18
-
19
-
20
- # Extra environment variables which take precedence for setting the basic/bearer
21
- # auth on http requests.
22
- _TRACKING_USERNAME_ENV_VAR = "MLFLOW_TRACKING_USERNAME"
23
- _TRACKING_PASSWORD_ENV_VAR = "MLFLOW_TRACKING_PASSWORD"
24
- _TRACKING_TOKEN_ENV_VAR = "MLFLOW_TRACKING_TOKEN"
25
-
26
- # sets verify param of 'requests.request' function
27
- # see https://requests.readthedocs.io/en/master/api/
28
- _TRACKING_INSECURE_TLS_ENV_VAR = "MLFLOW_TRACKING_INSECURE_TLS"
29
- _TRACKING_SERVER_CERT_PATH_ENV_VAR = "MLFLOW_TRACKING_SERVER_CERT_PATH"
30
-
31
- # sets cert param of 'requests.request' function
32
- # see https://requests.readthedocs.io/en/master/api/
33
- _TRACKING_CLIENT_CERT_PATH_ENV_VAR = "MLFLOW_TRACKING_CLIENT_CERT_PATH"
34
-
35
-
36
- def get_host_creds(store_uri):
37
- """Configuring mlflow's client"""
38
- host_metadata_provider.set_arn(store_uri)
39
-
40
- return rest_utils.MlflowHostCreds(
41
- host=host_metadata_provider.construct_tracking_server_url(),
42
- username=os.environ.get(_TRACKING_USERNAME_ENV_VAR),
43
- password=os.environ.get(_TRACKING_PASSWORD_ENV_VAR),
44
- token=os.environ.get(_TRACKING_TOKEN_ENV_VAR),
45
- auth="arn",
46
- # aws_sigv4="False", # Auth provider is used instead for now
47
- ignore_tls_verification=os.environ.get(_TRACKING_INSECURE_TLS_ENV_VAR) == "true",
48
- client_cert_path=os.environ.get(_TRACKING_CLIENT_CERT_PATH_ENV_VAR),
49
- server_cert_path=os.environ.get(_TRACKING_SERVER_CERT_PATH_ENV_VAR),
50
- )