Comments (6)
Hi, @mghantous apparently the problem comes from your task, this was my case.
By placing close_old_connections () within def store_result (........) I could see that my task in some parts took a long time and the connection with the database was lost, so also within my task place close_old_connections.
So modify store_result (): https://github.com/celery/django-celery-results/blob/master/django_celery_results/managers.py#L87
def store_result(self, content_type, content_encoding,
task_id, result, status,
traceback=None, meta=None):
"""Store the result and status of a task.
"""
fields = {
'status': status,
'result': result,
'traceback': traceback,
'meta': meta,
'content_encoding': content_encoding,
'content_type': content_type,
}
#Fix temporary (2006, 'MySQL server has gone away')
from django.db import close_old_connections
close_old_connections()
obj, created = self.get_or_create(task_id=task_id, defaults=fields)
if not created:
for k, v in items(fields):
setattr(obj, k, v)
obj.save()
return obj
I hope I help you, Regards
from django-celery-results.
It seems to be related to this PR celery/celery#4292
When I get rid of my 'CONN_MAX_AGE': 60
setting, it seems to resolve the issue.
Perhaps I should close the issue and report it on https://github.com/celery/celery instead?
from django-celery-results.
@mghantous same issue with:
#celery==4.0.2
amqp==2.1.4
billiard==3.5.0.2
celery==4.0.2
Django==1.11.2
django-celery-beat==1.0.1
django-celery-results==1.0.1
kombu==4.0.2
MySQL-python==1.2.5
pytz==2017.2
vine==1.1.3
After upgrade celery==4.2.1:
amqp==2.3.2
billiard==3.5.0.4
celery==4.2.1
Django==1.11.2
django-celery-beat==1.1.1
django-celery-results==1.0.1
kombu==4.2.1
MySQL-python==1.2.5
pytz==2018.5
redis==2.10.6
vine==1.1.4
from django-celery-results.
Thank you for the workaround. Hopefully there is a more permanent fix. The task I have been testing doesn't do anything with the database other than have its result be stored (it simply echos a message).
from django-celery-results.
from django-celery-results.
I hope this is fixed in celery master.
from django-celery-results.
Related Issues (20)
- Is there a way to use shadow_name as the result task name?
- Clean old results from Database
- `backend_cleanup` fails when TaskResult is referenced in a model HOT 1
- Can we use django celery results for remote workers?
- Unable to install django_celery_results with Django version 4.2 HOT 1
- Documentation and changelog are out of date HOT 1
- ModuleNotFoundError: No module named 'django_celery_results'
- 'result' cannot be specified for MyTaskResult model form as it is a non-editable field. Check fields/fieldsets/exclude attributes of class MyTaskResultAdmin. HOT 2
- `post_save` signal of TaskResult doesn't trigger HOT 2
- Display the seconds of the datetime fields in the django admin
- Django celery results in combination with dango tenants intermittent error of table not found HOT 2
- Task name, args, and kwargs are not being saved HOT 2
- Building docs fails with Sphinx 7.2 and SOURCE_DATE_EPOCH environment variable
- CELERY_RESULT_EXPIRES does not prevent backend.cleanup task
- date_done does not reflect the time the *task* was completed, but the time the *task result* is updated HOT 1
- Unable to retrieve results across workers HOT 8
- Django 5 support HOT 4
- Getting exception "select_for_update cannot be used outside of a transaction" HOT 2
- persistance for revoked tasks ? HOT 1
- why task name and worker column is always empty HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-celery-results.