diff --git a/anaconda-project.yml b/anaconda-project.yml index c070a67..a734267 100644 --- a/anaconda-project.yml +++ b/anaconda-project.yml @@ -75,10 +75,6 @@ env_specs: - defaults:pydantic>=2.0,<3 - defaults:click - defaults:requests - - defaults:pip - - pip: - - mlserver - - mlserver-mlflow # Project Maintenance and Development - defaults:anaconda-project diff --git a/mlflow_adsp/common/adsp.py b/mlflow_adsp/common/adsp.py index 3706b8b..62f05da 100644 --- a/mlflow_adsp/common/adsp.py +++ b/mlflow_adsp/common/adsp.py @@ -47,7 +47,7 @@ def get_project_id() -> str: """ if "TOOL_PROJECT_URL" in os.environ: - # When executing within a session this seems to be the most reliable method for getting a context id. + # When executing within a session, this seems to be the most reliable method for getting a context id. var_name: str = "TOOL_PROJECT_URL" elif "APP_SOURCE" in os.environ: # When executing within a scheduled job this seems to be the most reliable method for getting a context id. diff --git a/mlflow_adsp/common/scheduler.py b/mlflow_adsp/common/scheduler.py index f7b7980..c4357ca 100644 --- a/mlflow_adsp/common/scheduler.py +++ b/mlflow_adsp/common/scheduler.py @@ -166,7 +166,7 @@ def execute_step(step: Step) -> ADSPSubmittedRun: An instance of `SubmittedRun` for the requested workflow step run. """ - step_dict: Dict = step.model_dump(by_alias=False) + step_dict: Dict = step.model_dump() message: str = f"Launching new background job for: {step_dict}" logger.debug(message) diff --git a/mlflow_adsp/contracts/dto/base_model.py b/mlflow_adsp/contracts/dto/base_model.py index b5ff1f1..01f0c78 100644 --- a/mlflow_adsp/contracts/dto/base_model.py +++ b/mlflow_adsp/contracts/dto/base_model.py @@ -1,38 +1,15 @@ """ Base Model (Pydantic) Over-Ride """ -from typing import List - # pylint: disable=no-name-in-module from pydantic import BaseModel as PydanticBaseModel -def lower_camel_case(string: str) -> str: - """ - Alias Generator Definition - Used for externally based consumption - . - Parameters - ---------- - string: str - The input string to change casing of. - Returns - ------- - new_string: str - A new string which has been camel cased. - """ - - string_list: List[str] = string.split("_") - prefix: str = string_list[0] - suffix: str = "".join(word.capitalize() for word in string_list[1:]) - return prefix + suffix - - class BaseModel(PydanticBaseModel): """BaseModel [Pydantic] Over-Ride""" - # Pydantic Config Over-Ride + # https://pydantic-docs.helpmanual.io/usage/model_config/#options class Config: - alias_generator = lower_camel_case - populate_by_name = True + """Pydantic Config Over-Ride""" + arbitrary_types_allowed = True use_enum_values = True diff --git a/test/unit/common/test_scheduler.py b/test/unit/common/test_scheduler.py index eec55b8..2eb68d9 100644 --- a/test/unit/common/test_scheduler.py +++ b/test/unit/common/test_scheduler.py @@ -45,7 +45,7 @@ def test_execute_step(monkeypatch): # Review the results mock: MagicMock = mlflow.projects.run - mock.assert_called_once_with(**Step.parse_obj({}).dict(by_alias=False)) + mock.assert_called_once_with(**mock_request.model_dump()) ############################################################################### diff --git a/test/unit/services/test_endpoint_manager.py b/test/unit/services/test_endpoint_manager.py index b6ed182..dcf23bf 100644 --- a/test/unit/services/test_endpoint_manager.py +++ b/test/unit/services/test_endpoint_manager.py @@ -386,7 +386,7 @@ def test_poll_network_service_gracefully_fails(monkeypatch): client: MagicMock = MagicMock() monkeypatch.setattr(subprocess, "Popen", MockPOpen) - def mock_get(url): + def mock_get(url, timeout): raise requests.exceptions.ConnectionError("Boom!") monkeypatch.setattr(requests, "get", mock_get)