diff --git a/src/neptune_scale/core/components/sync_process.py b/src/neptune_scale/core/components/sync_process.py index bd586448..6935c731 100644 --- a/src/neptune_scale/core/components/sync_process.py +++ b/src/neptune_scale/core/components/sync_process.py @@ -63,13 +63,13 @@ ) from neptune_scale.core.util import safe_signal_name from neptune_scale.exceptions import ( + NeptuneAttributePathEmpty, + NeptuneAttributePathExceedsSizeLimit, + NeptuneAttributePathInvalid, + NeptuneAttributePathNonWritable, + NeptuneAttributeTypeMismatch, + NeptuneAttributeTypeUnsupported, NeptuneConnectionLostError, - NeptuneFieldPathEmpty, - NeptuneFieldPathExceedsSizeLimit, - NeptuneFieldPathInvalid, - NeptuneFieldPathNonWritable, - NeptuneFieldTypeConflicting, - NeptuneFieldTypeUnsupported, NeptuneFloatValueNanInfUnsupported, NeptuneInternalServerError, NeptuneInvalidCredentialsError, @@ -118,12 +118,12 @@ IngestCode.RUN_CONFLICTING: NeptuneRunConflicting, IngestCode.RUN_FORK_PARENT_NOT_FOUND: NeptuneRunForkParentNotFound, IngestCode.RUN_INVALID_CREATION_PARAMETERS: NeptuneRunInvalidCreationParameters, - IngestCode.FIELD_PATH_EXCEEDS_SIZE_LIMIT: NeptuneFieldPathExceedsSizeLimit, - IngestCode.FIELD_PATH_EMPTY: NeptuneFieldPathEmpty, - IngestCode.FIELD_PATH_INVALID: NeptuneFieldPathInvalid, - IngestCode.FIELD_PATH_NON_WRITABLE: NeptuneFieldPathNonWritable, - IngestCode.FIELD_TYPE_UNSUPPORTED: NeptuneFieldTypeUnsupported, - IngestCode.FIELD_TYPE_CONFLICTING: NeptuneFieldTypeConflicting, + IngestCode.FIELD_PATH_EXCEEDS_SIZE_LIMIT: NeptuneAttributePathExceedsSizeLimit, + IngestCode.FIELD_PATH_EMPTY: NeptuneAttributePathEmpty, + IngestCode.FIELD_PATH_INVALID: NeptuneAttributePathInvalid, + IngestCode.FIELD_PATH_NON_WRITABLE: NeptuneAttributePathNonWritable, + IngestCode.FIELD_TYPE_UNSUPPORTED: NeptuneAttributeTypeUnsupported, + IngestCode.FIELD_TYPE_CONFLICTING: NeptuneAttributeTypeMismatch, IngestCode.SERIES_POINT_DUPLICATE: NeptuneSeriesPointDuplicate, IngestCode.SERIES_STEP_NON_INCREASING: NeptuneSeriesStepNonIncreasing, IngestCode.SERIES_STEP_NOT_AFTER_FORK_POINT: NeptuneSeriesStepNotAfterForkPoint, diff --git a/src/neptune_scale/core/serialization.py b/src/neptune_scale/core/serialization.py index 3c4c8cf2..76516746 100644 --- a/src/neptune_scale/core/serialization.py +++ b/src/neptune_scale/core/serialization.py @@ -38,7 +38,7 @@ def make_value(value: Union[Value, float, str, int, bool, datetime, List[str], S elif isinstance(value, (list, set, tuple)): return Value(string_set=StringSet(values=value)) else: - raise ValueError(f"Unsupported ingest field value type: {type(value)}") + raise ValueError(f"Unsupported value type: {type(value)}") def datetime_to_proto(dt: datetime) -> Timestamp: diff --git a/src/neptune_scale/exceptions.py b/src/neptune_scale/exceptions.py index ec932872..c15c38d8 100644 --- a/src/neptune_scale/exceptions.py +++ b/src/neptune_scale/exceptions.py @@ -19,12 +19,12 @@ "NeptuneRunConflicting", "NeptuneRunForkParentNotFound", "NeptuneRunInvalidCreationParameters", - "NeptuneFieldPathExceedsSizeLimit", - "NeptuneFieldPathEmpty", - "NeptuneFieldPathInvalid", - "NeptuneFieldPathNonWritable", - "NeptuneFieldTypeUnsupported", - "NeptuneFieldTypeConflicting", + "NeptuneAttributePathExceedsSizeLimit", + "NeptuneAttributePathEmpty", + "NeptuneAttributePathInvalid", + "NeptuneAttributePathNonWritable", + "NeptuneAttributeTypeUnsupported", + "NeptuneAttributeTypeMismatch", "NeptuneSeriesPointDuplicate", "NeptuneSeriesStepNonIncreasing", "NeptuneSeriesStepNotAfterForkPoint", @@ -251,36 +251,36 @@ class NeptuneRunInvalidCreationParameters(NeptuneScaleError): """ -class NeptuneFieldPathExceedsSizeLimit(NeptuneScaleError): +class NeptuneAttributePathExceedsSizeLimit(NeptuneScaleError): message = """ {h1} -NeptuneFieldPathExceedsSizeLimit: Attribute name is too long. +NeptuneAttributePathExceedsSizeLimit: Attribute name is too long. {end} The maximum length is 1024 bytes (not characters) in UTF-8 encoding. """ -class NeptuneFieldPathEmpty(NeptuneScaleError): +class NeptuneAttributePathEmpty(NeptuneScaleError): message = """ {h1} -NeptuneFieldPathEmpty: Attribute path is empty. +NeptuneAttributePathEmpty: Attribute path is empty. {end} """ -class NeptuneFieldPathInvalid(NeptuneScaleError): +class NeptuneAttributePathInvalid(NeptuneScaleError): message = """ {h1} -NeptuneFieldPathInvalid: Attribute path is invalid. +NeptuneAttributePathInvalid: Attribute path is invalid. {end} To troubleshoot the problem, ensure that the provided path correctly encodes to UTF-8. """ -class NeptuneFieldPathNonWritable(NeptuneScaleError): +class NeptuneAttributePathNonWritable(NeptuneScaleError): message = """ {h1} -NeptuneFieldPathNonWritable: Attribute is not writable. +NeptuneAttributePathNonWritable: Attribute is not writable. {end} You could be trying to overwrite a read-only attribute. Note that most of the "sys/*" attributes are read-only. @@ -288,19 +288,19 @@ class NeptuneFieldPathNonWritable(NeptuneScaleError): """ -class NeptuneFieldTypeUnsupported(NeptuneScaleError): +class NeptuneAttributeTypeUnsupported(NeptuneScaleError): message = """ {h1} -NeptuneFieldTypeUnsupported: the provided attribute type is not supported by Neptune. +NeptuneAttributeTypeUnsupported: the provided attribute type is not supported by Neptune. {end} For supported types, see https://docs-beta.neptune.ai/attribute_types """ -class NeptuneFieldTypeConflicting(NeptuneScaleError): +class NeptuneAttributeTypeMismatch(NeptuneScaleError): message = """ {h1} -NeptuneFieldTypeConflicting: the attribute type is different from the one that was previously logged for this series. +NeptuneAttributeTypeMismatch: the attribute type is different from the one that was previously logged for this series. {end} Once an attribute type is set, it cannot be changed. Example: you can't log strings to an existing float series. """ diff --git a/tests/unit/test_metadata_splitter.py b/tests/unit/test_metadata_splitter.py index 67e941fe..2c9cc725 100644 --- a/tests/unit/test_metadata_splitter.py +++ b/tests/unit/test_metadata_splitter.py @@ -44,7 +44,7 @@ def test_empty(): @freeze_time("2024-07-30 12:12:12.000022") -def test_fields(): +def test_configs(): # given builder = MetadataSplitter( project="workspace/project", @@ -176,7 +176,7 @@ def test_splitting(): max_size = 1024 timestamp = datetime.now() metrics = {f"metric{v}": 7 / 9.0 * v for v in range(1000)} - fields = {f"field{v}": v for v in range(1000)} + configs = {f"config{v}": v for v in range(1000)} add_tags = {f"add/tag{v}": {f"value{v}"} for v in range(1000)} remove_tags = {f"remove/tag{v}": {f"value{v}"} for v in range(1000)} @@ -186,7 +186,7 @@ def test_splitting(): run_id="run_id", step=1, timestamp=timestamp, - configs=fields, + configs=configs, metrics=metrics, add_tags=add_tags, remove_tags=remove_tags, @@ -208,9 +208,9 @@ def test_splitting(): assert all(op.update.step.whole == 1 for op, _ in result) assert all(op.update.timestamp == Timestamp(seconds=1722341532, nanos=21934) for op, _ in result) - # Check if all metrics, fields and tags are present in the result + # Check if all metrics, configs and tags are present in the result assert sorted([key for op, _ in result for key in op.update.append.keys()]) == sorted(list(metrics.keys())) - assert sorted([key for op, _ in result for key in op.update.assign.keys()]) == sorted(list(fields.keys())) + assert sorted([key for op, _ in result for key in op.update.assign.keys()]) == sorted(list(configs.keys())) assert sorted([key for op, _ in result for key in op.update.modify_sets.keys()]) == sorted( list(add_tags.keys()) + list(remove_tags.keys()) )