-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(dev_reload): use jurigged to hot reload changes to Python source #4313
Conversation
Very cool! If it's still unmerged I'll give it a thorough review when I'm back from camping in a couple of days. |
# Conflicts: # invokeai/app/api_app.py # invokeai/app/services/config.py
7f454ce
to
76750b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woohoo! It works wonderfully.
One caveat - when changing a node:
- the
InvocationsUnion
doesn't change andGraph
model isn't re-initialized - so the OpenAPI schema is not updated
- so changes to anything other than the body of each node's
invoke()
function are not hot-reloaded
For example, changing the name, type, or fields of a node does not change trigger a reload. This is expected, but it would be very nice if that could all reload too.
I made some progress on this in #4334. Can we provide callbacks to jurrigged
to execute on certain events? Specifically, can we make any hot reload in invocations/*.py
trigger logic similar to #4334?
Hmm, looks like yes, but let's leave that to a later PR so we can explore that whole mess of Invocation loading and introspection separately. |
sooo on macos, ootb jurigged is broken because of some change to whichever flavour of FSEvents system that the fruit company wants us to use in 2023. is this able to act as a workaround? |
This is literally just instantiating a jurigged watcher, so I expect it inherits any jurigged brokenness. |
ahh. oh well, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
While it is not necessary to change the application source to use jurigged for live reloading, it does help discoverability to have the option show up in our Config instead of relying on developers having that particular bit of Python know-how.
Programmatically starting jurigged like this also allows for better integration with our logging configuration, though the way I've integrated it here lacks the color-coding provided by jurigged's default.
What type of PR is this? (check all applicable)
Have you discussed this change with the InvokeAI team?
See livereload / hot reloading Python development server.
Have you updated all relevant documentation?
Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Start the server with the
--dev_reload
flag.Change a Python source file and note the behavior changes without having to shut down and restart the server.
Added/updated tests?