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

Enhancement: Improve documentation to describe how to setup task scheduler #4

Open
studybuffalo opened this issue Dec 25, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@studybuffalo
Copy link
Owner

Update documentation to describe how to setup and integrate application with a task scheduler (e.g. Celery).

@studybuffalo studybuffalo added the enhancement New feature or request label Dec 25, 2018
@HosseyNJF
Copy link
Contributor

I think the manager system could be entirely replaced with the sched module. It will omit the complexity of a task scheduler.
https://docs.python.org/3/library/sched.html

@studybuffalo
Copy link
Owner Author

I took some time to look through this. It looks like it could technically work, but I am not sure I want to get this package into the complexity of task management. That said, if this is a feature that users are requesting/will find valuable, we could look into it further.

Some initial requirements up front:

  • I think this needs to be optional and easy to use/not use
  • In all implementations, I think we need to keep using subscriptions/management/commands/_manager.py to maintain and test all logic.

Two ways to meet the above requirements off the top of my head:

  • Update documentation to show people how to build their own scheduler with sched - this lets people know it is an options and how to use it quickly and easily. They can make the choice to make it more robust for their needs.
  • Implement it as a second Django app that users can choose to include or not. We'd need to consider how to best implement that in terms of file structure, testing, etc.

From a personal perspective, this is not something I am going to have time to implement robustly, so I probably am not going to do this. If you (or anyone else) is interested in taking this up, we can chat further on this issue here and determine the best approach (i.e. I don't want anyone to do all this work and then have the pull request rejected).

@HosseyNJF
Copy link
Contributor

HosseyNJF commented Jan 16, 2020

From my perspective, as a user of this library, it is definitely better to just let the library process events and notifying relevant manager functions than having to set-up and maintain my own schedule system; which is usually Cron on Linux having a precision of 1 minute - it means you can't be sure your task runs on the required second, only at the same minute without using Cron hacks.

It doesn't have to be optional; In fact, we could use it as the main way to run the Manager and deprecate the old system for backward compatibility.

Most of the system would be untouched - The same Manager that should be extended with the same event functions. We only have to do these things:

  • Deprecate process_subscriptions.py file and process_subscriptions function in the _manager.py file.
  • Fetch all subscriptions due times and schedule events for corresponding subscriptions and times on app start (For subscriptions that were in the database before the app ran)
  • Schedule new subscriptions that get inserted while the app is running

And it should do it, at least minimally to get it working.

@HosseyNJF
Copy link
Contributor

I'll open a new issue because this one isn't relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants