Commit Graph

4028 Commits

Author SHA1 Message Date
Lincoln Stein
29c2ada23c add test for the configuration module 2023-05-04 00:45:52 -04:00
Lincoln Stein
e4196bbe5b adjust non-app modules to use new config system 2023-05-04 00:43:51 -04:00
Lincoln Stein
15ffb53e59 remove globals, args, generate and the legacy CLI 2023-05-03 23:36:51 -04:00
Lincoln Stein
90054ddf0d use InvokeAISettings for app-wide configuration 2023-05-03 22:30:30 -04:00
Lincoln Stein
5e8c97f1ba
[Enhancement] Regularize logging messages (#3176)
# Intro

This commit adds invokeai.backend.util.logging, which provides support
for formatted console and logfile messages that follow the status
reporting conventions of earlier InvokeAI versions:

```
 ### A critical error
 *** A non-fatal error
 ** A warning
  >> Informational message
        | Debugging message
```

Internally, the invokeai logging module creates a new default logger
named "invokeai" so that its logging does not interfere with other
module's use of the vanilla logging module. So `logging.error("foo")`
will go through the regular logging path and not add InvokeAI's
informational message decorations, while `ialog.error("foo")` will add
the decorations.
    
# Usage:

This is a thin wrapper around the standard Python logging module. It can
be used in several ways:


## Module-level logging style
 
This style logs everything through a single default logging object and
is identical to using Python's `logging` module. The commonly-used
module-level logging functions are implemented as simple pass-thrus to
logging:
    
```
      import invokeai.backend.util.logging as logger
    
      logger.debug('this is a debugging message')
      logger.info('this is a informational message')
      logger.log(level=logging.CRITICAL, 'get out of dodge')

      logger.disable(level=logging.INFO)
      logger.basicConfig(filename='/var/log/invokeai.log')
      logger.error('this will be logged to console and to invokeai.log')
```    

Internally these functions all go through a custom logging object named
"invokeai". You can access it to perform additional customization in
either of these ways:

```
logger = logger.getLogger()
logger = logger.getLogger('invokeai')
```
    
## Object-oriented style

For more control, the logging module's object-oriented logging style is
also supported. The API is identical to the vanilla logging usage. In
fact, the only thing that has changed is that the getLogger() method
adds a custom formatter to the log messages.
    
```
     import logging
     from invokeai.backend.util.logging import InvokeAILogger
    
     logger = InvokeAILogger.getLogger(__name__)
     fh = logging.FileHandler('/var/invokeai.log')
     logger.addHandler(fh)
     logger.critical('this will be logged to both the console and the log file')
```

## Within the nodes API

From within the nodes API, the logger module is stored in the `logger`
slot of InvocationServices during dependency initialization. For
example, in a router, the idiom is:

```
from ..dependencies import ApiDependencies
logger = ApiDependencies.invoker.services.logger
logger.warning('uh oh')
```

Currently, to change the logger used by the API, one must change the
logging module passed to `ApiDependencies.initialize()` in `api_app.py`.
However, this will eventually be replaced with a method to select the
preferred logging module using the configuration file (dependent on
merging of PR #3221)
2023-05-03 15:00:05 -04:00
Lincoln Stein
4687ad4ed6
Merge branch 'main' into enhance/invokeai-logs 2023-05-03 13:36:06 -04:00
psychedelicious
994b247f8e feat(ui): do not persist gallery images
- I've sorted out the issues that make *not* persisting troublesome, these will be rolled out with canvas
- Also realized that persisting gallery images very quickly fills up localStorage, so we can't really do it anyways
2023-05-03 23:41:48 +10:00
psychedelicious
0419f50ab0 chore(ui): bump react-virtuoso
- Resolves an issue with gallery not rendering all items
2023-05-02 20:15:29 +10:00
psychedelicious
f9f40adcdc fix(nodes): fix t2i graph
Removed width and height edges.
2023-05-02 13:11:28 +10:00
psychedelicious
3264d30b44 feat(nodes): allow multiples of 8 for dimensions 2023-05-02 12:01:52 +10:00
psychedelicious
4d885653e9 feat(ui): tidy 2023-05-02 11:27:08 +10:00
psychedelicious
475b6bef53 feat(ui): use windowing for gallery
vastly improves the gallery performance when many images are loaded.

- `react-virtuoso` to do the virtualized list
- `overlayscrollbars` for a scrollbar
2023-05-02 11:27:08 +10:00
Eugene
d39de0ad38 fix(nodes): fix duplicate Invoker start/stop events 2023-05-01 18:24:37 -04:00
Eugene
d14a7d756e nodes-api: enforce single thread for the processor
On hyperthreaded CPUs we get two threads operating on the queue by
default on each core. This cases two threads to process queue items.
This results in pytorch errors and sometimes generates garbage.

Locking this to single thread makes sense because we are bound by the
number of GPUs in the system, not by CPU cores. And to parallelize
across GPUs we should just start multiple processors (and use async
instead of threading)

Fixes #3289
2023-05-01 18:24:37 -04:00
Lincoln Stein
b050c1bb8f use logger in ApiDependencies 2023-05-01 16:27:44 -04:00
psychedelicious
276dfc591b feat(ui): disable w/h when img2img & not fit 2023-05-01 17:28:22 +10:00
psychedelicious
b49d76ebee feat(nodes): fix image to image fit param
it was ignored previously.
2023-05-01 17:28:22 +10:00
psychedelicious
a6be44789b fix(ui): progress image rerender, checkbox 2023-05-01 11:16:49 +10:00
blessedcoolant
a4313c26cb fix: Do not hide Preview button & color code it 2023-05-01 11:16:49 +10:00
blessedcoolant
d4b250d509 feat(ui): Add auto show progress previews setting 2023-05-01 11:16:49 +10:00
psychedelicious
29743a9e02 fix(ui): next/prev image buttons 2023-05-01 11:16:49 +10:00
psychedelicious
fecb77e344 feat(ui): dndkit --> rnd for draggable 2023-05-01 11:16:49 +10:00
psychedelicious
779671753d feat(ui): tweak floating preview 2023-05-01 11:16:49 +10:00
psychedelicious
d5e152b35e fix(ui): ignore events after canceling session 2023-05-01 11:16:49 +10:00
psychedelicious
270657a62c feat(ui): gallery & progress image refactor 2023-05-01 11:16:49 +10:00
psychedelicious
3601b9c860 feat(ui): revamp status indicator 2023-05-01 11:16:49 +10:00
psychedelicious
c8fe12cd91 feat(ui): init image tweaks 2023-05-01 11:16:49 +10:00
psychedelicious
deae5fbaec fix(ui): socket event types 2023-05-01 11:16:49 +10:00
psychedelicious
5b558af2b3 fix(ui): fix metadata viewer scroll 2023-05-01 11:16:49 +10:00
psychedelicious
4150d5306f chore(ui): regen api client 2023-05-01 11:16:49 +10:00
psychedelicious
8c2e4700f9 feat(ui): persist gallery state 2023-05-01 11:16:49 +10:00
psychedelicious
adaecada20 fix(ui): fix current image seed button 2023-05-01 11:16:49 +10:00
psychedelicious
258895bcc9 feat(ui): being dismantling old sio stuff, fix recall seed/prompt/init
- still need to fix up metadataviewer's recall features
2023-05-01 11:16:49 +10:00
psychedelicious
2eb7c25bae feat(ui): clean up and simplify socketio middleware 2023-05-01 11:16:49 +10:00
psychedelicious
2e4e9434c1 fix(ui): fix initial image for uploads 2023-05-01 11:16:49 +10:00
psychedelicious
0cad204e74 feat(ui): add error handling for linear graph generation 2023-05-01 11:16:49 +10:00
Lincoln Stein
0bc2edc044
Merge branch 'main' into enhance/invokeai-logs 2023-04-29 11:00:18 -04:00
Lincoln Stein
16488e7db8 fix tests 2023-04-29 10:59:50 -04:00
Lincoln Stein
974841926d logger is a interchangeable service 2023-04-29 10:48:50 -04:00
Lincoln Stein
8db20e0d95 rename log to logger throughout 2023-04-29 09:43:40 -04:00
psychedelicious
d00d29d6b5 feat(ui): update settings modal 2023-04-29 18:28:19 +10:00
psychedelicious
dc976cd665 feat(ui): add switch for logging 2023-04-29 18:28:19 +10:00
psychedelicious
6d6b986a66 feat(ui): remove Console and redux logging state 2023-04-29 18:28:19 +10:00
psychedelicious
bffdede0fa feat(ui): improve log messages 2023-04-29 18:28:19 +10:00
psychedelicious
a4c258e9ec feat(ui): add roarr logger 2023-04-29 18:28:19 +10:00
psychedelicious
8d837558ac fix(ui): fix spelling of systemPersistDenylist.ts 2023-04-29 18:28:19 +10:00
psychedelicious
e673ed08ec fix(ui): restore missing chakra-cli package
(amending to try and get the workflow to run)
2023-04-29 12:21:11 +10:00
Lincoln Stein
f0e07bff5a fix bad logging path in config script 2023-04-28 15:39:00 -04:00
Lincoln Stein
3ec06a1fc3
Merge branch 'main' into enhance/invokeai-logs 2023-04-28 10:10:33 -04:00
Lincoln Stein
6b79e2b407 Merge branch 'main' into enhance/invokeai-logs
- resolve conflicts
- remove unused code identified by pyflakes
2023-04-28 10:09:46 -04:00