Pgqueuer

Latest version: v0.17.0

Safety actively analyzes 682471 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 10

0.17.0

PGQueuer v0.17.0 introduces breaking changes, improvements, and bug fixes. Please review the changes below, especially if using custom executors.

Breaking Changes

Executors Overhaul
- `JobExecutor` is now `AbstractEntrypointExecutor`.
- The `execute()` method now requires an additional `context` parameter: `async def execute(self, job: models.Job, context: models.Context) -> None`.
- **Custom Executor Registration**: Use `executor_factory` instead of `executor` for registering executors.
- **EntrypointExecutor Parameters**: Consolidated into `EntrypointExecutorParameters` dataclass.

Scheduler Executor Changes
- Schedulers now use `executor_factory` instead of direct instantiation.
- Executor parameters are consolidated into `ScheduleExecutorFactoryParameters`.

Deprecations
- **Executor Parameter**: Deprecated in favor of `executor_factory`.
- **Retry Timer Argument**: Define retry behavior at the entrypoint level instead of using `QueueManager.run()`.

Improvements
- Executors now receive a `context` object for better control over job execution.

Migration Guide

Updating Executors and Schedulers
1. Update executors to inherit from `AbstractEntrypointExecutor`.
2. Modify `execute()` to accept `context` as a parameter.
3. Use `executor_factory` to register executors.
4. Update schedulers to use `executor_factory` and access attributes via `parameters` (e.g., `executor.parameters.expression`).


Merges
* Use uv in test dockerfile by janbjorge in https://github.com/janbjorge/pgqueuer/pull/205
* Revert: Use uv in test dockerfile by janbjorge in https://github.com/janbjorge/pgqueuer/pull/206
* Revert docker cache by janbjorge in https://github.com/janbjorge/pgqueuer/pull/207
* Use queue_status_type in query builder by janbjorge in https://github.com/janbjorge/pgqueuer/pull/211
* Add executor_factory to entrypoint and schedule by janbjorge in https://github.com/janbjorge/pgqueuer/pull/208


**Full Changelog**: https://github.com/janbjorge/pgqueuer/compare/v0.16.2...v0.17.0

0.16.2

What's Changed
* Add unified interface by janbjorge in https://github.com/janbjorge/pgqueuer/pull/202


**Full Changelog**: https://github.com/janbjorge/pgqueuer/compare/v0.16.1...v0.16.2

0.16.1

What's Changed
* Update docs. by janbjorge in https://github.com/janbjorge/pgqueuer/pull/199
* Add test_execute_after_updated_gt_execute_after by janbjorge in https://github.com/janbjorge/pgqueuer/pull/200
* Task manager check task cancelled upon completed by janbjorge in https://github.com/janbjorge/pgqueuer/pull/203
* Dynamic import add current working directory to sys-path by janbjorge in https://github.com/janbjorge/pgqueuer/pull/204


**Full Changelog**: https://github.com/janbjorge/pgqueuer/compare/v0.16.0...v0.16.1

0.16.0

Release of v0.16.0, bringing new capability: deferred job execution for more precise control over job timing.

Breaking Changes / Migration Notes
- **Database Schema Update**: The `Job` model now includes a new `execute_after` column. This change requires a database schema update. To apply the necessary migration, please run:
bash
python -m pgqueuer upgrade

Failing to apply this migration will result in errors when trying to enqueue jobs with the new `execute_after` attribute.

What's Changed
* Add dataclass dec. to job executor by janbjorge in https://github.com/janbjorge/pgqueuer/pull/194
* Refactor verify structure by janbjorge in https://github.com/janbjorge/pgqueuer/pull/196
* Add execute after feature by janbjorge in https://github.com/janbjorge/pgqueuer/pull/195.

Example Usage
To enqueue a job for deferred execution until 1 minute from now:
python
from datetime import timedelta
await Queries(apgdriver).enqueue("my_task", payload=None, priority=0, execute_after=timedelta(minutes=1))

This job will only be picked for execution once the specified minute has elapsed, giving you better control over job timing.

**Full Changelog**: [v0.15.0...v0.16.0](https://github.com/janbjorge/pgqueuer/compare/v0.15.0...v0.16.0)

0.15.0

Im excited to introduce a new features and enhancements in this release; support for scheduling recurring jobs using cron-like syntax.

What's Changed
- **Public Interfaces Defined**: Updated `__init__.py` to define public interfaces more clearly ([186](https://github.com/janbjorge/pgqueuer/pull/186)).
- **Scheduling with Crontab Syntax**: You can now schedule functions using cron-like expressions for periodic task execution ([188](https://github.com/janbjorge/pgqueuer/pull/188)).
- **Added SchedulerManager to Public API**: Included `SchedulerManager` in `__init__.py` for easy access ([191](https://github.com/janbjorge/pgqueuer/pull/191)).
- **Added Scheduler Example to README**: Enhanced documentation with examples on using the new scheduling feature ([190](https://github.com/janbjorge/pgqueuer/pull/190)).
- **Batch RPS Events**: Implemented batching to improve the handling of rate-per-second (RPS) events ([192](https://github.com/janbjorge/pgqueuer/pull/192)).

**Note**: In order to use the new scheduling feature, a migration step is required. Please run:
bash
python -m pgqueuer upgrade


Example Usage
To schedule a recurring task every minute:
python
scheduler.schedule("sync_data", "* * * * *")
async def sync_data(schedule: Schedule) -> None:
print("Running scheduled sync_data task")

Run the scheduler using the CLI:
bash
pgq run myapp.create_scheduler


**Full Changelog**: [v0.14.1...v0.15.0](https://github.com/janbjorge/pgqueuer/compare/v0.14.1...v0.15.0)

0.14.1

What's Changed
* Minor readme update by janbjorge in https://github.com/janbjorge/pgqueuer/pull/179
* Add tooling concurrency-probe by janbjorge in https://github.com/janbjorge/pgqueuer/pull/180
* Switch to utc_now() for consistent timing across multiple processes by janbjorge in https://github.com/janbjorge/pgqueuer/pull/182
* CLI listen broken by janbjorge in https://github.com/janbjorge/pgqueuer/pull/183
* Use buffer for RPS by janbjorge in https://github.com/janbjorge/pgqueuer/pull/181
* Refactor listener setup by janbjorge in https://github.com/janbjorge/pgqueuer/pull/184


**Full Changelog**: https://github.com/janbjorge/pgqueuer/compare/v0.14.0...v0.14.1

Page 1 of 10

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.