如何使用调度程序获取作业状态?
How to get status of job using Scheduler?
我在 Scheduler 图书馆有一个预定的工作 运行,我想从 python 获得它的状态 ("Success", "Failed")
但我找不到关于如何获取状态。
让我们以下面的代码为例来使用调度程序:
import datetime as dt
import time
from scheduler import Scheduler
import scheduler.trigger as trigger
def foo():
print("foo")
schedule = Scheduler()
schedule.minutely(dt.time(second=15), foo)
while True:
schedule.exec_jobs()
time.sleep(1)
我只能打印调度程序,但我需要打印执行状态,可以吗?
>>> print(schedule)
max_exec=inf, tzinfo=None, priority_function=linear_priority_function, #jobs=9
type function due at due in attempts weight
-------- ---------------- ------------------- --------- ------------- ------
MINUTELY foo(..) 2022-03-30 00:37:15 0:00:14 0/inf 1
请指教
我在 Scheduler 图书馆有一个预定的工作 运行,我想从 python 获得它的状态 ("Success", "Failed")
但我找不到关于如何获取状态。
让我们以下面的代码为例来使用调度程序:
import datetime as dt
import time
from scheduler import Scheduler
import scheduler.trigger as trigger
def foo():
print("foo")
schedule = Scheduler()
schedule.minutely(dt.time(second=15), foo)
while True:
schedule.exec_jobs()
time.sleep(1)
我只能打印调度程序,但我需要打印执行状态,可以吗?
>>> print(schedule)
max_exec=inf, tzinfo=None, priority_function=linear_priority_function, #jobs=9
type function due at due in attempts weight
-------- ---------------- ------------------- --------- ------------- ------
MINUTELY foo(..) 2022-03-30 00:37:15 0:00:14 0/inf 1
请指教