[torqueusers] Qsub interactively (-I), Expect and standard output problem

James J Coyle jjc at iastate.edu
Thu Jun 26 09:05:33 MDT 2008


  You need  a sequence of send and expect commands, and are missing the
expect right after the spawn.  The expect command is just to wait for 
my tcsh prompt which is just 
'> '

  You can get the same prompt by having set prompt='> '
in your ~/.cshrc file.

  The following script works for me:

# Submit interactive job
spawn -noecho /usr/local/torque/bin/qsub -I
# Give job some commands
expect -re "\> \n"
send "date; echo 'Hello' \r"
expect -re ".*llo\n"

and gives:

 time ./aae
qsub: waiting for job 121288.hpc4 to start
qsub: job 121288.hpc4 ready

> date; echo 'Hello' 
Thu Jun 26 09:56:30 CDT 2008
> 0.000u 0.001s 0:19.33 0.0%    0+0k 0+0io 0pf+0w

There seems to be about a 20 second overhead on my system when
using expect and qsub -I , 10 sec. on the way in and 10 sec. 
on the way out.

 James Coyle, PhD
 SGI Origin, Alpha, Xeon and Opteron Cluster Manager
 High Performance Computing Group     
 Iowa State Univ.          
 Ames, Iowa 50011           web: http://jjc.public.iastate.edu

> Hi,
> I would like to be able to use "qsub -I" in a script. In this script, I want 
> to have the standard output of the job.
> I started with an Expect script:
> #!/usr/bin/expect -f
> # Submit interactive job
> spawn -noecho /usr/local/torque/bin/qsub -I
> # Give job some commands
> send "date\r"
> send "echo \"Hello\"\r"
> expect -re ".*llo"
> send_user "B$expect_out(buffer)E\n"
> send "exit\r"
> # Wait for qsub exit
> wait
> # Quit
> exit
> But the output is:
> date
> echo "Hello"
> Bdate
> echo "HelloE
> I get my commands back but not their results. Do you have any idea to explain 
> this behaviour ? Any solution(s) ?
> Thanks
> Charles
> _______________________________________________
> torqueusers mailing list
> torqueusers at supercluster.org
> http://www.supercluster.org/mailman/listinfo/torqueusers

More information about the torqueusers mailing list