1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
from apscheduler.schedulers.blocking import BlockingScheduler
def job1(para1, para2,para3):
print("This is job1")
print("The para1 is "+str(para1))
print("The para2 is "+str(para2))
print("The para2 is "+str(para2))
def job2(para1, para2,para3):
print("This is job2")
print("The para1 is "+str(para1))
print("The para2 is "+str(para2))
print("The para2 is "+str(para2))
scheduler.add_job(job1, 'interval', seconds=20,args=['para1','para2','para3'])
scheduler.add_job(job2, 'interval', seconds=20,kwargs={'para1':'3','para2':'2','para3':'1'})
print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))
try:
scheduler.start()
except (KeyboardInterrupt, SystemExit):
scheduler.shutdown(wait=False)
|