I'm very inexperienced when it comes to threads in python, and I have a little experience with apscheduler. I thought I understood that each job scheduled through the apscheduler was a separate thread and therefore should not block the progression of the script from which it is scheduled. However, maybe my understanding is not correct because the following program is stopped until the "Hello World" button is pushed (the called gtk application is closed).
Here is the main script:
#! /usr/bin/python
import time
import datetime
from apscheduler.scheduler import Scheduler
import hello
sched = Scheduler()
sched.start()
def notify_popup(text):
hello.HelloWorld().main()
print 'still going...'
loop_time = 10
while True:
now = datetime.datetime.now()
start_time = now + datetime.timedelta(minutes=1)
job = sched.add_date_job(notify_popup, start_time, ['text'], misfire_grace_time=loop_time+1)
print sched.print_jobs()
time.sleep(loop_time)
The hello module is the HelloWorld script from
here (saved as hello.py in the same dir)
I've looked through the apscheduler documentation, but I don't see any discussion of blocking vs non-blocking behavior. They do say that each job is sent to the "thread pool", which leads me to my previously described understanding that each job is a separate thread.
How can I modify this script such that calling the HelloWorld class is not blocking? Thanks.