tastyware/streaq:v6.0.1 #137
Graeme22
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What's Changed
Add Trio support (pending anyio support in coredis) by @Graeme22 in Add Trio support (pending anyio support in coredis) #80
This is a large change, powered by simultaneous changes to the coredis dependency. Here's a summary of the changes:
anyio_backendto workers:dynamic cron jobs by @Graeme22 in dynamic cron jobs #117
Aside from defining cron jobs with the decorator, you can also schedule tasks dynamically:
This causes the task to run repeatedly with the given arguments at the given schedule. To stop scheduling a repeating task, you can use:
Modular changes by @Graeme22 in Modular changes #125
Adds new function,
Worker.include(), which simply modifies the included worker's tasks to point to it instead. At its face this sounds like it could lead to problems, but since a) Only one worker is running per process at a time; and b) Workers that are included in other workers are not aware of that at import time, practically this is a clean and easy solution. To make this a bit more concrete:Here, we can actually run either worker independently without issues:
streaq run child_module:childandstreaq run parent_module:parentshould both work fine, because when running just the child, theparent.include(child)line will never run.The other element of this PR that is quite crucial is detaching the ability to access task and worker context from the worker instance itself. Under the hood this is done with a couple global
ContextVars, but in practice it uses a clean, FastAPI-like dependency injection pattern:What this enables that was not previously possible is a total separation of concerns. Task definitions can now access dependencies without having to know anything about the top level
Workerthey will eventually be included in. This replaces the previousWorker.contextandWorker.task_context()functions altogether.CLI makeover: the
streaqcommand has been split into two subcommands,streaq runandstreaq webfor running a worker and the web UI respectively. As a bonus this allowed for getting some extra coverage that was previously marked with# pragma: no cover.Typing for pipelined tasks is drastically better for both
Task.then()andTask.__or__(), with some fancy overloads and aTypeVarTuplethat allow for nearly perfect typing of the complex scenario where results from one task are fed into the next.Workers no longer attempt to re-enqueue tasks on shutdown--instead, we assume all shutdowns are unsafe, and allow
Worker.idle_timeoutto handle retrying. The default idle timeout has been decreased from 5 minutes to 1 minute to reflect this change.Redis scripts are now Redis functions in a single Lua library file. This means we now use FCALL instead of EVALSHA, which slightly increases performance in pipelines. This also means Redis versions less than 7.0 are no longer supported.
Task abortion now handles delayed tasks better, aborting them right away instead of marking them and leaving them untouched
TaskResultnow has slightly better typing. Instead of accessingTaskResult.resultwhich was either the task's output or any raised exception,TaskResult.resultnow only contains the task's output and errors if you access it whenTaskResult.successis False. Exceptions are now contained inTaskResult.exception, and errors if you access it whenTaskResult.successis True.Add date in logs by @nsteinmetz in Add date in logs #91
Ability to set custom formatters for task results and exceptions in Web UI by @espdev in Ability to set custom formatters for task results and exceptions in Web UI #95
Update docs for SAQ comparison: abort support by @vikigenius in Update docs for SAQ comparison: abort support #100
Custom worker id feature by @espdev in Custom worker id feature #101
Place sleep after the first healthcheck, not before it. by @espdev in Place sleep after the first healthcheck, not before it. #104
Add the info about exception traceback serialization with tblib to the docs by @espdev in Add the info about exception traceback serialization with tblib to the docs #105
Improve the user experience when running tests by @espdev in Improve the user experience when running tests #107
StreaqRetry,StreaqError, andStreaqCancelledhave been moved from utils to thestreaq.typesmodule.Workercan now be initialized from acoredis.ConnectionPoolinstead of a connection URI.The Redis health check cron job is now registered at worker startup instead of in the constructor.
Configure Renovate by @renovate[bot] in Configure Renovate #133
Redis Sentinel now in test coverage everywhere a worker is used
Tests now use a Docker compose cluster
Added "Contributing" page to docs
Benchmarks updated
Web UI no longer uses
alru_cachesince it's not compatible with anyioNew Contributors
Full Changelog: v5.2.2...v6.0.1
This discussion was created from the release tastyware/streaq:v6.0.1.
Beta Was this translation helpful? Give feedback.
All reactions