mlrun 1.7.0rc5__py3-none-any.whl → 1.7.0rc7__py3-none-any.whl
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.
Potentially problematic release.
This version of mlrun might be problematic. Click here for more details.
- mlrun/artifacts/base.py +2 -1
- mlrun/artifacts/plots.py +9 -5
- mlrun/common/constants.py +6 -0
- mlrun/common/schemas/__init__.py +2 -0
- mlrun/common/schemas/model_monitoring/__init__.py +4 -0
- mlrun/common/schemas/model_monitoring/constants.py +35 -18
- mlrun/common/schemas/project.py +1 -0
- mlrun/common/types.py +7 -1
- mlrun/config.py +19 -6
- mlrun/data_types/data_types.py +4 -0
- mlrun/datastore/alibaba_oss.py +130 -0
- mlrun/datastore/azure_blob.py +4 -5
- mlrun/datastore/base.py +22 -16
- mlrun/datastore/datastore.py +4 -0
- mlrun/datastore/google_cloud_storage.py +1 -1
- mlrun/datastore/sources.py +7 -7
- mlrun/db/base.py +14 -6
- mlrun/db/factory.py +1 -1
- mlrun/db/httpdb.py +61 -56
- mlrun/db/nopdb.py +3 -0
- mlrun/launcher/__init__.py +1 -1
- mlrun/launcher/base.py +1 -1
- mlrun/launcher/client.py +1 -1
- mlrun/launcher/factory.py +1 -1
- mlrun/launcher/local.py +1 -1
- mlrun/launcher/remote.py +1 -1
- mlrun/model.py +1 -0
- mlrun/model_monitoring/__init__.py +1 -1
- mlrun/model_monitoring/api.py +104 -301
- mlrun/model_monitoring/application.py +21 -21
- mlrun/model_monitoring/applications/histogram_data_drift.py +130 -40
- mlrun/model_monitoring/controller.py +26 -33
- mlrun/model_monitoring/db/__init__.py +16 -0
- mlrun/model_monitoring/{stores → db/stores}/__init__.py +43 -34
- mlrun/model_monitoring/db/stores/base/__init__.py +15 -0
- mlrun/model_monitoring/{stores/model_endpoint_store.py → db/stores/base/store.py} +47 -6
- mlrun/model_monitoring/db/stores/sqldb/__init__.py +13 -0
- mlrun/model_monitoring/db/stores/sqldb/models/__init__.py +49 -0
- mlrun/model_monitoring/{stores → db/stores/sqldb}/models/base.py +76 -3
- mlrun/model_monitoring/db/stores/sqldb/models/mysql.py +68 -0
- mlrun/model_monitoring/{stores → db/stores/sqldb}/models/sqlite.py +13 -1
- mlrun/model_monitoring/db/stores/sqldb/sql_store.py +662 -0
- mlrun/model_monitoring/db/stores/v3io_kv/__init__.py +13 -0
- mlrun/model_monitoring/{stores/kv_model_endpoint_store.py → db/stores/v3io_kv/kv_store.py} +134 -3
- mlrun/model_monitoring/features_drift_table.py +34 -22
- mlrun/model_monitoring/helpers.py +45 -6
- mlrun/model_monitoring/stream_processing.py +43 -9
- mlrun/model_monitoring/tracking_policy.py +7 -1
- mlrun/model_monitoring/writer.py +4 -36
- mlrun/projects/pipelines.py +13 -1
- mlrun/projects/project.py +279 -117
- mlrun/run.py +72 -74
- mlrun/runtimes/__init__.py +35 -0
- mlrun/runtimes/base.py +7 -1
- mlrun/runtimes/nuclio/api_gateway.py +188 -61
- mlrun/runtimes/nuclio/application/__init__.py +15 -0
- mlrun/runtimes/nuclio/application/application.py +283 -0
- mlrun/runtimes/nuclio/application/reverse_proxy.go +87 -0
- mlrun/runtimes/nuclio/function.py +53 -1
- mlrun/runtimes/nuclio/serving.py +28 -32
- mlrun/runtimes/pod.py +27 -1
- mlrun/serving/server.py +4 -6
- mlrun/serving/states.py +41 -33
- mlrun/utils/helpers.py +34 -0
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/METADATA +14 -5
- {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/RECORD +71 -64
- mlrun/model_monitoring/batch.py +0 -974
- mlrun/model_monitoring/stores/models/__init__.py +0 -27
- mlrun/model_monitoring/stores/models/mysql.py +0 -34
- mlrun/model_monitoring/stores/sql_model_endpoint_store.py +0 -382
- {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/LICENSE +0 -0
- {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/WHEEL +0 -0
- {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/entry_points.txt +0 -0
- {mlrun-1.7.0rc5.dist-info → mlrun-1.7.0rc7.dist-info}/top_level.txt +0 -0
mlrun/db/factory.py
CHANGED
mlrun/db/httpdb.py
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
14
15
|
import enum
|
|
15
16
|
import http
|
|
16
17
|
import re
|
|
@@ -30,10 +31,12 @@ import semver
|
|
|
30
31
|
|
|
31
32
|
import mlrun
|
|
32
33
|
import mlrun.common.schemas
|
|
34
|
+
import mlrun.common.types
|
|
33
35
|
import mlrun.model_monitoring.model_endpoint
|
|
34
36
|
import mlrun.platforms
|
|
35
37
|
import mlrun.projects
|
|
36
38
|
import mlrun.runtimes.nuclio.api_gateway
|
|
39
|
+
import mlrun.utils
|
|
37
40
|
from mlrun.errors import MLRunInvalidArgumentError, err_to_str
|
|
38
41
|
|
|
39
42
|
from ..artifacts import Artifact
|
|
@@ -180,7 +183,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
180
183
|
headers=None,
|
|
181
184
|
timeout=45,
|
|
182
185
|
version=None,
|
|
183
|
-
):
|
|
186
|
+
) -> requests.Response:
|
|
184
187
|
"""Perform a direct REST API call on the :py:mod:`mlrun` API server.
|
|
185
188
|
|
|
186
189
|
Caution:
|
|
@@ -198,7 +201,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
198
201
|
:param version: API version to use, None (the default) will mean to use the default value from config,
|
|
199
202
|
for un-versioned api set an empty string.
|
|
200
203
|
|
|
201
|
-
:return:
|
|
204
|
+
:return: `requests.Response` HTTP response object
|
|
202
205
|
"""
|
|
203
206
|
url = self.get_base_api_url(path, version)
|
|
204
207
|
kw = {
|
|
@@ -1616,19 +1619,21 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1616
1619
|
artifact_path=None,
|
|
1617
1620
|
ops=None,
|
|
1618
1621
|
cleanup_ttl=None,
|
|
1622
|
+
timeout=60,
|
|
1619
1623
|
):
|
|
1620
1624
|
"""Submit a KFP pipeline for execution.
|
|
1621
1625
|
|
|
1622
|
-
:param project:
|
|
1623
|
-
:param pipeline:
|
|
1624
|
-
:param arguments:
|
|
1625
|
-
:param experiment:
|
|
1626
|
-
:param run:
|
|
1627
|
-
:param namespace:
|
|
1628
|
-
:param artifact_path:
|
|
1629
|
-
:param ops:
|
|
1630
|
-
:param cleanup_ttl:
|
|
1631
|
-
|
|
1626
|
+
:param project: The project of the pipeline
|
|
1627
|
+
:param pipeline: Pipeline function or path to .yaml/.zip pipeline file.
|
|
1628
|
+
:param arguments: A dictionary of arguments to pass to the pipeline.
|
|
1629
|
+
:param experiment: A name to assign for the specific experiment.
|
|
1630
|
+
:param run: A name for this specific run.
|
|
1631
|
+
:param namespace: Kubernetes namespace to execute the pipeline in.
|
|
1632
|
+
:param artifact_path: A path to artifacts used by this pipeline.
|
|
1633
|
+
:param ops: Transformers to apply on all ops in the pipeline.
|
|
1634
|
+
:param cleanup_ttl: Pipeline cleanup ttl in secs (time to wait after workflow completion, at which point the
|
|
1635
|
+
workflow and all its resources are deleted)
|
|
1636
|
+
:param timeout: Timeout for the API call.
|
|
1632
1637
|
"""
|
|
1633
1638
|
|
|
1634
1639
|
if isinstance(pipeline, str):
|
|
@@ -1670,7 +1675,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
1670
1675
|
"POST",
|
|
1671
1676
|
f"projects/{project}/pipelines",
|
|
1672
1677
|
params=params,
|
|
1673
|
-
timeout=
|
|
1678
|
+
timeout=timeout,
|
|
1674
1679
|
body=data,
|
|
1675
1680
|
headers=headers,
|
|
1676
1681
|
)
|
|
@@ -3050,35 +3055,6 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3050
3055
|
params=attributes,
|
|
3051
3056
|
)
|
|
3052
3057
|
|
|
3053
|
-
def deploy_monitoring_batch_job(
|
|
3054
|
-
self,
|
|
3055
|
-
project: str = "",
|
|
3056
|
-
default_batch_image: str = "mlrun/mlrun",
|
|
3057
|
-
with_schedule: bool = False,
|
|
3058
|
-
):
|
|
3059
|
-
"""
|
|
3060
|
-
Submit model monitoring batch job. By default, submit only the batch job as ML function without scheduling.
|
|
3061
|
-
To submit a scheduled job as well, please set with_schedule = True.
|
|
3062
|
-
|
|
3063
|
-
:param project: Project name.
|
|
3064
|
-
:param default_batch_image: The default image of the model monitoring batch job. By default, the image
|
|
3065
|
-
is mlrun/mlrun.
|
|
3066
|
-
:param with_schedule: If true, submit the model monitoring scheduled job as well.
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
:returns: model monitoring batch job as a dictionary. You can easily convert the returned function into a
|
|
3070
|
-
runtime object by calling ~mlrun.new_function.
|
|
3071
|
-
"""
|
|
3072
|
-
|
|
3073
|
-
params = {
|
|
3074
|
-
"default_batch_image": default_batch_image,
|
|
3075
|
-
"with_schedule": with_schedule,
|
|
3076
|
-
}
|
|
3077
|
-
path = f"projects/{project}/jobs/batch-monitoring"
|
|
3078
|
-
|
|
3079
|
-
resp = self.api_call(method="POST", path=path, params=params)
|
|
3080
|
-
return resp.json()["func"]
|
|
3081
|
-
|
|
3082
3058
|
def update_model_monitoring_controller(
|
|
3083
3059
|
self,
|
|
3084
3060
|
project: str,
|
|
@@ -3107,7 +3083,8 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3107
3083
|
project: str,
|
|
3108
3084
|
base_period: int = 10,
|
|
3109
3085
|
image: str = "mlrun/mlrun",
|
|
3110
|
-
|
|
3086
|
+
deploy_histogram_data_drift_app: bool = True,
|
|
3087
|
+
) -> None:
|
|
3111
3088
|
"""
|
|
3112
3089
|
Deploy model monitoring application controller, writer and stream functions.
|
|
3113
3090
|
While the main goal of the controller function is to handle the monitoring processing and triggering
|
|
@@ -3116,21 +3093,38 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3116
3093
|
The stream function goal is to monitor the log of the data stream. It is triggered when a new log entry
|
|
3117
3094
|
is detected. It processes the new events into statistics that are then written to statistics databases.
|
|
3118
3095
|
|
|
3096
|
+
:param project: Project name.
|
|
3097
|
+
:param base_period: The time period in minutes in which the model monitoring controller function
|
|
3098
|
+
triggers. By default, the base period is 10 minutes.
|
|
3099
|
+
:param image: The image of the model monitoring controller, writer & monitoring
|
|
3100
|
+
stream functions, which are real time nuclio functions.
|
|
3101
|
+
By default, the image is mlrun/mlrun.
|
|
3102
|
+
:param deploy_histogram_data_drift_app: If true, deploy the default histogram-based data drift application.
|
|
3103
|
+
"""
|
|
3104
|
+
self.api_call(
|
|
3105
|
+
method=mlrun.common.types.HTTPMethod.POST,
|
|
3106
|
+
path=f"projects/{project}/model-monitoring/enable-model-monitoring",
|
|
3107
|
+
params={
|
|
3108
|
+
"base_period": base_period,
|
|
3109
|
+
"image": image,
|
|
3110
|
+
"deploy_histogram_data_drift_app": deploy_histogram_data_drift_app,
|
|
3111
|
+
},
|
|
3112
|
+
)
|
|
3119
3113
|
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
:param image: The image of the model monitoring controller, writer & monitoring
|
|
3124
|
-
stream functions, which are real time nuclio functions.
|
|
3125
|
-
By default, the image is mlrun/mlrun.
|
|
3114
|
+
def deploy_histogram_data_drift_app(
|
|
3115
|
+
self, project: str, image: str = "mlrun/mlrun"
|
|
3116
|
+
) -> None:
|
|
3126
3117
|
"""
|
|
3118
|
+
Deploy the histogram data drift application.
|
|
3127
3119
|
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3120
|
+
:param project: Project name.
|
|
3121
|
+
:param image: The image on which the application will run.
|
|
3122
|
+
"""
|
|
3123
|
+
self.api_call(
|
|
3124
|
+
method=mlrun.common.types.HTTPMethod.POST,
|
|
3125
|
+
path=f"projects/{project}/model-monitoring/deploy-histogram-data-drift-app",
|
|
3126
|
+
params={"image": image},
|
|
3127
|
+
)
|
|
3134
3128
|
|
|
3135
3129
|
def create_hub_source(
|
|
3136
3130
|
self, source: Union[dict, mlrun.common.schemas.IndexedHubSource]
|
|
@@ -3397,6 +3391,17 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3397
3391
|
response = self.api_call("GET", endpoint_path, error)
|
|
3398
3392
|
return mlrun.common.schemas.APIGateway(**response.json())
|
|
3399
3393
|
|
|
3394
|
+
def delete_api_gateway(self, name, project=None):
|
|
3395
|
+
"""
|
|
3396
|
+
Deletes an API gateway
|
|
3397
|
+
:param name: API gateway name
|
|
3398
|
+
:param project: Project name
|
|
3399
|
+
"""
|
|
3400
|
+
project = project or config.default_project
|
|
3401
|
+
error = "delete api gateway"
|
|
3402
|
+
endpoint_path = f"projects/{project}/api-gateways/{name}"
|
|
3403
|
+
self.api_call("DELETE", endpoint_path, error)
|
|
3404
|
+
|
|
3400
3405
|
def store_api_gateway(
|
|
3401
3406
|
self,
|
|
3402
3407
|
api_gateway: Union[
|
|
@@ -3422,7 +3427,7 @@ class HTTPRunDB(RunDBInterface):
|
|
|
3422
3427
|
"PUT",
|
|
3423
3428
|
endpoint_path,
|
|
3424
3429
|
error,
|
|
3425
|
-
json=api_gateway.dict(
|
|
3430
|
+
json=api_gateway.dict(exclude_none=True),
|
|
3426
3431
|
)
|
|
3427
3432
|
return mlrun.common.schemas.APIGateway(**response.json())
|
|
3428
3433
|
|
mlrun/db/nopdb.py
CHANGED
|
@@ -519,6 +519,9 @@ class NopDB(RunDBInterface):
|
|
|
519
519
|
def get_api_gateway(self, name, project=None):
|
|
520
520
|
pass
|
|
521
521
|
|
|
522
|
+
def delete_api_gateway(self, name, project=None):
|
|
523
|
+
pass
|
|
524
|
+
|
|
522
525
|
def verify_authorization(
|
|
523
526
|
self,
|
|
524
527
|
authorization_verification_input: mlrun.common.schemas.AuthorizationVerificationInput,
|
mlrun/launcher/__init__.py
CHANGED
mlrun/launcher/base.py
CHANGED
mlrun/launcher/client.py
CHANGED
mlrun/launcher/factory.py
CHANGED
mlrun/launcher/local.py
CHANGED
mlrun/launcher/remote.py
CHANGED
mlrun/model.py
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
# flake8: noqa - this is until we take care of the F401 violations with respect to __all__ & sphinx
|
|
16
16
|
# for backwards compatibility
|
|
17
17
|
|
|
18
|
+
from .db import get_store_object
|
|
18
19
|
from .helpers import get_stream_path
|
|
19
20
|
from .model_endpoint import ModelEndpoint
|
|
20
|
-
from .stores import ModelEndpointStore, ModelEndpointStoreType, get_model_endpoint_store
|
|
21
21
|
from .tracking_policy import TrackingPolicy
|