You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Proposal to implement decorators for task scheduling #77
That's a great idea @maxsonferovante! 🚀 That's a need many projects run into at some point. I implemented this feature in one my projects and I used a library called APScheduler, although there are many others out there. Let me know if you use that library, I can provide help.
Hello @geovalexis , I had an idea exactly because of a need that arose at work. I have an idea of how to do it in pynest, but I'm worried about the orchestration part of the scheduled tasks and how apscheduler can help us with that. From what I saw and understood the managed API documentation. So it would be loading the beginning of the task event loop along with loading the modules, just like what is done in Nest. This is how I imagine it to be.
Hello @geovalexis , I had an idea exactly because of a need that arose at work. I have an idea of how to do it in pynest, but I'm worried about the orchestration part of the scheduled tasks and how apscheduler can help us with that. From what I saw and understood the managed API documentation. So it would be loading the beginning of the task event loop along with loading the modules, just like what is done in Nest. This is how I imagine it to be.
What do you mean by orchestration part? You mean like managing the state of the job (start, stop, etc...)? APScheduler provides a whole bunch of functions for this purpose in particular. What's best, it provides a decorator function for initialising a new cronjob. It's called schedule_job() (see https://apscheduler.readthedocs.io/en/3.x/userguide.html#adding-jobs).
We could just create a wrapper of that function that seamlessly integrates into PyNest.
When I express my concern about the orchestration, it is, in a way, an excess of concern. The decorator would have to be able to validate the parameters, register and start when the module was loaded, basically. @geovalexis
I'm finishing another project, so I'll start creating my idea with pynest.
Thank you, including your availability. I'll bring you news soon. Hugs
Do you get a chance to start working on that? Iv'e just faced on use case in my application that requires job scheduling and wander if you have started to implement this feature?
Hey, sorry for disappearing, I've been having a rough few days at work.
I've started working on the implementation and opened a pull request so you can follow along and contribute, in case I've also started the implementation due to your demand.
@maxsonferovante saw the pr!! This is so great. I will integrate this into my project and make adjustments if needed. Thank you so much for this effort, this is crucial feature for PyNest
Activity
geovalexis commentedon Sep 15, 2024
That's a great idea @maxsonferovante! 🚀 That's a need many projects run into at some point. I implemented this feature in one my projects and I used a library called
APScheduler, although there are many others out there. Let me know if you use that library, I can provide help.maxsonferovante commentedon Sep 15, 2024
Hello @geovalexis , I had an idea exactly because of a need that arose at work. I have an idea of how to do it in pynest, but I'm worried about the orchestration part of the scheduled tasks and how apscheduler can help us with that. From what I saw and understood the managed API documentation. So it would be loading the beginning of the task event loop along with loading the modules, just like what is done in Nest. This is how I imagine it to be.
ItayTheDar commentedon Sep 16, 2024
@maxsonferovante this is such a great idea! I would help as much as i can. How NestJS implement this feature?
geovalexis commentedon Sep 18, 2024
What do you mean by orchestration part? You mean like managing the state of the job (start, stop, etc...)? APScheduler provides a whole bunch of functions for this purpose in particular. What's best, it provides a decorator function for initialising a new cronjob. It's called
schedule_job()(see https://apscheduler.readthedocs.io/en/3.x/userguide.html#adding-jobs).We could just create a wrapper of that function that seamlessly integrates into PyNest.
maxsonferovante commentedon Sep 18, 2024
Hey @ItayTheDar , from what I understand, NestJs, using the Cron and Interval decorator, registers the Job and its parameters in a list to be initialized when the module is loaded (https://docs.nestjs.com/techniques/task-scheduling )
Then, internally the decorator would register the work, as the apscheduler documentation demonstrates https://apscheduler.readthedocs.io/en/3.x/userguide.html#adding-jobs
When I express my concern about the orchestration, it is, in a way, an excess of concern. The decorator would have to be able to validate the parameters, register and start when the module was loaded, basically. @geovalexis
I'm finishing another project, so I'll start creating my idea with pynest.
Thank you, including your availability. I'll bring you news soon. Hugs
ItayTheDar commentedon Oct 10, 2024
Hi @maxsonferovante !
Do you get a chance to start working on that? Iv'e just faced on use case in my application that requires job scheduling and wander if you have started to implement this feature?
maxsonferovante commentedon Oct 18, 2024
@ItayTheDar
Hey, sorry for disappearing, I've been having a rough few days at work.
I've started working on the implementation and opened a pull request so you can follow along and contribute, in case I've also started the implementation due to your demand.
pullrequest
ItayTheDar commentedon Oct 18, 2024
@maxsonferovante saw the pr!! This is so great. I will integrate this into my project and make adjustments if needed. Thank you so much for this effort, this is crucial feature for PyNest