[Tutor] submitting batch jobs with python

Isaac Hall hall@nhn.ou.edu
Mon Dec 23 16:45:30 2002


Hi Bob,
Thank you, and one quick follow up question if I may.
If I did something like this,

commands=[<list of commandlines to send>]
output=[]
for i in range(len(commands)):
	a=os.popen(command[i]).readlines
	output.append(a)

where it takes the system a second or two to respond with the lines it
gives, would each iteration of the loop occur two seconds apart, or would
the loop keep going while a popen().readlines() waited for the system
response?


On Mon, 23 Dec 2002, Bob Gailer wrote:

> At 01:22 PM 12/23/2002 -0600, Isaac Hall wrote:
> >I am working on a program to submit several batch jobs with python.
> >when one submits a batch job from a shell here, the system returns several
> >lines of output telling you many things you need to know (like where the
> >ouput will be written, etc....)  I would like my program to capture this
> >information, but I am a little unclear as to how to do this.  It looks
> >like the call os.popen('command').read() is the way to go, but I do not
> >know what format this will put several lines into.
>
> os.popen('command').read()
>
> will return a string with lines separated by '\n'
>
> os.popen('command').readlines()
>
> will return a list of lines
>
> >how will this handle submitting say 200 jobs at once.  will each popen
> >call only
> >capture the lines intended for that job?
>
> Each popen call will run one batch job and return that job's output.
>
> Bob Gailer
> mailto:ramrom@earthling.net
> 303 442 2625
>