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

Deprecate async_add_hass_job #115061

Merged
merged 7 commits into from
Apr 8, 2024
Merged

Deprecate async_add_hass_job #115061

merged 7 commits into from
Apr 8, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Apr 6, 2024

Proposed change

Deprecate async_add_hass_job

In #113260 we deprecated async_run_job and async_add_job. As we no longer have integration usage of async_add_hass_job we can deprecate it as well. async_run_hass_job should be used instead.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

Comment on lines +1512 to +1513
# pylint: disable-next=protected-access
self._hass._async_add_hass_job(job, event)
Copy link
Member Author

Choose a reason for hiding this comment

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

We only have 3 places left where this is called. We should try to get rid of them so we can deprecate this as well

homeassistant/components/matrix/__init__.py:            EVENT_HOMEASSISTANT_START, handle_startup, run_immediately=False
homeassistant/components/rfxtrx/__init__.py:            dr.EVENT_DEVICE_REGISTRY_UPDATED, _updated_device, run_immediately=False
homeassistant/helpers/event.py:        run_immediately=False,

Copy link
Member Author

Choose a reason for hiding this comment

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

event can be switched after #115160

If we can fix the other two we can deprecate run_immediately=False and get rid of this completely in a future PR

@bdraco bdraco added deprecation Indicates a breaking change to happen in the future and removed docs-missing labels Apr 7, 2024
@bdraco bdraco marked this pull request as ready for review April 7, 2024 22:57
@bdraco bdraco requested a review from a team as a code owner April 7, 2024 22:57
@bdraco
Copy link
Member Author

bdraco commented Apr 7, 2024

codecov is likely going to fail.

Directly covered lines in core:
homeassistant/core.py 1092 93 91% 434, 459-467, 476-490, 528-532, 550, 819, 956, 1041-1045, 1062, 1064-1065, 1068, 1079, 1146, 1158, 1161, 1188, 1206, 1373, 1422, 1432, 1494-1496, 1510-1511, 1526-1534, 1602-1610, 1752, 1770, 1774, 1840, 1941, 1986-1989, 2030, 2075, 2122, 2348, 2398-2400, 2417, 2471, 2511, 2579, 2584-2591, 2636, 2642, 2736, 2773-2774, 2848, 2850, 2852-2855, 2865, 2889, 2972, 2981-3000, 3008

667-684 are the new lines here for the report and test coverage was verified locally

@bdraco bdraco merged commit 6b44570 into dev Apr 8, 2024
38 checks passed
@bdraco bdraco deleted the dep_async_add_has_job branch April 8, 2024 00:08
@@ -1458,7 +1510,8 @@ def _async_fire(
except Exception: # pylint: disable=broad-except
_LOGGER.exception("Error running job: %s", job)
else:
self._hass.async_add_hass_job(job, event)
# pylint: disable-next=protected-access
Copy link
Member Author

Choose a reason for hiding this comment

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

This will go away in #115169

@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants