|
@@ -21,11 +21,10 @@ class ApschedulerObject:
|
|
|
print('hello world: {} {}'.format(x, now_time))
|
|
|
|
|
|
def create_cron_job(self, func, task_id, day_of_week, hour, minute, args, second=0): # 周期任务
|
|
|
- job = self.scheduler.add_job(func=func, trigger='cron', day_of_week=day_of_week, hour=hour, minute=minute,
|
|
|
- second=second,
|
|
|
- replace_existing=True, id=task_id, max_instances=1, coalesce=False, args=args,
|
|
|
- misfire_grace_time=300)
|
|
|
- print(job)
|
|
|
+ # day_of_week: 0,1,2,3,4,5,6对应周一到周日,也可写mon,tue,wed,thu,fri,sat,sun
|
|
|
+ self.scheduler.add_job(func=func, trigger='cron', day_of_week=day_of_week, hour=hour, minute=minute,
|
|
|
+ second=second, replace_existing=True, id=task_id, max_instances=1, coalesce=False,
|
|
|
+ args=args, misfire_grace_time=300)
|
|
|
|
|
|
def create_interval_job(self, func, task_id, minutes, start_time, end_time, args): # 间隔任务
|
|
|
self.scheduler.add_job(func=func, trigger='interval', minutes=minutes,
|