Access Object From 2 Applications or Fix Scheduler

Robert Rawlins - Think Blue robert.rawlins at thinkbluemedia.co.uk
Mon Jul 16 10:51:39 CEST 2007


Thanks Hendrik & Alex for your suggestions,

I'm glad to see that there are lots of options for me here, and I'll give
them all of a decent exploration to see what my best option is, starting the
second app in a named pipe sounds like a fair solution, but I've not don't
this before, how easy is it to have the second application ready to receive
the new dictionary data?

Just out of interest though I'd still like to know why my first application
schedules didn't work properly, should I be starting them all in their own
thread? Would that work better?

Thanks Guys,

Rob

-----Original Message-----
From: python-list-bounces+robert.rawlins=thinkbluemedia.co.uk at python.org
[mailto:python-list-bounces+robert.rawlins=thinkbluemedia.co.uk at python.org]
On Behalf Of Hendrik van Rooyen
Sent: 16 July 2007 07:29
To: python-list at python.org
Subject: Re: Access Object From 2 Applications or Fix Scheduler

 Robert Rawlins - Think Blue  wrote:


>Hello Guys,
>
>I have two applications which I need to get talking and sharing an 
>object, what
s the best way to do this? Basically my >first application parses an XML
document into a bunch of lists and tuples etc, and I need to access the data
in these lists >and tuples from my second application. Is this possible? And
whats the simplest method?

>
>This problem all evolves from a hack/work around Ive had to place 
>together as
I have been having problems with >sched, these two applications used to be a
single one to start with but for some reason when scheduling tasks using the
>sched module they wouldnt ever run when supposed too, so Id schedule 
>it to
run every 2 minutes and it would run >between 3 and 15 minutes :-s so I
ripped it out into its own application and it now runs every 2 minutes
exactly.
>
>I either need to fix my sched issues or the memory share, either way 
>Im quite
happy, just need to get it working >smoothly.
>
>Any ideas?
>

You have already split the thing, so I would:

schedule the XML parser and make it do its stuff.
then pickle the results using cPickle
then from this first thing, either:
write the pickles to temp files and start the second thing using eg
os.system() or start the second thing and use a named pipe to pass the
pickles over for unpickling and processing, or use one of the popens, or
have a look at Pyro, or start the second thing as a thread and use a Queue..

of course this whole scheme will fall apart if the combined processing takes
longer than the scheduling interval.

HTH - Hendrik






More information about the Python-list mailing list