apache / apache/texera

Workflow-level READY state is unreachable: an all-ready workflow reports RUNNING

Open
#8,148 1 comment 0 reactions 1 assignee Claimed by @anthonychengit View on GitHub
Dominant language
Scala
Stars
314
Forks
187
Avg merge
1d 21h
Merged PRs (30d)
214

Description

### What happened?

`WorkflowExecution.getState`'s `READY` arm is unreachable, so a workflow whose operators are all `READY` is reported as `RUNNING`.

The chain is:

1. `WorkflowExecution.getState` aggregates over `getAllOperatorExecutions.map(_._2.getState)` and ends with:

```scala
} else if (runningOpStates.forall(_ == PAUSED)) {
WorkflowAggregatedState.PAUSED
} else if (runningOpStates.forall(_ == READY)) { // <- unreachable
WorkflowAggregatedState.READY
} else {
WorkflowAggregatedState.UNKNOWN
}
```

2. Each element of `runningOpStates` is an `OperatorExecution.getState`, which delegates to `ExecutionUtils.aggregateStates(workerStates, …, WorkerState.READY)`.

3. `ExecutionUtils.aggregateStates` maps an all-ready set to **`RUNNING`**, not `READY`:

```scala
} else if (unCompletedStates.forall(_ == readyState)) {
WorkflowAggregatedState.RUNNING
}
```

So no `OperatorExecution` can ever return `READY`, and `WorkflowExecution`'s `forall(_ == READY)` test can never hold. The workflow-level `READY` state is effectively unusable.

Expected: either an all-ready workflow reports `READY`, or the unreachable arm is removed and `WorkflowAggregatedState.READY` is documented as operator-level-only. Which of those is right is a product decision — the point of this report is that the current code says one thing and does another.

Found while assessing test coverage. **Deliberately not pinned by a test**, because a test asserting the present behaviour would cement the unreachability and make the fix harder.

### How to reproduce?

Static, no runtime repro needed:

1. `amber/src/main/scala/org/apache/texera/amber/engine/architecture/coordinator/execution/WorkflowExecution.scala` — the `forall(_ == READY)` arm near the end of `getState`.
2. `amber/src/main/scala/org/apache/texera/amber/engine/architecture/coordinator/execution/OperatorExecution.scala:73-84` — `getState` delegates to `aggregateStates`.
3. `amber/src/main/scala/org/apache/texera/amber/engine/architecture/coordinator/execution/ExecutionUtils.scala:108-109` — the all-`readyState` case returns `RUNNING`.

Coverage confirms it independently: the arm shows as never executed on `main`.

### Version/Branch

1.3.0-incubating-SNAPSHOT (main)

### Was this issue authored using generative AI tooling?

Generated-by: Claude Code (Opus 5)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.