-
Notifications
You must be signed in to change notification settings - Fork 719
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
Feature request: Passing the scheduled start time to jobs #297
Comments
http://apscheduler.readthedocs.io/en/latest/modules/triggers/cron.html#module-apscheduler.triggers.cron |
@DeeVeX Nope. From what I understand from the docs, |
Oh that would be nice. |
Does anyone working on this? |
Yes, this feature is useful to have for time sensitive jobs. I also need this in my current project. Is there any work going on this? I am also open to submit PR for this if I get some light on which direction to move on. Till then a workaround that I can think of is:
But I am not sure if it is full proof. And also, what would happen in the scenarios when using DB store and the scheduler goes down and jobs are missed and then the scheduler comes up. Would the calculation be still correct in that case Either way waiting for this feature... |
Also I guess calling it |
Mine use case by the way is explained below: Suppose a job is scheduled to poll data from a server every 10 minutes. So, I will
Now the catch here is, in an ideal world, I would expect the value of For example if the actual first run time is If there is a way where I could access the actual |
I need this feature too for measuring latency. Seems like it would be very easy to implement. Just add { "scheduled_run_time": run_time } or something like that to **kwargs in line 125 of the BaseExecutor class - "retval = job.func(*job.args, **job.kwargs)". Anyway, not sure the best way to do it, but since the value is right there, including it in the job.func call should be easy enough. |
I think this is a widely required feature in such cron like scheduler, but is's quite strange that neither |
This will be implemented in v4.0 in such a manner that the target function can receive all sorts of information about the job. |
Any update on this? |
@agronholm - has this been implemented and if not do you still plan to implement it and when? |
Preliminary work has been done but I'm mostly focusing on the highlight feature (data store sharing) now. It will take some time before 4.0 is in any usable state. |
I hope add a new event(JOB_ENENT_START) for this |
Are there any news on this? Do you need contributors since the function doesn't seem to be moving forward? |
There scheduled start time will not be passed to the scheduled function directly, but will be available through a context variable. I'm not sure if this will make into 4.0.0a1 but it should make into the first beta. |
@agronholm Thanks for the quick response. Is there an ETA on v4? I've just started using this library. |
I've stopped giving out ETAs as they have passed me by one by one. It's best to just follow #465 for progress updates. The first alpha only requires a couple more pushes, as soon as I can muster the willpower. I have quite a few other projects to maintain too, and those take their own share of my free time. |
Alright, thanks for the update. I'm guessing that the onboarding process might be so difficult at the moment that it's not worth asking for contributions from your side. |
If you really need this feature, you need to fork the project and modify your executor of choice to add this information to context variable (or threadlocal). That way the eventual transition to v4.0 should be relatively painless. I'm unfortunately not accepting contributions on 4.0 code until the code base is stable enough. |
I'll just write a function that parses the DB and inserts missing data for now. Looking forward to the release though. |
Implemented in v4.0.0a1 via the contextvar |
Currently there are no way for the job to know what is the scheduled start time (only the current time by doing
datetime.now()
). This feature would be useful for time sensitive jobs (e.g. extra handling if the job is delayed)The text was updated successfully, but these errors were encountered: