How to stop the job if it took more than the specified IntervalTrigger? #778
Unanswered
BabakAmini
asked this question in
Q&A
Replies: 1 comment 3 replies
-
There is an open PR to add that option back, but that's not the issue. If you have a function running in a thread, how do you propose to stop it from the outside? EDIT: I forgot I already merged it, so it will be in the next alpha. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using apscheduler v4.0.0a2 to retrieve data from an API every second. The request takes approximately 200 ms, and I need an extra 200 ms for processing the data, so this works as expected most of the time. However, in some situations, the total time of request and processing takes more than one second. By incorporating a timeout value, I can regulate the duration of the request but, due to the blocking nature of the processing task, I lack direct influence over its completion time. In such cases, if the CPU, for instance, is occupied, the processing time might exceed the expected duration.
So my question is, how can I cancel that blocking task if the time interval is triggered? In the latest version of apscheduler, it was possible to achieve this functionality by including the
max_running_jobs
keyword argument when using theadd_schedule()
method, as explained here. However, this feature is no longer available in version 4.0.0a2.Beta Was this translation helpful? Give feedback.
All reactions