23 Commits

Author SHA1 Message Date
Eric Callahan
b60e6dc311 spoolman: add history field tracking spool ids
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-05-04 08:16:37 -04:00
Patrick Schmidt
c857e1a99f spoolman: Add spoolman response headers to proxy results
Added the response headers to the V2 response of the proxy implementation as a new field named "response_headers".

Signed-off-by: Patrick Schmidt <ps.patti1998@gmail.com>
2024-04-24 13:51:23 -04:00
Eric Callahan
65a8271925
spoolman: fix exception handling
Make sure the connection delay isn't skipped if the
error list is full.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-02-14 20:34:33 -05:00
Eric Callahan
652bb46f60
spoolman: improve connection error reporting
Reduce verbosity in release mode and add connection status to the log rollover.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-21 08:24:05 -05:00
Eric Callahan
d410731faa
spoolman: add a status notification
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-21 08:24:03 -05:00
Eric Callahan
a5128f06ad
spoolman: add a status endpoint
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-21 08:24:02 -05:00
Eric Callahan
d4316d9878
spoolman: refactor tracking
Use a python dict to act as a queue for reporting used filament
per spool.  This eliminates the need for locks and resolves
potential issues with spool changes when the Spoolman
service is not available.

In addition, add support for tracking multiple tools

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-21 08:24:02 -05:00
Eric Callahan
3102391234
spoolman: implement alternate proxy responses
The exisiting implementation of spoolman's proxy endpoint
returns responses and errors exactly as they are received
by spoolman.  This creates a problem of ambiguity, as the
frontend cannot easily diffentiate between an error returned
by Moonraker and an error returned by Spoolman.

This implements a "v2" alternate response to proxy requests.
All requests to spoolman will return success, with responses
wrapped in a top level object.  Successful requests will be
returned in a "spoolman_response" object, errors in a
"spoolman_error" object.

Initially v2 responses will be opt-in to prevent breaking existing
spoolman implementations.  However, as of this commit the v1
response is deprecated and will be removed in a future version
of Moonraker.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-21 08:24:01 -05:00
Eric Callahan
e9ad278286
spoolman: use loop time rather than datetime
The loop time is monotonic and can't be affected by
changes to the system clock.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-21 08:24:00 -05:00
Eric Callahan
b836d618c9
spoolman: add a websocket connect
Connect to the spoolman sevice via websocket to receive
spool events.  In addition, this gives Moonraker a persistent
connection to know when the service is available.

Signed-off-by:  Eric Callahan  <arksine.code@gmail.com>
2024-01-21 08:24:00 -05:00
Eric Callahan
66de18f9b6
spoolman: really fix type checking this time
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-16 13:57:20 -05:00
Eric Callahan
8d6def7e41
spoolman: type checking fix
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-16 13:53:21 -05:00
Eric Callahan
15fed2e819
spoolman: check for deleted spools
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-16 11:57:53 -05:00
Eric Callahan
374516a00a
spoolman: remove class variables
Variables should be contained within the spoolman instance, as in the
future it could be desirable to support multiple instances.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-16 07:58:22 -05:00
Eric Callahan
a88468eb79
refactor: convert websockets into a component
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2024-01-13 15:15:15 -05:00
Eric Callahan
b18e9cc222
all: Replace strings with RequestType flags
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-16 16:21:20 -05:00
Eric Callahan
9ad8fed81e
spoolman: register announcement feed
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-12-02 07:44:40 -05:00
Eric Callahan
a71c5c159d
spoolman: filter spool_id before setting it active
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-10-24 19:32:24 -04:00
Eric Callahan
d3bab5de94
klippy_apis: support subscription callbacks
This callback will only fire after a component has requested
a subscription, preventing early updates while the component
is waiting for the subscription request to complete.  It is still
valid for components to register the "server:status_update"
event handler if this behavior is not a concern.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-07-30 16:30:00 -04:00
Eric Callahan
93f473f629
spoolman: correct API registration
Internal Moonraker APIs must be registered with a top level path of
"server" or "machine".

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-27 16:23:56 -04:00
Eric Callahan
a237ba3735
spoolman: add remote method to set active spool
Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-26 16:52:13 -04:00
Eric Callahan
5d54a10177
spoolman: minor fixes
Set the minimum value for the sync_rate to 1 second, rather
than above 1 second.  When transitioning from a null spool
to a named spool clear tracked extrusion.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
2023-06-26 16:38:19 -04:00
Donkie
4b9c836743
spoolman: Added basic spoolman integration
Proxies any request to the spoolman server. Records filament usage.

Signed-off-by: Daniel Hultgren <daniel.cf.hultgren@gmail.com>
2023-06-26 16:24:40 -04:00