[ale] Bash/Python Question

Geoffrey lists at serioustechnology.com
Tue Mar 16 06:42:44 EDT 2010


Omar Chanouha wrote:
> Hey all,
> 
>    I am creating an information gatherer for a school project. I have
> a python file called gatherer that executes a bunch of python
> downloader files. I also have a python file that parses the downloaded
> information and places it into a database. Every day I want to execute
> the following:
> 
> #!/bin/bash
> gatherer.py
> parser.py
> 
> Unfortunately, the gatherer only initializes a bunch of downloader
> scripts. Therefore it exits just after the downloaders are
> initialized, not after they are finished. This means that the parser
> begins executing when the files are being downloaded, which of course
> leads to the parser seeing a bunch of empty files.
> 
> Does anyone have a better solution than executing the parser at a
> constant time after the downloader?
> 
> The gatherer looks something like:
> 
> for file in list:
>  download.py file
> 
> I need the gatherer to work this way because I want the files to
> download in parallel in order to speed up the process.

So the 'download.py' should show up in the output of 'ps', thus, throw 
together a piece of code that loops while watching for 'download.py' 
processes in the output of 'ps.'  Once all the download.py scripts are 
done, then exit the loop.

> 
> Thanks,
> 
> Omar
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
> See JOBS, ANNOUNCE and SCHOOLS lists at
> http://mail.ale.org/mailman/listinfo
> 


-- 
Until later, Geoffrey

"I predict future happiness for America if they can prevent
the government from wasting the labors of the people under
the pretense of taking care of them."
- Thomas Jefferson


More information about the Ale mailing list