Django Priority Queue - django

I want to build a delivery app in Django, wherein I will create delivery objects to be delivered according to priority(attribute of the object) by a delivery person. I will login and create the tasks and there can be many delivery persons to login and accept task asynchronously.
Objects(tasks) will be popped out as a delivery person logs in and accepts the task, and the next logged in delivery person would see the next priority task.
How can this be implemented in Django? Any references and implementation links are welcomed. Thanks in advance!

Related

how to send mail automatically everyday when workflow completed successfully and also send an email when it run long

I want to receive an email when
1)The workflow will be successfully completed in time and a completion Notification will be sent to the respective person(e-mail id) or support group(distribution list) via the email task or the post-session e-mail notification in the session task.
The workflow will be continuing to run in excess of the expected time due to some issues (like network, data, etc).In such cases the “STILL RUNNING” notification will be sent to the respective person (e-mail id) or support group(distribution list) via the email task or the post-session e-mail notification in the session task.
For the scenario 1 just follow the guide linked by #rownum-highart.
For the scenario 2 use a parallel flow with a timer. Combine the two flows with Decision Task. Remember to use Treat the input links as set to OR. followed by Email Task with a condition of your session status.

Django: Send reminder email

my app has list of events with start time (date and time). I want to make a scheduled task to send reminder via email to all user participate in event 1 hour before event start. (Note: Admin can change time of event).
I currently use celery to send email to list of participants when admin change the time of event.
Please suggest me some solution for this. Thanks.
Here's a recent(ish) discussion where a potential solution is proposed for celery: https://github.com/celery/celery/issues/4522.
I built Posthook to make solving these kinds of problems easier for developers. In your case, when a new event is created or the event time changes you can schedule a request back to your app for 1 hour before the start time. Then when you get the request from Posthook you can send out the reminder after validating that it still needs to be sent out.

News feed using Celery and RabbitMQ

I am developing a news feed backend for multiple applications. The idea is that a user can subscribe to multiple groups and receive posts from the groups that he is subscribed to via push.
I was thinking of: on creating a new post have a create_post_task(content) that goes to the Celery feed queue, so that Celery workers can consume it. What I am not sure is what should I do afterwards to deliver the posts to the clients, dynamically create a new RabbitMQ queue for each group, and route the posts to the respective queue, so that subscribed clients will be pushed the posts from those queues? If so, how do I do that after the task was consumed? Is having a lot of RabbitMQ/Celery queues a problem? Any suggestions on an effective solution would be valuable.

How to use Akka with transactions across email and database?

I have a situation where I have a component with a list of users. I need to send an email to each user, and then update the user's record to indicate the time when the email was sent.
This seems like a good first use-case for Akka. I was thinking the component that gets the list of users would be an Actor, and a separate Actor would be created for each outbound email-sending Actor, which could be multithreaded. The email-sending Actor would be responsible for updating the date in the user record.
If the email-sending Actor failed, the user's record wouldn't be done, and the supervising Actor would be able to reschedule it.
Is that the right model? Or should the supervisor be responsible for updating the user record?
Or is this a bad use-case for Akka completely?
BTW, I could send mail via SMTP or a web service. I don't think it matters much for the discussion, but I thought I'd mention it.
I don't think you should get hung up on transactionality when there's IO involved. You have no guarantees that the emails will be read, received, received by the right person, received within a certain period of time, be understood etc.
Just send the email and then update the database.
Happy hAkking!

Time Based Reminder Email in Django

I want incorporate a timed based reminder email of the events for the day in django. Basically I have a model which has all the events (including the date of the event). I want to send emails to concerned people at around 8.00 AM in the morning of each day about the events for the day. How do I incorporate this is django?
Thanks
I reckon a custom management command to send the alerts, commanded by django-chronograph should do the trick
I wrote a database-backed email queue, to send out emails from a single django install and not have to worry about SMTP throttling and whatnot. It's dead simple -- one model class for the email with a sendit() method, and a command-line script to flush the queue, which I run with cron.
http://gist.github.com/629663