Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
| Filename | Overview |
|---|---|
| nominal/experimental/migration/migrator/asset_migrator.py | Adds series_tags propagation when migrating asset datasets; refactors _copy_optional_runs inline and guards _copy_asset_datasets with a dataset_config is not None check. Two minor issues: _resolve_destination_dataset is now dead code, and _list_dataset_scopes() + list_datasets() make redundant back-to-back _get_latest_api() calls. |
Sequence Diagram
sequenceDiagram
participant AM as AssetMigrator
participant SA as source_asset (Asset)
participant API as _get_latest_api()
participant Cat as Catalog API
participant DM as DatasetMigrator
participant DA as destination_asset (Asset)
AM->>SA: _list_dataset_scopes()
SA->>API: _get_latest_api() [call 1]
API-->>SA: DataScope[] (with series_tags)
SA-->>AM: source_data_scopes
AM->>SA: list_datasets()
SA->>API: _get_latest_api() [call 2 – redundant]
API-->>SA: scope RID map
SA->>Cat: _get_datasets(rids)
Cat-->>SA: Dataset objects
SA-->>AM: {dataset_rid: Dataset}
loop for each DataScope
AM->>DM: copy_from(source_dataset, DatasetCopyOptions)
DM-->>AM: new_dataset
AM->>DA: add_dataset(scope_name, new_dataset, series_tags=source_series_tags)
end
Prompt To Fix All With AI
This is a comment left during a code review.
Path: nominal/experimental/migration/migrator/asset_migrator.py
Line: 93-110
Comment:
**`_resolve_destination_dataset` is now dead code**
After the refactor, `_resolve_destination_dataset` is defined but never called anywhere — the logic it previously encapsulated was inlined directly into the new `_copy_asset_datasets` implementation. A quick grep confirms there are no callers of this method anywhere in the repository.
Consider removing the method to avoid confusion for future readers who might wonder why it exists.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: nominal/experimental/migration/migrator/asset_migrator.py
Line: 125-126
Comment:
**Redundant `_get_latest_api()` call**
Both `_list_dataset_scopes()` and `list_datasets()` independently call `_get_latest_api()` internally (which makes a network round-trip to fetch the asset). This means the asset is fetched **twice** in sequence — once to get the `DataScope` objects (for `series_tags`) and once more to get the dataset RID-to-scope mapping.
The two results could be derived from a single `_get_latest_api()` call, e.g. by iterating over `source_asset._list_dataset_scopes()` alone and then calling `_get_datasets()` directly on the collected RIDs, avoiding the extra hop entirely.
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 671c45c
aba04d4 to
ae1edad
Compare
ae1edad to
ab864e7
Compare
ab864e7 to
08979cd
Compare
71b736b to
c75b3f3
Compare
08979cd to
1eda91a
Compare
| ), | ||
| ) | ||
|
|
||
| def _copy_asset_datasets(self, source_asset: Asset, new_asset: Asset, options: AssetCopyOptions) -> None: |
There was a problem hiding this comment.
are we consistent with this naming scheme? I could have sworn we were doing source_xyz vs. dest_xyz but who knows.
| dataset_mapping = options.old_to_new_dataset_rid_mapping | ||
|
|
||
| source_data_scopes = source_asset._list_dataset_scopes() | ||
| source_datasets = {data_scope[1].rid: data_scope[1] for data_scope in source_asset.list_datasets()} |
There was a problem hiding this comment.
more readable like:
source_datasets = {ds.rid: ds for _, ds in source_asset.list_datasets()}| if source_dataset_rid in dataset_mapping: | ||
| new_dataset_rid = dataset_mapping[source_dataset_rid] | ||
| new_dataset = self.ctx.destination_client.get_dataset(new_dataset_rid) | ||
| else: | ||
| new_dataset = dataset_migrator.copy_from( | ||
| source_dataset, | ||
| DatasetCopyOptions( | ||
| include_files=options.dataset_config.include_dataset_files, | ||
| preserve_uuid=options.dataset_config.preserve_dataset_uuid, | ||
| ), | ||
| ) |
There was a problem hiding this comment.
conditional assignment :)
1eda91a to
671c45c
Compare

Fixes MDEV-67
Description
We weren't migrating tags as part of datascope migration in the
asset_migrator- this change does that.Testing
Testing details in Linear ticket.