Combing Medusa's Hair... (Design Pattern)

K

kirby.urner

This is an idea I got thinking about COM objects, and getting
some support from Mark Hammond, Python's Win32 wizard.

The goal is to have a host language (not Python) instantiate
an object that runs against the Python interpreter, which lives
as its own process. The VMs have various ways of implementing
this. Mono isn't that different right?

In this design pattern, you have something like a dry cleaner's,
where people submit jobs at the counter, and go away right
away with a ticket (Python returns -- but keeps running). When
they come back is more up to them. Work has been done in
the meantime (or not, if the queue is backed up).

So Python needs a queue in the front, to accept these job orders,
a facility for issuing tickets, and a way to catalog what tasks
are completed in some urn or receptacle (given this is Python,
we might call it a "holy grail").

The host process has a method from querying the Python object
as to whether such-and-such a job is complete or not. More
primitively, it could just check an output bin (folder) for the
expected file (perhaps each "hair" creates a PDF in roughly
1 to 4 seconds).

The reason "Medusa" is useful wordplay is it reminds us of the
asynchronous server embedded in early Zope. How Medusa
relates to Twisted is lore for others to recount. However, given
we're spawning strands, hairs or threads each time a host process
calls into our object, we're looking at a multi-snaked environment,
so the image could hardly be more apt.

The act of "combing" suggests some synchronization / communication
between threads, but that's not a requirement.

More on tap here:
http://mail.python.org/pipermail/edu-sig/2010-December/010141.html

Kirby
 
K

Kushal Kumaran

This is an idea I got thinking about COM objects, and getting
some support from Mark Hammond, Python's Win32 wizard.

The goal is to have a host language (not Python) instantiate
an object that runs against the Python interpreter, which lives
as its own process.  The VMs have various ways of implementing
this.  Mono isn't that different right?

In this design pattern, you have something like a dry cleaner's,
where people submit jobs at the counter, and go away right
away with a ticket (Python returns -- but keeps running).  When
they come back is more up to them.  Work has been done in
the meantime (or not, if the queue is backed up).

Isn't this the way people use queuing systems (ActiveMQ and the like)?
Or simply multiprocessing + Queue.
 
K

kirby urner

On Tue, Dec 14, 2010 at 8:10 PM, Kushal Kumaran

Isn't this the way people use queuing systems (ActiveMQ and the like)?
 Or simply multiprocessing + Queue.

Yeah, that's probably right. This is more like a pedagogical
metaphor, a mnemonic. As the name for a design pattern,
it should probably be confined to Python examples, as that's
where the wordplay on Medusa makes some sense, and
not just because her hair was all snakes.

http://bytes.com/topic/python/answers/26771-twisted-medusa-zope

Kirby
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top