from apscheduler.schedulers.blocking import BlockingScheduler
import time
from datetime import datetime
from apscheduler.triggers.cron import CronTrigger
def schedule_task():
"""
create one schedule visitor
:return:
"""
print("dsds")
time.sleep(4)
print("current time is: %s" % datetime.now())
def schedule_task1():
"""
create one schedule visitor
:return:
"""
print("jixn")
time.sleep(4)
print("current jixn time is: %s" % datetime.now())
if __name__ == '__main__':
schedule_job = BlockingScheduler()
# schedule_job.add_job(job_function, 'cron', hour=3, minute=30)
schedule_job.add_job(schedule_task, 'cron',second = '*/5')
schedule_job.add_job(schedule_task1, 'cron',second = '*/3')
schedule_job.start()
print(CronTrigger.from_crontab('37 * * * *'))
本文由博客群发一文多发等运营工具平台 OpenWrite 发布
网友评论