Skip to content

SPARK-2083 Add support for spark.local.maxFailures configuration property - #1465

Closed
bhavanki wants to merge 2 commits into
apache:masterfrom
bhavanki:SPARK-2083
Closed

bhavanki wants to merge 2 commits into
apache:masterfrom
bhavanki:SPARK-2083

Conversation

@bhavanki

Copy link
Copy Markdown

The logic in SparkContext for creating a new task scheduler now looks for a "spark.local.maxFailures" property to specify the number of task failures in a local job that will cause the job to fail. Its default is the prior fixed value of 1 (no retries).

The patch includes documentation updates and new unit tests.

@AmplabJenkins

Copy link
Copy Markdown

Can one of the admins verify this patch?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'd rename the variable maxTaskFailures

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do.

@roji

roji commented Aug 10, 2014

Copy link
Copy Markdown

+1, this is important to us for locally testing exception logic before running on a real cluster

@JoshRosen

Copy link
Copy Markdown
Contributor

I think there's already a mechanism to set this by using local[N, maxFailures] to create your SparkContext:

// Regular expression for local[N, maxRetries], used in tests with failing tasks
     val LOCAL_N_FAILURES_REGEX = """local\[([0-9]+)\s*,\s*([0-9]+)\]""".r

// ...

case LOCAL_N_FAILURES_REGEX(threads, maxFailures) =>
         val scheduler = new TaskSchedulerImpl(sc, maxFailures.toInt, isLocal = true)
         val backend = new LocalBackend(scheduler, threads.toInt)
         scheduler.initialize(backend)
         scheduler

@AmplabJenkins

Copy link
Copy Markdown

Can one of the admins verify this patch?

@bhavanki

Copy link
Copy Markdown
Author

@JoshRosen You are right, the local[N, maxfailures] mechanism works already, but the filer of SPARK-2083 stated that "it is not documented and hard to manage", and suggested a patch like this one.

@SparkQA

SparkQA commented Sep 5, 2014

Copy link
Copy Markdown

Can one of the admins verify this patch?

@andrewor14

Copy link
Copy Markdown
Contributor

@kbzod Why do we need a separate config for the local case? I think the correct solution is to use the same config, but set a different default value for local mode. Right now this doesn't work because we pass in a hard-coded value of 1, but we can change that to take in spark.task.maxFailures instead (and then default to 1).

Also, can you rebase to master when you have the chance?

@andrewor14

Copy link
Copy Markdown
Contributor

add to whitelist

@pwendell

Copy link
Copy Markdown
Contributor

If this is being used for testing, I don't see a compelling reason to adding a config over using the constructor.

@pwendell

Copy link
Copy Markdown
Contributor

I'm going to close this issue as wontfix.

@asfgit asfgit closed this in f73b56f Nov 10, 2014
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 11, 2026
…1465)

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

This repository runs pull requests' tests in the author's fork (`build_main.yml` on push), and shows the result on the pull request as a `Build` check. Two workflows on this repository handle that:

* `notify_test_workflow.yml` ("On pull request update") ran on `pull_request_target` on every push. It found the fork's run and created the `Build` check, pointing at it.
* `update_build_status.yml` starts on `workflow_run` when that workflow completes. It then polls every open pull request's fork run every 120 seconds while any is in flight, patches each `Build` check to its run's status and verdict, and creates a `Build` check for a pull request that has none (the backfill). A cron every 15 minutes is the backstop.

This change removes the `pull_request_target` step and keeps the rest:

1. **`notify_test_workflow.yml` is deleted**, as apache/spark deleted it (SPARK-60578). Upstream's comment changes to `update_build_status.yml` from that commit are taken as well, so later syncs stay small. With notify gone, the updater's backfill creates the `Build` check on its first pass.
2. **New `.github/workflows/varka-pr-update.yml`** keeps notify's workflow name, "On pull request update", so the updater's `workflow_run: workflows: [...]` list is unchanged. It runs on `pull_request` (opened, reopened, synchronize) with `permissions: {}`, checks nothing out and writes nothing. It waits up to three minutes, polling every 10 seconds, for the fork's `build_main.yml` run of the head commit to be listed. Without that wait, the updater's first pass could run before the fork run registers and write an `action_required` "Workflow run detection failed" check. A newer push to the same pull request cancels the older wait (a per-PR concurrency group). A cancelled run still completes, and its completion still starts the updater.
3. **`update_build_status.yml`**: a backfilled check is created `queued`, and only the next pass writes its run's verdict. The pass that creates it now counts it in flight even when the fork run has already completed, so the loop does not end before writing the verdict. Without this, a fast-failing run would leave the check `queued` until the cron. The header comments now describe the new trigger.

Upstream's updater relies on its cron alone. GitHub's cron runs hours late on this repository, so the push signal stays and only its trigger changes.

### Why are the changes needed?

The ASF is turning `pull_request_target` off, and GitHub changes that trigger's default on 2 December 2026. After that, notify would stop running and pull requests would get no `Build` check until the late cron. A `pull_request` run from a fork gets a read-only token and no secrets. The writes happen in `update_build_status.yml`, which `workflow_run` runs from the default branch with this repository's token. It never checks out a pull request's code and reads nothing from the triggering run's payload; it lists open pull requests and fork runs through the API. So a pull request that edits `varka-pr-update.yml` can at most stop its own trigger. In that case the cron or `gh workflow run update_build_status.yml -R vecbricks/varka` still syncs it.

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

No user-facing change to Spark or Varka. On pull requests:
* The "Notify test workflow" check is replaced by "Wait for the fork's Build run".
* The `Build` check keeps its name. It appears when the updater's first pass runs, once the fork run is listed or after three minutes, rather than seconds after the push.
* The check's link opens the fork's Actions run, not its `Run / Check changes` check.

`master` has no branch protection or ruleset (the API returns "Branch not protected" and `[]`), so no required check is renamed and no merge is blocked. A first-time contributor's `pull_request` run needs a maintainer's approval under this repository's `first_time_contributors` policy; until it is approved, that pull request's check waits for the cron.

### How was this patch tested?

* `actionlint` on both workflows; `python3 dev/varka_push_check.py` passed.
* This pull request cannot prove the new path by itself, because `master`'s notify still writes this pull request's `Build` check. To test it before merge, with no merge needed:
  1. `gh workflow disable notify_test_workflow.yml -R vecbricks/varka`.
  2. Push to this pull request. The "On pull request update" run (this branch's `varka-pr-update.yml`) should complete. Then `master`'s `update_build_status.yml` should start on `workflow_run`, backfill a `queued` `Build` check, and move it to the fork run's verdict.
  3. `gh workflow enable notify_test_workflow.yml -R vecbricks/varka` (or merge, which deletes it).

  This tests the trigger, the `workflow_run` chain and the backfill. It does not test this pull request's edit to `update_build_status.yml`, because `workflow_run` runs `master`'s copy; that edit runs only after merge. If the updater does not start in step 2, the result is inconclusive, because the trigger file is not on `master` yet. On the first push, the trigger job's log should read "Fork run ... is ...". If it reads "Listing the fork runs failed", the `permissions: {}` token cannot read the fork, and every push would wait the full three minutes.
* After merge, the first pull request push shows the same sequence. If it shows no `Build` check, run `gh workflow run update_build_status.yml -R vecbricks/varka`. If the check then appears, the trigger chain is broken; if it does not, the backfill is. Reverting this pull request restores notify, but only until 2 December.

Review: `/code-review high` found nine points. Fixed: a backfilled check over a completed run left `queued` when the loop ended (now counted in flight after a successful create, so a create that keeps failing cannot hold the loop open); the wait stopping at its first failed read; no cancellation for superseded pushes; the record's other notify mentions; and two misleading comments. Left as they are:
* A loop already running for another pull request can still reach a fresh push before its fork run registers. It writes `action_required`, and its next pass, 120 seconds later, supersedes it.
* The approval gate for first-time contributors, described above.
* The suggestion to move the wait into the updater, kept out to keep the change small.

### 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)
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.

8 participants