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: asyncore loop lacks timers and work tasks
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, facundobatista, giampaolo.rodola, intgr, janssen, josiahcarlson
Priority: normal Keywords:

Created on 2008-02-04 05:52 by janssen, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
unnamed janssen, 2008-02-05 18:39
unnamed janssen, 2008-02-07 04:08
unnamed janssen, 2008-02-07 04:08
Messages (12)
msg62034 - (view) Author: Bill Janssen (janssen) * (Python committer) Date: 2008-02-04 05:52
I've been reading asyncore lately, and feel that it's showing its age. 
Most loops of this sort (we developed something similar for ILU, about
15 years ago) contain handlers for timers and work tasks, in addition to
input handling.  For timers, typically there's a list of tasks and
times, often with a repeat period.  A system timer is set to the time of
the next task to fire, and the select() loop is exited when it fires. 
The loop handler then looks down the list of timer tasks, and executes
those ready to run.  Similarly, most loops of this sort include a list
of work tasks, and a policy for executing them, such as "take one task
from the front of the list and run it, then do the select".  This allows
background tasks to get run that don't have associated input or output fds.
msg62035 - (view) Author: Bill Janssen (janssen) * (Python committer) Date: 2008-02-04 05:56
Looks like Giampaolo has already submitted a patch for part of this, in
http://bugs.python.org/issue1641
msg62040 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-02-04 14:57
If you are going to spend some time with async event io you may be
interested in my patch #1657. It adds epoll and kqueue.
msg62052 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2008-02-04 22:00
I'm not sure to understand what do you mean by "work tasks".
Do you need them to have ssl module work with asyncore?

> I've been reading asyncore lately, and feel that it's showing its age. 

Absolutely. I'd have some ideas about some asyncore/chat enhancements,
including writing a poller suitable with epoll and kqueue, but it seems
there are not enough people who cares enough about asyncore.
msg62076 - (view) Author: Bill Janssen (janssen) * (Python committer) Date: 2008-02-05 18:39
*I'm not sure to understand what do you mean by "work tasks".*

They're low-priority tasks that need to get run sometime, but aren't
associated with an input source.  In ILU, we had a function called
"do_soon", and you could call it with a function that should be called
sometime in the near future.

*writing a poller suitable with epoll and kqueue*

Christian's patch looks interesting, in that respect.  I haven't applied it
to a codebase yet.

Bill

On Feb 4, 2008 2:00 PM, Giampaolo Rodola' <report@bugs.python.org> wrote:

>
> Giampaolo Rodola' added the comment:
>
> I'm not sure to understand what do you mean by "work tasks".
> Do you need them to have ssl module work with asyncore?
>
> > I've been reading asyncore lately, and feel that it's showing its age.
>
> Absolutely. I'd have some ideas about some asyncore/chat enhancements,
> including writing a poller suitable with epoll and kqueue, but it seems
> there are not enough people who cares enough about asyncore.
>
> __________________________________
> Tracker <report@bugs.python.org>
> <http://bugs.python.org/issue2006>
> __________________________________
>
msg62125 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2008-02-06 20:49
I still don't get it.  Maybe you're talking about something like "call a
function at the next select() loop" which in Twisted is equal to:
>>> reactor.callLater(0, something)

By using my patched asyncore you can do the same with:
>>> self.call_later(0, something)
msg62132 - (view) Author: Bill Janssen (janssen) * (Python committer) Date: 2008-02-07 04:08
Yes, that's it exactly.  So things without work tasks can still get done.

But timers are the important thing.  With timers you can always implement
work tasks by yourself.

On Feb 6, 2008 12:49 PM, Giampaolo Rodola' <report@bugs.python.org> wrote:

>
> Giampaolo Rodola' added the comment:
>
> I still don't get it.  Maybe you're talking about something like "call a
> function at the next select() loop" which in Twisted is equal to:
> >>> reactor.callLater(0, something)
>
> By using my patched asyncore you can do the same with:
> >>> self.call_later(0, something)
>
> __________________________________
> Tracker <report@bugs.python.org>
> <http://bugs.python.org/issue2006>
> __________________________________
>
msg62133 - (view) Author: Bill Janssen (janssen) * (Python committer) Date: 2008-02-07 04:08
Sorry, I meant to say, "so things without input FDs can make progress".

On Feb 6, 2008 8:08 PM, Bill Janssen <bill.janssen@gmail.com> wrote:

> Yes, that's it exactly.  So things without work tasks can still get done.
>
> But timers are the important thing.  With timers you can always implement
> work tasks by yourself.
>
>
> On Feb 6, 2008 12:49 PM, Giampaolo Rodola' <report@bugs.python.org> wrote:
>
> >
> > Giampaolo Rodola' added the comment:
> >
> > I still don't get it.  Maybe you're talking about something like "call a
> > function at the next select() loop" which in Twisted is equal to:
> > >>> reactor.callLater(0, something)
> >
> > By using my patched asyncore you can do the same with:
> > >>> self.call_later(0, something)
> >
> > __________________________________
> > Tracker <report@bugs.python.org>
> > <http://bugs.python.org/issue2006>
> > __________________________________
> >
>
>
msg62137 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2008-02-07 07:59
> Yes, that's it exactly.  So things without input FDs can make progress".
> But timers are the important thing.  With timers you can always 
> implement work tasks by yourself.

I have the feeling that you're talking about the same thing.

>>> self.call_later(0, something)

Note that "something" is any callable object ('e.g. lambda: print
"hello"'), not necessarily a fd.
msg62164 - (view) Author: Bill Janssen (janssen) * (Python committer) Date: 2008-02-07 18:37
Yes, I think we're talking about the same thing, too.
msg62396 - (view) Author: Giampaolo Rodola' (giampaolo.rodola) * (Python committer) Date: 2008-02-14 16:27
Since this seems to be a duplicate of #1641 I propose to close this issue.
msg62397 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-02-14 16:39
Because of Giampaolo suggestion, that is reviewing all these
asyncore/asynchat issues.
History
Date User Action Args
2022-04-11 14:56:30adminsetgithub: 46290
2009-03-25 05:57:00intgrsetnosy: + intgr
2008-02-14 16:39:22facundobatistasetstatus: open -> closed
nosy: + facundobatista
resolution: duplicate
messages: + msg62397
2008-02-14 16:27:37giampaolo.rodolasetmessages: + msg62396
2008-02-07 18:37:12janssensetmessages: + msg62164
2008-02-07 07:59:44giampaolo.rodolasetmessages: + msg62137
2008-02-07 04:08:35janssensetfiles: + unnamed
messages: + msg62133
2008-02-07 04:08:07janssensetfiles: + unnamed
messages: + msg62132
2008-02-06 20:49:18giampaolo.rodolasetmessages: + msg62125
2008-02-05 18:39:49janssensetfiles: + unnamed
messages: + msg62076
2008-02-04 22:00:32giampaolo.rodolasetmessages: + msg62052
2008-02-04 14:57:34christian.heimessetpriority: normal
nosy: + christian.heimes
messages: + msg62040
2008-02-04 05:56:39janssensetnosy: + josiahcarlson, giampaolo.rodola
messages: + msg62035
2008-02-04 05:52:01janssencreate