Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #103 +/- ##
==========================================
+ Coverage 82.84% 87.31% +4.46%
==========================================
Files 69 70 +1
Lines 4104 4666 +562
==========================================
+ Hits 3400 4074 +674
+ Misses 704 592 -112
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Plugin session lifecycle features, fixes #104
…hes to require PRs.
…r. 7 exceptions we couldn't work around.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
0.27.0
🚨 This release changes the plugin and leadership APIs. Update custom plugins
and application code that configures leadership or uses
worker.is_leader.No database migration is needed.
This release is primarily a cleanup release, with a focus on improving the
durability of the system under adverse or unusual conditions. We now use
Toxiproxy to simulate network failures during testing, which has helped us find
and fix some issues that were previously hard to reproduce.
✨ API Changes
setup(session).Replace
run(worker, chancy)andon_worker_startedwith setup that registerssession.periodic(...)orsession.service(...). Useinterval=for periodicscheduling and the returned operation's
wake_up()for early runs. Registerevent handlers with
session.subscribe(...). Plugins using only unchanged jobhooks need no lifecycle migration. See the
plugin migration guide.
cleanupnow accepts(chancy, cursor)and must use the supplied transactionwithout committing it. Cleanup operations run independently and must not rely
on another plugin's cleanup order.
OperationContext.database(...)for retryable plugin transactions. Itscallbacks and cleanup hooks must be safe to repeat, even when an earlier
attempt committed but its response was lost.
Remove
Leadership(...)from plugin lists andchancy.leadershipfrom plugindependency lists. Configure
leadership_poll_intervalandleadership_timeouton Worker instead. Set
leadership_eligible=Falseto opt out. Custom electionplugins,
ImmediateLeadership, and thechancy.plugins.leadershipmodule areremoved.
worker.is_leaderis now a read-only boolean. Replace.is_set()calls withthe property and
.wait()calls withworker.wait_for_leadership(). Checkingthe property does not protect later writes. Replace
wait_for_leader()withauthority=Authority.LEADERoperations and usectx.database(...)withinthem to verify and lock the lease in the same transaction.
stop()andwait_for_shutdown()now report background and cleanup failuresafter teardown. Multiple failures are raised together in an exception group,
and concurrent or later waiters receive the retained failures.
For example, this plugin reports pending jobs on each worker every 60 seconds.
Before (0.26):
After (0.27):
✨ Improvements
is awaiting
wait_for_shutdown(). Unexpected maintenance-task exits andexhausted database retries follow the same shutdown path.
Authority.LEADERoperations now limit idle time torelease locks after a client goes silent. Configure
Worker.leadership_idle_timeoutseparately from the lease lifetime. The defaultis 120 seconds, and
Noneuses the database policy. Active SQL is unaffected,and stricter database timeouts are preserved. Plugin transactions that exceed
the idle limit are terminated and retried according to the worker's retry
settings.
shutdown_timeoutnow covers the entire shutdown, including job draining,task cleanup, final database writes, and plugin hooks. At the deadline,
stop()requests cancellation and reportsTimeoutErrorwithout waitinglonger for cleanup. A later call can finish incomplete shutdown without
repeating completed hooks and returns
Truewhen it succeeds. Late errorsfrom the expired attempt are logged without making a successful retry fail.
chancy.retry.RetryTransactionto retry actx.database(...)callback in a fresh transaction without giving up leadership.
🐛 Fixes
a connection failure cannot leave those jobs stranded on a healthy worker.
Claim confirmation waits for locked rows without exhausting database retries.
Fresh fetching pauses for that queue on that worker until confirmation
finishes. Running jobs and other queues continue normally.
previously cancelled running asyncio jobs.
last confirmed deadline still applies until renewal succeeds.
failure or is shutting down, with a
{"status": "unhealthy"}response body.Applications can check the same status through
worker.healthy.to other handlers. Plugin session subscriptions also isolate handler errors.
increase twice.
flushes preserve pending updates and their order for the next attempt.
requests or raises the done-callback
KeyErrorreported inTaskManager.cancel_allcan make a done-callback raiseKeyError(regression in 0.26.0, ec536e2) #105.