TeaSitta / AI-Horde-Worker

Turn your local KoboldAI compatible API into an AI Horde worker
GNU Affero General Public License v3.0
0 stars 0 forks source link

Rework UI exit check - currently fails on colab #21

Closed TeaSitta closed 7 months ago

TeaSitta commented 7 months ago

New UI exit cleanup trigger makes worker thread die because colab runs with no UI

Implement a better way to do non-UI and graceful thread shutdown.

ERROR      | 2024-03-19 15:29:10.825471 | __main__:main:22 - An error has been caught in function 'main', process 'MainProcess' (4553), thread 'MainThread' (138685003399168):
Traceback (most recent call last):

  File "/content/AI-Horde-Worker/horde_scribe_bridge.py", line 31, in <module>
    main()
    └ <function main at 0x7e221e24bd90>

> File "/content/AI-Horde-Worker/horde_scribe_bridge.py", line 22, in main
    worker.start()
    │      └ <function ScribeWorker.start at 0x7e221bd81870>
    └ <worker.scribe_worker.ScribeWorker object at 0x7e221bd5c550>

  File "/content/AI-Horde-Worker/worker/scribe_worker.py", line 84, in start
    if not self.ui.is_alive():
           │    └ None
           └ <worker.scribe_worker.ScribeWorker object at 0x7e221bd5c550>

AttributeError: 'NoneType' object has no attribute 'is_alive'
Traceback (most recent call last):
  File "/content/AI-Horde-Worker/horde_scribe_bridge.py", line 31, in <module>
    main()
  File "/content/AI-Horde-Worker/horde_scribe_bridge.py", line 22, in main
    worker.start()
  File "/usr/local/lib/python3.10/dist-packages/loguru/_logger.py", line 1277, in catch_wrapper
    return function(*args, **kwargs)
  File "/content/AI-Horde-Worker/worker/scribe_worker.py", line 84, in start
    if not self.ui.is_alive():
AttributeError: 'NoneType' object has no attribute 'is_alive'