Skip to content

Commit c934385

Browse files
Merge pull request #162 from cubewise-code/docs/issue-160-mode-cube-reads
docs: clarify --mode is required for optimized cube reads (#160)
2 parents 1c0bfce + 68534bc commit c934385

7 files changed

Lines changed: 81 additions & 15 deletions

File tree

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
All notable changes to RushTI are documented in this file.
44

5+
## Unreleased — docs: `--mode` for cube reads (#160)
6+
7+
- **Docs fix:** corrected the long-standing claim that `--mode` is
8+
deprecated/ignored. It is only auto-detected (and ignored) for **file
9+
sources** (`--tasks`). A **cube read** (`--tm1-instance`) cannot infer
10+
the mode — every workflow occupies the same cube measures — so it
11+
defaults to `norm` and silently drops the `predecessors` measure unless
12+
`--mode opt` is passed. This caused predecessors to disappear from
13+
cube-read execution plans (e.g. `Sample_Optimal_Mode`). Updated the CLI
14+
reference, settings reference, migration guide, TM1 integration guide
15+
(new "Choosing the mode for cube reads" section), getting-started
16+
task-files page, and the `rushti run --help` text.
17+
518
## Unreleased — `feat/issue-154-v12-load-results`
619

720
- Fix: `rushti build` now installs a TM1-version-aware `}rushti.load.results`

docs/advanced/cli-reference.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ rushti --tasks FILE [options] # 'run' is the default command
5555
| `--retries` | `-r` | INT | `0` | Retry count for failed TI executions. Uses exponential backoff. |
5656
| `--result` | `-o` | PATH | *(empty)* | Output CSV path for execution summary. Omit to skip CSV creation. |
5757
| `--settings` | `-s` | PATH | auto | Path to `settings.ini`. Auto-discovered if omitted. |
58-
| `--mode` | `-m` | CHOICE | auto | **Deprecated.** Mode is auto-detected from file content. Ignored. |
58+
| `--mode` | `-m` | CHOICE | `norm` | Execution mode: `norm` or `opt`. **Ignored for file sources** (`--tasks`), where mode is auto-detected from file content. **Required for cube reads** (`--tm1-instance`) when the workflow uses explicit `predecessors` — pass `--mode opt`, otherwise the cube is read in `norm` mode and predecessors are dropped. See [TM1 integration → Choosing the mode for cube reads](../features/tm1-integration.md#choosing-the-mode-for-cube-reads). |
5959
| `--exclusive` | `-x` | FLAG | `false` | Enable exclusive mode. Waits for other RushTI sessions to finish. |
6060
| `--force` | `-f` | FLAG | `false` | Bypass exclusive mode checks and run immediately. |
6161
| `--optimize` | | CHOICE | *(none)* | Enable task optimization with a scheduling algorithm: `longest_first` or `shortest_first`. |
@@ -80,9 +80,12 @@ rushti run --tasks critical.json --exclusive --result results/critical.csv
8080
# Override workflow name for a file-based run
8181
rushti run --tasks daily-etl.json --workflow DailyETL --max-workers 8
8282

83-
# Read task file from TM1 cube
83+
# Read task file from TM1 cube (norm mode — wait-based sequencing)
8484
rushti run --tm1-instance tm1srv01 --workflow DailyETL --max-workers 8
8585

86+
# Read an optimized workflow from the cube — --mode opt is required to honour predecessors
87+
rushti run --tm1-instance tm1srv01 --workflow DailyETL --mode opt --max-workers 8
88+
8689
# Optimize with shortest-first scheduling (good for shared-resource TM1 workloads)
8790
rushti run --tasks tasks.json --max-workers 20 --optimize shortest_first
8891

docs/advanced/migration-guide.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,19 @@ Logging is configured separately via `config/logging_config.ini` (Python's stand
6262

6363
All settings have sensible defaults. You do not need to create a `settings.ini` to use v2.0 -- it works with built-in defaults.
6464

65-
### --mode Flag: Deprecated
65+
### --mode Flag: Auto-Detected for Files, Still Required for Cube Reads
6666

6767
In v1.x, the `--mode` flag (`norm` or `opt`) controlled whether RushTI used level-based (wait) or dependency-based execution.
6868

69-
In v2.0, mode is **auto-detected** from file content:
69+
In v2.0, mode is **auto-detected from file content** for file sources (`--tasks`):
7070

7171
- JSON files always use DAG execution (optimized mode).
7272
- TXT files use `norm` mode if they contain `wait` keywords, or `opt` mode if tasks have `id` and `predecessors` fields.
7373

74-
The `--mode` flag is accepted for backward compatibility but ignored.
74+
For file sources the `--mode` flag is therefore accepted for backward compatibility but ignored.
75+
76+
!!! warning "Cube reads still need `--mode`"
77+
Auto-detection does **not** apply when reading from a TM1 cube (`--tm1-instance`). The cube stores every workflow with the same measures, so RushTI cannot tell a wait-based workflow from a predecessor-based one. Cube reads default to `norm` (wait-based) and **ignore the `predecessors` measure** unless you pass `--mode opt`. See [TM1 integration → Choosing the mode for cube reads](../features/tm1-integration.md#choosing-the-mode-for-cube-reads).
7578

7679
### Task File: id and predecessors in TXT Files
7780

@@ -413,9 +416,9 @@ rushti run --tasks tasks.json --log-level DEBUG
413416

414417
Check that `max_workers` is set in the correct place with the correct spelling.
415418

416-
### Issue: Mode Deprecation Warning
419+
### Issue: Predecessors Missing When Running from a Cube
417420

418-
If you see a deprecation warning about `--mode`, it is safe to ignore. Remove `--mode` from your scripts when convenient -- mode detection is automatic.
421+
If you run an optimized workflow from the cube (`--tm1-instance`) and the resulting plan ignores your `predecessors`, you are running in the default `norm` mode. Add `--mode opt` to the command (or set `mode = opt` in `settings.ini`). Mode auto-detection applies to file sources only — see [TM1 integration → Choosing the mode for cube reads](../features/tm1-integration.md#choosing-the-mode-for-cube-reads). For `--tasks` file sources you can safely omit `--mode` entirely.
419422

420423
### Issue: TXT File Not Auto-Detecting Mode
421424

docs/advanced/settings-reference.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ Common execution settings that control basic RushTI behavior.
4646
| `max_workers` | int | `4` | Maximum number of parallel workers. Valid range: 1--100. Recommended: start at 4, increase based on TM1 server capacity. |
4747
| `retries` | int | `0` | Number of retry attempts for failed TI process executions. Valid range: 0--10. Retries use exponential backoff (1s, 2s, 4s, ...). |
4848
| `result_file` | str | `""` (empty) | CSV output path for execution summary. Empty string means no CSV is created. |
49-
| `mode` | str | `norm` | **Deprecated.** Execution mode is now auto-detected from file content. JSON files always use DAG execution; TXT files use the mode indicated by their content structure. Kept for backward compatibility only. |
49+
| `mode` | str | `norm` | Default execution mode (`norm` or `opt`) for **cube reads** (`--tm1-instance`). A cube read cannot auto-detect its mode, so this value (or the `--mode` CLI override) decides whether the `predecessors` measure is honoured (`opt`) or the `wait` measure drives sequencing (`norm`). **Ignored for file sources**, where the mode is auto-detected from file content. See [Choosing the mode for cube reads](../features/tm1-integration.md#choosing-the-mode-for-cube-reads). |
5050

51-
**Overridable via CLI:** `--max-workers` / `-w`, `--retries` / `-r`, `--result` / `-o`, `--mode` / `-m` (deprecated)
51+
**Overridable via CLI:** `--max-workers` / `-w`, `--retries` / `-r`, `--result` / `-o`, `--mode` / `-m`
5252

5353
**Overridable via JSON task file:** `max_workers`, `retries`, `result_file`
5454

@@ -243,7 +243,10 @@ Copy this template to `config/settings.ini` and uncomment the settings you want
243243
# Default: (empty - no CSV created)
244244
# result_file = rushti.csv
245245

246-
# Execution mode (deprecated - auto-detected from file content)
246+
# Default execution mode for cube reads (--tm1-instance): norm or opt.
247+
# Cube reads cannot auto-detect the mode; set opt here if most of your
248+
# cube-stored workflows use explicit predecessors. Ignored for file
249+
# sources (--tasks), where the mode is auto-detected from file content.
247250
# Default: norm
248251
# mode = norm
249252

docs/features/tm1-integration.md

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,17 @@ rushti run --tm1-instance tm1srv01 --workflow Sample_Stage_Mode --max-workers 4
6969

7070
RushTI reads the task definitions from the cube, builds the execution plan, and runs them — exactly like running from a file.
7171

72+
!!! warning "Optimized workflows need `--mode opt`"
73+
When you run from the cube, RushTI **cannot auto-detect** whether the workflow is wait-based (`norm`) or predecessor-based (`opt`) — the cube row layout is identical either way. It therefore defaults to `norm`, which uses the `wait` measure for sequencing and **ignores the `predecessors` measure entirely**.
74+
75+
To run an optimized workflow (one that defines explicit `predecessors`), you must pass `--mode opt`:
76+
77+
```bash
78+
rushti run --tm1-instance tm1srv01 --workflow Sample_Optimal_Mode --mode opt --max-workers 4
79+
```
80+
81+
Without `--mode opt`, the predecessors silently disappear from the execution plan (RushTI logs a `predecessors ignored in norm mode` warning, but the run still proceeds). See [Choosing the mode for cube reads](#choosing-the-mode-for-cube-reads) below.
82+
7283
### View Results in the Cube
7384

7485
Once the run completes, RushTI writes the results back to the same cube under a timestamped `rushti_run_id` element. Open the `rushti_results` subset to see execution data:
@@ -180,14 +191,41 @@ rushti run --tm1-instance tm1srv01 --workflow Sample_Normal_Mode --max-workers 4
180191
# Run the stage-based sample
181192
rushti run --tm1-instance tm1srv01 --workflow Sample_Stage_Mode --max-workers 4
182193

183-
# Run the optimized sample (with explicit dependencies)
184-
rushti run --tm1-instance tm1srv01 --workflow Sample_Optimal_Mode --max-workers 4
194+
# Run the optimized sample (with explicit dependencies) — note --mode opt
195+
rushti run --tm1-instance tm1srv01 --workflow Sample_Optimal_Mode --mode opt --max-workers 4
185196
```
186197

198+
`Sample_Optimal_Mode` defines its task ordering through the `predecessors` measure, so it **requires `--mode opt`**. Run it without that flag and RushTI reads the cube in `norm` mode, drops the predecessors, and falls back to wait-based sequencing — the run "works" but does not respect the dependency graph you defined.
199+
187200
Check the `rushti` cube afterward to confirm that results were written.
188201

189202
---
190203

204+
## Choosing the Mode for Cube Reads
205+
206+
Unlike file sources — where the mode is auto-detected from the file's structure — a cube read **cannot infer the mode**. Every workflow occupies the same set of measures in the `rushti` cube (`wait`, `predecessors`, `instance`, `process`, …), so there is no structural signal that distinguishes a wait-based workflow from a predecessor-based one. You tell RushTI which one to use with `--mode`:
207+
208+
| `--mode` | Sequencing driver | `wait` measure | `predecessors` measure |
209+
|----------|-------------------|----------------|------------------------|
210+
| `norm` (default) | `wait` markers create sequential groups | **Used** | **Ignored** (logs a warning if populated) |
211+
| `opt` | Explicit `predecessors` form a DAG | Ignored | **Used** |
212+
213+
```bash
214+
# Wait-based (norm) workflow — the default, no flag needed
215+
rushti run --tm1-instance tm1srv01 --workflow Sample_Normal_Mode --max-workers 4
216+
217+
# Predecessor-based (opt) workflow — --mode opt is required
218+
rushti run --tm1-instance tm1srv01 --workflow Sample_Optimal_Mode --mode opt --max-workers 4
219+
```
220+
221+
!!! tip "Make `opt` the default if most of your cube workflows use predecessors"
222+
If the majority of your cube-stored workflows are predecessor-based, set `mode = opt` in the `[defaults]` section of `settings.ini` so you don't have to pass `--mode opt` on every run. The CLI `--mode` flag still overrides it per run.
223+
224+
!!! note "`--mode` and file sources"
225+
For `--tasks` (JSON/TXT files) the mode is auto-detected from content and `--mode` is ignored. The flag only changes behaviour for cube reads (`--tm1-instance`).
226+
227+
---
228+
191229
## Configuration
192230

193231
### Settings Reference

docs/getting-started/task-files.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,14 @@ Each task is defined by writing values to these measures:
7272
### Run Tasks from the Cube
7373

7474
```bash
75-
rushti run --tm1-instance tm1srv01 --workflow daily-refresh --max-workers 4
75+
rushti run --tm1-instance tm1srv01 --workflow daily-refresh --mode opt --max-workers 4
7676
```
7777

7878
RushTI reads the task definitions from the cube, builds the DAG, and executes — exactly like running from a file.
7979

80+
!!! warning "`--mode opt` is required for predecessor-based workflows"
81+
Because the workflow above uses the `predecessors` measure, you must pass `--mode opt`. A cube read cannot auto-detect its mode (unlike a file source) and defaults to `norm`, which ignores `predecessors` and sequences tasks by the `wait` measure instead. See [TM1 integration → Choosing the mode for cube reads](../features/tm1-integration.md#choosing-the-mode-for-cube-reads).
82+
8083
### View Results
8184

8285
When result pushing is enabled, RushTI writes execution results back to the same cube. Each run gets its own `rushti_run_id` element (e.g., `20260209_143022`), so you can see the full execution history:

src/rushti/cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,11 +249,14 @@ def create_argument_parser() -> argparse.ArgumentParser:
249249
%(prog)s -t tasks.txt -w 4 -r 2 -o results.csv
250250
%(prog)s --tasks tasks.json --max-workers 8 --retries 3
251251
%(prog)s --tm1-instance tm1srv01 --workflow Sample --max-workers 4
252+
%(prog)s --tm1-instance tm1srv01 --workflow Sample_Optimal_Mode --mode opt
252253
253254
Configuration:
254255
Default values can be set in settings.ini (see settings.ini.template).
255256
Settings precedence: CLI args > JSON task file > settings.ini > defaults
256-
File format is auto-detected (--mode is deprecated for file sources).
257+
File sources auto-detect the mode (--mode is ignored). Cube reads
258+
(--tm1-instance) cannot, and default to norm; pass --mode opt to honour
259+
the 'predecessors' measure.
257260
""",
258261
)
259262

@@ -286,7 +289,7 @@ def create_argument_parser() -> argparse.ArgumentParser:
286289
dest="execution_mode",
287290
choices=["norm", "opt"],
288291
default=None,
289-
help="[Deprecated] Execution mode is now auto-detected from file content. This option is kept for backwards compatibility but ignored.",
292+
help="Execution mode: norm or opt. Auto-detected (and ignored) for file sources. For cube reads (--tm1-instance) it defaults to norm; pass 'opt' to honour the 'predecessors' measure.",
290293
)
291294

292295
parser.add_argument(

0 commit comments

Comments
 (0)