Skip to content

Commit db72465

Browse files
Saeid Baraticlaude
andcommitted
Address Greptile review feedback
- SerializerStore now extends ABCMeta (not type) so @AbstractMethod is enforced — incomplete subclasses raise TypeError at definition - Validate blobs non-empty before accessing blobs[0] in save_artifacts - Add NOTE on compress_method not yet wired into save path Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 329059f commit db72465

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

metaflow/datastore/artifacts/serializer.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from abc import abstractmethod
1+
from abc import ABCMeta, abstractmethod
22
from collections import namedtuple
33

44

@@ -23,6 +23,9 @@ class SerializedBlob(object):
2323
If None, auto-detected from value type: str -> reference, bytes -> new data.
2424
compress_method : str
2525
Compression method for new blobs. Ignored for references. Default "gzip".
26+
NOTE: Not yet wired into the save path — ContentAddressedStore currently
27+
always applies gzip. This field is forward-looking for when per-blob
28+
compression control is needed (e.g., multi-blob IOType support).
2629
"""
2730

2831
def __init__(self, value, is_reference=None, compress_method="gzip"):
@@ -43,7 +46,7 @@ def needs_save(self):
4346
return not self.is_reference
4447

4548

46-
class SerializerStore(type):
49+
class SerializerStore(ABCMeta):
4750
"""
4851
Metaclass for ArtifactSerializer that auto-registers subclasses by TYPE.
4952

metaflow/datastore/task_datastore.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,11 @@ def serialize_iter():
372372

373373
# For now, serializers produce a single blob per artifact.
374374
# Multi-blob support will be added when IOType lands.
375+
if not blobs:
376+
raise DataException(
377+
"Serializer %s returned no blobs for artifact '%s'"
378+
% (serializer.__name__, name)
379+
)
375380
artifact_names.append(name)
376381
yield blobs[0].value
377382

0 commit comments

Comments
 (0)