From e906680ba5d6bcf25e695e9c16dda3b2cb82ca13 Mon Sep 17 00:00:00 2001 From: Daniele Tria Date: Mon, 1 Jul 2024 16:34:40 +0200 Subject: [PATCH 1/3] feat: add latest current and reference job status to modelOut --- api/app/models/model_dto.py | 29 ++++++++++++++-- api/app/services/model_service.py | 33 ++++++++----------- api/tests/services/model_service_test.py | 4 +-- .../models/__init__.py | 3 +- .../models/job_status.py | 8 +++++ .../models/model_definition.py | 7 ++++ sdk/tests/apis/model_test.py | 17 ++++++++++ sdk/tests/client_test.py | 13 +++++++- sdk/tests/models/model_definition_test.py | 13 +++++++- 9 files changed, 101 insertions(+), 26 deletions(-) diff --git a/api/app/models/model_dto.py b/api/app/models/model_dto.py index 85cd3738..d80988ae 100644 --- a/api/app/models/model_dto.py +++ b/api/app/models/model_dto.py @@ -7,6 +7,9 @@ from pydantic.alias_generators import to_camel from app.db.dao.model_dao import Model +from app.db.dao.reference_dataset_dao import ReferenceDataset +from app.db.dao.current_dataset_dao import CurrentDataset +from app.models.job_status import JobStatus class ModelType(str, Enum): @@ -100,6 +103,8 @@ class ModelOut(BaseModel): updated_at: str latest_reference_uuid: Optional[UUID] latest_current_uuid: Optional[UUID] + latest_reference_job_status: JobStatus + latest_current_job_status: JobStatus model_config = ConfigDict( populate_by_name=True, alias_generator=to_camel, protected_namespaces=() @@ -108,9 +113,27 @@ class ModelOut(BaseModel): @staticmethod def from_model( model: Model, - latest_reference_uuid: Optional[UUID] = None, - latest_current_uuid: Optional[UUID] = None, + latest_reference_dataset: Optional[ReferenceDataset] = None, + latest_current_dataset: Optional[CurrentDataset] = None, ): + latest_reference_uuid = ( + latest_reference_dataset.uuid if latest_reference_dataset else None + ) + latest_current_uuid = ( + latest_current_dataset.uuid if latest_current_dataset else None + ) + + latest_reference_job_status = ( + latest_reference_dataset.status + if latest_reference_dataset + else JobStatus.MISSING_REFERENCE + ) + latest_current_job_status = ( + latest_current_dataset.status + if latest_current_dataset + else JobStatus.MISSING_CURRENT + ) + return ModelOut( uuid=model.uuid, name=model.name, @@ -128,4 +151,6 @@ def from_model( updated_at=str(model.updated_at), latest_reference_uuid=latest_reference_uuid, latest_current_uuid=latest_current_uuid, + latest_reference_job_status=latest_reference_job_status, + latest_current_job_status=latest_current_job_status, ) diff --git a/api/app/services/model_service.py b/api/app/services/model_service.py index 4e7ed4e0..9dd77758 100644 --- a/api/app/services/model_service.py +++ b/api/app/services/model_service.py @@ -6,7 +6,9 @@ from app.db.dao.current_dataset_dao import CurrentDatasetDAO from app.db.dao.model_dao import ModelDAO from app.db.dao.reference_dataset_dao import ReferenceDatasetDAO +from app.db.tables.current_dataset_table import CurrentDataset from app.db.tables.model_table import Model +from app.db.tables.reference_dataset_table import ReferenceDataset from app.models.exceptions import ModelInternalError, ModelNotFoundError from app.models.model_dto import ModelIn, ModelOut from app.models.model_order import OrderType @@ -35,13 +37,13 @@ def create_model(self, model_in: ModelIn) -> ModelOut: def get_model_by_uuid(self, model_uuid: UUID) -> Optional[ModelOut]: model = self.check_and_get_model(model_uuid) - latest_reference_uuid, latest_current_uuid = self.get_latest_dataset_uuids( + latest_reference_dataset, latest_current_dataset = self.get_latest_datasets( model_uuid ) return ModelOut.from_model( model=model, - latest_reference_uuid=latest_reference_uuid, - latest_current_uuid=latest_current_uuid, + latest_reference_dataset=latest_reference_dataset, + latest_current_dataset=latest_current_dataset, ) def delete_model(self, model_uuid: UUID) -> Optional[ModelOut]: @@ -55,13 +57,13 @@ def get_all_models( models = self.model_dao.get_all() model_out_list = [] for model in models: - latest_reference_uuid, latest_current_uuid = self.get_latest_dataset_uuids( + latest_reference_dataset, latest_current_dataset = self.get_latest_datasets( model.uuid ) model_out = ModelOut.from_model( model=model, - latest_reference_uuid=latest_reference_uuid, - latest_current_uuid=latest_current_uuid, + latest_reference_dataset=latest_reference_dataset, + latest_current_dataset=latest_current_dataset, ) model_out_list.append(model_out) return model_out_list @@ -78,13 +80,13 @@ def get_all_models_paginated( _items = [] for model in models.items: - latest_reference_uuid, latest_current_uuid = self.get_latest_dataset_uuids( + latest_reference_dataset, latest_current_dataset = self.get_latest_datasets( model.uuid ) model_out = ModelOut.from_model( model=model, - latest_reference_uuid=latest_reference_uuid, - latest_current_uuid=latest_current_uuid, + latest_reference_dataset=latest_reference_dataset, + latest_current_dataset=latest_current_dataset, ) _items.append(model_out) @@ -96,9 +98,9 @@ def check_and_get_model(self, model_uuid: UUID) -> Model: raise ModelNotFoundError(f'Model {model_uuid} not found') return model - def get_latest_dataset_uuids( + def get_latest_datasets( self, model_uuid: UUID - ) -> (Optional[UUID], Optional[UUID]): + ) -> (Optional[ReferenceDataset], Optional[CurrentDataset]): latest_reference_dataset = ( self.rd_dao.get_latest_reference_dataset_by_model_uuid(model_uuid) ) @@ -106,11 +108,4 @@ def get_latest_dataset_uuids( model_uuid ) - latest_reference_uuid = ( - latest_reference_dataset.uuid if latest_reference_dataset else None - ) - latest_current_uuid = ( - latest_current_dataset.uuid if latest_current_dataset else None - ) - - return latest_reference_uuid, latest_current_uuid + return latest_reference_dataset, latest_current_dataset diff --git a/api/tests/services/model_service_test.py b/api/tests/services/model_service_test.py index 1564c195..02e6a669 100644 --- a/api/tests/services/model_service_test.py +++ b/api/tests/services/model_service_test.py @@ -55,8 +55,8 @@ def test_get_model_by_uuid_ok(self): assert res == ModelOut.from_model( model=model, - latest_reference_uuid=reference_dataset.uuid, - latest_current_uuid=current_dataset.uuid, + latest_reference_dataset=reference_dataset, + latest_current_dataset=current_dataset, ) def test_get_model_by_uuid_not_found(self): diff --git a/sdk/radicalbit_platform_sdk/models/__init__.py b/sdk/radicalbit_platform_sdk/models/__init__.py index 6e7be01a..dd66dd28 100644 --- a/sdk/radicalbit_platform_sdk/models/__init__.py +++ b/sdk/radicalbit_platform_sdk/models/__init__.py @@ -33,7 +33,7 @@ ) from .dataset_stats import DatasetStats from .file_upload_result import CurrentFileUpload, FileReference, ReferenceFileUpload -from .job_status import JobStatus +from .job_status import JobStatus, JobStatusWithMissingDatasetStatus from .model_definition import ( CreateModel, Granularity, @@ -49,6 +49,7 @@ 'ModelDefinition', 'ColumnDefinition', 'JobStatus', + 'JobStatusWithMissingDatasetStatus', 'DataType', 'ModelType', 'DatasetStats', diff --git a/sdk/radicalbit_platform_sdk/models/job_status.py b/sdk/radicalbit_platform_sdk/models/job_status.py index e8bae428..f2a02321 100644 --- a/sdk/radicalbit_platform_sdk/models/job_status.py +++ b/sdk/radicalbit_platform_sdk/models/job_status.py @@ -5,3 +5,11 @@ class JobStatus(str, Enum): IMPORTING = 'IMPORTING' SUCCEEDED = 'SUCCEEDED' ERROR = 'ERROR' + + +class JobStatusWithMissingDatasetStatus(str, Enum): + IMPORTING = JobStatus.IMPORTING + SUCCEEDED = JobStatus.SUCCEEDED + ERROR = JobStatus.ERROR + MISSING_REFERENCE = 'MISSING_REFERENCE' + MISSING_CURRENT = 'MISSING_CURRENT' diff --git a/sdk/radicalbit_platform_sdk/models/model_definition.py b/sdk/radicalbit_platform_sdk/models/model_definition.py index 3fb6b4ba..bb43d76d 100644 --- a/sdk/radicalbit_platform_sdk/models/model_definition.py +++ b/sdk/radicalbit_platform_sdk/models/model_definition.py @@ -5,6 +5,7 @@ from pydantic import BaseModel, ConfigDict, Field from pydantic.alias_generators import to_camel +from radicalbit_platform_sdk.models import JobStatusWithMissingDatasetStatus from radicalbit_platform_sdk.models.column_definition import ColumnDefinition from radicalbit_platform_sdk.models.data_type import DataType from radicalbit_platform_sdk.models.model_type import ModelType @@ -70,5 +71,11 @@ class ModelDefinition(BaseModelDefinition): updated_at: str = Field(alias='updatedAt') latest_reference_uuid: Optional[uuid_lib.UUID] = Field(alias='latestReferenceUuid') latest_current_uuid: Optional[uuid_lib.UUID] = Field(alias='latestCurrentUuid') + latest_reference_job_status: JobStatusWithMissingDatasetStatus = Field( + alias='latestReferenceJobStatus' + ) + latest_current_job_status: JobStatusWithMissingDatasetStatus = Field( + alias='latestCurrentJobStatus' + ) model_config = ConfigDict(populate_by_name=True, alias_generator=to_camel) diff --git a/sdk/tests/apis/model_test.py b/sdk/tests/apis/model_test.py index a33adc83..9a6c262d 100644 --- a/sdk/tests/apis/model_test.py +++ b/sdk/tests/apis/model_test.py @@ -15,6 +15,7 @@ DataType, Granularity, JobStatus, + JobStatusWithMissingDatasetStatus, ModelDefinition, ModelType, OutputType, @@ -45,6 +46,8 @@ def test_delete_model(self): updated_at=str(time.time()), latest_reference_uuid=uuid.uuid4(), latest_current_uuid=uuid.uuid4(), + latest_reference_job_status=JobStatusWithMissingDatasetStatus.MISSING_REFERENCE, + latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ), ) responses.add( @@ -84,6 +87,8 @@ def test_load_reference_dataset_without_object_name(self): updated_at=str(time.time()), latest_reference_uuid=uuid.uuid4(), latest_current_uuid=uuid.uuid4(), + latest_reference_job_status=JobStatusWithMissingDatasetStatus.IMPORTING, + latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ), ) response = ReferenceFileUpload( @@ -131,6 +136,8 @@ def test_load_reference_dataset_with_different_separator(self): updated_at=str(time.time()), latest_reference_uuid=uuid.uuid4(), latest_current_uuid=uuid.uuid4(), + latest_reference_job_status=JobStatusWithMissingDatasetStatus.IMPORTING, + latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ), ) response = ReferenceFileUpload( @@ -178,6 +185,8 @@ def test_load_reference_dataset_with_object_name(self): updated_at=str(time.time()), latest_reference_uuid=uuid.uuid4(), latest_current_uuid=uuid.uuid4(), + latest_reference_job_status=JobStatusWithMissingDatasetStatus.IMPORTING, + latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ), ) response = ReferenceFileUpload( @@ -216,6 +225,8 @@ def test_load_reference_dataset_wrong_headers(self): updated_at=str(time.time()), latest_reference_uuid=None, latest_current_uuid=None, + latest_reference_job_status=JobStatusWithMissingDatasetStatus.MISSING_REFERENCE, + latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ), ) with pytest.raises(ClientError): @@ -251,6 +262,8 @@ def test_load_current_dataset_without_object_name(self): updated_at=str(time.time()), latest_reference_uuid=uuid.uuid4(), latest_current_uuid=uuid.uuid4(), + latest_reference_job_status=JobStatusWithMissingDatasetStatus.SUCCEEDED, + latest_current_job_status=JobStatusWithMissingDatasetStatus.IMPORTING, ), ) response = CurrentFileUpload( @@ -304,6 +317,8 @@ def test_load_current_dataset_with_object_name(self): updated_at=str(time.time()), latest_reference_uuid=uuid.uuid4(), latest_current_uuid=uuid.uuid4(), + latest_reference_job_status=JobStatusWithMissingDatasetStatus.SUCCEEDED, + latest_current_job_status=JobStatusWithMissingDatasetStatus.IMPORTING, ), ) response = CurrentFileUpload( @@ -348,6 +363,8 @@ def test_load_current_dataset_wrong_headers(self): updated_at=str(time.time()), latest_reference_uuid=None, latest_current_uuid=None, + latest_reference_job_status=JobStatusWithMissingDatasetStatus.SUCCEEDED, + latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ), ) with pytest.raises(ClientError): diff --git a/sdk/tests/client_test.py b/sdk/tests/client_test.py index 1cf8fb24..e301bf62 100644 --- a/sdk/tests/client_test.py +++ b/sdk/tests/client_test.py @@ -12,6 +12,7 @@ CreateModel, DataType, Granularity, + JobStatusWithMissingDatasetStatus, ModelDefinition, ModelType, OutputType, @@ -41,6 +42,10 @@ def test_get_model(self): ts = str(time.time()) latest_reference_uuid = uuid.uuid4() latest_current_uuid = uuid.uuid4() + latest_reference_job_status = ( + JobStatusWithMissingDatasetStatus.MISSING_REFERENCE + ) + latest_current_job_status = JobStatusWithMissingDatasetStatus.MISSING_CURRENT json_string = f"""{{ "uuid": "{str(model_id)}", "name": "{name}", @@ -79,7 +84,9 @@ def test_get_model(self): "createdAt": "{ts}", "updatedAt": "{ts}", "latestReferenceUuid": "{str(latest_reference_uuid)}", - "latestCurrentUuid": "{str(latest_current_uuid)}" + "latestCurrentUuid": "{str(latest_current_uuid)}", + "latestReferenceJobStatus": "{latest_reference_job_status.value}", + "latestCurrentJobStatus": "{latest_current_job_status.value}" }}""" responses.add( method=responses.GET, @@ -158,6 +165,8 @@ def test_create_model(self): updated_at=str(time.time()), latest_reference_uuid=None, latest_current_uuid=None, + latest_reference_job_status=JobStatusWithMissingDatasetStatus.MISSING_REFERENCE, + latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ) responses.add( method=responses.POST, @@ -201,6 +210,8 @@ def test_search_models(self): updated_at=str(time.time()), latest_reference_uuid=None, latest_current_uuid=None, + latest_reference_job_status=JobStatusWithMissingDatasetStatus.MISSING_REFERENCE, + latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ) responses.add( diff --git a/sdk/tests/models/model_definition_test.py b/sdk/tests/models/model_definition_test.py index 7d904ff0..3a7091c1 100644 --- a/sdk/tests/models/model_definition_test.py +++ b/sdk/tests/models/model_definition_test.py @@ -6,6 +6,7 @@ from radicalbit_platform_sdk.models import ( DataType, Granularity, + JobStatusWithMissingDatasetStatus, ModelDefinition, ModelType, ) @@ -32,6 +33,10 @@ def test_model_definition_from_json(self): ts = str(time.time()) latest_reference_uuid = uuid.uuid4() latest_current_uuid = uuid.uuid4() + latest_reference_job_status = ( + JobStatusWithMissingDatasetStatus.MISSING_REFERENCE + ) + latest_current_job_status = JobStatusWithMissingDatasetStatus.MISSING_CURRENT json_string = f"""{{ "uuid": "{str(id)}", "name": "{name}", @@ -70,7 +75,9 @@ def test_model_definition_from_json(self): "createdAt": "{ts}", "updatedAt": "{ts}", "latestReferenceUuid": "{str(latest_reference_uuid)}", - "latestCurrentUuid": "{str(latest_current_uuid)}" + "latestCurrentUuid": "{str(latest_current_uuid)}", + "latestReferenceJobStatus": "{latest_reference_job_status.value}", + "latestCurrentJobStatus": "{latest_current_job_status.value}" }}""" model_definition = ModelDefinition.model_validate(json.loads(json_string)) assert model_definition.uuid == id @@ -85,6 +92,10 @@ def test_model_definition_from_json(self): assert model_definition.updated_at == ts assert model_definition.latest_reference_uuid == latest_reference_uuid assert model_definition.latest_current_uuid == latest_current_uuid + assert ( + model_definition.latest_reference_job_status == latest_reference_job_status + ) + assert model_definition.latest_current_job_status == latest_current_job_status assert len(model_definition.features) == 1 assert model_definition.features[0].name == feature_name assert model_definition.features[0].type == feature_type From 7e9eddabae55958fa18a4e14e8670f780e9afe9c Mon Sep 17 00:00:00 2001 From: Daniele Tria Date: Mon, 1 Jul 2024 16:37:57 +0200 Subject: [PATCH 2/3] fix: align with main --- api/app/models/model_dto.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/api/app/models/model_dto.py b/api/app/models/model_dto.py index 64c699cb..2d47188a 100644 --- a/api/app/models/model_dto.py +++ b/api/app/models/model_dto.py @@ -6,12 +6,12 @@ from pydantic import BaseModel, ConfigDict, model_validator from pydantic.alias_generators import to_camel +from app.db.dao.current_dataset_dao import CurrentDataset from app.db.dao.model_dao import Model -from app.models.inferred_schema_dto import SupportedTypes -from app.models.utils import is_none, is_number, is_number_or_string, is_optional_float from app.db.dao.reference_dataset_dao import ReferenceDataset -from app.db.dao.current_dataset_dao import CurrentDataset +from app.models.inferred_schema_dto import SupportedTypes from app.models.job_status import JobStatus +from app.models.utils import is_none, is_number, is_number_or_string, is_optional_float class ModelType(str, Enum): From bb3b782cd41a63d14b36b9bc30d206dd5233d1cf Mon Sep 17 00:00:00 2001 From: Daniele Tria Date: Mon, 1 Jul 2024 18:39:24 +0200 Subject: [PATCH 3/3] fix: remove unused model definition fields into the sdk --- .../models/__init__.py | 3 +- .../models/job_status.py | 8 ----- .../models/model_definition.py | 9 ----- sdk/tests/apis/model_test.py | 33 ------------------- sdk/tests/client_test.py | 21 +----------- sdk/tests/models/model_definition_test.py | 19 +---------- 6 files changed, 3 insertions(+), 90 deletions(-) diff --git a/sdk/radicalbit_platform_sdk/models/__init__.py b/sdk/radicalbit_platform_sdk/models/__init__.py index dd66dd28..6e7be01a 100644 --- a/sdk/radicalbit_platform_sdk/models/__init__.py +++ b/sdk/radicalbit_platform_sdk/models/__init__.py @@ -33,7 +33,7 @@ ) from .dataset_stats import DatasetStats from .file_upload_result import CurrentFileUpload, FileReference, ReferenceFileUpload -from .job_status import JobStatus, JobStatusWithMissingDatasetStatus +from .job_status import JobStatus from .model_definition import ( CreateModel, Granularity, @@ -49,7 +49,6 @@ 'ModelDefinition', 'ColumnDefinition', 'JobStatus', - 'JobStatusWithMissingDatasetStatus', 'DataType', 'ModelType', 'DatasetStats', diff --git a/sdk/radicalbit_platform_sdk/models/job_status.py b/sdk/radicalbit_platform_sdk/models/job_status.py index f2a02321..e8bae428 100644 --- a/sdk/radicalbit_platform_sdk/models/job_status.py +++ b/sdk/radicalbit_platform_sdk/models/job_status.py @@ -5,11 +5,3 @@ class JobStatus(str, Enum): IMPORTING = 'IMPORTING' SUCCEEDED = 'SUCCEEDED' ERROR = 'ERROR' - - -class JobStatusWithMissingDatasetStatus(str, Enum): - IMPORTING = JobStatus.IMPORTING - SUCCEEDED = JobStatus.SUCCEEDED - ERROR = JobStatus.ERROR - MISSING_REFERENCE = 'MISSING_REFERENCE' - MISSING_CURRENT = 'MISSING_CURRENT' diff --git a/sdk/radicalbit_platform_sdk/models/model_definition.py b/sdk/radicalbit_platform_sdk/models/model_definition.py index bb43d76d..eb47445c 100644 --- a/sdk/radicalbit_platform_sdk/models/model_definition.py +++ b/sdk/radicalbit_platform_sdk/models/model_definition.py @@ -5,7 +5,6 @@ from pydantic import BaseModel, ConfigDict, Field from pydantic.alias_generators import to_camel -from radicalbit_platform_sdk.models import JobStatusWithMissingDatasetStatus from radicalbit_platform_sdk.models.column_definition import ColumnDefinition from radicalbit_platform_sdk.models.data_type import DataType from radicalbit_platform_sdk.models.model_type import ModelType @@ -69,13 +68,5 @@ class ModelDefinition(BaseModelDefinition): uuid: uuid_lib.UUID = Field(default_factory=lambda: uuid_lib.uuid4()) created_at: str = Field(alias='createdAt') updated_at: str = Field(alias='updatedAt') - latest_reference_uuid: Optional[uuid_lib.UUID] = Field(alias='latestReferenceUuid') - latest_current_uuid: Optional[uuid_lib.UUID] = Field(alias='latestCurrentUuid') - latest_reference_job_status: JobStatusWithMissingDatasetStatus = Field( - alias='latestReferenceJobStatus' - ) - latest_current_job_status: JobStatusWithMissingDatasetStatus = Field( - alias='latestCurrentJobStatus' - ) model_config = ConfigDict(populate_by_name=True, alias_generator=to_camel) diff --git a/sdk/tests/apis/model_test.py b/sdk/tests/apis/model_test.py index 9a6c262d..fd93c8b2 100644 --- a/sdk/tests/apis/model_test.py +++ b/sdk/tests/apis/model_test.py @@ -15,7 +15,6 @@ DataType, Granularity, JobStatus, - JobStatusWithMissingDatasetStatus, ModelDefinition, ModelType, OutputType, @@ -44,10 +43,6 @@ def test_delete_model(self): timestamp=column_def, created_at=str(time.time()), updated_at=str(time.time()), - latest_reference_uuid=uuid.uuid4(), - latest_current_uuid=uuid.uuid4(), - latest_reference_job_status=JobStatusWithMissingDatasetStatus.MISSING_REFERENCE, - latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ), ) responses.add( @@ -85,10 +80,6 @@ def test_load_reference_dataset_without_object_name(self): timestamp=ColumnDefinition(name='created_at', type='str'), created_at=str(time.time()), updated_at=str(time.time()), - latest_reference_uuid=uuid.uuid4(), - latest_current_uuid=uuid.uuid4(), - latest_reference_job_status=JobStatusWithMissingDatasetStatus.IMPORTING, - latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ), ) response = ReferenceFileUpload( @@ -134,10 +125,6 @@ def test_load_reference_dataset_with_different_separator(self): timestamp=ColumnDefinition(name='created_at', type='str'), created_at=str(time.time()), updated_at=str(time.time()), - latest_reference_uuid=uuid.uuid4(), - latest_current_uuid=uuid.uuid4(), - latest_reference_job_status=JobStatusWithMissingDatasetStatus.IMPORTING, - latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ), ) response = ReferenceFileUpload( @@ -183,10 +170,6 @@ def test_load_reference_dataset_with_object_name(self): timestamp=ColumnDefinition(name='created_at', type='str'), created_at=str(time.time()), updated_at=str(time.time()), - latest_reference_uuid=uuid.uuid4(), - latest_current_uuid=uuid.uuid4(), - latest_reference_job_status=JobStatusWithMissingDatasetStatus.IMPORTING, - latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ), ) response = ReferenceFileUpload( @@ -223,10 +206,6 @@ def test_load_reference_dataset_wrong_headers(self): timestamp=ColumnDefinition(name='created_at', type='str'), created_at=str(time.time()), updated_at=str(time.time()), - latest_reference_uuid=None, - latest_current_uuid=None, - latest_reference_job_status=JobStatusWithMissingDatasetStatus.MISSING_REFERENCE, - latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ), ) with pytest.raises(ClientError): @@ -260,10 +239,6 @@ def test_load_current_dataset_without_object_name(self): timestamp=ColumnDefinition(name='created_at', type='str'), created_at=str(time.time()), updated_at=str(time.time()), - latest_reference_uuid=uuid.uuid4(), - latest_current_uuid=uuid.uuid4(), - latest_reference_job_status=JobStatusWithMissingDatasetStatus.SUCCEEDED, - latest_current_job_status=JobStatusWithMissingDatasetStatus.IMPORTING, ), ) response = CurrentFileUpload( @@ -315,10 +290,6 @@ def test_load_current_dataset_with_object_name(self): timestamp=ColumnDefinition(name='created_at', type='str'), created_at=str(time.time()), updated_at=str(time.time()), - latest_reference_uuid=uuid.uuid4(), - latest_current_uuid=uuid.uuid4(), - latest_reference_job_status=JobStatusWithMissingDatasetStatus.SUCCEEDED, - latest_current_job_status=JobStatusWithMissingDatasetStatus.IMPORTING, ), ) response = CurrentFileUpload( @@ -361,10 +332,6 @@ def test_load_current_dataset_wrong_headers(self): timestamp=ColumnDefinition(name='created_at', type='str'), created_at=str(time.time()), updated_at=str(time.time()), - latest_reference_uuid=None, - latest_current_uuid=None, - latest_reference_job_status=JobStatusWithMissingDatasetStatus.SUCCEEDED, - latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ), ) with pytest.raises(ClientError): diff --git a/sdk/tests/client_test.py b/sdk/tests/client_test.py index e301bf62..c07d28be 100644 --- a/sdk/tests/client_test.py +++ b/sdk/tests/client_test.py @@ -12,7 +12,6 @@ CreateModel, DataType, Granularity, - JobStatusWithMissingDatasetStatus, ModelDefinition, ModelType, OutputType, @@ -40,12 +39,6 @@ def test_get_model(self): timestamp_name = 'when' timestamp_type = 'str' ts = str(time.time()) - latest_reference_uuid = uuid.uuid4() - latest_current_uuid = uuid.uuid4() - latest_reference_job_status = ( - JobStatusWithMissingDatasetStatus.MISSING_REFERENCE - ) - latest_current_job_status = JobStatusWithMissingDatasetStatus.MISSING_CURRENT json_string = f"""{{ "uuid": "{str(model_id)}", "name": "{name}", @@ -82,11 +75,7 @@ def test_get_model(self): "algorithm": "{algorithm}", "frameworks": "{frameworks}", "createdAt": "{ts}", - "updatedAt": "{ts}", - "latestReferenceUuid": "{str(latest_reference_uuid)}", - "latestCurrentUuid": "{str(latest_current_uuid)}", - "latestReferenceJobStatus": "{latest_reference_job_status.value}", - "latestCurrentJobStatus": "{latest_current_job_status.value}" + "updatedAt": "{ts}" }}""" responses.add( method=responses.GET, @@ -163,10 +152,6 @@ def test_create_model(self): timestamp=model.timestamp, created_at=str(time.time()), updated_at=str(time.time()), - latest_reference_uuid=None, - latest_current_uuid=None, - latest_reference_job_status=JobStatusWithMissingDatasetStatus.MISSING_REFERENCE, - latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ) responses.add( method=responses.POST, @@ -208,10 +193,6 @@ def test_search_models(self): timestamp=ColumnDefinition(name='tst_column', type='string'), created_at=str(time.time()), updated_at=str(time.time()), - latest_reference_uuid=None, - latest_current_uuid=None, - latest_reference_job_status=JobStatusWithMissingDatasetStatus.MISSING_REFERENCE, - latest_current_job_status=JobStatusWithMissingDatasetStatus.MISSING_CURRENT, ) responses.add( diff --git a/sdk/tests/models/model_definition_test.py b/sdk/tests/models/model_definition_test.py index 3a7091c1..c7a9a48b 100644 --- a/sdk/tests/models/model_definition_test.py +++ b/sdk/tests/models/model_definition_test.py @@ -6,7 +6,6 @@ from radicalbit_platform_sdk.models import ( DataType, Granularity, - JobStatusWithMissingDatasetStatus, ModelDefinition, ModelType, ) @@ -31,12 +30,6 @@ def test_model_definition_from_json(self): timestamp_name = 'when' timestamp_type = 'str' ts = str(time.time()) - latest_reference_uuid = uuid.uuid4() - latest_current_uuid = uuid.uuid4() - latest_reference_job_status = ( - JobStatusWithMissingDatasetStatus.MISSING_REFERENCE - ) - latest_current_job_status = JobStatusWithMissingDatasetStatus.MISSING_CURRENT json_string = f"""{{ "uuid": "{str(id)}", "name": "{name}", @@ -73,11 +66,7 @@ def test_model_definition_from_json(self): "algorithm": "{algorithm}", "frameworks": "{frameworks}", "createdAt": "{ts}", - "updatedAt": "{ts}", - "latestReferenceUuid": "{str(latest_reference_uuid)}", - "latestCurrentUuid": "{str(latest_current_uuid)}", - "latestReferenceJobStatus": "{latest_reference_job_status.value}", - "latestCurrentJobStatus": "{latest_current_job_status.value}" + "updatedAt": "{ts}" }}""" model_definition = ModelDefinition.model_validate(json.loads(json_string)) assert model_definition.uuid == id @@ -90,12 +79,6 @@ def test_model_definition_from_json(self): assert model_definition.frameworks == frameworks assert model_definition.created_at == ts assert model_definition.updated_at == ts - assert model_definition.latest_reference_uuid == latest_reference_uuid - assert model_definition.latest_current_uuid == latest_current_uuid - assert ( - model_definition.latest_reference_job_status == latest_reference_job_status - ) - assert model_definition.latest_current_job_status == latest_current_job_status assert len(model_definition.features) == 1 assert model_definition.features[0].name == feature_name assert model_definition.features[0].type == feature_type