mlrun 1.7.0rc39__py3-none-any.whl → 1.7.0rc40__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/runtimes/nuclio/application/application.py +93 -50
- mlrun/utils/helpers.py +12 -2
- mlrun/utils/version/version.json +2 -2
- {mlrun-1.7.0rc39.dist-info → mlrun-1.7.0rc40.dist-info}/METADATA +1 -1
- {mlrun-1.7.0rc39.dist-info → mlrun-1.7.0rc40.dist-info}/RECORD +9 -9
- {mlrun-1.7.0rc39.dist-info → mlrun-1.7.0rc40.dist-info}/LICENSE +0 -0
- {mlrun-1.7.0rc39.dist-info → mlrun-1.7.0rc40.dist-info}/WHEEL +0 -0
- {mlrun-1.7.0rc39.dist-info → mlrun-1.7.0rc40.dist-info}/entry_points.txt +0 -0
- {mlrun-1.7.0rc39.dist-info → mlrun-1.7.0rc40.dist-info}/top_level.txt +0 -0
|
@@ -281,34 +281,29 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
281
281
|
is_kfp=False,
|
|
282
282
|
mlrun_version_specifier=None,
|
|
283
283
|
show_on_failure: bool = False,
|
|
284
|
-
|
|
285
|
-
authentication_mode: schemas.APIGatewayAuthenticationMode = None,
|
|
286
|
-
authentication_creds: tuple[str] = None,
|
|
287
|
-
ssl_redirect: bool = None,
|
|
284
|
+
create_default_api_gateway: bool = True,
|
|
288
285
|
):
|
|
289
286
|
"""
|
|
290
287
|
Deploy function, builds the application image if required (self.requires_build()) or force_build is True,
|
|
291
288
|
Once the image is built, the function is deployed.
|
|
292
289
|
|
|
293
|
-
:param project:
|
|
294
|
-
:param tag:
|
|
295
|
-
:param verbose:
|
|
296
|
-
:param auth_info:
|
|
297
|
-
:param builder_env:
|
|
298
|
-
|
|
299
|
-
:param force_build:
|
|
300
|
-
:param with_mlrun:
|
|
301
|
-
:param skip_deployed:
|
|
302
|
-
:param is_kfp:
|
|
303
|
-
:param mlrun_version_specifier:
|
|
304
|
-
:param show_on_failure:
|
|
305
|
-
:param
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
:return: True if the function is ready (deployed)
|
|
290
|
+
:param project: Project name
|
|
291
|
+
:param tag: Function tag
|
|
292
|
+
:param verbose: Set True for verbose logging
|
|
293
|
+
:param auth_info: Service AuthInfo (deprecated and ignored)
|
|
294
|
+
:param builder_env: Env vars dict for source archive config/credentials
|
|
295
|
+
e.g. builder_env={"GIT_TOKEN": token}
|
|
296
|
+
:param force_build: Set True for force building the application image
|
|
297
|
+
:param with_mlrun: Add the current mlrun package to the container build
|
|
298
|
+
:param skip_deployed: Skip the build if we already have an image for the function
|
|
299
|
+
:param is_kfp: Deploy as part of a kfp pipeline
|
|
300
|
+
:param mlrun_version_specifier: Which mlrun package version to include (if not current)
|
|
301
|
+
:param show_on_failure: Show logs only in case of build failure
|
|
302
|
+
:param create_default_api_gateway: When deploy finishes the default API gateway will be created for the
|
|
303
|
+
application. Disabling this flag means that the application will not be
|
|
304
|
+
accessible until an API gateway is created for it.
|
|
305
|
+
|
|
306
|
+
:return: The default API gateway URL if created or True if the function is ready (deployed)
|
|
312
307
|
"""
|
|
313
308
|
if (self.requires_build() and not self.spec.image) or force_build:
|
|
314
309
|
self._fill_credentials()
|
|
@@ -328,10 +323,6 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
328
323
|
self._configure_application_sidecar()
|
|
329
324
|
|
|
330
325
|
# We only allow accessing the application via the API Gateway
|
|
331
|
-
name_tag = tag or self.metadata.tag
|
|
332
|
-
self.status.api_gateway_name = (
|
|
333
|
-
f"{self.metadata.name}-{name_tag}" if name_tag else self.metadata.name
|
|
334
|
-
)
|
|
335
326
|
self.spec.add_templated_ingress_host_mode = (
|
|
336
327
|
NuclioIngressAddTemplatedIngressModes.never
|
|
337
328
|
)
|
|
@@ -344,9 +335,7 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
344
335
|
builder_env=builder_env,
|
|
345
336
|
)
|
|
346
337
|
logger.info(
|
|
347
|
-
"Successfully deployed function
|
|
348
|
-
api_gateway_name=self.status.api_gateway_name,
|
|
349
|
-
authentication_mode=authentication_mode,
|
|
338
|
+
"Successfully deployed function.",
|
|
350
339
|
)
|
|
351
340
|
|
|
352
341
|
# Restore the source in case it was removed to make nuclio not consider it when building
|
|
@@ -354,14 +343,23 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
354
343
|
self.spec.build.source = self.status.application_source
|
|
355
344
|
self.save(versioned=False)
|
|
356
345
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
346
|
+
if create_default_api_gateway:
|
|
347
|
+
try:
|
|
348
|
+
api_gateway_name = self.resolve_default_api_gateway_name()
|
|
349
|
+
return self.create_api_gateway(api_gateway_name, set_as_default=True)
|
|
350
|
+
except Exception as exc:
|
|
351
|
+
logger.warning(
|
|
352
|
+
"Failed to create default API gateway, application may not be accessible. "
|
|
353
|
+
"Use the `create_api_gateway` method to make it accessible",
|
|
354
|
+
exc=mlrun.errors.err_to_str(exc),
|
|
355
|
+
)
|
|
356
|
+
elif not self.status.api_gateway:
|
|
357
|
+
logger.warning(
|
|
358
|
+
"Application is online but may not be accessible since default gateway creation was not requested."
|
|
359
|
+
"Use the `create_api_gateway` method to make it accessible."
|
|
360
|
+
)
|
|
361
|
+
|
|
362
|
+
return True
|
|
365
363
|
|
|
366
364
|
def with_source_archive(
|
|
367
365
|
self,
|
|
@@ -429,11 +427,38 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
429
427
|
self,
|
|
430
428
|
name: str = None,
|
|
431
429
|
path: str = None,
|
|
432
|
-
|
|
430
|
+
direct_port_access: bool = False,
|
|
433
431
|
authentication_mode: schemas.APIGatewayAuthenticationMode = None,
|
|
434
|
-
authentication_creds: tuple[str] = None,
|
|
432
|
+
authentication_creds: tuple[str, str] = None,
|
|
435
433
|
ssl_redirect: bool = None,
|
|
434
|
+
set_as_default: bool = False,
|
|
436
435
|
):
|
|
436
|
+
"""
|
|
437
|
+
Create the application API gateway. Once the application is deployed, the API gateway can be created.
|
|
438
|
+
An application without an API gateway is not accessible.
|
|
439
|
+
:param name: The name of the API gateway, defaults to <function-name>-<function-tag>
|
|
440
|
+
:param path: Optional path of the API gateway, default value is "/"
|
|
441
|
+
:param direct_port_access: Set True to allow direct port access to the application sidecar
|
|
442
|
+
:param authentication_mode: API Gateway authentication mode
|
|
443
|
+
:param authentication_creds: API Gateway basic authentication credentials as a tuple (username, password)
|
|
444
|
+
:param ssl_redirect: Set True to force SSL redirect, False to disable. Defaults to
|
|
445
|
+
mlrun.mlconf.force_api_gateway_ssl_redirect()
|
|
446
|
+
:param set_as_default: Set the API gateway as the default for the application (`status.api_gateway`)
|
|
447
|
+
|
|
448
|
+
:return: The API gateway URL
|
|
449
|
+
"""
|
|
450
|
+
if not name:
|
|
451
|
+
raise mlrun.errors.MLRunInvalidArgumentError(
|
|
452
|
+
"API gateway name must be specified."
|
|
453
|
+
)
|
|
454
|
+
|
|
455
|
+
if not set_as_default and name == self.resolve_default_api_gateway_name():
|
|
456
|
+
raise mlrun.errors.MLRunInvalidArgumentError(
|
|
457
|
+
f"Non-default API gateway cannot use the default gateway name, {name=}."
|
|
458
|
+
)
|
|
459
|
+
|
|
460
|
+
ports = self.spec.internal_application_port if direct_port_access else []
|
|
461
|
+
|
|
437
462
|
api_gateway = APIGateway(
|
|
438
463
|
APIGatewayMetadata(
|
|
439
464
|
name=name,
|
|
@@ -452,10 +477,10 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
452
477
|
if ssl_redirect is None:
|
|
453
478
|
ssl_redirect = mlrun.mlconf.force_api_gateway_ssl_redirect()
|
|
454
479
|
if ssl_redirect:
|
|
455
|
-
#
|
|
480
|
+
# Force ssl redirect so that the application is only accessible via https
|
|
456
481
|
api_gateway.with_force_ssl_redirect()
|
|
457
482
|
|
|
458
|
-
#
|
|
483
|
+
# Add authentication if required
|
|
459
484
|
authentication_mode = (
|
|
460
485
|
authentication_mode
|
|
461
486
|
or mlrun.mlconf.function.application.default_authentication_mode
|
|
@@ -469,14 +494,22 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
469
494
|
api_gateway_scheme = db.store_api_gateway(
|
|
470
495
|
api_gateway=api_gateway.to_scheme(), project=self.metadata.project
|
|
471
496
|
)
|
|
472
|
-
if not self.status.api_gateway_name:
|
|
473
|
-
self.status.api_gateway_name = api_gateway_scheme.metadata.name
|
|
474
|
-
self.status.api_gateway = APIGateway.from_scheme(api_gateway_scheme)
|
|
475
|
-
self.status.api_gateway.wait_for_readiness()
|
|
476
|
-
self.url = self.status.api_gateway.invoke_url
|
|
477
497
|
|
|
478
|
-
|
|
479
|
-
|
|
498
|
+
if set_as_default:
|
|
499
|
+
self.status.api_gateway_name = api_gateway_scheme.metadata.name
|
|
500
|
+
self.status.api_gateway = APIGateway.from_scheme(api_gateway_scheme)
|
|
501
|
+
self.status.api_gateway.wait_for_readiness()
|
|
502
|
+
self.url = self.status.api_gateway.invoke_url
|
|
503
|
+
url = self.url
|
|
504
|
+
else:
|
|
505
|
+
api_gateway = APIGateway.from_scheme(api_gateway_scheme)
|
|
506
|
+
api_gateway.wait_for_readiness()
|
|
507
|
+
url = api_gateway.invoke_url
|
|
508
|
+
# Update application status (enriches invocation url)
|
|
509
|
+
self._get_state(raise_on_exception=False)
|
|
510
|
+
|
|
511
|
+
logger.info("Successfully created API gateway", url=url)
|
|
512
|
+
return url
|
|
480
513
|
|
|
481
514
|
def invoke(
|
|
482
515
|
self,
|
|
@@ -493,7 +526,10 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
493
526
|
self._sync_api_gateway()
|
|
494
527
|
# If the API Gateway is not ready or not set, try to invoke the function directly (without the API Gateway)
|
|
495
528
|
if not self.status.api_gateway:
|
|
496
|
-
|
|
529
|
+
logger.warning(
|
|
530
|
+
"Default API gateway is not configured, invoking function invocation URL."
|
|
531
|
+
)
|
|
532
|
+
return super().invoke(
|
|
497
533
|
path,
|
|
498
534
|
body,
|
|
499
535
|
method,
|
|
@@ -552,6 +588,13 @@ class ApplicationRuntime(RemoteRuntime):
|
|
|
552
588
|
reverse_proxy_func.metadata.name, reverse_proxy_func.metadata.project
|
|
553
589
|
)
|
|
554
590
|
|
|
591
|
+
def resolve_default_api_gateway_name(self):
|
|
592
|
+
return (
|
|
593
|
+
f"{self.metadata.name}-{self.metadata.tag}"
|
|
594
|
+
if self.metadata.tag
|
|
595
|
+
else self.metadata.name
|
|
596
|
+
)
|
|
597
|
+
|
|
555
598
|
@min_nuclio_versions("1.13.1")
|
|
556
599
|
def disable_default_http_trigger(
|
|
557
600
|
self,
|
mlrun/utils/helpers.py
CHANGED
|
@@ -1701,11 +1701,21 @@ def validate_component_version_compatibility(
|
|
|
1701
1701
|
)
|
|
1702
1702
|
return True
|
|
1703
1703
|
|
|
1704
|
+
# Feature might have been back-ported e.g. nuclio node selection is supported from
|
|
1705
|
+
# 1.5.20 and 1.6.10 but not in 1.6.9 - therefore we reverse sort to validate against 1.6.x 1st and
|
|
1706
|
+
# then against 1.5.x
|
|
1704
1707
|
parsed_min_versions.sort(reverse=True)
|
|
1705
1708
|
for parsed_min_version in parsed_min_versions:
|
|
1706
|
-
if
|
|
1709
|
+
if (
|
|
1710
|
+
parsed_current_version.major == parsed_min_version.major
|
|
1711
|
+
and parsed_current_version.minor == parsed_min_version.minor
|
|
1712
|
+
and parsed_current_version.patch < parsed_min_version.patch
|
|
1713
|
+
):
|
|
1707
1714
|
return False
|
|
1708
|
-
|
|
1715
|
+
|
|
1716
|
+
if parsed_current_version >= parsed_min_version:
|
|
1717
|
+
return True
|
|
1718
|
+
return False
|
|
1709
1719
|
|
|
1710
1720
|
|
|
1711
1721
|
def format_alert_summary(
|
mlrun/utils/version/version.json
CHANGED
|
@@ -298,7 +298,7 @@ mlrun/runtimes/nuclio/function.py,sha256=4bKjuCIL-Hwh4gIXQSgI-7KqOOkKGHTydpdlvCR
|
|
|
298
298
|
mlrun/runtimes/nuclio/nuclio.py,sha256=sLK8KdGO1LbftlL3HqPZlFOFTAAuxJACZCVl1c0Ha6E,2942
|
|
299
299
|
mlrun/runtimes/nuclio/serving.py,sha256=eUMqtIU6NYIVgKtxfxKN7pd9_QCo_V0aurrjUSU3s08,29754
|
|
300
300
|
mlrun/runtimes/nuclio/application/__init__.py,sha256=rRs5vasy_G9IyoTpYIjYDafGoL6ifFBKgBtsXn31Atw,614
|
|
301
|
-
mlrun/runtimes/nuclio/application/application.py,sha256=
|
|
301
|
+
mlrun/runtimes/nuclio/application/application.py,sha256=sz7vwDY3rfDzOWa7RN0IqZf2EpFk8jMU2s_rEIGkzco,27582
|
|
302
302
|
mlrun/runtimes/nuclio/application/reverse_proxy.go,sha256=JIIYae6bXzCLf3jXuu49KWPQYoXr_FDQ2Rbo1OWKAd0,3150
|
|
303
303
|
mlrun/runtimes/sparkjob/__init__.py,sha256=_KPvk0qefeLtHO6lxQE_AMOGiMTG_OT48eRCE4Z2ldw,709
|
|
304
304
|
mlrun/runtimes/sparkjob/spark3job.py,sha256=fj3iiqScXNR7wvnHXvgtvgvHkGNCKAvLBX9XF17dNeI,41027
|
|
@@ -323,7 +323,7 @@ mlrun/utils/azure_vault.py,sha256=IEFizrDGDbAaoWwDr1WoA88S_EZ0T--vjYtY-i0cvYQ,34
|
|
|
323
323
|
mlrun/utils/clones.py,sha256=mJpx4nyFiY6jlBCvFABsNuyi_mr1mvfPWn81vlafpOU,7361
|
|
324
324
|
mlrun/utils/condition_evaluator.py,sha256=-nGfRmZzivn01rHTroiGY4rqEv8T1irMyhzxEei-sKc,1897
|
|
325
325
|
mlrun/utils/db.py,sha256=blQgkWMfFH9lcN4sgJQcPQgEETz2Dl_zwbVA0SslpFg,2186
|
|
326
|
-
mlrun/utils/helpers.py,sha256=
|
|
326
|
+
mlrun/utils/helpers.py,sha256=WUD4fd2B18CAoCx-8CebHVwJOPzzL1i0HoOdGrMBvnQ,58984
|
|
327
327
|
mlrun/utils/http.py,sha256=t6FrXQstZm9xVVjxqIGiLzrwZNCR4CSienSOuVgNIcI,8706
|
|
328
328
|
mlrun/utils/logger.py,sha256=cag2J30-jynIHmHZ2J8RYmVMNhYBGgAoimc5sbk-A1U,10016
|
|
329
329
|
mlrun/utils/regex.py,sha256=b0AUa2THS-ELzJj0grl5b8Stq609F2XomTZkD9SB1fQ,4900
|
|
@@ -341,11 +341,11 @@ mlrun/utils/notifications/notification/ipython.py,sha256=ZtVL30B_Ha0VGoo4LxO-voT
|
|
|
341
341
|
mlrun/utils/notifications/notification/slack.py,sha256=wqpFGr5BTvFO5KuUSzFfxsgmyU1Ohq7fbrGeNe9TXOk,7006
|
|
342
342
|
mlrun/utils/notifications/notification/webhook.py,sha256=cb9w1Mc8ENfJBdgan7iiVHK9eVls4-R3tUxmXM-P-8I,4746
|
|
343
343
|
mlrun/utils/version/__init__.py,sha256=7kkrB7hEZ3cLXoWj1kPoDwo4MaswsI2JVOBpbKgPAgc,614
|
|
344
|
-
mlrun/utils/version/version.json,sha256=
|
|
344
|
+
mlrun/utils/version/version.json,sha256=l59vjyoYyjoWJo2VqWu7D7gAuVWaSDLsuuoxCZyOKhc,89
|
|
345
345
|
mlrun/utils/version/version.py,sha256=eEW0tqIAkU9Xifxv8Z9_qsYnNhn3YH7NRAfM-pPLt1g,1878
|
|
346
|
-
mlrun-1.7.
|
|
347
|
-
mlrun-1.7.
|
|
348
|
-
mlrun-1.7.
|
|
349
|
-
mlrun-1.7.
|
|
350
|
-
mlrun-1.7.
|
|
351
|
-
mlrun-1.7.
|
|
346
|
+
mlrun-1.7.0rc40.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
347
|
+
mlrun-1.7.0rc40.dist-info/METADATA,sha256=5hWSEBis5GTHdd7Pi5G8zY6ENqBpxfXszzFsik7eqwY,19939
|
|
348
|
+
mlrun-1.7.0rc40.dist-info/WHEEL,sha256=UvcQYKBHoFqaQd6LKyqHw9fxEolWLQnlzP0h_LgJAfI,91
|
|
349
|
+
mlrun-1.7.0rc40.dist-info/entry_points.txt,sha256=1Owd16eAclD5pfRCoJpYC2ZJSyGNTtUr0nCELMioMmU,46
|
|
350
|
+
mlrun-1.7.0rc40.dist-info/top_level.txt,sha256=NObLzw3maSF9wVrgSeYBv-fgnHkAJ1kEkh12DLdd5KM,6
|
|
351
|
+
mlrun-1.7.0rc40.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|