[torqueusers] Runnig a script after job completion

Chaitanya Krishna icymist at gmail.com
Fri Oct 12 13:31:35 MDT 2007


Hello,

Yep I did think along these lines. I have been using bash for
scripting and I didn't find it very reliable using sleep. I used to
monitor my jobs for completion using something like this

while job_is_not_finished
sleep 300
if finished mail user at email.com
(This before I discovered the -m abe -M user at email.com)

When I use the above method, what's happening is that the script
sometimes doesn't send me mail and sometimes it sends it twice. Now if
I use such an unreliable method, my next job might get submitted twice
and nasty things might happen. I want to avoid this scenario.

I don't mind if you can help with any scripts that can do it. Need not
be bash, python if fine too.

I have sent the scripts I have been using in reply to Geln's mail. You
might get some clues from there.

One more thing I tired is to just submit a job and then use the joid
as follows to check for completion using qsub as follows
$ qsub -depend=afterok:full.job.id /script/to/check/convergence

And script/to/check/convergence will have the check and another
./submit_job (Pease, check my reply to Glen's mail) if the calculation
has not converged.

This didn't work too for me. Don't know why...

Kind regards,
Chaitanya.

On 10/12/07, Martins, Flavio <flavio.martins at fttinc.com> wrote:
> I have done similar things in the past by the following method:
>
> I issue the qsub command in a script. The script then waits for job
> completion through a loop that checks qstat for the "C" state (or while
> your jobid is still present in the queue). When the job is done, the
> main script continues with whatever tests and set-up you need. You could
> set all this inside a loop that repeats until your job is converged.
> Here is the concept:
>
> # start a loop until convergence
> Converged=no
> While(converged = no)
>
>    # launch the case and get the job id
>    Jobid = qsub my_job
>
>    # wait for job to complete
>    While(qstat = jobid)
>       Sleep 60
>    End
>
>    # check for convergence
>    Converged = Check_for_convergence()
>
>    # set up next case if not converged
>    If(converged = no)
>       Set_up_next_run()
>    End
>
> End
>
> I hope this helps. Let me know if you need more details in the scripting
> part. I kept is generic since I don't know what language you are
> scripting in.
>
> Flavio Martins
> Senior Engineer
> Aerodynamics / CFD
> Florida Turbine Technologies Inc.
> 100 Marquette Road
> Suite 110
> Jupiter, FL 33458-7101
> Phone: (561) 427-6261
> Fax: (561) 427-6191
> -----Original Message-----
> From: torqueusers-bounces at supercluster.org
> [mailto:torqueusers-bounces at supercluster.org] On Behalf Of Chaitanya
> Krishna
> Sent: Thursday, October 11, 2007 3:45 PM
> To: torqueusers at supercluster.org
> Subject: [torqueusers] Runnig a script after job completion
>
> Hello all,
>
> I have been searching for a simple solution to my problem but havent
> been ablt to find any till now.
>
> I tried the archives too. May be my search terms weren't good enough!!
>
> I want to run a shell script after a job that I submit using qsub is
> over. Is this possible? If so how?
>
> To elaborate on the question. I submit a job using qsub, then I need
> to check the output to see if the calculation has converged. If it
> hasn't converged I need to copy the outputfiles that I have at present
> and then continue the job using another qsub command. Is this
> possible?
>
> In a nut shell whenever the job submitted using qsub is finished in
> should trigger a shell script.
>
> Thanks in advance,
> Chaitanya.
> TU Delft
> _______________________________________________
> torqueusers mailing list
> torqueusers at supercluster.org
> http://www.supercluster.org/mailman/listinfo/torqueusers
>


More information about the torqueusers mailing list