Commit Graph
332 Commits
Author SHA1 Message Date
J. Nick Koston d0976f9a7e Ensure setup continues to move forward if a stage times out
If any stage timed out the setup of the components would
be cancelled instead of moving forward

fixes
```
2023-05-25 19:21:21.696 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Sun for sun
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 186, in _async_process_integration
    await self.async_process_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 248, in async_process_requirements
    async with self.pip_lock:
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 14, in __aenter__
    await self.acquire()
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 114, in acquire
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 217, in _async_setup_component
    processed_config = await conf_util.async_process_component_config(
  File "/usr/src/homeassistant/homeassistant/config.py", line 922, in async_process_component_config
    p_integration = await async_get_integration_with_requirements(hass, p_name)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 52, in async_get_integration_with_requirements
    return await manager.async_get_integration_with_requirements(domain)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 207, in _async_process_integration
    results = await asyncio.gather(
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/sun/__init__.py", line 101, in async_setup_entry
    await hass.config_entries.async_forward_entry_setups(entry, [Platform.SENSOR])
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1365, in async_forward_entry_setups
    await asyncio.gather(
asyncio.exceptions.CancelledError
2023-05-25 19:21:21.714 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry  for hacs
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 186, in _async_process_integration
    await self.async_process_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 248, in async_process_requirements
    async with self.pip_lock:
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 14, in __aenter__
    await self.acquire()
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 114, in acquire
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 217, in _async_setup_component
    processed_config = await conf_util.async_process_component_config(
  File "/usr/src/homeassistant/homeassistant/config.py", line 922, in async_process_component_config
    p_integration = await async_get_integration_with_requirements(hass, p_name)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 52, in async_get_integration_with_requirements
    return await manager.async_get_integration_with_requirements(domain)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 207, in _async_process_integration
    results = await asyncio.gather(
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/hacs/__init__.py", line 226, in async_setup_entry
    setup_result = await async_initialize_integration(hass=hass, config_entry=config_entry)
  File "/config/custom_components/hacs/__init__.py", line 212, in async_initialize_integration
    await async_try_startup()
  File "/config/custom_components/hacs/__init__.py", line 199, in async_try_startup
    startup_result = await async_startup()
  File "/config/custom_components/hacs/__init__.py", line 177, in async_startup
    await hass.config_entries.async_forward_entry_setups(
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1365, in async_forward_entry_setups
    await asyncio.gather(
asyncio.exceptions.CancelledError
2023-05-25 19:21:21.721 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Socket DB565A for flux_led
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 186, in _async_process_integration
    await self.async_process_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 248, in async_process_requirements
    async with self.pip_lock:
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 14, in __aenter__
    await self.acquire()
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 114, in acquire
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 217, in _async_setup_component
    processed_config = await conf_util.async_process_component_config(
  File "/usr/src/homeassistant/homeassistant/config.py", line 922, in async_process_component_config
    p_integration = await async_get_integration_with_requirements(hass, p_name)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 52, in async_get_integration_with_requirements
    return await manager.async_get_integration_with_requirements(domain)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 207, in _async_process_integration
    results = await asyncio.gather(
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/flux_led/__init__.py", line 208, in async_setup_entry
    await hass.config_entries.async_forward_entry_setups(entry, platforms)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1365, in async_forward_entry_setups
    await asyncio.gather(
asyncio.exceptions.CancelledError
2023-05-25 19:21:21.728 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Addressable v3 5v 588EB7 for flux_led
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 186, in _async_process_integration
    await self.async_process_requirements(
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 248, in async_process_requirements
    async with self.pip_lock:
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 14, in __aenter__
    await self.acquire()
  File "/usr/local/lib/python3.10/asyncio/locks.py", line 114, in acquire
    await fut
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 217, in _async_setup_component
    processed_config = await conf_util.async_process_component_config(
  File "/usr/src/homeassistant/homeassistant/config.py", line 922, in async_process_component_config
    p_integration = await async_get_integration_with_requirements(hass, p_name)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 52, in async_get_integration_with_requirements
    return await manager.async_get_integration_with_requirements(domain)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 171, in async_get_integration_with_requirements
    await self._async_process_integration(integration, done)
  File "/usr/src/homeassistant/homeassistant/requirements.py", line 207, in _async_process_integration
    results = await asyncio.gather(
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 387, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/flux_led/__init__.py", line 208, in async_setup_entry
    await hass.config_entries.async_forward_entry_setups(entry, platforms)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1365, in async_forward_entry_setups
    await asyncio.gather(
asyncio.exceptions.CancelledError
2023-05-25 19:21:21.731 WARNING (MainThread) [homeassistant.bootstrap] Setup timed out for stage 2 - moving forward
2023-05-25 16:29:19 -05:00
Ville Skyttä cb22154b36 Capture warnings.warn and friends messages in logs (#85875)
The default behavior of these warnings is to go to stderr, which in
some setups goes easily unnoticed. For example in Docker based ones,
they end up only in the container logs, and not e.g. in the HA log.

Capture these to make them available in logs where other such messages
are, and to make them subject to filtering as usual.
https://docs.python.org/3/library/logging.html#logging.captureWarnings
2023-05-18 21:41:13 +03:00
Jan Bouwhuis da26b0a930 Ensure dependencies are awaited correctly when setting up integrations (#91454)
* Do not wait

* Correct tests

* Manage after dependencies stage 1

* test bootstrap dependencies

* Assert log the dependenciy is waited for

* Improve docstrings

* Assert outside callback

* Patch async_get_integrations

* Revert changes made to snips integration

* Undo changes to mqtt_statestream
2023-04-21 08:33:50 +02:00
J. Nick Koston 17719663f0 Fix memory churn in state templates (#90685)
* Fix memory churn in state templates

The LRU for state templates was limited to 512 states. As soon
as it was exaused, system performance would tank as each template
that iterated all states would have to create and GC any state
> 512

* does it scale?

* avoid copy on all

* comment

* preen

* cover

* cover

* comments

* comments

* comments

* preen

* preen
2023-04-02 20:51:25 -04:00
Erik MontnemeryandFranck Nijhof 5bc9545b81 Rename custom_jinja to custom_templates (#90473)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2023-03-29 21:58:25 +02:00
J. Nick Koston f60e9c71a2 Make bootstrap cancelation safe (#90420) 2023-03-28 11:22:41 -10:00
David PollandErik Montnemery 7284af6a3e Add an in-memory-preloading loader for Jinja imports (#88850)
* Adds a loader to enable jinja imports.

* Switch to in-memory

* Move loading custom_jinja off of the event loop

* Raise TemplateNotFound if template doesn't exist

* Fix docstring

* Adds a service to reload custom jinja

* Remove IO from test setup

* Improve coverage and small refactor

* Incorporate feedback and use .jinja extension

* Check the loaded sources in test.

* Incorporate PR feedback.

* Update homeassistant/helpers/template.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
2023-03-13 11:00:05 +01:00
J. Nick Koston 11681f3f31 Pass a helpful name when creating common asyncio tasks in core (#89171) 2023-03-05 12:46:02 +01:00
Erik Montnemery 83e5bf7ae8 Use entity_sources to determine integration in recorder platforms (#88382) 2023-02-18 07:21:41 -06:00
Franck Nijhof 5e81d28116 Update black to 23.1.0 (#87188) 2023-02-02 18:35:24 +01:00
Franck Nijhof 79b52a2b41 Stricter pylint message control (#86154) 2023-01-20 13:47:55 +01:00
Franck Nijhof 64c2340fab Core code styling improvements (#85963) 2023-01-15 23:00:51 +01:00
Franck NijhofandErik Montnemery b0cee0bc46 String formatting and max line length - Part 1 (#84390)
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2022-12-22 10:12:50 +01:00
puddly 8c8994352d Allow only specific packages to be skipped during startup dependency installation (#82758) 2022-11-30 08:38:52 +01:00
Erik MontnemeryandFranck Nijhof e1338adf1a Allow configuring country and language in core config (#81734)
* Allow configuring country and language in core config

* Add script for updating list of countries

* Use black for formatting

* Fix quoting

* Move country codes to a separate file

* Address review comments

* Add generated/countries.py

* Get default language from owner account

* Remove unused variable

* Add script to generate list of supported languages

* Add tests

* Fix stale docsring

* Use format_python_namespace

* Correct async_user_store

* Improve typing

* Fix with_store decorator

* Initialize language in core store migration

* Fix startup

* Tweak

* Apply suggestions from code review

Co-authored-by: Franck Nijhof <git@frenck.dev>

* Update storage.py

Co-authored-by: Franck Nijhof <git@frenck.dev>
2022-11-24 23:25:50 +01:00
Franck Nijhof 6a1bb8c421 Deprecate Python 3.9 (#82193) 2022-11-16 15:38:10 +01:00
Aarni Koskela 8038485ca4 Use partition instead of split where possible in core (#81806) 2022-11-15 21:45:48 +01:00
Charles Garwood 58d531841b Fix typo SIGNAL_BOOTSTRAP_INTEGRATONS -> SIGNAL_BOOTSTRAP_INTEGRATIONS (#79970) 2022-10-09 17:06:28 -10:00
Erik Montnemery dfed3ba75e Move issue_registry to homeassistant.helpers (#77299)
* Move issue_registry to homeassistant.helpers

* Add backwards compatibility
2022-08-25 11:32:06 +02:00
Erik Montnemery fd6ffef52f Support non-live database migration (#72433)
* Support non-live database migration

* Tweak startup order, add test

* Address review comments

* Fix typo

* Clarify comment about promoting dependencies

* Tweak

* Fix merge mistake

* Fix some tests

* Fix additional test

* Fix additional test

* Adjust tests

* Improve test coverage
2022-07-22 15:11:34 +02:00
J. Nick Koston 61cc9f5288 Consolidate executor jobs when loading integration manifests (#75176) 2022-07-14 13:06:08 -07:00
J. Nick KostonandPaulus Schoutsen a697672944 Add bluetooth integration (#74653)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2022-07-08 18:55:31 -05:00
puddly ae295f1bf5 Add three decimal places of sub-second resolution to root logger timestamps (#74518) 2022-07-07 10:49:32 +02:00
J. Nick Koston 55b5ade586 Prime platform.uname cache at startup to fix blocking subprocess in the event loop (#73975)
Prime platform.uname cache at startup to fix blocking subprocess

- Multiple modules check platform.uname()[0] at startup which
  does a blocking subprocess call. We can avoid this happening
  in the eventloop and distrupting startup stability by priming
  the cache ahead of time in the executor
2022-06-25 04:31:44 -04:00
Joakim Sørensen 3a0111e65d Use supervisor envs instead of hassio (#72601) 2022-05-30 12:00:13 +02:00
Franck Nijhof 3afadf8adb Revert "Block peer certs on supervisor" (#67104) 2022-02-23 12:32:07 +01:00
938b64081b Block peer certs on supervisor (#66837)
Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
Co-authored-by: Mike Degatano <michael.degatano@gmail.com>
2022-02-22 13:59:40 -08:00
J. Nick Koston 3bf2be1765 Startup with an emergency self signed cert if the ssl certificate cannot be loaded (#66707) 2022-02-18 16:08:26 -08:00
Marc Mueller 8d2fb72cc3 Add type ignore error codes [core] (#66773) 2022-02-17 23:09:22 -08:00
J. Nick Koston 9691128e96 Fix ImportError when discovery deps change (#66518) 2022-02-14 17:12:24 +01:00
Marc Mueller b2ee7cebc9 Improve setup_time typing (#66509) 2022-02-14 14:24:58 +01:00
Erik Montnemery 8d6e2ae354 Import persistent notification part 1 (#63898) 2022-01-11 17:24:59 +01:00
Ruslan Sayfutdinov 55f4962c06 Fix pylint plugin which checks relative imports (#62693) 2021-12-23 11:14:47 -08:00
Robert Blomqvist ea58778a5c Rephrase upgrade notification message to avoid installing Python 3.10 (#61181) 2021-12-07 17:19:23 -08:00
Paulus Schoutsen b024d88b36 Deprecate Python 3.8 (#57079) 2021-10-05 08:58:20 +02:00
Marc Mueller 7af67d34cf Use assignment expressions 01 (#56394) 2021-09-18 13:31:35 -10:00
J. Nick Koston 5709640453 Report integrations that block startup wrap up (#56003) 2021-09-09 20:39:22 -07:00
Paulus Schoutsen e0f640c0f8 Guard for doRollover failing (#55669) 2021-09-03 09:53:47 -07:00
jan iversen 3a0a8da648 Change logging to do rollover() instead of rotate() (#55177)
* Change to rollover from rotate.

* Remove test log files.
2021-08-25 17:32:48 +02:00
jan iversen 1e3452496a Make log rollover at startup (#54865)
* Secure log rollover at startup.

* Review comments.

* Please CI.
2021-08-20 17:59:10 +02:00
J. Nick Koston 564e7fa53c Avoid sending empty integration list multiple times during subscribe_bootstrap_integrations (#49181) 2021-04-15 23:16:17 -07:00
J. Nick Koston 1f80c756ab Fix subscribe_bootstrap_integrations to send events (#48754) 2021-04-08 07:30:33 -10:00
J. Nick KostonandPaulus Schoutsen 12e3bc8101 Provide api to see which integrations are being loaded (#48274)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
2021-04-04 22:11:44 -10:00
Marc Mueller 4cb7718192 Update typing 16 (#48087) 2021-03-18 22:58:19 +01:00
Marc Mueller e55702d635 Update typing 01 (#48013) 2021-03-17 17:34:55 +01:00
Paulus Schoutsen 2df644c6cc Clean up secret loading (#47034) 2021-03-02 12:58:53 -08:00
Erik Montnemery ed31cc363b Wait for registries to load at startup (#46265)
* Wait for registries to load at startup

* Don't decorate new functions with @bind_hass

* Fix typing errors in zwave_js

* Load registries in async_test_home_assistant

* Tweak

* Typo

* Tweak

* Explicitly silence mypy errors

* Fix tests

* Fix more tests

* Fix test

* Improve docstring

* Wait for registries to load
2021-02-11 17:36:19 +01:00
Pascal VizeliandFranck Nijhof a7a4875f52 Add more debug details to running timeouts (#43644)
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-01-04 13:10:39 +01:00
43474762b2 Drop remaining Python < 3.8 support (#44743)
Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
Co-authored-by: Franck Nijhof <git@frenck.dev>
2021-01-04 11:47:29 +01:00
Franck Nijhof 508d33a220 Remove deprecated PTVSD integration (#44748) 2021-01-01 23:36:15 +01:00