alibaba / alibaba/ROCK

[Feature] Support non-blocking submission for `rock job run` via `--async`

Open
#929 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
485
Forks
81
Avg merge
16h 12m
Merged PRs (30d)
8

Description

**Feature Category**
- [ ] Sandbox
- [ ] Actions
- [ ] Deployments
- [ ] SDK & API
- [ ] Envhub
- [x] CLI
- [ ] Performance & Optimization
- [ ] Documentation & Examples

**Problem Statement**

`rock job run` today is strictly blocking: the command stays attached to
the job lifecycle (`submit` + `wait`) and only returns when every trial
finishes. This forces users to keep a terminal open for long-running
bash/harbor jobs and makes it awkward to launch jobs from automation
(CI, shell scripts, schedulers) that would rather fire-and-forget and
track the job by its sandbox/experiment id.

The Job SDK already exposes a three-stage lifecycle (`submit` / `wait` /
`run`), so the non-blocking capability is there — the CLI just doesn't
surface it.

**Proposed Solution**

Add an `--async` flag to `rock job run` that:

1. Calls `Job.submit()` (non-blocking) instead of `Job.run()`.
2. Prints the key identifiers needed to track the submitted job:
- `experiment_id`
- `job_name`
- `sandbox_ids` (comma-separated; one per trial)
3. Returns immediately after submission; does not call `wait()`.

Minimal, additive change — no YAML schema / executor / config changes.

**Detailed Feature Description**

- CLI: new `--async` flag on `job run` (dest `async_mode`, default
`False`). When set, `_job_run` branches to `await job.submit()` and
prints the three fields above, then returns.
- SDK: new read-only `Job.sandbox_ids` property returning
`[tc.sandbox.sandbox_id for tc in job_client.trials]`, or `[]` before
`submit()` has been called.
- Behavior: sync mode (default) unchanged; regression covered by tests.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the CLI's _job_run entry point and read the existing Job.run() and Job.submit() lifecycle. Add the async branch and the Job.sandbox_ids property described in the issue, then run the existing CLI and regression tests. Done means --async submits without waiting, prints experiment_id, job_name, and sandbox_ids, while default synchronous behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.