473,387 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Best way to spawn process on back end computer

Hi,

I'm running a python cgi script on a frontend web server and I want it
to spawn another script (that takes a long time to run) on a backend
number crunching server thats connected to the same network. What do
you think is the best way to do this? I have a few ideas but I'm sure
there is a "best" way to go about this.

Thanks.
Oct 16 '08 #1
3 2080
2008/10/16 sophie_newbie <pa**********@gmail.com>:
I'm running a python cgi script on a frontend web server and I want it
to spawn another script (that takes a long time to run) on a backend
number crunching server thats connected to the same network. What do
you think is the best way to do this? I have a few ideas but I'm sure
there is a "best" way to go about this.
http://edit.kamaelia.org/ might be qworth a look.

--
Cheers,
Simon B.
si***@brunningonline.net
Oct 16 '08 #2
sophie_newbie wrote:
Hi,

I'm running a python cgi script on a frontend web server and I want it
to spawn another script (that takes a long time to run) on a backend
number crunching server thats connected to the same network. What do
you think is the best way to do this? I have a few ideas but I'm sure
there is a "best" way to go about this.

The main problem here is that you'll probably need to detach the job to allow
the current cgi request to return a response to the client.

The implication of that is that the job either has to be anonymous and requires
no further attention or you need to provide some means of making the job
responsive to requests about its status so that a periodic request can be made
by the web page. That implies that the job can be identified and the creation
reponse returns the identity. One of the major problems is that the normal www
user has few privileges and cannot normally write to disk.

I have done this using both external shell scripts to do the main processing and
detaching and or python scripts that know how to detach. It was not terribly
easy or obvious.

Another alternative, as Simon's Kamaelia might indicate, is that you might
consider running a job server to service the cgi script requests on the remote
host. I have also done this as part of a web application. One of the advantages
was that the jobserver can run as any user and thus gets access to whatever the
owner has; additionally by providing a suitable protocol eg XMLRPC you can test
the jobserver without going through the web.
--
Robin Becker

Oct 16 '08 #3
sophie_newbie wrote:
Hi,

I'm running a python cgi script on a frontend web server and I want it
to spawn another script (that takes a long time to run) on a backend
number crunching server thats connected to the same network. What do
you think is the best way to do this? I have a few ideas but I'm sure
there is a "best" way to go about this.
Best is always subjective - what sort of interaction are you after?

Web request to trigger an activity (fire and forget)

Web request to trigger an activity, which produces output suitable for
something else?

Web request to trigger an activity, which produces output after a while that
you want to send back over a later web request?

Web request to trigger an activity, which produces output after a while that
you want to send back over a later web request, and you want to easily tie
the two things together?

Web request to trigger an activity, which produces output after a while that
you want to send back over a later web request, and you want those two
events to look like part of one operation?

Picking a concrete example...

Or something a bit more like:
* User uploads an image
* Gets converted to a bunch of standard sizes, and placed into a queue
for moderation and then later use?

Or perhaps:
* User uploads a video
* That gets transcoded to a different video format ? (eg video
contribution transcoded to flash video?)

In the latter two cases, this is something I've needed to do, so I created a
simple WSGI filter that dumps the uploaded images/videos into a standard
file location, and then had a script that watches that standard location
for new images & videos, and does those conversions and transcodes.

Strictly speaking to be "clean" about it, you need to dump the file to a
temporary location whilst you're grabbing it from the network and when it's
been written to disk rename it.

I've no idea if this maps to your problem at all. (since I can think of a
few scenarios that match your description).

If it does match, then this code may be handy:
http://code.google.com/p/kamaelia/so...leProcessor.py

If you want to use that code, let me know and I'll package it up. There's an
older version here:
* http://www.kamaelia.org/release/Kama...r-0.1.0.tar.gz

Regards,
Michael.
--
http://www.kamaelia.org/Home

Oct 23 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: C Gillespie | last post by:
Dear All, I have a function def printHello(): fp = open('file','w') fp.write('hello') fp.close() I would like to call that function using spawn or fork. My questions are:
1
by: googlemike | last post by:
I'm trying to use Python and PyGTK + Glade, along with Bash. I want to make a GUI for the Linux vpnclient command-line tool. (Look for linux-vpnclient.tar.gz on the Internet if you are curious.)...
1
by: The Oracle | last post by:
Hi there, I have an ArrayList containing approximately 20,000 database INSERT command objects. Each of these commands needs to be executed. The commands do not need to be executed in any...
3
by: Paul | last post by:
Hi all. Can someone provide some help on the following as there seems to be many different methods of acheiving the same outcome. Basically I am trying to develop a web service which will...
3
by: Teckie03 | last post by:
Hi, does anyone know how to display a seperate browser from server process? My ASP.NET app control (ascx) has Archive button that does its own work , including updating an html page called...
4
by: david | last post by:
It seems that it can not do it due to security. My boss believes that .NET ASP web form application can spawn a local application at the client computer via web browser. Can we do it? How to...
3
by: jeremyfee | last post by:
The spawn* and exec* functions appear to escape asterisks, I'm guessing all shell characters too, before the spawn/exec'ed process sees them. Is there a way around this? Not sure if this is a...
3
by: somuchh8 | last post by:
Hi, I'm having a lot of trouble with the Win32::Spawn module in perl. Here is my situation, I have a Win32::Spawn call which looks like this: my $success = undef; my $cmdline =...
4
by: Brendan Miller | last post by:
I want to spawn a child process based on an external executable that I have the path for. I then want to wait on that executable, and capture it's output. In the os module, fork is only...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.