Commit Graph
105 Commits
Author SHA1 Message Date
Ilan Steemers 681375364d Merge pull request #393 from ossobv/sync
Preserve database connection when sync=True
2020-01-17 15:34:46 +01:00
Jake Bell dc65f5e1de Replacing ugettext_ functions with gettext_ for Django 3 2020-01-07 15:57:37 -06:00
Harm Geerts 66588a28e7 Preserve database connection when sync=True
When tasks run synchronously django-q should only affect the calling
context by running the tasks.
Fixes https://github.com/Koed00/django-q/issues/326
2019-11-27 12:37:31 +01:00
Ilan Steemers c27938ee62 Merge pull request #333 from tremby/fix-timeout-override
Fix timeout override
2019-08-13 14:16:03 +02:00
Martijn Jacobs 924ff928b0 Lock the Schedule objects to ensure tasks are created once
Tested this with PostgreSQL and MySQL
2019-08-12 14:28:26 +02:00
Martijn Jacobs abaa0ba39b Don't call the scheduler twice: respect Conf.SCHEDULER 2019-08-12 14:27:56 +02:00
Ilan Steemers 7d437ea5cf Merge pull request #353 from maerteijn/fix-mysql-naive-datetime-in-scheduler
Fix issue when using USE_TZ=False with MySQL
2019-08-10 14:16:11 +02:00
Ilan Steemers 16fa6fa8d9 Fixes deprecated arrow syntax 2019-08-10 14:03:03 +02:00
Martijn Jacobs c0cda97864 Don't save the next_run field as TZ aware when USE_TZ is False
arrow always returns a tz aware datetime, and we don't want this when we explicitly configured django with USE_TZ=False. This causes issues with MySQL.
2019-04-17 15:02:20 +02:00
Janne Rönkkö bca22054df Fix concurrency issue in timeout timer value processing
According to multiprocessing documentation for Value
(https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Value)
reads and writes are protected with lock when the lock argument is True
(the default) or the lock argument is an instance of Lock or RLock. The
documentation states that operations like += are not atomic as that
involves reading and writing.

On the worker side the critical section includes also storing finished task
result because the timeout could happen after the task function has
finished but before the result has been stored and timer.value has been
updated to tell the guard process that the task has been finished.

On the guard side the critical section includes all checks done to see
if the worker has timed out or died and the actual reincarnation function
because the worker could update timer value to -1 (idle) or -2 (recycle)
after the guard has seen timer value 0 (timeout) and is going to terminate
the worker.
2019-01-28 08:39:56 +02:00
Ilan Steemers 44d963b716 Merge pull request #327 from mattaw/master
Modified django_q imports to support Python 3.4 again in cluster.py. …
2019-01-27 18:34:30 +01:00
Ilan Steemers 198ab59555 Merge branch 'master' into fix-timeout-override 2019-01-27 18:30:05 +01:00
Janne Rönkkö 0e2df88d92 Fix async_task timeout parameter handling when cluster timeout is set to None (the default)
The cluster timeout configuration default value None is documented to mean
tasks never timeout out. Also the documentation states that the timeout
can be overridden for individual tasks.

With the old implementation the timeout parameter given to async_task was
not honored if the cluster timeout was set to None.

Fixes: #335
2019-01-27 19:09:22 +02:00
Bart Nagel 4c2a2f3279 Fix timeout override
Closes https://github.com/Koed00/django-q/issues/332
2019-01-21 16:23:45 -08:00
Matthew Swabey e84be5f33b Modified django_q imports to support Python 3.4 again in cluster.py. Closes #315 2018-12-09 12:28:04 -05:00
Ilan Steemers b5a01a9e93 Removes old rollbar support - relies on the pluggable error reporters now 2018-08-10 13:03:58 +02:00
Ilan Steemers 7d5c9f8b46 removes xrange compat 2018-08-05 13:39:04 +02:00
Ilan Steemers bd062503c5 Adds tracebacks in error logs @strets123 2018-08-05 11:13:16 +02:00
Ilan Steemers acebdaa850 Renames async/enqueue to async_task. 2018-08-01 15:20:34 +02:00
Pierre-Elliott Bécue ae75a84f7f Replaces async occurrences with alternatives
* async is now a reserved word in python3.7
 * Rename async function to enqueue
 * Rename all async_ functions to enqueue_
 * Rename Async class to AsyncTask
 * Updates the docs.
2018-07-07 21:33:43 +02:00
Ilan Steemers d5e430be44 Merge pull request #298 from Balletie/master
Add option for acknowledging failed tasks (globally and per-task)
2018-03-13 15:24:31 +01:00
Eagllus 8f87bc352f Change imports for cluster and tasks 2018-03-13 09:28:17 +01:00
Eagllus 9c39546417 Change imports signing classes explicit 2018-03-13 09:22:09 +01:00
Balletie 03abbc960f Add option for acknowledging failed tasks (globally and per-task)
If a task fails with an exception, it is retried until it
succeeds. This is contrary to what is said in the documentation: under
the "Architecture" section, heading "Broker" it says that even when a
task errors, it's still considered a successful delivery. Failed tasks
never get acknowledged however, thereby being retried after the
timeout period. See also issues #238 and #194.

This patch adds an option to acknowledge failures, thereby closing
issue #238. Issue #194 would require some more work. The default of
this option is set to `False`, thereby maintaining backwards
compatibility.
2018-03-09 22:09:46 +01:00
Ronald van Zon dd4f02f122 Add custom SharedCounter / Queue
This will not fix anything related to Django 2.0 but will allow MAC
users to run Django-Q allowing tests to be run locally.
2017-12-13 14:36:12 +01:00
Daniel Welch 4530b05d86 putting back support for backwards compatibility 2017-10-06 13:26:43 -04:00
Daniel Welch f90c4f5747 merge conflict resolution 2017-10-03 16:55:28 -04:00
Benjamin Bach 5ea55e3718 Import python3 version of range 2017-07-09 21:44:25 +02:00
Benjamin Bach ab48bad0f6 Remove unused dependency and sys module patching 2017-07-09 21:14:08 +02:00
Daniel Welch aac6984ec3 replace rollbar reporting with generic error_reporter reporting in cluster.py 2017-03-30 22:02:31 -04:00
Aurélien Bompard 77c5bb0737 Add signals
Fixes #219
2017-03-03 14:25:04 +01:00
Yann Pomarede 78b997e88f fix typo 2016-12-05 14:58:42 +01:00
Yann Pomarede aa667b40d4 daemonize_workers option 2016-12-05 14:55:42 +01:00
yannpom 3b8199cb8f set daemon to False 2016-12-05 12:21:41 +01:00
Vladimir Rychkov 1a1385dfba Guard loop sleep made configurable 2016-07-12 13:08:17 +01:00
Matt Bone 823ca0c51b allow scheduler to schedule all pending tasks 2016-04-21 16:31:34 -05:00
Ilan Steemers 6026953132 Fixes typo in Save limit 2016-04-06 20:33:26 +02:00
Ilan Steemers 763fff34c0 Makes it possible to set a schedules group name via q_options dict 2016-02-24 11:22:58 +01:00
Ilan Steemers 2e965b1631 Closes db connections on reincarnate 2016-02-24 10:08:09 +01:00
Ilan Steemers c66f0b74ed Closes all db connections on worker recycle 2016-02-16 11:29:43 +01:00
Ilan Steemers c75ab4e7f0 Only updates existing tasks if it was failing
updates stopped, result and success only for existing task results if the original result was failing. Otherwise the result is discarded.
2016-01-20 14:11:53 +01:00
Ilan Steemers 66771f274a Save task now creates or updates
This way failed tasks that get requeued can have a changed status and result
2016-01-19 22:49:28 +01:00
Ilan Steemers 0e8ea25396 Only acks task if it's succesful 2016-01-18 10:51:28 +01:00
Ilan Steemers d29c861d09 Adds Rollbar support for exceptions
Also formats exceptions in case they are unprintable
2016-01-07 18:50:55 +01:00
Ilan Steemers 02bd14c169 Fixes bug where task with a group only has a group result. 2015-10-26 19:35:07 +01:00
Ilan Steemers 69551793c0 adds timeout to group_key cache object 2015-10-19 15:42:05 +02:00
Ilan Steemers 2df29b908c Adds tests for task chains
adds several small improvements based on the problems that surfaced during writing the tests
2015-10-17 18:49:45 +02:00
Ilan Steemers 6dcead7310 Adds task chains 2015-10-17 12:13:29 +02:00
Ilan Steemers 2ba88f2d17 adds cached option to async_iter 2015-10-06 19:37:02 +02:00
Ilan Steemers f73ae66c0f Adds async_iter command
With async iter you can quickly run the same function on an iterable set of arguments. The results are held in the cache until all are done and collated into a database result.
2015-10-03 18:07:57 +02:00