Commit Graph

1864 Commits

Author SHA1 Message Date
Selwin Ong 4c28ec617a
Delete legacy.py (#2083)
* Delete legacy.py

* Deleted Sentry's built in integration.

* Fixed ruff warnings.
2024-05-02 08:20:41 +07:00
Alpha 87af9b51e9
doc: Job statuses descriptions (#2075)
* doc: Job statuses descriptions

* Applied review suggestions
2024-05-01 14:25:26 +07:00
Selwin Ong 4efd81e648 Merge branch 'master' of github.com:rq/rq 2024-05-01 14:20:44 +07:00
Selwin Ong b52457afb6 Merge branch 'v1' 2024-05-01 14:20:29 +07:00
Jack Kinsella 0b31edc6da
Document suspend and resume commands (#2068)
* Document suspend and resume commands

* Title case title

* Modify docs
2024-05-01 14:18:02 +07:00
Harm Berntsen fbd9858f3c
Fix fetch_many method type (#2082)
The type introduced in #1772 does not match the method description and
behaviour. None is part of the returned list.
2024-05-01 14:17:19 +07:00
Selwin Ong 0e15b2a942 Bump version to 1.16.2 2024-05-01 14:12:08 +07:00
Selwin Ong 00adbc08c6 Use sentry-sdk<2 for tests 2024-04-28 20:50:26 +07:00
Selwin Ong e2d144d772 Moved intermediate queue cleaning functionality to intermediate_queue.cleanup() 2024-04-28 20:48:07 +07:00
Selwin Ong a7f19d966f Done implementing clean_intermediate_queue() 2024-04-28 20:32:30 +07:00
Selwin Ong aae428500c Skip intermediate queue tests if Redis < 6.2.0 2024-04-28 19:51:21 +07:00
Selwin Ong 3ca348049f Ensure intermediate_queue is empty before running tests 2024-04-28 19:37:53 +07:00
Selwin Ong 7d4c7eee30 Added intermediate_queue.get_job_ids() 2024-04-28 19:24:24 +07:00
Selwin Ong 50467b4d58 Made IntermediateQueue class 2024-04-27 19:54:20 +07:00
Selwin Ong 1068956bad Use sentry-sdk<2 for tests 2024-04-27 15:24:50 +07:00
Selwin Ong 673b70dad0 Fix test_clean_large_registry 2024-04-27 15:00:42 +07:00
Andrey Nehaychik 7be63fb468
Always remove fetched job_ids for scheduler queue (#2077)
* Always remove fetched job_ids for scheduler queue

* Correct fix job removing
2024-04-20 13:47:39 +07:00
Selwin Ong caf6af9df7 Updated docs 2024-04-13 14:45:34 +07:00
Selwin Ong fd261d5d8f Fix test_clean_large_registry 2024-04-13 14:38:53 +07:00
Selwin Ong 7fa34246f6 Merge branch 'master' of github.com:rq/rq 2024-04-13 07:17:56 +07:00
dependabot[bot] 233f56d382
Bump actions/setup-python from 5.0.0 to 5.1.0 (#2065)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5.0.0 to 5.1.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5.0.0...v5.1.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-13 06:52:15 +07:00
Stanislav Khlud e21ce4e255
Extend ssl config options (#2066) 2024-04-13 06:43:55 +07:00
Ethan Wolinsky 2fc5484852
Execute custom handlers when abandoned job is found (#2057)
* Execute custom handlers when abandoned job is found

* Make exception_handlers optional

* Run exception handlers before checking retry

* Test abandoned job handler is called

* Improve test coverage

* Fix handler order
2024-03-23 16:46:07 +07:00
Selwin Ong bab0061da1
Removed utils.utcnow() (#2056)
* Bump version to 1.16.1

* Partially replaced utcnow() with now()

* Removed utils.utcnow

* Fix lint
2024-03-11 19:44:12 +07:00
Ethan Wolinsky 3a3787dcc3
Group jobs into batches and retrieve by batch name (#1945)
* Batch.py initial commit

* Add method to refresh batch status

* Clean up Redis key properties

* Remove persist_job method

* Execute refresh method when fetching batch

* Add batch_id to job

* Add option to batch jobs with enqueue_many

* Add set_batch_id method

* Handle batch_ttl when job is started

* Renew ttl on all jobs in batch when a job finishes

* Use fetch_jobs method in refresh()

* Remove batch TTL

During worker maintenance task, worker will loop through batches and
delete expired jobs.
When all jobs are expired, the batch is deleted.

* Fix buggy connection

* Raise batch error in fetch method

* Fix fetch connection arg

* Add testing for batch

* Remove unused import

* Update batch documentation

* Add batch ID to job persistence test

* Test that empty batch is removed from batch list

* Make default batch ID full uuid4 to match Job

* Add method to return batch key

* Add all method to return iterable of batches

* Revert changes to queue.py

* Separate batch creating from job enqueueing.

Batches can be created by passing an array of jobs.

* Fix bug with stopped callback in enqueue_many

* Rename delete_expired_jobs batch method

* Use exists to identify expired jobs

* Remove jobs attribute from batch

Jobs have to be explicitly fetched using the get_jobs method

* Don't add batch_id to job in _add_jobs method

This should be done when the job is created before it is saved to redis.

* Use cleanup method to determine if batch should be deleted

* Add get_jobs method

This method will return an array of jobs belonging to the batch.

* Update create method to not allow jobs arg

Jobs should be added to batches in the Queue.enqueue_many
function

* Add batch_id to job create method

* Delete set_batch_id method

The batch ID should be set atomically when the job is created

* Add batch argument to queue.enqueue_many

This will be how jobs can be batched. The batch ID is added to each job
created by enqueue_many, and then those jobs are all added to the batch
in Redis using the batch's _add_jobs method

* Update batch tests to use new enqueue_many arg

* Fix batch_id for non_batched jobs

* Use different pipeline name

* Don't use fetch method when enqueuing jobs

If the batch is empty, fetch will delete it from Redis

* Test enqueuing batched jobs with string ID

* Update batch documentation

* Remove unused variables

* Fix expired job tracking bug

* Add delete_job method

* Use delete_job method on batch

* Pass multiple jobs into srem command

* Add multiple keys to exists call

* Pipeline _add_jobs call

* Fix missing job_id arg

* Move clean_batch_registry to Batch class

* Remove unused variables

* Fix missing dependency deletion

I accidentally deleted this earlier

* Move batch enqueueing to batch class

* Update batch docs

* Add test for batched jobs with str queue arg

* Don't delete batch in cleanup

* Change Batch to Group

* Import EnqueueData for type hint

* Sort imports

* Remove local config file

* Rename clean_group_registries method

* Update feature version

* Fix group constant names

* Only allow Queue in enqueue many

* Move cleanup logic to classmethod

* Remove str group test

* Remove unused import

* Make pipeline mandatory in _add_jobs method

* Rename expired job ids array

* Add slow decorator

* Assert job 1 data in group

* Rename id arg to name

* Only run cleanup when jobs are retrieved

* Remove job_ids variable

* Fix group name arg

* Fix group name arg

* Clean groups before fetching

* Use uuid4().hex for shorter id

* Move cleanup logic to instance method

* Use all method when cleaning group registry

* Check if group exists instead of catching error

* Cleanup expired jobs

* Apply black formatting

* Fix black formatting

* Pipeline group cleanup

* Fix pipeline call to exists

* Add pyenv version file

* Remove group cleanup after job completes

* Use existing pipeline

* Remove unneeded pipeline check

* Fix empty call

* Test group __repr__ method

* Remove unnecessary pipeline assignment

* Remove unused delete method

* Fix pipeline name

* Remove unnecessary conditional block
2024-03-11 15:08:53 +07:00
Selwin Ong 7189771c23 Merge branch 'master' of github.com:rq/rq 2024-03-11 08:02:27 +07:00
dewalujjwal cdf5cfcd3d
Replace deprecated utcnow() with timezone aware now() (#2055)
* changed the utcnow() to now()

* changed the utcnow() to now()

* changed the utcnow() to now()

* changed the utcnow() to now()

* changed the utcnow() to now()

* changed the utcnow() to now()

* changed the utcnow() to now()

* changed the utcnow() to now()
2024-03-11 08:00:46 +07:00
Selwin Ong 089ecc17c1 Bump version to 1.16.1 2024-03-09 09:38:09 +07:00
Selwin Ong 1f8e031a46 Bump version to 1.16.1 2024-03-09 09:31:58 +07:00
Selwin Ong e2a1011074
Added worker_pool.get_worker_process() (#2052) 2024-03-09 09:28:23 +07:00
Selwin Ong 2de949126f Added worker_pool.get_worker_process() 2024-03-03 20:06:02 +07:00
Selwin Ong 3ad86083c3 Merge tag 'v1.16' 2024-02-25 08:10:01 +07:00
Selwin Ong 34f83d637f Remove Python 3.6 from test matrix 2024-02-24 11:50:40 +07:00
Selwin Ong e98509434e Workflow syntax 2 2024-02-24 10:31:33 +07:00
Selwin Ong b8d2750c17 Workflow syntax 2024-02-24 10:30:42 +07:00
Selwin Ong 6ca0a299c8 Run on push to all branches 2024-02-24 10:29:23 +07:00
Selwin Ong e50b8f323d Always run github actions on push 2024-02-24 10:24:33 +07:00
Selwin Ong 97b2d83164 Minor test case change to trigger Github Actions 2024-02-24 10:19:23 +07:00
Selwin Ong 6ce1cc63b9 Bump version to 1.16.0 2024-02-24 10:10:21 +07:00
Rob Hudson 0935f47213 Store project metadata in pyproject.toml (PEP 621) (#1952) 2024-02-24 10:07:56 +07:00
Ethan Wolinsky efd4bd82d7 Delete maintenance lock after registries cleaned (#2024)
* Delete maintenance lock after registries cleaned

* Fix test to assert that lock is released

* Remove deprecated test case
2024-02-24 09:54:47 +07:00
Ethan Wolinsky 1e6953b534 Fix bug with stopped callback in enqueue_many (#1954)
* Fix bug with stopped callback in enqueue_many

* Add test for callbacks enqueued using enqueue_many
2024-02-24 09:51:20 +07:00
Christofer Saputra 49f12451ba Set workerpool with_scheduler defaults to True (#2027)
* Set workerpool with_scheduler defaults to True

* Add delay before sending shutdown command

* Black format

* Delay a bit longer for test
2024-02-24 09:50:26 +07:00
Péter Gyarmati 2440db31f1 fix: cast redis server version from `float` to `str` (#2025)
Currently, with Redis engine 7.1, and `redis` client 5.0.1 trying to enqueue a new job yields

```text
AttributeError: 'float' object has no attribute 'split'
```

This is caused by the fact that `redis_conn.info("server")["redis_version"]` returns a `float`, not a `str`.
2024-02-24 09:50:12 +07:00
Simó Albert i Beltran 7349032bbf fix_cleanup_ghosts_by_using_configured_worker_class (#1988)
Signed-off-by: Simó Albert i Beltran <sim6@bona.gent>
2024-02-24 09:49:50 +07:00
Andrew Nisbet 87da060648 Add result blocking (#1939)
* Add result blocking

* Dev tidyup

* Skip XREAD test on old redis versions

* Lint

* Clarify that the latest result is returned.

* Fix job test ordering

* Remove test latency hack

* Readability improvements
2024-02-24 09:48:28 +07:00
Ethan Wolinsky 690a6451db
Delete maintenance lock after registries cleaned (#2024)
* Delete maintenance lock after registries cleaned

* Fix test to assert that lock is released

* Remove deprecated test case
2024-02-24 09:44:44 +07:00
Selwin Ong 67624eba0b
Deprecate current connection (#2043)
* Removed pop_connection from Worker.find_by_key()

* Removed push_connection from worker.work()

* Remove push_connection from workers.py and cli

* Remove get_current_connection() from worker._set_connection()

* Fix failing tests

* Removed the use of get_current_connection()

* WIP removing get_connection()

* Fixed tests in test_dependencies.py

* Fixed a few test files

* test_worker.py now passes

* Fix HerokuWorker

* Fix schedule_access_self test

* Fix ruff errors
2024-02-21 07:37:15 +07:00
Selwin Ong 16fa7e837a
Added polarsource to FUNDING.yml 2024-02-19 08:48:15 +07:00
dependabot[bot] 133d18dfb2
Bump codecov/codecov-action from 3 to 4 (#2032)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 3 to 4.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-14 19:22:56 +07:00