agronholm / apscheduler

Task scheduling library for Python
MIT License
5.98k stars 694 forks source link

能否捕获`EVENT_JOB_EXECUTED`事件的函数执行结果,以便做更多的处理? #831

Closed freedomgod closed 6 months ago

freedomgod commented 6 months ago

Things to check first

Feature description

在使用事件监听时,我想对EVENT_JOB_EXECUTED事件的函数执行结果做一个捕获,以便能够针对定时任务执行的结果做针对性的处理,这能够做到吗?

Use case

能够动态的添加定时任务,针对函数的执行结果决定是否采取更多的措施。

agronholm commented 6 months ago

Please use English when reporting issues.

freedomgod commented 6 months ago

Please use English when reporting issues.报告问题时请使用英语。

When using event listening, I want to capture the result of the function execution of the EVENT_JOB_EXECUTED event so that I can deal with the results of the execution of scheduled tasks. Can this be done?

agronholm commented 6 months ago

Just use the retval attribute from the event? https://apscheduler.readthedocs.io/en/3.x/modules/events.html#apscheduler.events.JobExecutionEvent