mlrun 1.5.0rc4__py3-none-any.whl → 1.5.0rc6__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.
- mlrun/api/api/endpoints/datastore_profile.py +35 -13
- mlrun/api/api/endpoints/files.py +1 -1
- mlrun/api/api/endpoints/frontend_spec.py +1 -10
- mlrun/api/api/endpoints/functions.py +28 -18
- mlrun/api/api/endpoints/hub.py +2 -6
- mlrun/api/api/endpoints/pipelines.py +5 -1
- mlrun/api/api/endpoints/projects.py +1 -0
- mlrun/api/api/endpoints/workflows.py +1 -0
- mlrun/api/api/utils.py +18 -0
- mlrun/api/crud/client_spec.py +3 -0
- mlrun/api/crud/datastore_profiles.py +2 -2
- mlrun/api/crud/hub.py +158 -142
- mlrun/api/crud/model_monitoring/deployment.py +3 -0
- mlrun/api/crud/model_monitoring/model_endpoints.py +1 -1
- mlrun/api/crud/pipelines.py +10 -4
- mlrun/api/crud/workflows.py +11 -4
- mlrun/api/db/session.py +7 -2
- mlrun/api/db/sqldb/db.py +19 -21
- mlrun/api/db/sqldb/models/models_mysql.py +10 -1
- mlrun/api/db/sqldb/models/models_sqlite.py +11 -1
- mlrun/api/initial_data.py +3 -5
- mlrun/api/launcher.py +2 -1
- mlrun/api/migrations_mysql/versions/026c947c4487_altering_table_datastore_profiles_2.py +46 -0
- mlrun/api/migrations_sqlite/versions/026c947c4487_altering_table_datastore_profiles_2.py +46 -0
- mlrun/api/rundb/sqldb.py +113 -61
- mlrun/api/utils/db/sqlite_migration.py +1 -0
- mlrun/common/model_monitoring/helpers.py +3 -1
- mlrun/common/schemas/client_spec.py +1 -0
- mlrun/common/schemas/datastore_profile.py +1 -1
- mlrun/common/schemas/frontend_spec.py +1 -1
- mlrun/config.py +3 -2
- mlrun/datastore/datastore_profile.py +33 -21
- mlrun/datastore/dbfs_store.py +9 -8
- mlrun/datastore/redis.py +6 -0
- mlrun/datastore/targets.py +12 -1
- mlrun/db/base.py +1 -1
- mlrun/db/factory.py +3 -0
- mlrun/db/httpdb.py +14 -13
- mlrun/db/nopdb.py +1 -1
- mlrun/feature_store/api.py +4 -1
- mlrun/feature_store/feature_set.py +3 -1
- mlrun/feature_store/ingestion.py +1 -0
- mlrun/kfpops.py +8 -2
- mlrun/launcher/base.py +1 -1
- mlrun/model.py +7 -5
- mlrun/projects/pipelines.py +7 -6
- mlrun/projects/project.py +2 -2
- mlrun/run.py +1 -1
- mlrun/runtimes/__init__.py +1 -0
- mlrun/utils/helpers.py +1 -1
- mlrun/utils/notifications/notification/webhook.py +9 -1
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.5.0rc4.dist-info → mlrun-1.5.0rc6.dist-info}/METADATA +6 -5
- {mlrun-1.5.0rc4.dist-info → mlrun-1.5.0rc6.dist-info}/RECORD +58 -56
- {mlrun-1.5.0rc4.dist-info → mlrun-1.5.0rc6.dist-info}/LICENSE +0 -0
- {mlrun-1.5.0rc4.dist-info → mlrun-1.5.0rc6.dist-info}/WHEEL +0 -0
- {mlrun-1.5.0rc4.dist-info → mlrun-1.5.0rc6.dist-info}/entry_points.txt +0 -0
- {mlrun-1.5.0rc4.dist-info → mlrun-1.5.0rc6.dist-info}/top_level.txt +0 -0
mlrun/api/initial_data.py
CHANGED
|
@@ -192,7 +192,7 @@ def _perform_schema_migrations(alembic_util: mlrun.api.utils.db.alembic.AlembicU
|
|
|
192
192
|
|
|
193
193
|
def _is_latest_data_version():
|
|
194
194
|
db_session = create_session()
|
|
195
|
-
db = mlrun.api.db.sqldb.db.SQLDB(
|
|
195
|
+
db = mlrun.api.db.sqldb.db.SQLDB()
|
|
196
196
|
|
|
197
197
|
try:
|
|
198
198
|
current_data_version = _resolve_current_data_version(db, db_session)
|
|
@@ -214,8 +214,7 @@ def _perform_database_migration(
|
|
|
214
214
|
|
|
215
215
|
def _perform_data_migrations(db_session: sqlalchemy.orm.Session):
|
|
216
216
|
if config.httpdb.db.data_migrations_mode == "enabled":
|
|
217
|
-
|
|
218
|
-
db = mlrun.api.db.sqldb.db.SQLDB("")
|
|
217
|
+
db = mlrun.api.db.sqldb.db.SQLDB()
|
|
219
218
|
current_data_version = int(db.get_current_data_version(db_session))
|
|
220
219
|
if current_data_version != latest_data_version:
|
|
221
220
|
logger.info(
|
|
@@ -235,8 +234,7 @@ def _perform_data_migrations(db_session: sqlalchemy.orm.Session):
|
|
|
235
234
|
|
|
236
235
|
|
|
237
236
|
def _add_initial_data(db_session: sqlalchemy.orm.Session):
|
|
238
|
-
|
|
239
|
-
db = mlrun.api.db.sqldb.db.SQLDB("")
|
|
237
|
+
db = mlrun.api.db.sqldb.db.SQLDB()
|
|
240
238
|
_add_default_hub_source_if_needed(db, db_session)
|
|
241
239
|
_add_data_version(db, db_session)
|
|
242
240
|
|
mlrun/api/launcher.py
CHANGED
|
@@ -203,8 +203,9 @@ class ServerSideLauncher(launcher.BaseLauncher):
|
|
|
203
203
|
# in normal use cases if no project is found we will get an error
|
|
204
204
|
if project:
|
|
205
205
|
project = mlrun.projects.project.MlrunProject.from_dict(project.dict())
|
|
206
|
+
# there is no need to auto mount here as it was already done in the full spec enrichment with the auth info
|
|
206
207
|
mlrun.projects.pipelines.enrich_function_object(
|
|
207
|
-
project, runtime, copy_function=False
|
|
208
|
+
project, runtime, copy_function=False, try_auto_mount=False
|
|
208
209
|
)
|
|
209
210
|
|
|
210
211
|
def _enrich_full_spec(
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Copyright 2023 Iguazio
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
"""altering table datastore_profiles 2
|
|
17
|
+
|
|
18
|
+
Revision ID: 026c947c4487
|
|
19
|
+
Revises: b1d1e7ab5dec
|
|
20
|
+
Create Date: 2023-08-10 14:15:30.523729
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
import sqlalchemy as sa
|
|
24
|
+
from alembic import op
|
|
25
|
+
|
|
26
|
+
# revision identifiers, used by Alembic.
|
|
27
|
+
revision = "026c947c4487"
|
|
28
|
+
down_revision = "b1d1e7ab5dec"
|
|
29
|
+
branch_labels = None
|
|
30
|
+
depends_on = None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def upgrade():
|
|
34
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
35
|
+
op.add_column("datastore_profiles", sa.Column("object", sa.JSON(), nullable=True))
|
|
36
|
+
op.drop_column("datastore_profiles", "body")
|
|
37
|
+
# ### end Alembic commands ###
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def downgrade():
|
|
41
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
42
|
+
op.add_column(
|
|
43
|
+
"datastore_profiles", sa.Column("body", sa.String(length=1024), nullable=True)
|
|
44
|
+
)
|
|
45
|
+
op.drop_column("datastore_profiles", "object")
|
|
46
|
+
# ### end Alembic commands ###
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Copyright 2023 Iguazio
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
#
|
|
15
|
+
|
|
16
|
+
"""altering table datastore_profiles 2
|
|
17
|
+
|
|
18
|
+
Revision ID: 026c947c4487
|
|
19
|
+
Revises: 6e0c9531edc7
|
|
20
|
+
Create Date: 2023-08-10 14:15:30.523729
|
|
21
|
+
|
|
22
|
+
"""
|
|
23
|
+
import sqlalchemy as sa
|
|
24
|
+
from alembic import op
|
|
25
|
+
|
|
26
|
+
# revision identifiers, used by Alembic.
|
|
27
|
+
revision = "026c947c4487"
|
|
28
|
+
down_revision = "6e0c9531edc7"
|
|
29
|
+
branch_labels = None
|
|
30
|
+
depends_on = None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def upgrade():
|
|
34
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
35
|
+
with op.batch_alter_table("datastore_profiles") as batch_op:
|
|
36
|
+
batch_op.add_column(sa.Column("object", sa.JSON(), nullable=True))
|
|
37
|
+
batch_op.drop_column("body")
|
|
38
|
+
# ### end Alembic commands ###
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def downgrade():
|
|
42
|
+
# ### commands auto generated by Alembic - please adjust! ###
|
|
43
|
+
with op.batch_alter_table("datastore_profiles") as batch_op:
|
|
44
|
+
batch_op.add_column(sa.Column("body", sa.String(length=1024), nullable=True))
|
|
45
|
+
batch_op.drop_column("object")
|
|
46
|
+
# ### end Alembic commands ###
|
mlrun/api/rundb/sqldb.py
CHANGED
|
@@ -16,8 +16,10 @@ import datetime
|
|
|
16
16
|
from typing import List, Optional, Union
|
|
17
17
|
|
|
18
18
|
from dependency_injector import containers, providers
|
|
19
|
+
from sqlalchemy.exc import SQLAlchemyError
|
|
19
20
|
|
|
20
21
|
import mlrun.api.crud
|
|
22
|
+
import mlrun.api.db.session
|
|
21
23
|
import mlrun.common.schemas
|
|
22
24
|
import mlrun.db.factory
|
|
23
25
|
import mlrun.model_monitoring.model_endpoint
|
|
@@ -39,11 +41,15 @@ class SQLRunDB(RunDBInterface):
|
|
|
39
41
|
def __init__(
|
|
40
42
|
self,
|
|
41
43
|
dsn,
|
|
44
|
+
session=None,
|
|
42
45
|
):
|
|
46
|
+
self.session = session
|
|
43
47
|
self.dsn = dsn
|
|
44
48
|
self.db = None
|
|
45
49
|
|
|
46
50
|
def connect(self, secrets=None):
|
|
51
|
+
if not self.session:
|
|
52
|
+
self.session = create_session()
|
|
47
53
|
self.db = SQLDB(self.dsn)
|
|
48
54
|
return self
|
|
49
55
|
|
|
@@ -68,8 +74,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
68
74
|
)
|
|
69
75
|
|
|
70
76
|
def store_run(self, struct, uid, project="", iter=0):
|
|
71
|
-
return self.
|
|
77
|
+
return self._transform_db_error(
|
|
72
78
|
mlrun.api.crud.Runs().store_run,
|
|
79
|
+
self.session,
|
|
73
80
|
struct,
|
|
74
81
|
uid,
|
|
75
82
|
iter,
|
|
@@ -77,8 +84,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
77
84
|
)
|
|
78
85
|
|
|
79
86
|
def update_run(self, updates: dict, uid, project="", iter=0):
|
|
80
|
-
return self.
|
|
87
|
+
return self._transform_db_error(
|
|
81
88
|
mlrun.api.crud.Runs().update_run,
|
|
89
|
+
self.session,
|
|
82
90
|
project,
|
|
83
91
|
uid,
|
|
84
92
|
iter,
|
|
@@ -89,8 +97,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
89
97
|
raise NotImplementedError()
|
|
90
98
|
|
|
91
99
|
def read_run(self, uid, project=None, iter=None):
|
|
92
|
-
return self.
|
|
100
|
+
return self._transform_db_error(
|
|
93
101
|
mlrun.api.crud.Runs().get_run,
|
|
102
|
+
self.session,
|
|
94
103
|
uid,
|
|
95
104
|
iter,
|
|
96
105
|
project,
|
|
@@ -119,8 +128,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
119
128
|
max_partitions: int = 0,
|
|
120
129
|
with_notifications: bool = False,
|
|
121
130
|
):
|
|
122
|
-
return self.
|
|
131
|
+
return self._transform_db_error(
|
|
123
132
|
mlrun.api.crud.Runs().list_runs,
|
|
133
|
+
db_session=self.session,
|
|
124
134
|
name=name,
|
|
125
135
|
uid=uid,
|
|
126
136
|
project=project,
|
|
@@ -142,16 +152,18 @@ class SQLRunDB(RunDBInterface):
|
|
|
142
152
|
)
|
|
143
153
|
|
|
144
154
|
def del_run(self, uid, project=None, iter=None):
|
|
145
|
-
return self.
|
|
155
|
+
return self._transform_db_error(
|
|
146
156
|
mlrun.api.crud.Runs().delete_run,
|
|
157
|
+
self.session,
|
|
147
158
|
uid,
|
|
148
159
|
iter,
|
|
149
160
|
project,
|
|
150
161
|
)
|
|
151
162
|
|
|
152
163
|
def del_runs(self, name=None, project=None, labels=None, state=None, days_ago=0):
|
|
153
|
-
return self.
|
|
164
|
+
return self._transform_db_error(
|
|
154
165
|
mlrun.api.crud.Runs().delete_runs,
|
|
166
|
+
self.session,
|
|
155
167
|
name,
|
|
156
168
|
project,
|
|
157
169
|
labels,
|
|
@@ -160,8 +172,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
160
172
|
)
|
|
161
173
|
|
|
162
174
|
def store_artifact(self, key, artifact, uid, iter=None, tag="", project=""):
|
|
163
|
-
return self.
|
|
175
|
+
return self._transform_db_error(
|
|
164
176
|
mlrun.api.crud.Artifacts().store_artifact,
|
|
177
|
+
self.session,
|
|
165
178
|
key,
|
|
166
179
|
artifact,
|
|
167
180
|
uid,
|
|
@@ -171,8 +184,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
171
184
|
)
|
|
172
185
|
|
|
173
186
|
def read_artifact(self, key, tag="", iter=None, project=""):
|
|
174
|
-
return self.
|
|
187
|
+
return self._transform_db_error(
|
|
175
188
|
mlrun.api.crud.Artifacts().get_artifact,
|
|
189
|
+
self.session,
|
|
176
190
|
key,
|
|
177
191
|
tag,
|
|
178
192
|
iter,
|
|
@@ -195,8 +209,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
195
209
|
if category and isinstance(category, str):
|
|
196
210
|
category = mlrun.common.schemas.ArtifactCategories(category)
|
|
197
211
|
|
|
198
|
-
return self.
|
|
212
|
+
return self._transform_db_error(
|
|
199
213
|
mlrun.api.crud.Artifacts().list_artifacts,
|
|
214
|
+
self.session,
|
|
200
215
|
project,
|
|
201
216
|
name,
|
|
202
217
|
tag,
|
|
@@ -210,16 +225,18 @@ class SQLRunDB(RunDBInterface):
|
|
|
210
225
|
)
|
|
211
226
|
|
|
212
227
|
def del_artifact(self, key, tag="", project=""):
|
|
213
|
-
return self.
|
|
228
|
+
return self._transform_db_error(
|
|
214
229
|
mlrun.api.crud.Artifacts().delete_artifact,
|
|
230
|
+
self.session,
|
|
215
231
|
key,
|
|
216
232
|
tag,
|
|
217
233
|
project,
|
|
218
234
|
)
|
|
219
235
|
|
|
220
236
|
def del_artifacts(self, name="", project="", tag="", labels=None):
|
|
221
|
-
return self.
|
|
237
|
+
return self._transform_db_error(
|
|
222
238
|
mlrun.api.crud.Artifacts().delete_artifacts,
|
|
239
|
+
self.session,
|
|
223
240
|
project,
|
|
224
241
|
name,
|
|
225
242
|
tag,
|
|
@@ -227,8 +244,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
227
244
|
)
|
|
228
245
|
|
|
229
246
|
def store_function(self, function, name, project="", tag="", versioned=False):
|
|
230
|
-
return self.
|
|
247
|
+
return self._transform_db_error(
|
|
231
248
|
mlrun.api.crud.Functions().store_function,
|
|
249
|
+
self.session,
|
|
232
250
|
function,
|
|
233
251
|
name,
|
|
234
252
|
project,
|
|
@@ -237,8 +255,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
237
255
|
)
|
|
238
256
|
|
|
239
257
|
def get_function(self, name, project="", tag="", hash_key=""):
|
|
240
|
-
return self.
|
|
258
|
+
return self._transform_db_error(
|
|
241
259
|
mlrun.api.crud.Functions().get_function,
|
|
260
|
+
self.session,
|
|
242
261
|
name,
|
|
243
262
|
project,
|
|
244
263
|
tag,
|
|
@@ -246,15 +265,17 @@ class SQLRunDB(RunDBInterface):
|
|
|
246
265
|
)
|
|
247
266
|
|
|
248
267
|
def delete_function(self, name: str, project: str = ""):
|
|
249
|
-
return self.
|
|
268
|
+
return self._transform_db_error(
|
|
250
269
|
mlrun.api.crud.Functions().delete_function,
|
|
270
|
+
self.session,
|
|
251
271
|
project,
|
|
252
272
|
name,
|
|
253
273
|
)
|
|
254
274
|
|
|
255
275
|
def list_functions(self, name=None, project=None, tag=None, labels=None):
|
|
256
|
-
return self.
|
|
276
|
+
return self._transform_db_error(
|
|
257
277
|
mlrun.api.crud.Functions().list_functions,
|
|
278
|
+
db_session=self.session,
|
|
258
279
|
project=project,
|
|
259
280
|
name=name,
|
|
260
281
|
tag=tag,
|
|
@@ -266,8 +287,8 @@ class SQLRunDB(RunDBInterface):
|
|
|
266
287
|
project=None,
|
|
267
288
|
category: Union[str, mlrun.common.schemas.ArtifactCategories] = None,
|
|
268
289
|
):
|
|
269
|
-
return self.
|
|
270
|
-
self.db.list_artifact_tags, project
|
|
290
|
+
return self._transform_db_error(
|
|
291
|
+
self.db.list_artifact_tags, self.session, project
|
|
271
292
|
)
|
|
272
293
|
|
|
273
294
|
def tag_objects(
|
|
@@ -278,15 +299,17 @@ class SQLRunDB(RunDBInterface):
|
|
|
278
299
|
replace: bool = False,
|
|
279
300
|
):
|
|
280
301
|
if replace:
|
|
281
|
-
return self.
|
|
302
|
+
return self._transform_db_error(
|
|
282
303
|
mlrun.api.crud.Tags().overwrite_object_tags_with_tag,
|
|
304
|
+
self.session,
|
|
283
305
|
project,
|
|
284
306
|
tag_name,
|
|
285
307
|
tag_objects,
|
|
286
308
|
)
|
|
287
309
|
|
|
288
|
-
return self.
|
|
310
|
+
return self._transform_db_error(
|
|
289
311
|
mlrun.api.crud.Tags().append_tag_to_objects,
|
|
312
|
+
self.session,
|
|
290
313
|
project,
|
|
291
314
|
tag_name,
|
|
292
315
|
tag_objects,
|
|
@@ -298,8 +321,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
298
321
|
tag_name: str,
|
|
299
322
|
tag_objects: mlrun.common.schemas.TagObjects,
|
|
300
323
|
):
|
|
301
|
-
return self.
|
|
324
|
+
return self._transform_db_error(
|
|
302
325
|
mlrun.api.crud.Tags().delete_tag_from_objects,
|
|
326
|
+
self.session,
|
|
303
327
|
project,
|
|
304
328
|
tag_name,
|
|
305
329
|
tag_objects,
|
|
@@ -334,10 +358,10 @@ class SQLRunDB(RunDBInterface):
|
|
|
334
358
|
)
|
|
335
359
|
|
|
336
360
|
def store_schedule(self, data):
|
|
337
|
-
return self.
|
|
361
|
+
return self._transform_db_error(self.db.store_schedule, self.session, data)
|
|
338
362
|
|
|
339
363
|
def list_schedules(self):
|
|
340
|
-
return self.
|
|
364
|
+
return self._transform_db_error(self.db.list_schedules, self.session)
|
|
341
365
|
|
|
342
366
|
def store_project(
|
|
343
367
|
self,
|
|
@@ -347,8 +371,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
347
371
|
if isinstance(project, dict):
|
|
348
372
|
project = mlrun.common.schemas.Project(**project)
|
|
349
373
|
|
|
350
|
-
return self.
|
|
374
|
+
return self._transform_db_error(
|
|
351
375
|
mlrun.api.crud.Projects().store_project,
|
|
376
|
+
self.session,
|
|
352
377
|
name=name,
|
|
353
378
|
project=project,
|
|
354
379
|
)
|
|
@@ -359,8 +384,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
359
384
|
project: dict,
|
|
360
385
|
patch_mode: mlrun.common.schemas.PatchMode = mlrun.common.schemas.PatchMode.replace,
|
|
361
386
|
) -> mlrun.common.schemas.Project:
|
|
362
|
-
return self.
|
|
387
|
+
return self._transform_db_error(
|
|
363
388
|
mlrun.api.crud.Projects().patch_project,
|
|
389
|
+
self.session,
|
|
364
390
|
name=name,
|
|
365
391
|
project=project,
|
|
366
392
|
patch_mode=patch_mode,
|
|
@@ -370,8 +396,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
370
396
|
self,
|
|
371
397
|
project: mlrun.common.schemas.Project,
|
|
372
398
|
) -> mlrun.common.schemas.Project:
|
|
373
|
-
return self.
|
|
399
|
+
return self._transform_db_error(
|
|
374
400
|
mlrun.api.crud.Projects().create_project,
|
|
401
|
+
self.session,
|
|
375
402
|
project=project,
|
|
376
403
|
)
|
|
377
404
|
|
|
@@ -380,8 +407,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
380
407
|
name: str,
|
|
381
408
|
deletion_strategy: mlrun.common.schemas.DeletionStrategy = mlrun.common.schemas.DeletionStrategy.default(),
|
|
382
409
|
):
|
|
383
|
-
return self.
|
|
410
|
+
return self._transform_db_error(
|
|
384
411
|
mlrun.api.crud.Projects().delete_project,
|
|
412
|
+
self.session,
|
|
385
413
|
name=name,
|
|
386
414
|
deletion_strategy=deletion_strategy,
|
|
387
415
|
)
|
|
@@ -389,8 +417,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
389
417
|
def get_project(
|
|
390
418
|
self, name: str = None, project_id: int = None
|
|
391
419
|
) -> mlrun.common.schemas.Project:
|
|
392
|
-
return self.
|
|
420
|
+
return self._transform_db_error(
|
|
393
421
|
mlrun.api.crud.Projects().get_project,
|
|
422
|
+
self.session,
|
|
394
423
|
name=name,
|
|
395
424
|
)
|
|
396
425
|
|
|
@@ -401,8 +430,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
401
430
|
labels: List[str] = None,
|
|
402
431
|
state: mlrun.common.schemas.ProjectState = None,
|
|
403
432
|
) -> mlrun.common.schemas.ProjectsOutput:
|
|
404
|
-
return self.
|
|
433
|
+
return self._transform_db_error(
|
|
405
434
|
mlrun.api.crud.Projects().list_projects,
|
|
435
|
+
self.session,
|
|
406
436
|
owner=owner,
|
|
407
437
|
format_=format_,
|
|
408
438
|
labels=labels,
|
|
@@ -410,8 +440,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
410
440
|
)
|
|
411
441
|
|
|
412
442
|
def create_feature_set(self, feature_set, project="", versioned=True):
|
|
413
|
-
return self.
|
|
443
|
+
return self._transform_db_error(
|
|
414
444
|
mlrun.api.crud.FeatureStore().create_feature_set,
|
|
445
|
+
self.session,
|
|
415
446
|
project,
|
|
416
447
|
feature_set,
|
|
417
448
|
versioned,
|
|
@@ -420,8 +451,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
420
451
|
def get_feature_set(
|
|
421
452
|
self, name: str, project: str = "", tag: str = None, uid: str = None
|
|
422
453
|
):
|
|
423
|
-
feature_set = self.
|
|
454
|
+
feature_set = self._transform_db_error(
|
|
424
455
|
mlrun.api.crud.FeatureStore().get_feature_set,
|
|
456
|
+
self.session,
|
|
425
457
|
project,
|
|
426
458
|
name,
|
|
427
459
|
tag,
|
|
@@ -437,8 +469,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
437
469
|
entities: List[str] = None,
|
|
438
470
|
labels: List[str] = None,
|
|
439
471
|
):
|
|
440
|
-
return self.
|
|
472
|
+
return self._transform_db_error(
|
|
441
473
|
mlrun.api.crud.FeatureStore().list_features,
|
|
474
|
+
self.session,
|
|
442
475
|
project,
|
|
443
476
|
name,
|
|
444
477
|
tag,
|
|
@@ -453,8 +486,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
453
486
|
tag: str = None,
|
|
454
487
|
labels: List[str] = None,
|
|
455
488
|
):
|
|
456
|
-
return self.
|
|
489
|
+
return self._transform_db_error(
|
|
457
490
|
mlrun.api.crud.FeatureStore().list_entities,
|
|
491
|
+
self.session,
|
|
458
492
|
project,
|
|
459
493
|
name,
|
|
460
494
|
tag,
|
|
@@ -475,8 +509,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
475
509
|
partition_sort_by: mlrun.common.schemas.SortField = None,
|
|
476
510
|
partition_order: mlrun.common.schemas.OrderType = mlrun.common.schemas.OrderType.desc,
|
|
477
511
|
):
|
|
478
|
-
return self.
|
|
512
|
+
return self._transform_db_error(
|
|
479
513
|
mlrun.api.crud.FeatureStore().list_feature_sets,
|
|
514
|
+
self.session,
|
|
480
515
|
project,
|
|
481
516
|
name,
|
|
482
517
|
tag,
|
|
@@ -504,8 +539,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
504
539
|
|
|
505
540
|
name = name or feature_set.metadata.name
|
|
506
541
|
project = project or feature_set.metadata.project
|
|
507
|
-
return self.
|
|
542
|
+
return self._transform_db_error(
|
|
508
543
|
mlrun.api.crud.FeatureStore().store_feature_set,
|
|
544
|
+
self.session,
|
|
509
545
|
project,
|
|
510
546
|
name,
|
|
511
547
|
feature_set,
|
|
@@ -517,8 +553,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
517
553
|
def patch_feature_set(
|
|
518
554
|
self, name, feature_set, project="", tag=None, uid=None, patch_mode="replace"
|
|
519
555
|
):
|
|
520
|
-
return self.
|
|
556
|
+
return self._transform_db_error(
|
|
521
557
|
mlrun.api.crud.FeatureStore().patch_feature_set,
|
|
558
|
+
self.session,
|
|
522
559
|
project,
|
|
523
560
|
name,
|
|
524
561
|
feature_set,
|
|
@@ -528,8 +565,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
528
565
|
)
|
|
529
566
|
|
|
530
567
|
def delete_feature_set(self, name, project="", tag=None, uid=None):
|
|
531
|
-
return self.
|
|
568
|
+
return self._transform_db_error(
|
|
532
569
|
mlrun.api.crud.FeatureStore().delete_feature_set,
|
|
570
|
+
self.session,
|
|
533
571
|
project,
|
|
534
572
|
name,
|
|
535
573
|
tag,
|
|
@@ -537,8 +575,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
537
575
|
)
|
|
538
576
|
|
|
539
577
|
def create_feature_vector(self, feature_vector, project="", versioned=True):
|
|
540
|
-
return self.
|
|
578
|
+
return self._transform_db_error(
|
|
541
579
|
mlrun.api.crud.FeatureStore().create_feature_vector,
|
|
580
|
+
self.session,
|
|
542
581
|
project,
|
|
543
582
|
feature_vector,
|
|
544
583
|
versioned,
|
|
@@ -547,8 +586,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
547
586
|
def get_feature_vector(
|
|
548
587
|
self, name: str, project: str = "", tag: str = None, uid: str = None
|
|
549
588
|
):
|
|
550
|
-
return self.
|
|
589
|
+
return self._transform_db_error(
|
|
551
590
|
mlrun.api.crud.FeatureStore().get_feature_vector,
|
|
591
|
+
self.session,
|
|
552
592
|
project,
|
|
553
593
|
name,
|
|
554
594
|
tag,
|
|
@@ -567,8 +607,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
567
607
|
partition_sort_by: mlrun.common.schemas.SortField = None,
|
|
568
608
|
partition_order: mlrun.common.schemas.OrderType = mlrun.common.schemas.OrderType.desc,
|
|
569
609
|
):
|
|
570
|
-
return self.
|
|
610
|
+
return self._transform_db_error(
|
|
571
611
|
mlrun.api.crud.FeatureStore().list_feature_vectors,
|
|
612
|
+
self.session,
|
|
572
613
|
project,
|
|
573
614
|
name,
|
|
574
615
|
tag,
|
|
@@ -589,8 +630,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
589
630
|
uid=None,
|
|
590
631
|
versioned=True,
|
|
591
632
|
):
|
|
592
|
-
return self.
|
|
633
|
+
return self._transform_db_error(
|
|
593
634
|
mlrun.api.crud.FeatureStore().store_feature_vector,
|
|
635
|
+
self.session,
|
|
594
636
|
project,
|
|
595
637
|
name,
|
|
596
638
|
feature_vector,
|
|
@@ -608,8 +650,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
608
650
|
uid=None,
|
|
609
651
|
patch_mode="replace",
|
|
610
652
|
):
|
|
611
|
-
return self.
|
|
653
|
+
return self._transform_db_error(
|
|
612
654
|
mlrun.api.crud.FeatureStore().patch_feature_vector,
|
|
655
|
+
self.session,
|
|
613
656
|
project,
|
|
614
657
|
name,
|
|
615
658
|
feature_vector_update,
|
|
@@ -619,8 +662,9 @@ class SQLRunDB(RunDBInterface):
|
|
|
619
662
|
)
|
|
620
663
|
|
|
621
664
|
def delete_feature_vector(self, name, project="", tag=None, uid=None):
|
|
622
|
-
return self.
|
|
665
|
+
return self._transform_db_error(
|
|
623
666
|
mlrun.api.crud.FeatureStore().delete_feature_vector,
|
|
667
|
+
self.session,
|
|
624
668
|
project,
|
|
625
669
|
name,
|
|
626
670
|
tag,
|
|
@@ -634,7 +678,10 @@ class SQLRunDB(RunDBInterface):
|
|
|
634
678
|
project: str = None,
|
|
635
679
|
mask_params: bool = True,
|
|
636
680
|
):
|
|
637
|
-
|
|
681
|
+
# We run this function with a new session because it may run concurrently.
|
|
682
|
+
# Older sessions will not be able to see the changes made by this function until they are committed.
|
|
683
|
+
return self._transform_db_error(
|
|
684
|
+
mlrun.api.db.session.run_function_with_new_db_session,
|
|
638
685
|
mlrun.api.crud.Notifications().store_run_notifications,
|
|
639
686
|
notification_objects,
|
|
640
687
|
run_uid,
|
|
@@ -670,6 +717,20 @@ class SQLRunDB(RunDBInterface):
|
|
|
670
717
|
function,
|
|
671
718
|
)
|
|
672
719
|
|
|
720
|
+
def list_hub_sources(
|
|
721
|
+
self,
|
|
722
|
+
item_name: Optional[str] = None,
|
|
723
|
+
tag: Optional[str] = None,
|
|
724
|
+
version: Optional[str] = None,
|
|
725
|
+
):
|
|
726
|
+
return self._transform_db_error(
|
|
727
|
+
mlrun.api.crud.Hub().list_hub_sources,
|
|
728
|
+
self.session,
|
|
729
|
+
item_name,
|
|
730
|
+
tag,
|
|
731
|
+
version,
|
|
732
|
+
)
|
|
733
|
+
|
|
673
734
|
def list_pipelines(
|
|
674
735
|
self,
|
|
675
736
|
project: str,
|
|
@@ -795,14 +856,6 @@ class SQLRunDB(RunDBInterface):
|
|
|
795
856
|
):
|
|
796
857
|
raise NotImplementedError()
|
|
797
858
|
|
|
798
|
-
def list_hub_sources(
|
|
799
|
-
self,
|
|
800
|
-
item_name: Optional[str] = None,
|
|
801
|
-
tag: Optional[str] = None,
|
|
802
|
-
version: Optional[str] = None,
|
|
803
|
-
):
|
|
804
|
-
raise NotImplementedError()
|
|
805
|
-
|
|
806
859
|
def get_hub_source(self, source_name: str):
|
|
807
860
|
raise NotImplementedError()
|
|
808
861
|
|
|
@@ -847,7 +900,7 @@ class SQLRunDB(RunDBInterface):
|
|
|
847
900
|
def delete_datastore_profile(self, name: str, project: str):
|
|
848
901
|
raise NotImplementedError()
|
|
849
902
|
|
|
850
|
-
def
|
|
903
|
+
def list_datastore_profiles(
|
|
851
904
|
self, project: str
|
|
852
905
|
) -> List[mlrun.common.schemas.DatastoreProfile]:
|
|
853
906
|
raise NotImplementedError()
|
|
@@ -857,17 +910,16 @@ class SQLRunDB(RunDBInterface):
|
|
|
857
910
|
):
|
|
858
911
|
raise NotImplementedError()
|
|
859
912
|
|
|
860
|
-
def
|
|
861
|
-
session = create_session()
|
|
862
|
-
try:
|
|
863
|
-
return self._transform_db_error(func, session, *args, **kwargs)
|
|
864
|
-
finally:
|
|
865
|
-
session.close()
|
|
866
|
-
|
|
867
|
-
@staticmethod
|
|
868
|
-
def _transform_db_error(func, *args, **kwargs):
|
|
913
|
+
def _transform_db_error(self, func, *args, **kwargs):
|
|
869
914
|
try:
|
|
870
915
|
return func(*args, **kwargs)
|
|
916
|
+
|
|
917
|
+
except SQLAlchemyError as exc:
|
|
918
|
+
# If we got a SQLAlchemyError, it means the error was not handled by the SQLDB and we need to rollback
|
|
919
|
+
# to make the session usable again
|
|
920
|
+
self.session.rollback()
|
|
921
|
+
raise mlrun.db.RunDBError(exc.args) from exc
|
|
922
|
+
|
|
871
923
|
except DBError as exc:
|
|
872
924
|
raise mlrun.db.RunDBError(exc.args) from exc
|
|
873
925
|
|
|
@@ -65,5 +65,7 @@ def parse_monitoring_stream_path(stream_uri: str, project: str):
|
|
|
65
65
|
|
|
66
66
|
elif stream_uri.startswith("v3io://") and mlrun.mlconf.is_ce_mode():
|
|
67
67
|
# V3IO is not supported in CE mode, generating a default http stream path
|
|
68
|
-
stream_uri = mlrun.mlconf.model_endpoint_monitoring.default_http_sink
|
|
68
|
+
stream_uri = mlrun.mlconf.model_endpoint_monitoring.default_http_sink.format(
|
|
69
|
+
project=project
|
|
70
|
+
)
|
|
69
71
|
return stream_uri
|
|
@@ -57,6 +57,7 @@ class ClientSpec(pydantic.BaseModel):
|
|
|
57
57
|
redis_type: typing.Optional[str]
|
|
58
58
|
sql_url: typing.Optional[str]
|
|
59
59
|
model_endpoint_monitoring_store_type: typing.Optional[str]
|
|
60
|
+
model_endpoint_monitoring_endpoint_store_connection: typing.Optional[str]
|
|
60
61
|
# ce_mode is deprecated, we will use the full ce config instead and ce_mode will be removed in 1.6.0
|
|
61
62
|
ce_mode: typing.Optional[str]
|
|
62
63
|
ce: typing.Optional[dict]
|