Moved printing into its own separate project called frank. It also has its own toml and deployement system.

It also works on a raspberry pi
This commit is contained in:
2021-03-23 18:18:33 +05:30
parent 0b30ce258c
commit f4caa19bb2
17 changed files with 184 additions and 67 deletions

30
frank/worker.py Normal file
View File

@ -0,0 +1,30 @@
import sys
from aiohttp import ClientSession
from config import settings as sett
from printing import sent_to_printer
from settings import settings
sys.path.extend(["./"])
async def startup(ctx):
ctx["session"] = ClientSession()
print(f"Worker listening for: {sett.QUEUE_NAME}")
# print(f"Worker printing on: {sett.WORKER_PRINTER_ADDRESS}")
async def shutdown(ctx):
await ctx["session"].close()
class WorkerSettings:
"""
Settings for the ARQ worker.
"""
queue_name = f"barker:print:{sett.QUEUE_NAME}"
redis_settings = settings
functions: list = [sent_to_printer]
on_startup = startup
on_shutdown = shutdown