Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not fork new thread for callback #4

Open
misli opened this issue Nov 2, 2014 · 2 comments
Open

do not fork new thread for callback #4

misli opened this issue Nov 2, 2014 · 2 comments

Comments

@misli
Copy link
Contributor

misli commented Nov 2, 2014

If we really need to use callback at all (i believe we do not), use string definition of callback ('module.submodule.func') and pass it to task.
In the task use django.utils.module_loading.import_string to get the actual callback function.

@twaugh
Copy link
Contributor

twaugh commented Nov 19, 2014

Another possible approach is to use celery signals:

@signals.task_postrun(sender=dbs.tasks.build_image)
def task_postrun_handler(sender, **kwargs):
    ...

If I'm reading it right, task_postrun_handler() would be run in the server not the worker.
http://celery.readthedocs.org/en/latest/userguide/signals.html

@TomasTomecek
Copy link
Member

I've implemented state change in DB via signals:
ef6bc60#diff-993fb812f6bae891a1e5603a70d7a96bR31

IMO, this could really be the easiest and most flexible solution. Good job scouting that out, Tim.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants