[Refactor] Move custom_meta to SampleMeta and custom_backend_meta to FieldMeta#30
Open
Evelynn-V wants to merge 4 commits intoAscend:mainfrom
Open
[Refactor] Move custom_meta to SampleMeta and custom_backend_meta to FieldMeta#30Evelynn-V wants to merge 4 commits intoAscend:mainfrom
Evelynn-V wants to merge 4 commits intoAscend:mainfrom
Conversation
Signed-off-by: Evelynn-V <liwenlin0223l@gmail.com>
Signed-off-by: Evelynn-V <liwenlin0223l@gmail.com>
Signed-off-by: Evelynn-V <liwenlin0223l@gmail.com>
Signed-off-by: Evelynn-V <liwenlin0223l@gmail.com>
dpj135
reviewed
Feb 10, 2026
Comment on lines
+205
to
+216
|
|
||
| for global_idx, field_metas in custom_backend_meta.items(): | ||
| template = SampleMeta( | ||
| partition_id="", | ||
| global_index=global_idx, | ||
| fields={ | ||
| fname: FieldMeta(name=fname, dtype=None, shape=None, _custom_backend_meta=meta) | ||
| for fname, meta in field_metas.items() | ||
| }, | ||
| custom_meta={}, | ||
| ) | ||
| next((s for s in metadata.samples if s.global_index == global_idx), None).union(template, validate=False) |
Contributor
There was a problem hiding this comment.
This code appears multiple times; can it be refactored into a function?
Comment on lines
+317
to
+319
| if sample.global_index == global_index: | ||
| sample.custom_meta = copy.deepcopy(meta_dict) | ||
| break |
Contributor
There was a problem hiding this comment.
Can we prove the [sample.global_index for sample in self.samples] is Monotonically increasing? If we can, methods like binary search would be much faster.
Contributor
There was a problem hiding this comment.
Here is
Comment on lines
+354
to
+358
| for global_index, meta_dict in new_meta.items(): | ||
| for sample in self.samples: | ||
| if sample.global_index == global_index: | ||
| sample.custom_meta.update(copy.deepcopy(meta_dict)) | ||
| break |
Contributor
There was a problem hiding this comment.
same as above. btw, we can even replace these codes with a 'method'
Contributor
There was a problem hiding this comment.
Here is
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background
This PR refactors the metadata storage architecture to embed metadata directly where it logically belongs:
custom_meta (user-defined sample annotations) → moved from
BatchMetatoSampleMetabackend_meta (storage-specific field metadata) → moved from
BatchMetatoFieldMetaChanges
transfer_queue/metadata.py, movedcustom_metafromBatchMetatoSampleMeta, and movedcustom_backend_metafromBatchMetatoFieldMeta.tests/test_metadata.py, adapted to the new metadata structure and passed the tests.transfer_queue/storage/managers/base.pyandtransfer_queue/controller.pyto prevent access tocustom_metaandcustom_backend_meta, which no longer exist inBatchMeta