Python Apscheduler is not shutting down
<p>We have a requirement to schedule multiple jobs dynamically while current job is executing.</p>

<p>Approximate Scenario is:</p>

<p>There should be a scheduler to go through a table of application daily basis (assume at 6 AM UTC).
Find the users who has today's datetime as resume_dttime
Dynamically schedule a job for that user and start his service at that today's resume_dttime
So the my code is:</p>

<pre><code>from apscheduler.schedulers.blocking import BlockingScheduler
sched = BlockingScheduler()

def scheduled_job():
    """
    """
    liveusers = todays_userslist() #Get users from table with todays resume_dttime
    for u in liveusers:
        user_job = get_userjob(u.id)
        runtime = u.resume_dttime #eg u.resume_dttime is datetime(2015, 12, 13, 16, 30, 5)
        sched.add_job(user_job, 'date', run_date=runtime, args=[u.name])


if __name__ == "__main__":
  scheduled_job()
  sched.start()
  sched.shutdown(wait=True)
</code></pre>

<p>Code works well (for one job). Not checked with multiple jobs, but it doesn't stop at all.  I tried removing for loop. Also,have gone through the many queries on <a href="https://www.google.co.in/?gfe_rd=cr&amp;ei=FGyGVuGhFe7I8AfaxaDoCQ#safe=active&amp;q=apscheduler%20not%20shutting%20down" rel="nofollow">google</a>. But no luck :( 
To Exit, every time, I need to exit through <code>CTrl+C</code></p>