Repository navigation
v2.4.0
A bug-fix release for #100 to #106. It is a minor version because it adds a database
migration (019, run it before upgrading workers or archivers) and new public items
(JobHistory::jobs_with_status, EventManager::delivers_payload and
EventManager::payload_wanted), and because several fixes change observable behaviour
(see below). The one signature change is hammerwork-web's jobs::routes, which now
needs T: JobHistory.
Behaviour changes to check when upgrading
maintenance vacuumandbackup createtreat "failed" asFailed,Deador
TimedOut(asjob list --failedandmonitordo).vacuumnow also deletes old
DeadandTimedOutjobs (--keep-failed-days), andbackup createwithout
--include-failednow leaves them out.job enqueue,batch enqueueandcron create:--queueis optional when
default_queue(config file) orHAMMERWORK_DEFAULT_QUEUEis set.- Dashboard
POST /api/system/maintenancecleanupnow deletes exactly the dead
jobs its dry run counts, including dead rows whosefailed_atis NULL (age is taken
fromfailed_at, elsetimed_out_at, elsecreated_at). GET /api/jobs?status=...now lists jobs in any status (up to the newest 100 per
status);hammerwork-web'sjobs::routesnow needsT: JobHistory, andJobHistory
gains a defaultedjobs_with_statusmethod.TestQueue:get_queue_statson an unknown queue returns zero counts, and
get_batch_status/restore_archived_jobreturnJobNotFound, as the PostgreSQL and
MySQL backends do.retry_jobandrestore_archived_jobre-evaluate a job's dependencies. A job
that depends on other jobs becomes runnable when they all completed and waits while
some are unfinished. When a dependency failed (Failed,DeadorTimedOut, which
includes the jobs of a cancelled workflow) or no longer exists, the call now returns
HammerworkError::Workflowand changes nothing; it used to succeed and leave the job
Pendingforever. Retry or restore the dependency first. A job whose dependencies
were already satisfied is left as is, even if they have since been purged.TestQueue
does the same. (#102)- Events can carry job payloads.
EventFilter::include_payloadand
EventConfig::include_payload_defaultnow work (both stay off by default), so
webhooks and streams that ask for payloads receive them. (#101)
Database
- Migration 019 (
019_add_archive_workflow) addsworkflow_idand
workflow_nametohammerwork_jobs_archive, on PostgreSQL and MySQL. It is
idempotent. Run it before upgrading workers or archivers: archiving, restoring and
reading archived jobs use the new columns. (#102)
Fixed
- Dashboard (#103):
/api/jobscan list Running, Completed, TimedOut, Retrying and
Pending jobs scheduled for later; the stats endpoints decodetime_range=START,ENDand
queues=a,bfrom a query string (they returned 400),queuesnow filters and
granularity(hour,day,week) is honoured; the maintenance cleanup dry run and
real run share one predicate. - CLI (#104):
vacuumandbackup createhandleDeadandTimedOutjobs as failed;
default_queue/HAMMERWORK_DEFAULT_QUEUEis used as the fallback queue. TestQueue(#106): aRetryoutcome'sretry_atis moved onto the mock clock, and
the error types listed above match the database backends.- A panicking event hook, statistics collector or spawn handler no longer kills the
worker. Event hooks (on_job_*,with_event_hooks),StatisticsCollector::record_event
and spawn handlers run behind one panic guard each (sync hooks and async callbacks):
the panic is logged at error level, the job's outcome is recorded and the worker
keeps polling. A panicking spawn handler fails the parent's run, like a spawn error.
Previously the job stayedRunninguntil its lease expired. (#100) EventFilter::include_payloadandEventConfig::include_payload_defaulthad no
effect: worker events always hadpayload: None. Workers now include the job
payload when a subscriber asks for it, the event manager keeps it when the default or
any subscription's filter asks for it, and the webhook and stream managers drop it
for subscribers that did not ask (EventManager::delivers_payload,
EventManager::payload_wanted). The payload of a job with payload encryption is never
put into events, neither plaintext nor ciphertext. (#101)- Archived jobs lost their workflow. Archiving now copies
workflow_idand
workflow_name,restore_archived_jobputs them back, andget_jobon an archived
job returns them. (#102) - A job retried with
retry_jobor restored from the archive could stayPending
forever when a dependency had failed (its dependency status stayedfailed). See
the behaviour change above; same behaviour on PostgreSQL and MySQL. (#102) - A batch could be counted as completed twice in
BatchProcessingStatswhen its
last jobs finished at the same time on a worker with batch concurrency above one:
each saw the batch finished. A worker now counts each finished batch once. The
batch's own record was already updated once (its row lock serializes the jobs'
final transitions). (#105) KeyManagerpanicked on a huge rotation interval:generate_key_with_options,
rotate_keyandupdate_key_rotation_schedulecomputednow + intervalwithout a
check. An interval whose next rotation time cannot be represented now returns
EncryptionError::KeyManagementand stores nothing. (#105)