Skip to content

Commit 01c2a11

Browse files
authored
Refactor the torc CLI (#241)
* Refactor the torc CLI The goal of this commit is to simplify the user experience. - The primary workflow lifecycle commands are now at the root level. - Useful workflows summary/status information is moved into torc status. - Move reports functionality into other subcommands. * Refactor slurm-tests control script to use torc
1 parent 7964581 commit 01c2a11

File tree

94 files changed

+2116
-2311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+2116
-2311
lines changed

.config/nextest.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,12 @@
33
# nextest runs tests in separate processes.
44

55
[profile.default]
6-
# Retry flaky tests up to 2 times
7-
retries = 2
6+
# Allow extra time for the first test in each file, which may trigger a cargo
7+
# build of server/runner binaries via build_test_binaries() in the #[once]
8+
# fixture. Multiple test files start in parallel, and while cargo serializes
9+
# concurrent builds via its lock, the waiting processes can exceed the default
10+
# 60-second timeout.
11+
slow-timeout = { period = "120s", terminate-after = 3 }
812

913
[test-groups]
1014
# Slurm mock tests - modify PATH and mock executables

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ sqlite3 server/db/sqlite/dev.db
498498
- `torc workflows submit <id>` - Submit workflow to scheduler (requires
499499
on_workflow_start/schedule_nodes action)
500500
- `torc workflows run <id>` - Run workflow locally
501-
- `torc workflows initialize <id>` - Initialize workflow (set up dependencies without execution)
501+
- `torc workflows init <id>` - Initialize workflow (set up dependencies without execution)
502502
- `torc workflows status <id>` - Check workflow status
503503

504504
**Job Management**:

docs/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@
112112
- [Shell Completions](./specialized/tools/shell-completions.md)
113113
- [Design & Architecture](./specialized/design/index.md)
114114
- [Client Architecture](./specialized/design/client.md)
115+
- [HTTP API Design](./specialized/design/http-api.md)
115116
- [Workflow Actions](./specialized/design/workflow-actions.md)
116117
- [Web Dashboard Design](./specialized/design/dashboard.md)
117118
- [Server API Handler](./specialized/design/server.md)

docs/src/core/concepts/job-runners.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Job runners are worker processes that execute jobs on compute resources.
77
Torc supports three execution modes:
88

99
1. **Local Runner** (`torc run`) - Runs jobs on the local machine with resource tracking
10-
2. **HPC/Slurm Runner** (`torc submit-slurm`) - Runs jobs on Slurm-allocated compute nodes
10+
2. **HPC/Slurm Runner** (`torc slurm generate` + `torc submit`) - Runs jobs on Slurm-allocated
11+
compute nodes
1112
3. **Remote Workers** (`torc remote run`) - Distributes jobs across SSH-accessible machines
1213

1314
### Local Runner

docs/src/core/concepts/reinitialization.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ appropriate jobs for re-execution.
66

77
## When to Use Reinitialization
88

9-
Use `torc workflows reinitialize` when:
9+
Use `torc workflows reinit` when:
1010

1111
- **Input files changed** — You modified an input file and want dependent jobs to rerun
1212
- **Configuration updated** — You changed user_data parameters
@@ -18,13 +18,13 @@ Use `torc workflows reinitialize` when:
1818

1919
```bash
2020
# Preview what would change (recommended first step)
21-
torc workflows reinitialize <workflow_id> --dry-run
21+
torc workflows reinit <workflow_id> --dry-run
2222

2323
# Reinitialize the workflow
24-
torc workflows reinitialize <workflow_id>
24+
torc workflows reinit <workflow_id>
2525

2626
# Force reinitialization even with warnings
27-
torc workflows reinitialize <workflow_id> --force
27+
torc workflows reinit <workflow_id> --force
2828
```
2929

3030
## How Change Detection Works
@@ -42,7 +42,7 @@ for re-execution.
4242
echo "new data" > input.json
4343

4444
# Reinitialize detects the change
45-
torc workflows reinitialize <workflow_id>
45+
torc workflows reinit <workflow_id>
4646
# Output: Reset 3 jobs due to changed inputs
4747
```
4848

@@ -87,7 +87,7 @@ postprocess (depends on process output) → also marked
8787
Always use `--dry-run` first to preview changes without modifying anything:
8888

8989
```bash
90-
torc workflows reinitialize <workflow_id> --dry-run
90+
torc workflows reinit <workflow_id> --dry-run
9191
```
9292

9393
Example output:

docs/src/core/how-to/cancel-workflow.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Stop a running workflow and terminate its jobs.
55
## Cancel a Workflow
66

77
```bash
8-
torc workflows cancel <workflow_id>
8+
torc cancel <workflow_id>
99
```
1010

1111
This:
@@ -20,7 +20,7 @@ This:
2020
Verify the workflow was canceled:
2121

2222
```bash
23-
torc workflows status <workflow_id>
23+
torc status <workflow_id>
2424
```
2525

2626
Or check completion status:
@@ -43,11 +43,12 @@ To resume a canceled workflow:
4343

4444
```bash
4545
# Reinitialize to reset canceled jobs
46-
torc workflows reinitialize <workflow_id>
46+
torc workflows reinit <workflow_id>
4747

48-
# Run again
49-
torc workflows run <workflow_id>
50-
torc workflows submit <workflow_id>
48+
# Run again locally
49+
torc run <workflow_id>
50+
# Or submit to scheduler
51+
torc submit <workflow_id>
5152
```
5253

5354
Jobs that completed before cancellation remain completed.

docs/src/core/how-to/check-resource-utilization.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ limits.
66
## Quick Start
77

88
```bash
9-
torc reports check-resource-utilization <workflow_id>
9+
torc workflows check-resources <workflow_id>
1010
```
1111

1212
Example output:
@@ -25,15 +25,15 @@ Job ID | Job Name | Resource | Specified | Peak Used | Over-Utilization
2525
Include jobs that stayed within limits:
2626

2727
```bash
28-
torc reports check-resource-utilization <workflow_id> --all
28+
torc workflows check-resources <workflow_id> --all
2929
```
3030

3131
## Check a Specific Run
3232

3333
For workflows that have been reinitialized multiple times:
3434

3535
```bash
36-
torc reports check-resource-utilization <workflow_id> --run-id 2
36+
torc workflows check-resources <workflow_id> --run-id 2
3737
```
3838

3939
## Automatically Correct Requirements

docs/src/core/how-to/debug-failed-job.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Common exit codes:
3232

3333
```bash
3434
# Get log paths
35-
torc reports results <workflow_id> --job-id <job_id>
35+
torc results list --include-logs <workflow_id> --job-id <job_id>
3636

3737
# View stderr (usually contains error messages)
3838
cat output/job_stdio/job_wf43_j15_r1_a1.e
@@ -52,7 +52,7 @@ cat output/job_stdio/job_wf43_j15_r1_a1.log
5252
Did the job exceed its resource limits?
5353

5454
```bash
55-
torc reports check-resource-utilization <workflow_id>
55+
torc workflows check-resources <workflow_id>
5656
```
5757

5858
Look for:
@@ -92,9 +92,10 @@ After fixing the issue:
9292
# Reinitialize to reset failed jobs
9393
torc workflows reset-status --failed --reinitialize <workflow_id>
9494

95-
# Run again
96-
torc workflows run <workflow_id>
97-
torc submit-slurm <workflow_id>
95+
# Run again locally
96+
torc run <workflow_id>
97+
# Or re-submit to Slurm
98+
torc submit <workflow_id>
9899
```
99100

100101
## See Also

docs/src/core/how-to/track-workflow-status.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Monitor a running workflow's progress using the CLI, TUI, or dashboard.
55
## Quick Status Check
66

77
```bash
8-
torc reports summary <workflow_id>
8+
torc status <workflow_id>
99
```
1010

1111
Example output:
@@ -25,7 +25,7 @@ Jobs by Status:
2525
Watch status update every 10 seconds:
2626

2727
```bash
28-
watch -n 10 torc reports summary <workflow_id>
28+
watch -n 10 torc status <workflow_id>
2929
```
3030

3131
## Interactive TUI

docs/src/core/how-to/view-job-logs.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Find and read the stdout/stderr output from job execution.
55
## Find Log File Paths
66

77
```bash
8-
torc reports results <workflow_id>
9-
torc reports results <workflow_id> --job-id 15
8+
torc results list --include-logs <workflow_id>
9+
torc results list --include-logs <workflow_id> --job-id 15
1010
```
1111

1212
Output includes:
@@ -71,7 +71,7 @@ Quickly find logs for failed jobs:
7171
torc jobs list <workflow_id> --status failed
7272

7373
# Then view each job's logs
74-
torc reports results <workflow_id> --job-id <failed_job_id>
74+
torc results list --include-logs <workflow_id> --job-id <failed_job_id>
7575
```
7676

7777
## View Logs in TUI or Dashboard

0 commit comments

Comments
 (0)