[MM bugfix] Put model install errors on the event bus (#6578)

* fix access token lookup

* fix bug preventing model install error events from being reported

---------

Co-authored-by: Lincoln Stein <lstein@gmail.com>
This commit is contained in:
Lincoln Stein 2024-07-03 22:44:34 -04:00 committed by GitHub
parent bb6ff4cf37
commit 0fe92cd406
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -848,7 +848,7 @@ class ModelInstallService(ModelInstallServiceBase):
with self._lock:
if install_job := self._download_cache.pop(download_job.id, None):
assert excp is not None
install_job.set_error(excp)
self._set_error(install_job, excp)
self._download_queue.cancel_job(download_job)
# Let other threads know that the number of downloads has changed

View File

@ -18,6 +18,7 @@ from invokeai.app.services.events.events_common import (
ModelInstallDownloadProgressEvent,
ModelInstallDownloadsCompleteEvent,
ModelInstallDownloadStartedEvent,
ModelInstallErrorEvent,
ModelInstallStartedEvent,
)
from invokeai.app.services.model_install import (
@ -339,7 +340,13 @@ def test_404_download(mm2_installer: ModelInstallServiceBase, mm2_app_config: In
assert job.error_type == "HTTPError"
assert job.error
assert "NOT FOUND" in job.error
assert job.error_traceback is not None
assert job.error_traceback.startswith("Traceback")
bus = mm2_installer.event_bus
assert bus is not None
assert hasattr(bus, "events") # the dummyeventservice has this
event_types = [type(x) for x in bus.events]
assert ModelInstallErrorEvent in event_types
def test_other_error_during_install(