9 Commits (master)

Author SHA1 Message Date
Rishabh Ranjan a53966c918
callback func as string (#1905)
* callback func as string

* add tests for string callbacks; update documentation and type annotations

* lint

* concise test for string callback

* add string callbacks to existing tests

* remove string callback testcase; extend existing testcases
2 years ago
Cyril Chapellier 933860ee8c
fix: linting error (#1920) 2 years ago
Ethan Wolinsky 192fbc9c50
Add support for a callback on stopped jobs (#1909)
* Add support for a callback on stopped jobs

This function will run when an active job is stopped using the
send_stopped_job_command_function

* Remove testing async job with stopped callback

* Remove stopped job test from simpleworker case.

I can't stop the job from the test until the work() method returns, at which point the
job can't be stopped.

* Improve coverage

* Add test for stopped callback execution

* Move stopped callback check out of execution func

* Use SimpleWorker for stopped callback test

* Call stopped callback directly in main proc

* Remove unused imports

* Fix import order

* Fix import order

* Fix death penalty class arg

* Fix worker instance init

Sorry these commits are so lazy
2 years ago
Rob Hudson ea063edf0a
Update linting configuration (#1915)
* Update linting configuration

This removes flake8 in favor of ruff, which also provides isort support, and
updates all files to be black, isort, and ruff compliant. This also adds black
and ruff checks to the tox and Github linting workflow.

* Tweak the code coverage config and calls
2 years ago
Selwin Ong acdeff385d
Use job.return_value() instead of job.result when processing callbacks (#1801)
* Use job.return_value() instead of job.result when processing callbacks

* job.return_value() should also support Redis server < 5.
2 years ago
Selwin Ong bc5bb1fba2
Revert "Jobs that are run synchronously should always raise an exception" (#1682)
This reverts commit 0d21e714c33cfefba51a8c2b714a735bcad1264d.
2 years ago
Selwin Ong 87bacb650e
Jobs that are run synchronously should always raise an exception (#1671) 3 years ago
Eric Feldman 93f34c796f
call callbacks and prepare job when running sync (#1599)
* call signals

* fix lines

* add tests and fix faliure status bug

* bump version
3 years ago
Selwin Ong 5590aab458
Success and failure callbacks (#1480)
* Support enqueueing with on_success_callback

* Got success callback to execute properly

* Added on_failure callback

* Document success and failure callbacks

* More Flake8 fixes

* Mention that options can also be passed in via environment variables

* Increase coverage on test_callbacks.py
4 years ago