This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: sched module enhancement request
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: sched.scheduler.run() blocks scheduler
View: 16165
Assigned To: Nosy List: carlosmf.pt, serhiy.storchaka
Priority: normal Keywords:

Created on 2012-12-05 19:36 by carlosmf.pt, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
sched2.py carlosmf.pt, 2012-12-05 19:43
Messages (3)
msg177002 - (view) Author: Carlos Ferreira (carlosmf.pt) Date: 2012-12-05 19:36
The sched module available in the Python core lacks a simple but very useful which is waiting for new events scheduling.

Current version only process events that are present in the queue before the schedule.run() is issued or for events that are schedule while the scheduler is still active and processing events from the queue.

I propose a simple enhancement, by using an Event object from the threading module, so that the thread that is running the scheduler, waits for new events scheduling, after finishing processing all queued events.

The sched2.py is a modified version of the original sched.py (modified by means of a large hammer), which adds an "alwaysRunning" argument in the object constructor, a self.wakeUpEvent attribute which is the Event Object, a modified eterabs method to call the Event.set() and finally, a modified run() to wait for new events.

This modification is just a quick patch in order to pass the idea of what is being requested here. If there is a better way to do this, then it should be taken.
msg177003 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2012-12-05 19:39
See also issue16165.
msg177004 - (view) Author: Carlos Ferreira (carlosmf.pt) Date: 2012-12-05 19:43
Sorry, wrong file issued before...
History
Date User Action Args
2022-04-11 14:57:39adminsetgithub: 60825
2021-10-21 21:59:38iritkatrielsetstatus: open -> closed
superseder: sched.scheduler.run() blocks scheduler
resolution: duplicate
stage: resolved
2012-12-05 19:43:04carlosmf.ptsetfiles: + sched2.py

messages: + msg177004
2012-12-05 19:42:28carlosmf.ptsetfiles: - sched2.py
2012-12-05 19:39:54serhiy.storchakasetnosy: + serhiy.storchaka

messages: + msg177003
versions: + Python 3.4, - Python 3.3
2012-12-05 19:36:59carlosmf.ptcreate