Skip to content

3.0.0b1

Pre-release
Pre-release
Compare
Choose a tag to compare
@ewjoachim ewjoachim released this 12 Jan 15:52
· 9 commits to main since this release
9cefcde

What's Changed

Breaking changes

A long, complex, necessary and highly appreciated work from @onlyann who has been quite active this year: rewriting most of the main job processing loop of the Procrastinate Worker (#1114) as discussed in #933. It was followed by quite a few improvements we wanted to make for a long time and took the opportunity of a breaking release to do, as described below.

Changes include:

  • The migration process has changed, especially if you apply migrations while the application is running. The way it was before was that you had to apply the migrations that came with version X.Y.Z before upgrading the code to X.Y.Z with complex procedures around minor/major versions. The new way is that migrations are noted as pre or post, you apply the pre migrations before deploying the accompagnying new version of Procrastinate, and you apply the post migrations after deploying the said code. If you are several versions late, you'll have to repeat these for every intermediate release that comes with migrations. See the Migration documentation.
  • Aborted asynchronous jobs are now cancelled through asyncio's cancel method, which can be handled gracefully by users using shielding, as explained in the Cancel documentation. Synchronous jobs will not be cancelled, but job_context.should_abort() will return True so that you can handle the abortion request in your code.
  • A better graceful stopping mechanism with a timeout controlled by shutdown_graceful_timeout. During shutdown, jobs (both synchronous and asynchronous) get an abort request as described in the previous bullet point. See all details in the Shutdown documentation.
  • The way a job's abortion request is stored used to be part of the job's status (ABORTING). It's now an independent field (Job.abort_requested). This has implications if you introspect job states, such as with the Job objects or via the Django integration.
  • The timeout worker option was renamed to fetch_job_polling_interval to better reflect its purpose. It's accompanied by a new setting abort_job_polling_interval. Both regulate how often the worker contacts the database to request new jobs or cancellation requests, in case they don't receive notifications from the LISTEN/NOTIFY mechanism. This is explained in the Polling documentation. Note that the work from @onlyann led to workers making significantly less SQL queries, especially for workers with high concurrency settings.
  • There have been a few changes on the JobContext object that your tasks receive if the task decorator was passed with pass_context=True:
    • job_context.job_result was removed. The only relevant information it contained was the start timestamp, which is now accessible via job_context.start_timestamp
    • The attributes app and job had static typing, mentioning that those attributes could be None while they actually were always set. They are now properly typed.
    • job_context.should_abort_async() was removed. Knowing whether the job should abort or not, is not doing I/Os anymore, so both sync and async code can now use job_context.should_abort(). job_context.abort_reason tells you whether a job is being aborted because the user requested an abortion, or because the worker is stopping.
    • The job_context.task attribute is now a read-only property. Not that it wasn't a good idea to modify it before, but in the very surprising case that one would do, that's now not possible anymore.
  • In the arguments of builtin_tasks.remove_old_jobs(), remove_error was renamed to remove_failed for consistency. Similarly, in JobManager.delete_old_jobs(), include_error was renamed include_failed.
  • Support for Python 3.8 was removed following its deprecation.

Bug Fixes

Related PRs:

Miscellaneous

Documentation

Dependencies

Kudos

MVPs

  • Special thanks to @onlyann who has brought significant changes and helped us bring a lot of the good stuff you can see in this release.
  • Never-ending stream of kudos to @medihack who stepped up as a maintainer and has been an excellent steward & force for good to the project.

New contributors for this release

Feedback

We'd love for you to share your thoughts about this release to us:

  • Was the upgrade simple enough? Were these release notes detailed enough? Was the timing good? What do you think of the project and its updates? In the future, would you prefer new features or more stability? Please feel free to chime in in the discussion accompanying this release to make your voice heard.

Full Changelog: 2.14.0...3.0.0b1