Problem on combining triggers
See original GitHub issueHi, I’m trying to use combine triggers. For example, I want to run a function on the first minute for every 2 seconds:
from time import sleep
from apscheduler.triggers.combining import AndTrigger
from apscheduler.triggers.interval import IntervalTrigger
from apscheduler.triggers.cron import CronTrigger
from apscheduler.schedulers.background import BackgroundScheduler
def job_function():
print("hello from function")
if __name__ == "__main__":
scheduler = BackgroundScheduler()
trigger = AndTrigger([IntervalTrigger(seconds=2),
CronTrigger(minute=1)])
scheduler.add_job(job_function, trigger)
print("before start", scheduler.get_jobs())
scheduler.start()
print("after start", scheduler.get_jobs())
print("ok")
while True:
sleep(.1)
But the program never prints after start
. It is very strange to me. The OrTrigger
works fine for this example. If it is a bug is there any workaround?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
mixing triggers - MOD WIGGLER
I've combined triggers with mixers, no problems mostly. I have found an offset/attenuator to be useful with triggers, a little offset ...
Read more >How to Consolidate Triggers and Why It's a Good Idea
One of the biggest reasons to consolidate triggers is to control the order of execution. If you have multiple triggers on the same...
Read more >Problem-solving: triggers and behaviors - LinkedIn
A defined process provides a path for team members to follow, lets them know expected behavior, and helps teams navigate issues from root-cause ......
Read more >Can I combine two triggers in an automation
Looking to make an automation triggered if the issue is new OR if the issue is moved. Need to know how to combine...
Read more >Combined problem triggers in simultaneous interpreting
The complexity of simultaneous interpreting may be influenced by so-called problem triggers, i.e. factors that increase the interpreter's ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Why not just:
day=10, hour=10, second='*/10'
?The proper solution would have been to use
CronTrigger(minute=1, second="*/2")
. v4.0.0a1 also includes athreshold
parameter forAndTrigger
which can be used to solve the issue of the trigger run times not matching exactly.