Skip to content

[Spark 2557] fix LOCAL_N_REGEX in createTaskScheduler and make local-n and local-n-failures consistent - #1464

Closed
advancedxy wants to merge 2 commits into
apache:masterfrom
advancedxy:SPARK-2557
Closed

advancedxy wants to merge 2 commits into
apache:masterfrom
advancedxy:SPARK-2557

Conversation

@advancedxy

Copy link
Copy Markdown
Contributor

@AmplabJenkins

Copy link
Copy Markdown

Can one of the admins verify this patch?

@pwendell

Copy link
Copy Markdown
Contributor

/cc @aarondav

@advancedxy

Copy link
Copy Markdown
Contributor Author

ping. @aarondav what do you think?

@advancedxy

Copy link
Copy Markdown
Contributor Author

Well, could someone review this pr? Or should I close this pr?

@aarondav

aarondav commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

This seems totally reasonable, apologies for not seeing this. LGTM once Jenkins passes.

@aarondav

aarondav commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

Jenkins, test this please.

@SparkQA

SparkQA commented Aug 1, 2014

Copy link
Copy Markdown

QA tests have started for PR 1464. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17655/consoleFull

@SparkQA

SparkQA commented Aug 1, 2014

Copy link
Copy Markdown

QA results for PR 1464:
- This patch PASSES unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17655/consoleFull

@aarondav

aarondav commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

Merging into master. Thanks!

@asfgit asfgit closed this in 284771e Aug 1, 2014
xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
…n and local-n-failures consistent

[SPARK-2557](https://issues.apache.org/jira/browse/SPARK-2557)

Author: Ye Xianjin <advancedxy@gmail.com>

Closes apache#1464 from advancedxy/SPARK-2557 and squashes the following commits:

d844d67 [Ye Xianjin] add local-*-n-failures, bad-local-n, bad-local-n-failures test case
3bbc668 [Ye Xianjin] fix LOCAL_N_REGEX regular expression and make local_n_failures accept * as all cores on the computer
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 11, 2026
…ache#1464)

### What changes were proposed in this pull request?

`benchmark.yml` takes an `expected-cpu` input. When it is set, the harness and pair jobs check the runner's CPU in their step "Probe the machine's CPU and vector datapath" (`dev/varka_datapath.sh`), and on another CPU the job fails before the build with the annotation `CPU mismatch! Expected 'AMD EPYC 7763' but got '...'`. Results are taken only from an EPYC 7763, so a run that draws another CPU has to be rerun. This pull request moves that rerun into CI.

**The workflow.** A new workflow, `.github/workflows/varka-bench-cpu-retry.yml`, starts through `workflow_run` when a run of "Run benchmarks" completes with a failure. Its one job runs `dev/varka_bench_cpu_retry.py` for that run and attempt:

1. **Wait for the attempt.** A job started by `workflow_run` finds its attempt already complete. A dispatched job polls every 2 minutes until the attempt completes, including while the run has not yet reached that attempt. It stops early when the run is not of `benchmark.yml`, when a later attempt has started, or when every benchmark job of the attempt has passed its CPU check, since such an attempt can no longer fail on the CPU. For a rerun attempt, this early stop waits until every job the previous attempt failed is listed again, so that jobs carried over as passed do not end the watch on their own. If the attempt is still running after 240 minutes, the job fails and names the dispatch that resumes the chain.
2. **Decide.** A rerun is due only when the run is a run of `benchmark.yml` and concluded `failure`, and every job that neither succeeded nor skipped concluded `failure` with the probe step as its first failed step and a failure annotation starting `CPU mismatch! ` on its check run. The tool reads job and step conclusions from the jobs API and annotations from the check-runs API, not from logs. A cancelled, timed-out or startup-failed job, a failure in any other step (the build, the benchmark, the matrix job), or the probe's own 256:128 control failing in the same step means no rerun.
3. **Wait.** The rerun comes 60 minutes after the attempt completed. The tool then reads the run again and does nothing if it is no longer at that attempt and completed, for example because someone reran it by hand.
4. **Rerun and chain.** It calls `rerun-failed-jobs`, so jobs that passed are kept. It then dispatches its own workflow to watch the next attempt. GitHub does not start new runs for most events caused by `GITHUB_TOKEN`, and it does not say whether a rerun requested with that token fires `workflow_run` when it completes. A `workflow_dispatch` is documented to work, so the dispatch is what keeps the chain going. If `workflow_run` fires as well, the concurrency group (one per run and attempt) runs the two jobs one after the other, and the second finds the run moved on and stops. The group names the attempt because GitHub keeps only one pending job per group and cancels an older one. A group per run would let a late `workflow_run` job cancel the pending watcher of the next attempt. Reads and the dispatch are retried over 429, 5xx and network failures. The rerun request is not retried, since a rerun the server accepted but did not answer would otherwise start twice.
5. **Cap.** At most 6 attempts in all, counted by the run's `run_attempt`. An `expected-cpu` that no runner has mismatches on every attempt and stops at attempt 6 with "gave up: attempt 6 of 6 is the cap".

The job holds `actions: write` (the rerun and the dispatch), `checks: read` (the annotations) and `contents: read`. It checks out only the tool, never a benchmark's code, and passes event fields through `env`. A hand dispatch (`run-id`, `attempt`, `wait-minutes`, `dry-run`) starts or resumes a chain.

**The summary.** With `--github`, `dev/varka_datapath.sh` now writes `CPU check, attempt N: expected '...', got '...': failed` to the benchmark job's summary. On a later attempt that passes, it writes the CPU it got. So each attempt's page shows its own CPU. Each retry job's summary lists the mismatches it read and what it did.

The tool's self-test runs in the Build's lint job beside the other house-rule tools. `varka-surface-benchmark.yml` runs the same CPU check, but its runs are not rerun: the change covers `benchmark.yml` only.

**Review.** `/code-review high` on the branch found ten points, and eight are fixed:

- the per-run concurrency group, described above;
- a watcher dispatched ahead of its attempt stopped instead of polling;
- the deadline ended the chain with a green job;
- the dispatch was not retried;
- the dry run waited out the hour;
- jobs carried over by a rerun could end the watch early;
- a run of another workflow was rejected only after the watch;
- a comment claimed the surface benchmark's reruns.

Two are left. The first is a scheduled sweep in place of the chain. This repository's notes say GitHub's cron runs hours late here, which would turn the one-hour wait into several. The second is an API client shared with `dev/varka_ci_admit.py`. The job checks out only this one file.

### Why are the changes needed?

The rerun was done by a laptop script. It waited for the run, grepped `gh run view --log-failed` for `CPU mismatch`, slept an hour and reran the failed jobs, at most six times. On 9 November 2026 one pull request's 128-bit benchmark run needed four tries over about five hours. Two other pull requests' runs were still retrying at the time, each from a detached laptop process, which dies when the laptop sleeps or reboots. On 10 November 4 of 5 attempts on vecbricks/varka drew an EPYC 9V45 or 9V74. At that rate, six attempts reach a 7763 about 74% of the time (1 - 0.8^6).

### Does this PR introduce _any_ user-facing change?

No. CI only.

### How was this patch tested?

- `python3 dev/varka_bench_cpu_retry.py --selftest`: 22 tests and the doctests. They run the decision over job and annotation shapes recorded from vecbricks/varka runs 42794013318 (attempt 3, a 9V45) and 41977272181 (a benchmark failure). They also cover a misconfigured `expected-cpu` chained to the cap (five reruns, then stop), a run rerun by someone else during the wait, a watcher of an older attempt and one dispatched ahead of its attempt, early exit once every check passed (and not before a rerun's jobs are listed), the deadline failing the job, a run of another workflow, which failures are retried, and the dry run. The names the tool keys on are read from `benchmark.yml`, `varka_datapath.sh` and the new workflow.
- `--dry-run --wait-minutes 0` against live vecbricks/varka runs (read-only): run 42794013318 attempt 3 and run 41970716865 read as CPU-only, run 41977272181 as "failed in step 'Run benchmarks'", and run 42794019027 as a success.
- `actionlint` on the new workflow, `ruff` 0.14.8, `dev/varka_push_check.py`.

`workflow_run` runs only from the default branch, so the workflow can be checked end to end only after the merge. On vecbricks/varka, dispatch `benchmark.yml` with a small class, `generate-tpcds=false` and `expected-cpu=NO-SUCH-CPU`. Cancel the `workflow_run` retry job it starts, then dispatch `varka-bench-cpu-retry.yml` with `run-id=<run> attempt=1 wait-minutes=0`. The chain passes the wait on, so this should rerun attempts 1 to 5 and stop at 6, in about half an hour of short jobs. Any extra retry job started by `workflow_run` shows whether a `GITHUB_TOKEN` rerun fires that event.

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5.5)
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 11, 2026
…e#1509)

### What changes were proposed in this pull request?

This is a plan-only change to milestone 8's task table (`sql/varka/plans/m8/PLAN.md` section 3). I read every row whose state is not `Done` against the pull requests merged under its id and against its done-when. Eleven rows are closed, one is marked done in part, and two rows that lag merged work have their state text corrected. Only the state clause of each row changes. Merge dates are in CET.

| row | old state -> new state | evidence |
| ---: | :--- | :--- |
| 554 | Started -> Done | apache#1312 merged 3 November. Its own Build was cancelled. The size step later failed the lint job of apache#1427's Build (run 42606922446) with "1357 counted lines ... at or over the cap of 1000" and the largest files. Passing changes print their count. That 1357 is the over-count row 588 later fixed, but it still shows the failure path. |
| 558 | Started -> Done | apache#1320 merged 3 November. `varka_lint.py --selftest` passes in the Varka docs checks job, `ci-gates` included. The Build of the plan-only apache#1506 (run 43087405861) skipped both the protobuf job and the UI job. |
| 559 | Started -> Done | apache#1329 merged 4 November. Every chain explains in under 2 ms at depth 20, with verdicts and bytes unchanged (`VARKA-559.md` 6, `results/VARKA-559-planning-cost.txt`). |
| 569 | Started -> Done | apache#1367 merged 5 November. The hook refuses the wrong checkout and names the fix. `dev/varka_prepush.sh --selftest` is in the lint job and passes. |
| 580 | Started -> Done | apache#1426 merged 9 November. The row was done when it merged. The grammar draws a narrow `BitCount` again (`VarkaIrGrammar` case 10). |
| 581 | Started -> Done | apache#1416 merged 9 November. The first three Builds whose heads hold it passed catalyst shard 1 of 3: runs 42589018437, 42602246363 and 42602326887. No later run of that job failed through 03:00 UTC on 10 November. In their JUnit reports `VarkaWidthAuditSuite` spends 538 to 1099 s in `beforeAll`, and its longest test takes 1.0 s. |
| 582 | Started -> Done | apache#1429 merged 9 November. The row's only open item was review and merge. `VarkaChildProcess` and `VarkaChildProcessSuite` are on master. |
| 585 | Started -> Done | apache#1441 merged 10 November. The Build of its head `f017ecac0e8` (run 42699618930) passed all seven suites, according to its JUnit reports. The census suite's one skipped test is the host-census file check, not a child-JVM test. |
| 588 | Started -> Done | apache#1471 merged 11 November. The lint job's other steps continue on error. apache#1427's merge commit is in master's history, so the self-test's pinned case counts 52 lines both in the docs-checks job's full clone and on the laptop. |
| 589 | Started -> Done | apache#1465 merged 11 November. `notify_test_workflow.yml` is gone, and no `pull_request_target` sync has run since. apache#1506's `Build` check (check run 130755752876) was created while fork run 43087405861 was still running, and it completed with that run's success. |
| 595 | Started -> Done | apache#1481 merged 11 November. `dev/varka_precommit.sh --selftest` passes. |
| 594 | Started -> Done in part | apache#1463 merged 10 November. Its dry-run table passes every baseline but one at both widths, on AVX-512 and under `-XX:UseAVX=2` on the same laptop. Left: `VarkaBooleanOutputBenchmark`, which stops by design until row 27's step 6, and a dry run on a real AVX2 host. |
| 340 | Started (text) | "built on branch" now reads "merged as apache#1397" for steps 2 to 4 and "merged as apache#1434" for step 5. The runner measurement is still owed. |
| 414 | Started (text) | "built" now reads "built and merged as apache#1454". The fuse after the SPARK-61352 sync is still owed. |

Rows left as they are:

- 591: apache#1464 merged, and retry runs exist on vecbricks/varka, for example 43039739304. The post-merge check of `VARKA-591.md` 3 is not recorded on master, so this is unverified.
- 572: this change does the reading that row 572 leaves open. The row can close once this change merges.
- 414: its done-when is met by its "stays declined with the reason recorded" branch. The row still names the post-sync fuse as owed, so I left the state to the owner.
- 27, 157, 332, 341 to 344, 347 to 349, 352, 359, 361, 363, 506 and 577: the type rows. Each one names steps or runner measurements that are still left, and merged work does not finish them.
- 483, 490, 491, 493, 507, 508, 510, 512 to 517, 519 to 521, 523 to 530, 532, 533, 536, 538, 546, 555, 557, 563, 565 and 573: the harness rows. Each one's open item is a CI measurement, a matrix run or an owner decision, and master records none of them. For 565, the EPYC regeneration is still owed. For 573, a scheduled run (42355859989) is cited in row 330, but the row's own list of open items is longer.
- Planned rows with only plan PRs merged, and every row with an open PR today (103, 104, 339, 342, 345, 360, 541, 578, 584, 592, 593, 596 to 598, 603, 606), were not changed.

### Why are the changes needed?

The owner asked on 11 November 2026 for the rows whose work had finished to stop reading as Started. A count of the milestone reads these states.

### Does this PR introduce _any_ user-facing change?

No. Only the plan changes.

### How was this patch tested?

- `python3 dev/varka_plan_lint.py --check`, online so that the run-head pairing of row 585 is checked: 0 findings.
- `python3 dev/varka_push_check.py`: passed (28 counted lines).
- `varka_msg_check.py`, `varka_precommit.sh`, `varka_prepush.sh` and `varka_lint.py` self-tests: ok.
- One `/code-review high` pass: found 10 / fixed 5 / left 5. Fixed:
  - row 588 wrongly said CI runs the apache#1427 case vacuously;
  - rows 558, 569 and 588 named the lint job for self-tests that run in the Varka docs checks job;
  - row 594 contradicted itself and did not say its AVX2 columns are emulated;
  - row 554 claimed "every Build since" without a source;
  - row 589 still named its branch.

  Left:
  - `VARKA-559.md` 9 still says "not opened". This change rewrites only the plan's state clauses.
  - Row 414 meets its done-when through the "stays declined" branch, but the row keeps the post-sync fuse as owed. That is the owner's call.
  - `varka_plan_lint.py` reads run heads from vecbricks/varka, so a fork Build citation such as row 585's can never be checked. That is a tool change, not a row change.
  - Row 585's skipped census test is the host-file check (see the table).
  - Row 595's "differs from both parents" rule is the reading of "what it adds over its first parent" that leaves out what master brings, which is the row's intent.

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5.5)
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 12, 2026
…pache#1516)

### What changes were proposed in this pull request?

This is a plan-only change to milestone 8's task table (`sql/varka/plans/m8/PLAN.md`, section 3). No code moves. It closes one row, corrects the text of another, and adds two rows on the owner's word.

| row | change | evidence |
| ---: | :--- | :--- |
| 572 | Started -> Done | The row asked for every row whose text lagged merged work to be read against its pull requests and corrected in a plan-only PR. apache#1366 and apache#1370 (merged 5 November) did the first readings. apache#1509 (merged 11 November) read every row not `Done` and closed eleven. Of the rows apache#1509 read and left alone, 591 still read as before its merge, and this change fixes it. Row 414 already names apache#1454. Rows whose PRs merged after apache#1509 (578, 592, 593, 596, 603 and 606, all on 12 November) do not name those PRs yet. They are past this reading and are not corrected here. |
| 591 | Started (text) | "built" now reads "built and merged as apache#1464 on 11 November 2026". The post-merge check is still owed, so the row stays Started. |
| 608 | new, Planned | The filter fallback evaluates the left fold of the fused conjuncts, not Spark's tree (below). |
| 609 | new, Planned | A guard in an `IfElse` condition is never qualified by the arms around the `IfElse` (below). |

**Row 608.** When no conjunct is residual, `VarkaColumnarRule.rewriteFilter` builds the Varka node's condition as `fusedConjuncts.reduceLeft(And(_, _))` and passes no `wholeCondition`. `VarkaExpressionCompiler.conjuncts` flattens every `AND` of the spine first. When the filter is not whole-stage compiled, `VarkaFilterExecBase.fallbackCondition` returns that fold unchanged, so a batch the kernel declines is filtered by `Predicate.create` over the fold, while Spark's `FilterExec` uses `Predicate.create` over its own tree.

With subexpression elimination on, `GeneratePredicate` uses `generateConjunctsWithSubexprCodes`. That keeps an `AND` of the spine that is itself a common subexpression as one conjunct, and evaluates the subexpressions it contains just before it, which is ahead of its first operand (SPARK-61197's mechanism). An `AND` that only Spark's tree has can therefore make Spark raise where Varka answers.

The row carries a reproducer worked out by hand and not run, under ANSI with codegen off: `j > 0 AND (i > 1 AND make_date(2021, m, 1) < d) AND IF(i > 1 AND make_date(2021, m, 1) < d, d0, d1) < make_date(2021, m, 1)`. It also notes that this corrects `VARKA-541.md` 0 item 7, which says the two agree by construction when Spark does not compile the filter. Done when the fallback evaluates the filter's own tree and a differential test agrees with Spark under both settings of subexpression elimination. The row starts after row 541, and coordinates with row 386, because both edit `fallbackCondition`. Found in row 541's build. The cause predates that build and is outside 541's scope.

**Row 609.** `Analysis.assignArmChain` enters every `IfElse` condition with the empty chain, and the empty chain means unqualified. A guarded node that a condition reads therefore condemns the batch from any lane, including lanes of an enclosing arm that is not taken. The result is lost fusion: the batch declines to the row path, which answers as Spark does.

The example on master, found by reading the code: `abs` of a year-month interval is `IfElse(x < 0, -x, x)`, and `ym - ymm` is a checked subtraction. In `CASE WHEN <guard> < 0 THEN abs(ym - ymm) ELSE <column> END`, and as a later COALESCE argument, the extremes row's overflow condemns the batch. Spark answers there. Once step 103a1 lands, `abs(dt * 3)` is the same case.

Done when an `IfElse` condition inherits the chain that its `IfElse` is reached by. The existing own-condition and cycle rules must still hold (`VarkaGuardEdgeSuite`), and a coverage row `abs(ym - ymm)` must be served in the untaken CASE arm and the COALESCE position. Found in step 103a2's build.

### Why are the changes needed?

The owner approved this change on 12 November 2026. Row 572's work is finished, so it should stop counting as open. Both findings are outside the builds that found them, and without rows of their own nothing would track them. Row 608 is a case where Varka answers a query that vanilla Spark rejects with an error. Row 609 costs fusion on every batch that holds such a row.

### Does this PR introduce _any_ user-facing change?

No. Only the plan changes.

### How was this patch tested?

- `python3 dev/varka_plan_lint.py --check --offline`: 0 findings.
- `python3 dev/varka_quote_check.py`: 0 orphans.
- `python3 dev/varka_msg_check.py size`: 6 counted lines.
- `dev/varka_push_check.py` passes.
- Every code claim in rows 608 and 609 was checked by reading master at `e48a856f5a8`. Neither reproducer was run, and each row says so.

One `/code-review high` pass: found 5 / fixed 4 / left 1. All five were in row 608.

- The sketch first used `i = 2`. `ConstantPropagation.moveEqualitiesFirst` would move that equality first and substitute it into the `IF`, so the example would show nothing. It now uses `i > 1`.
- The row contradicted `VARKA-541.md` 0 item 7 without saying so. It now names the correction and SPARK-61197.
- The done-when asked for a served-kernel cell that no raising batch can reach. That cell is dropped.
- The row did not mention row 386, which edits the same method. It does now.
- Left as a trade-off: the dated note on `VARKA-541.md` 0 item 7 itself. Row 541's open build rewrites that file, so the note is part of row 608's done-when instead of this change. This keeps the PR to `PLAN.md` and avoids a conflict with that build.

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Opus 5.5)
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 15, 2026
### What changes were proposed in this pull request?

Closes two milestone rows on the CI evidence of 14 November 2026, and corrects a third row's record. Records only: `sql/varka/plans/m8/PLAN.md` and `VARKA-591.md`.

**Row 591 — a benchmark that lands on the wrong CPU is rerun by CI, not by a laptop.** The retry workflow (`varka-bench-cpu-retry.yml`, merged as apache#1464) reran the day's CPU-failed benchmark runs from a failed attempt to a passing one: chain `43549162970` on run `43549050075`, `43582971991` on run `43582853857`, and `43599624021` on run `43575854826`'s attempt 5 to its attempt 6. Jobs that watched a green run are skipped (`43556282066`, `43584498512`, `43589334199`, `43608011497`), so a `GITHUB_TOKEN` rerun does not keep a chain alive. Some reruns that day came from the operator's watcher rather than the workflow, which the row now says; the give-up arm is held by `dev/varka_bench_cpu_retry.py --selftest`, and `VARKA-591.md` 3 records the outcome against its planned check.

**Row 592 — the proof solvers install from a cache, and a download retries** (merged as apache#1474 on 12 November 2026, commit `c26e5d6c099`). The fork's master run `43222340532` (head `1958fd1d7a7`, 12 November) found no `varka-solvers` entry, installed z3 5.1.0 and cvc5 1.4.1 and saved the key `varka-solvers-z3-5.1.0-dfad9e309d7010b1-cvc5-1.4.1-2f8efe58fe27ba7b`. Every master run since and the pull request Builds' linters jobs restore it with no solver download — the Build's job `132581520819` restored the key at 20:49 on 14 November, and its log shows no cvc5 or z3 download.

**Row 598 — kept Started, with its record corrected.** Its code merged as apache#1486 on 12 November 2026, but that pull request's own description records that the row stays Started until a results PR carries the decimal and day-time baselines' EPYC 7763 runs measured after the merge, and that PR has not merged; the committed runner files still predate the change. The row now says so, and its earlier `NULL_TESTS` claim was dropped with it.

### Why are the changes needed?

The plan has been overstating two rows' open work: both were built and merged and waited only on a post-merge CI observation, and that observation now exists. A third row looked closed and is not, so its record is corrected to say what is still owed rather than to claim a completion its own pull request deferred.

### Does this PR introduce _any_ user-facing change?

No. The plan records change; no code, test or generated file moves.

### How was this patch tested?

No code changed. From the worktree, after the review corrections: `dev/varka_plan_lint.py --check` (the CI form, with the run-head check online) reports 0 findings; `dev/varka_quote_check.py` passes; `dev/varka_census.py --check` passes; `dev/varka_push_check.py` counts 6 of 1000 lines. `/code-review high` on the branch found six points, all applied in the second commit: row 591's citation attributed the retry chains to green benchmark runs and ignored the operator's own reruns (rewritten to the chains that actually reran a failed attempt), `VARKA-591.md` 3 now records the outcome against its planned check, row 592 names its pull request (apache#1474), and row 598 is kept Started because apache#1486's description conditions its closure on a results PR that has not merged; the two sentences that made that claim are gone.

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code (deepseek-flash[1m])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants