feat(datasets): make 'rock datasets list' fast on cross-region OSS (#1010)#1011
Merged
Conversation
AI-Model: claude-opus-4-7 AI-Contributed/Feature: 48/48 AI-Contributed/UT: 107/107
AI-Model: claude-opus-4-7 AI-Contributed/Feature: 24/24 AI-Contributed/UT: 63/63
AI-Model: claude-opus-4-7 AI-Contributed/Feature: 36/53 AI-Contributed/UT: 44/65
ef1dd52 to
a18d497
Compare
Defer the default list depth until runtime so argparse still treats an explicit --depth value as present in the mutually exclusive group on Python 3.10. Update envhub CLI docs for the rewritten list output and splits command. Co-Authored-By: Codex <noreply@openai.com> AI-Model: gpt-5 AI-Contributed/Feature: 47/47 AI-Contributed/UT: 8/8
jake11-oho
pushed a commit
to jake11-oho/ROCK
that referenced
this pull request
Jun 10, 2026
…libaba#1010) (alibaba#1011) * feat(datasets): add list_organizations to registry * feat(datasets): add list_org_datasets to registry * feat(datasets): add list_dataset_splits to registry * feat(datasets): add list_all_datasets with bounded concurrency * feat(datasets): add fast-path methods to DatasetClient * feat(datasets): rewrite list with --depth and fast paths AI-Model: claude-opus-4-7 AI-Contributed/Feature: 48/48 AI-Contributed/UT: 107/107 * feat(datasets): add splits subcommand AI-Model: claude-opus-4-7 AI-Contributed/Feature: 24/24 AI-Contributed/UT: 63/63 * chore(datasets): apply lint and format AI-Model: claude-opus-4-7 AI-Contributed/Feature: 36/53 AI-Contributed/UT: 44/65 * fix(datasets): preserve list parser exclusivity Defer the default list depth until runtime so argparse still treats an explicit --depth value as present in the mutually exclusive group on Python 3.10. Update envhub CLI docs for the rewritten list output and splits command. Co-Authored-By: Codex <noreply@openai.com> AI-Model: gpt-5 AI-Contributed/Feature: 47/47 AI-Contributed/UT: 8/8
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.
Summary
rock datasets listwith two-step OSS prefix listing (delimiter='/'), bringing cross-region listing down from ~30s+ to a few seconds (live verification on cn-shanghai → us-east-1 bucket).--depth {1,2}(default 2) and--org <name>flags so users can scope listing —--depth 1lists organizations only (one HTTP round-trip),--orgskips the top-level scan and lists datasets under one org. The two are mutually exclusive.rock datasets splits --org X --dataset Ysubcommand to list available splits, parallel totasks.listoutput format is unchanged.Change
rock/sdk/envhub/datasets/registry/oss.py— three new fast-path methods around bounded-concurrency prefix listing:rock/cli/command/datasets.py— rewrite_listto dispatch by--org/--depth, plus a new_splitshandler:async def _list(self, args: argparse.Namespace) -> None: registry_info = self._build_oss_registry_info(args) client = DatasetClient(registry_info) - # old: walk every dataset, then every split, then every task - datasets = client.list_datasets(getattr(args, 'org', None)) - for spec in datasets: - ... + if getattr(args, "org", None): + datasets = client.list_org_datasets(args.org) + self._render_org_dataset_pairs([(args.org, d) for d in datasets]) + return + if getattr(args, "depth", 2) == 1: + self._render_orgs(client.list_organizations()) + return + self._render_org_dataset_pairs(client.list_all_datasets())argparse:
--depth {1,2}and--orgare placed in a mutually-exclusive group onlist; newsplitssubparser requires--organd--dataset.File diff
rock/sdk/envhub/datasets/registry/oss.py_list_common_prefixeshelper)rock/sdk/envhub/datasets/registry/base.pyrock/sdk/envhub/datasets/client.pyrock/cli/command/datasets.py_listdispatch,_splits, render helpers, parser changes)tests/unit/datasets/test_oss_registry.pytests/unit/datasets/test_client.pytests/unit/datasets/test_datasets_command.pyTest plan
uv run pytest tests/unit/datasets/ -v— 64 passed (32 existing + 32 new)uv run ruff check rock/ tests/— cleanuv run ruff format rock/ tests/— cleanrock datasets list --depth 1androck datasets list --org <name>return in ~1s;rock datasets list(depth=2) returns in ~3s with 10-way concurrency.rock datasets listwith no flags still shows 'Organization | Dataset' two-column output; only the underlying calls changed.--depthand--orgmutual exclusion error message is acceptable.Notes
<base>/<org>/<dataset>/<split>/) is the same one already used bytasksandupload; this PR just stops descending past the level you asked for.--orgpaths are single-call.fix #1010