-
Notifications
You must be signed in to change notification settings - Fork 32
feat(infra): add blob storage lifecycle policies and folder structure #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rezatnoMsirhC
merged 21 commits into
main
from
infra/45-storage-account-folder-structure-and-lifecycle-policies
Mar 20, 2026
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
a9ed930
feat(cloud): add blob storage lifecycle policies and folder structure
rezatnoMsirhC 39e3b0e
Merge branch 'main' of github.com:Azure-Samples/azure-nvidia-robotics…
rezatnoMsirhC 36db68c
Merge branch 'main' of github.com:microsoft/physical-ai-toolchain int…
rezatnoMsirhC 88017e1
Merge branch 'main' into infra/45-storage-account-folder-structure-an…
rezatnoMsirhC 8b30584
fix(docs): update dead LeRobot link and fix ruff format violations
rezatnoMsirhC 47ff807
fix(docs): correct LeRobot datasets URL to src/lerobot/datasets
rezatnoMsirhC cf7bdae
Merge branch 'main' into infra/45-storage-account-folder-structure-an…
rezatnoMsirhC 52f6b14
revert: restore root README.md from main
484ebdc
Merge branch 'main' into infra/45-storage-account-folder-structure-an…
WilliamBerryiii 35f88c1
Merge branch 'main' of github.com:microsoft/physical-ai-toolchain int…
rezatnoMsirhC bdab354
Merge branch 'main' of github.com:microsoft/physical-ai-toolchain int…
rezatnoMsirhC 8e2b029
style: apply ruff auto-fixes for Python lint errors
rezatnoMsirhC b62b0c8
Merge branch 'main' of github.com:microsoft/physical-ai-toolchain int…
rezatnoMsirhC bfaf70d
Merge branch 'main' of github.com:microsoft/physical-ai-toolchain int…
rezatnoMsirhC a9ed314
refactor(infra): relocate blob_path_validator to data-management/tools
rezatnoMsirhC bab9e9e
Merge branch 'main' of github.com:microsoft/physical-ai-toolchain int…
rezatnoMsirhC 8c1c6df
refactor: remove sys.path injection from blob_path_validator test
rezatnoMsirhC cbec82b
docs(cloud): replace env-specific storage account names with placehol…
rezatnoMsirhC c7f0304
Merge branch 'main' into infra/45-storage-account-folder-structure-an…
rezatnoMsirhC bae4249
Merge branch 'main' into infra/45-storage-account-folder-structure-an…
rezatnoMsirhC 73cc647
Merge branch 'main' into infra/45-storage-account-folder-structure-an…
rezatnoMsirhC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| """Blob path validation for Azure Storage folder structure. | ||
|
|
||
| Validates blob paths against naming conventions: | ||
| - Lowercase only (no uppercase) | ||
| - Hyphens for separators (no underscores or spaces in folder names) | ||
| - Date format: YYYY-MM-DD | ||
| - Timestamp format: YYYYMMDD_HHMMSS | ||
| - File extensions: .mcap, .bag, .json, .npz, .mp4, .pt, .onnx, .jit | ||
|
|
||
| Validation enforces folder structure and naming patterns for: | ||
| - raw: ROS bags from edge devices | ||
| - converted: LeRobot datasets | ||
| - reports: Validation and inference reports | ||
| - checkpoints: Model checkpoints from training | ||
| """ | ||
|
|
||
| import re | ||
| from typing import Literal | ||
|
|
||
| DataType = Literal["raw", "converted", "reports", "checkpoints"] | ||
|
|
||
| # Regex patterns for each data type | ||
| PATTERNS = { | ||
| "raw": r"^raw/[a-z0-9-]+/\d{4}-\d{2}-\d{2}/[a-z0-9-]+\.(mcap|bag)$", | ||
| "converted": r"^converted/[a-z0-9-]+(-v\d+)?/(meta|data|videos)/.+$", | ||
| "reports": r"^reports/[a-z0-9-]+/\d{4}-\d{2}-\d{2}/[a-z0-9-_]+\.(json|npz|mp4)$", | ||
| "checkpoints": r"^checkpoints/[a-z0-9-]+/\d{8}_\d{6}(_step_\d+)?\.(pt|onnx|jit)$", | ||
| } | ||
|
|
||
|
|
||
| def validate_blob_path(blob_name: str, data_type: DataType) -> bool: | ||
| """Validate blob path follows naming conventions. | ||
|
|
||
| Args: | ||
| blob_name: Full blob path (e.g., "raw/robot-01/2026-03-05/episode-001.mcap") | ||
| data_type: Type of data ("raw", "converted", "reports", "checkpoints") | ||
|
|
||
| Returns: | ||
| True if path is valid, False otherwise | ||
|
|
||
| Raises: | ||
| ValueError: If data_type is not recognized | ||
| """ | ||
| if data_type not in PATTERNS: | ||
| raise ValueError(f"Unknown data type: {data_type}. Must be one of {list(PATTERNS.keys())}") | ||
|
|
||
| return bool(re.match(PATTERNS[data_type], blob_name)) | ||
|
|
||
|
|
||
| def get_validation_error(blob_name: str, data_type: DataType) -> str | None: | ||
| """Get validation error message if path is invalid. | ||
|
|
||
| Args: | ||
| blob_name: Full blob path | ||
| data_type: Type of data | ||
|
|
||
| Returns: | ||
| Error message if invalid, None if valid | ||
| """ | ||
| if validate_blob_path(blob_name, data_type): | ||
| return None | ||
|
|
||
| errors = [] | ||
| if any(c.isupper() for c in blob_name): | ||
| errors.append("contains uppercase characters (must be lowercase only)") | ||
| if " " in blob_name: | ||
| errors.append("contains spaces (use hyphens instead)") | ||
|
|
||
| error_detail = ", ".join(errors) if errors else "does not match expected pattern" | ||
| return ( | ||
| f"Invalid blob path '{blob_name}': {error_detail}. See docs/cloud/blob-storage-structure.md for path patterns." | ||
| ) | ||
143 changes: 143 additions & 0 deletions
143
data-management/tools/tests/test_blob_path_validator.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| """Unit tests for blob path validator.""" | ||
|
|
||
| import pytest | ||
| from blob_path_validator import ( | ||
| get_validation_error, | ||
| validate_blob_path, | ||
| ) | ||
|
|
||
|
|
||
| class TestRawBagValidation: | ||
| """Test validation for raw ROS bag paths.""" | ||
|
|
||
| def test_valid_raw_mcap(self): | ||
| assert validate_blob_path("raw/robot-01/2026-03-05/episode-001.mcap", "raw") | ||
|
|
||
| def test_valid_raw_bag(self): | ||
| assert validate_blob_path("raw/ur10e-arm/2026-03-04/pick-task-001.bag", "raw") | ||
|
|
||
| def test_valid_raw_mobile_manipulator(self): | ||
| assert validate_blob_path("raw/mobile-manipulator-03/2026-03-01/navigation-001.mcap", "raw") | ||
|
|
||
| def test_invalid_raw_uppercase_device(self): | ||
| assert not validate_blob_path("raw/Robot-01/2026-03-05/episode-001.mcap", "raw") | ||
|
|
||
| def test_invalid_raw_uppercase_filename(self): | ||
| assert not validate_blob_path("raw/robot-01/2026-03-05/Episode-001.mcap", "raw") | ||
|
|
||
| def test_invalid_raw_spaces(self): | ||
| assert not validate_blob_path("raw/robot-01/2026-03-05/episode 001.mcap", "raw") | ||
|
|
||
| def test_invalid_raw_wrong_date_format(self): | ||
| assert not validate_blob_path("raw/robot-01/03-05-2026/episode-001.mcap", "raw") | ||
|
|
||
| def test_invalid_raw_wrong_extension(self): | ||
| assert not validate_blob_path("raw/robot-01/2026-03-05/episode-001.txt", "raw") | ||
|
|
||
| def test_invalid_raw_missing_date(self): | ||
| assert not validate_blob_path("raw/robot-01/episode-001.mcap", "raw") | ||
|
|
||
|
|
||
| class TestConvertedDatasetValidation: | ||
| """Test validation for converted LeRobot dataset paths.""" | ||
|
|
||
| def test_valid_converted_meta_info(self): | ||
| assert validate_blob_path("converted/pick-place-v1/meta/info.json", "converted") | ||
|
|
||
| def test_valid_converted_meta_stats(self): | ||
| assert validate_blob_path("converted/pick-place-v1/meta/stats.json", "converted") | ||
|
|
||
| def test_valid_converted_data_parquet(self): | ||
| assert validate_blob_path("converted/pick-place-v1/data/chunk-000/episode_000000.parquet", "converted") | ||
|
|
||
| def test_valid_converted_video(self): | ||
| assert validate_blob_path( | ||
| "converted/pick-place-v1/videos/observation.image/chunk-000/episode_0000.mp4", | ||
| "converted", | ||
| ) | ||
|
|
||
| def test_valid_converted_no_version(self): | ||
| assert validate_blob_path("converted/navigation/meta/info.json", "converted") | ||
|
|
||
| def test_invalid_converted_uppercase(self): | ||
| assert not validate_blob_path("converted/Pick-Place-v1/meta/info.json", "converted") | ||
|
|
||
| def test_invalid_converted_wrong_subfolder(self): | ||
| assert not validate_blob_path("converted/pick-place-v1/invalid/info.json", "converted") | ||
|
|
||
|
|
||
| class TestReportsValidation: | ||
| """Test validation for validation report paths.""" | ||
|
|
||
| def test_valid_reports_json(self): | ||
| assert validate_blob_path("reports/pick-place-v1/2026-03-05/eval_results.json", "reports") | ||
|
|
||
| def test_valid_reports_npz(self): | ||
| assert validate_blob_path("reports/pick-place-v1/2026-03-05/ep000_predictions.npz", "reports") | ||
|
|
||
| def test_valid_reports_mp4(self): | ||
| assert validate_blob_path("reports/pick-place-v1/2026-03-05/inference_video.mp4", "reports") | ||
|
|
||
| def test_invalid_reports_uppercase(self): | ||
| assert not validate_blob_path("reports/Pick-Place-v1/2026-03-05/eval_results.json", "reports") | ||
|
|
||
| def test_invalid_reports_wrong_date_format(self): | ||
| assert not validate_blob_path("reports/pick-place-v1/03-05-2026/eval_results.json", "reports") | ||
|
|
||
| def test_invalid_reports_missing_date(self): | ||
| assert not validate_blob_path("reports/pick-place-v1/eval_results.json", "reports") | ||
|
|
||
|
|
||
| class TestCheckpointsValidation: | ||
| """Test validation for model checkpoint paths.""" | ||
|
|
||
| def test_valid_checkpoints_with_step(self): | ||
| assert validate_blob_path("checkpoints/act-policy/20260305_143022_step_1000.pt", "checkpoints") | ||
|
|
||
| def test_valid_checkpoints_no_step(self): | ||
| assert validate_blob_path("checkpoints/velocity-anymal/20260301_120000.pt", "checkpoints") | ||
|
|
||
| def test_valid_checkpoints_onnx(self): | ||
| assert validate_blob_path("checkpoints/diffusion-policy/20260304_091500.onnx", "checkpoints") | ||
|
|
||
| def test_valid_checkpoints_jit(self): | ||
| assert validate_blob_path("checkpoints/rsl-rl/20260305_100000.jit", "checkpoints") | ||
|
|
||
| def test_invalid_checkpoints_uppercase(self): | ||
| assert not validate_blob_path("checkpoints/ACT-Policy/20260305_143022_step_1000.pt", "checkpoints") | ||
|
|
||
| def test_invalid_checkpoints_wrong_timestamp_format(self): | ||
| assert not validate_blob_path("checkpoints/act-policy/2026-03-05_14-30-22_step_1000.pt", "checkpoints") | ||
|
|
||
| def test_invalid_checkpoints_wrong_extension(self): | ||
| assert not validate_blob_path("checkpoints/act-policy/20260305_143022_step_1000.pth", "checkpoints") | ||
|
|
||
|
|
||
| class TestValidationErrors: | ||
| """Test validation error messages.""" | ||
|
|
||
| def test_error_message_uppercase(self): | ||
| error = get_validation_error("raw/Robot-01/2026-03-05/episode-001.mcap", "raw") | ||
| assert error is not None | ||
| assert "uppercase" in error | ||
| assert "docs/cloud/blob-storage-structure.md" in error | ||
|
|
||
| def test_error_message_spaces(self): | ||
| error = get_validation_error("raw/robot-01/2026-03-05/episode 001.mcap", "raw") | ||
| assert error is not None | ||
| assert "spaces" in error | ||
| assert "hyphens" in error | ||
|
|
||
| def test_error_message_multiple_issues(self): | ||
| error = get_validation_error("raw/Robot-01/2026-03-05/Episode 001.mcap", "raw") | ||
| assert error is not None | ||
| assert "uppercase" in error | ||
| assert "spaces" in error | ||
|
|
||
| def test_valid_path_no_error(self): | ||
| error = get_validation_error("raw/robot-01/2026-03-05/episode-001.mcap", "raw") | ||
| assert error is None | ||
|
|
||
| def test_unknown_data_type_raises_error(self): | ||
| with pytest.raises(ValueError, match="Unknown data type"): | ||
| validate_blob_path("some/path/file.txt", "invalid") # type: ignore |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.