fix: the print file is written over twice as fast, and a file finished after Prova OK queues its order (#81)
Some checks failed
Build and deploy / Validate source (push) Successful in 1m41s
Build and deploy / Publish images (push) Has been cancelled
Build and deploy / Secret scan and release gate (push) Has been cancelled
Build and deploy / Integration suite on a real stack (push) Has been cancelled
Some checks failed
Build and deploy / Validate source (push) Successful in 1m41s
Build and deploy / Publish images (push) Has been cancelled
Build and deploy / Secret scan and release gate (push) Has been cancelled
Build and deploy / Integration suite on a real stack (push) Has been cancelled
#81's 91,5 m took 6 hours to generate. The PNG writer ran Pillow's row filters and then deflate at level 6; no filter at level 1 gives the same size in under half the time, for the file and the viewer's strips alike (1 m: 34 s -> 13 s). Its Prova OK came while the file was still being generated, so the order stayed in Arte recebida. The approval now also runs when the file finishes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -396,6 +396,41 @@ def run():
|
||||
assert final['created_by'] == 'Prumo' and 'prova' in final['note'].lower(), final
|
||||
print('PASS: Prova OK turns Prumo\'s full file into the parent final and queues it')
|
||||
|
||||
# Prova OK while the parent's file is still being generated (#81, 91,5 m,
|
||||
# 2026-11-24): the parent waits in Arte recebida and enters the queue on
|
||||
# its own once the file is ready.
|
||||
readable = upload_bytes(client, artwork(), name='LOCAL-PROOF-LATE.png')
|
||||
parent = paid_order(client, loose_item(readable, copies=1))
|
||||
with db.connect() as c:
|
||||
c.execute("UPDATE dtf_local.orders SET snapshot=jsonb_set(snapshot,'{proof}','true') WHERE id=%s",
|
||||
(parent['id'],))
|
||||
card = client.call('/operator/orders/' + parent['id'] + '/proof-card', {}, operator=True)
|
||||
wait_print(client, parent['id'], 'ready')
|
||||
wait_print(client, card['id'], 'ready')
|
||||
with db.connect() as c:
|
||||
# The parent's file back to "being generated", held by a claim no worker owns.
|
||||
c.execute('''UPDATE dtf_local.print_files SET status='rendering', upload_id=NULL, finished_at=NULL,
|
||||
claimed_at=now(), deadline_at=now()+interval '1 hour', claim_token=%s WHERE order_id=%s''',
|
||||
(str(uuid4()), parent['id']))
|
||||
c.execute("UPDATE dtf_local.orders SET state='rev' WHERE id=%s", (card['id'],))
|
||||
client.call('/operator/orders/' + card['id'] + '/proof-answer', {'result': 'ok'}, operator=True)
|
||||
mine = next(o for o in client.call('/operator/board', operator=True)['orders'] if o['id'] == parent['id'])
|
||||
assert mine['state'] == 'rec' and mine['proof_ok_at'] and not mine['final_items'], mine
|
||||
with db.connect() as c:
|
||||
c.execute("UPDATE dtf_local.print_files SET status='pending', claim_token=NULL WHERE order_id=%s",
|
||||
(parent['id'],))
|
||||
wait_print(client, parent['id'], 'ready')
|
||||
deadline = time.monotonic() + 30
|
||||
while (mine := next(o for o in client.call('/operator/board', operator=True)['orders']
|
||||
if o['id'] == parent['id']))['state'] != 'tra' and time.monotonic() < deadline:
|
||||
time.sleep(1)
|
||||
assert mine['state'] == 'tra' and mine['final_items'] == [0], mine
|
||||
with db.connect() as c:
|
||||
moved = c.execute('''SELECT operator,reason FROM dtf_local.movements
|
||||
WHERE order_id=%s AND to_state='tra' ORDER BY id DESC LIMIT 1''', (parent['id'],)).fetchone()
|
||||
assert (moved['operator'], moved['reason']) == ('Prumo', 'Prova OK'), moved
|
||||
print('PASS: a file finished after Prova OK becomes the final and queues the order')
|
||||
|
||||
# A CDR cannot be decoded by the worker. The designer prepares the full
|
||||
# parent PNG, then the worker automatically cuts the child's proof from it.
|
||||
manual_source = upload_bytes(client, b'LOCAL PRINT TEST - NOT AN IMAGE', name='MANUAL-PROOF.cdr')
|
||||
|
||||
Reference in New Issue
Block a user