diff --git a/projects/tentacles/src/python/tentacles/workers.py b/projects/tentacles/src/python/tentacles/workers.py index e3f500c..a1cb34d 100644 --- a/projects/tentacles/src/python/tentacles/workers.py +++ b/projects/tentacles/src/python/tentacles/workers.py @@ -70,7 +70,7 @@ def poll_printers(app: App, db: Db) -> None: def _set_status(status: str): if printer.status != status: log.info(f"Printer {printer.id} {printer.status} -> {status}") - db.update_printer_status(pid=printer.id, status=status) + db.update_printer_status(pid=printer.id, status=status) def _bed_clear(): if not ( @@ -117,7 +117,7 @@ def poll_printers(app: App, db: Db) -> None: if mapped_job: db.start_job(jid=mapped_job.id) - elif printer_job.get("state").lower() == "connecting": + elif printer_job.get("state", "").lower() == "connecting": _set_status("connecting") elif printer_state.get("ready"): @@ -171,8 +171,8 @@ def assign_jobs(app: App, db: Db) -> None: db.assign_job(jid=job.id, pid=printer.id) log.info(f"Mapped job {job.id} to printer {printer.id}") break - else: - print("Could not map\n", job, "\n", printer) + else: + log.info(f"Could not map job {job!r}") def push_jobs(app: App, db: Db) -> None: @@ -307,7 +307,8 @@ def analyze_files(app: App, db: Db): for file in db.list_unanalyzed_files(): p = Path(file.path) if not p.is_file(): - log.error(f"Invalid file {file.id}!") + log.error(f"Deleting missing file {file.id}!") + db.delete_file(uid=file.user_id, fid=file.id) continue record = analyze_gcode_file(p) diff --git a/tools/python/requirements.in b/tools/python/requirements.in index 7546ca0..c88d77b 100644 --- a/tools/python/requirements.in +++ b/tools/python/requirements.in @@ -54,3 +54,4 @@ unify yamllint yaspin pytimeparse +git+https://github.com/arrdem/jaraco.text.git@0dd8d0b25a93c3fad896f3a92d11caff61ff273d#egg=jaraco.text diff --git a/tools/python/requirements_lock.txt b/tools/python/requirements_lock.txt index e2c15b9..912d645 100644 --- a/tools/python/requirements_lock.txt +++ b/tools/python/requirements_lock.txt @@ -42,7 +42,7 @@ itsdangerous==2.1.2 jaraco.collections==4.3.0 jaraco.context==4.3.0 jaraco.functools==3.8.0 -jaraco.text==3.11.1 +jaraco.text @ git+https://github.com/arrdem/jaraco.text.git@0dd8d0b25a93c3fad896f3a92d11caff61ff273d jedi==0.18.2 Jinja2==3.1.2 jsonschema==4.18.4