Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --upgrade_warnings_as_errors flag #1701

Closed
wants to merge 14 commits into from

Conversation

Jasha10
Copy link
Collaborator

@Jasha10 Jasha10 commented Jun 29, 2021

This PR is to close #1689.

The main contributions are:

  • create a new subclass HydraUpgradeWarning of UserWarning
  • In deprecation warnings, use category=HydraUpgradeWarning
  • Add a command line flag --upgrade_warnings_as_errors that causes warnings.warn("...", category=HydraUpgradeWarning) to raise an error instead of a warning.

@facebook-github-bot facebook-github-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 Jun 29, 2021
@omry
Copy link
Collaborator

omry commented Jun 30, 2021

I was thinking about something a bit different:

  1. create a common function to call to issue a warning.
  2. That function can check the presence of an environment variable to decide if to trigger an error as well (sys.exit, maybe just an exception).

This way, we will also be able to replace that function at runtime to add additional logic to the warning (such as custom logging in fbcode).

What do you think?

@Jasha10
Copy link
Collaborator Author

Jasha10 commented Jun 30, 2021

What do you think?

Sounds reasonable to me. I've opened #1703 with an initial implementation.

@Jasha10 Jasha10 closed this Jun 30, 2021
@Jasha10 Jasha10 deleted the closes1689 branch September 15, 2021 20:14
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.

Option to fail application if there is any upgrade warnings
3 participants