Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Combing Medusa's Hair... (Design Pattern)

Reply
Thread Tools

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

 
 
kirby.urner@gmail.com
Guest
Posts: n/a
 
      12-14-2010

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...er/010141.html

Kirby
 
Reply With Quote
 
 
 
 
Kushal Kumaran
Guest
Posts: n/a
 
      12-15-2010
On Wed, Dec 15, 2010 at 5:04 AM, http://www.velocityreviews.com/forums/(E-Mail Removed)
<(E-Mail Removed)> wrote:
>
> 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.

--
regards,
kushal
 
Reply With Quote
 
 
 
 
kirby urner
Guest
Posts: n/a
 
      12-15-2010
On Tue, Dec 14, 2010 at 8:10 PM, Kushal Kumaran
<(E-Mail Removed)> wrote:

<< snip >>

>>
>> 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.
>
> --
> regards,
> kushal
>


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/answer...ed-medusa-zope

Kirby
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Ruport combing tables and writing to PDF Mordechai Mr Ruby 0 08-27-2009 03:59 PM
Combing avi file parts? DG150 Computer Support 3 07-06-2009 03:21 AM
Combing html and server controls Will ASP .Net 1 08-02-2008 05:20 PM
Way to combing Hash Definition sans => with %w() ? Dan Diebolt Ruby 7 12-13-2005 04:49 AM
Combing two linked lists deanfamily C++ 7 12-07-2005 07:07 PM



Advertisments