Skip to content

Commit

Permalink
[Application] Fix the application runtime min nuclio versions error m…
Browse files Browse the repository at this point in the history
…essage (#5718)
  • Loading branch information
moranbental committed Jun 5, 2024
1 parent 4f1041f commit c5042e0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion mlrun/runtimes/nuclio/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from datetime import datetime
from time import sleep

import inflection
import nuclio
import nuclio.utils
import requests
Expand Down Expand Up @@ -65,7 +66,14 @@ def wrapper(*args, **kwargs):
if validate_nuclio_version_compatibility(*versions):
return function(*args, **kwargs)

message = f"'{function.__qualname__}' function requires Nuclio v{' or v'.join(versions)} or higher"
if function.__name__ == "__init__":
name = inflection.titleize(function.__qualname__.split(".")[0])
else:
name = function.__qualname__

message = (
f"'{name}' function requires Nuclio v{' or v'.join(versions)} or higher"
)
raise mlrun.errors.MLRunIncompatibleVersionError(message)

return wrapper
Expand Down
2 changes: 1 addition & 1 deletion tests/api/runtimes/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_create_function_validate_min_nuclio_version(
self._generate_runtime(self.runtime_kind)
assert (
str(exc.value)
== "'ApplicationRuntime.__init__' function requires Nuclio v1.13.1 or higher"
== "'Application Runtime' function requires Nuclio v1.13.1 or higher"
)

def _execute_run(self, runtime, **kwargs):
Expand Down

0 comments on commit c5042e0

Please sign in to comment.