InvokeAI/invokeai/app
psychedelicious df5457231f feat(app): handle preparation errors as node errors
We were not handling node preparation errors as node errors before. Here's the explanation, copied from a comment that is no longer required:

---

TODO(psyche): Sessions only support errors on nodes, not on the session itself. When an error occurs outside
node execution, it bubbles up to the processor where it is treated as a queue item error.

Nodes are pydantic models. When we prepare a node in `session.next()`, we set its inputs. This can cause a
pydantic validation error. For example, consider a resize image node which has a constraint on its `width`
input field - it must be greater than zero. During preparation, if the width is set to zero, pydantic will
raise a validation error.

When this happens, it breaks the flow before `invocation` is set. We can't set an error on the invocation
because we didn't get far enough to get it - we don't know its id. Hence, we just set it as a queue item error.

---

This change wraps the node preparation step with exception handling. A new `NodeInputError` exception is raised when there is a validation error. This error has the node (in the state it was in just prior to the error) and an identifier of the input that failed.

This allows us to mark the node that failed preparation as errored, correctly making such errors _node_ errors and not _processor_ errors. It's much easier to diagnose these situations. The error messages look like this:

> Node b5ac87c6-0678-4b8c-96b9-d215aee12175 has invalid incoming input for height

Some of the exception handling logic is cleaned up.
2024-05-24 09:20:15 +10:00
..
api feat(app): support multiple processor lifecycle callbacks 2024-05-24 09:19:55 +10:00
assets/images tweaks in response to psychedelicious review of PR 2023-07-24 09:23:51 -04:00
invocations feat(nodes): make ModelIdentifierInvocation a prototype 2024-05-19 20:14:01 +10:00
services feat(app): handle preparation errors as node errors 2024-05-24 09:20:15 +10:00
shared tidy(nodes): move all field things to fields.py 2024-03-01 10:42:33 +11:00
util tidy(backend): clean up controlnet_utils 2024-04-25 13:20:09 +10:00
__init__.py fix: make invocation_context.py accessible to mkdocs 2024-03-01 10:42:33 +11:00
api_app.py feat(api): add InvocationOutputMap to OpenAPI schema 2024-05-15 14:09:44 +10:00
run_app.py feat: single app entrypoint with CLI arg parsing 2024-03-19 09:24:28 +11:00