Skip to content

Conversation

@termux2o
Copy link

Motivation

This PR fixes a bug where on_job_end and on_run_end callbacks are not executed when the program is interrupted via Ctrl+C (KeyboardInterrupt).
Without this fix, cleanup and logging callbacks may be skipped, potentially causing inconsistent state or incomplete logs.

The patch ensures that callbacks are called safely during a KeyboardInterrupt while still allowing the program to terminate normally.
Tested on Hydra v1.3.2.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

  1. A minimal Hydra project was created with a registered MyCallback:
    • main.py runs a small training loop.
    • Pressing Ctrl+C triggers the interrupt.
  2. Verified manually that the following sequence occurs:
    • on_run_starton_job_start → Ctrl+C → on_job_endon_run_end
  3. Optional: Added automated pytest test for safe_invoke_on_interrupt() to ensure callbacks are called.
  4. No special setup required; tested in a clean conda environment with Python 3.8.

Related Issues and PRs

  • Fixes issue #3078
  • This is a standalone fix, not part of any larger PR

Jasha10 and others added 30 commits December 19, 2022 15:18
Previously running `nox -l` took about 5 seconds on my machine. After
this change, `nox -l` takes about 3 seconds.
Bumps [express](https://github.com/expressjs/express) from 4.17.2 to 4.18.2.
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.17.2...4.18.2)

---
updated-dependencies:
- dependency-name: express
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](json5/json5@v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Previously the error message for get_class failure-to-locate
was imprecise.
Jasha10 and others added 10 commits February 22, 2023 16:02
Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](kornelski/http-cache-semantics@v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
These changes were produced by running `FIX=1 nox -s lint-3.10`

This fixes a number of problems reported by the lint tests.  This does
not fix all errors: bandit still reports security issues due to using
pickle.
…esearch#2565)

When constructing the config search path, allow callers to directly pass
in a non-relative module name starting with `pkg://`.  This allows
callers to bypass the relative name lookup, and always get consistent
behavior regardless of the current environment variables at runtime.

This addresses issue facebookresearch#2564.

Co-authored-by: Adam Simpkins <[email protected]>
Co-authored-by: Jasha <[email protected]>
@meta-cla
Copy link

meta-cla bot commented Oct 23, 2025

Hi @termux2o!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 23, 2025
@meta-cla
Copy link

meta-cla bot commented Oct 23, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@termux2o
Copy link
Author

Hi, all tests have passed successfully on all platforms (Linux, Windows, macOS).
The CLA check also passed. Could someone please review and approve the workflows?
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants