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

Add a helper for notifying (emailing?) the result of a task to a user on completion #2

Open
winhamwr opened this issue Aug 30, 2012 · 0 comments

Comments

@winhamwr
Copy link
Contributor

For really long-running tasks, even a progress bar isn't all that user friendly. It still requires them to hang around with a browser window open. A really nice feature would be the ability to let users opt-in to some kind of notification when their task is done.

Jobtastic can do this with a keyword argument on the task combined with a JobtasticNotifierTask. The idea would be to add something like

allow_user_notification = True

on the task. Then, with a supplied Django View or Flask request handler, the user can opt in to being notified about the task from the page where they're waiting for results. When the original JobtasticTask finishes, it checks a known cache location (based off of cache_prefix) to see if any users have opted in to notifications. If they have, it fires off a JobtasticNotifierTask right before it was finished.

This task then checks the same cache location and uses the configured JOBTASTIC_NOTIFICATION_BACKENDS to notify the given user.

We can probably start with these backends for good coverage of common use-cases:

  • Flask-Mail backend that just accepts an email address
  • Django user email notification backend that takes a django.contrib.auth.models.User id and fires off an email to their user.email using Django's send_mail
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

1 participant