PrintOperations¶
Access via client.print. Publishes label-printer jobs and waits for a print result.
crucible.resources.printer.PrintOperations
¶
Printer job operations.
Access via: client.print.barcode().
barcode(printer_id, mfid, name)
¶
Publish a barcode print job and wait for a print result.
The server waits briefly for the printer to confirm the job before responding; HTTP success alone does not mean the label printed. Check the returned 'status':
- "ok": the printer confirmed success.
- "error": the printer explicitly reported failure.
- "timeout": no result arrived in time (likely offline, slow, or an unreachable/unknown printer_id).
The server never validates that printer_id refers to a real, known printer -- it always attempts the publish. On "error" or "timeout", 'detail' may explain further using live printer-fleet status (e.g. the printer appears offline), checked only after the fact to help diagnose the failure, not to prevent the attempt. None does not mean the print is fine -- it means no extra diagnostic info was available.
Not automatically retried on a transient 429/502/503/504: the server may have already published the job to MQTT (and the printer may have already printed it) by the time such a response arrives, so a client-side retry here could trigger a second, genuinely new print job and double-print the label.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
printer_id
|
str
|
Target printer identifier, e.g. 'lab3-zebra'. Not validated against a known-printers list; a typo reaches the server and publishes regardless. |
required |
mfid
|
str
|
MFID of the sample or tray to print. |
required |
name
|
str
|
Human-readable label text. Any string, including empty. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Dict |
Dict
|
{job_id, printer_id, mfid, name, ts, status, detail} |