robert.kern at gmail.com
Tue Mar 13 16:02:12 CET 2012
On 3/13/12 2:35 PM, ferreirafm wrote:
> Hi List,
> I've coded three functions that I would like to concatenate. I mean, run
> them one after another. The third function depends on the results of the
> second function, which depends on the results of the first one. When I call
> one function after another, python runs them at the same time causing
> obvious errors messages. I've tried to call one of them from inside another
> but no way. Any clues are appreciated.
> Complete code goes here:
Just to clarify, the Python functions are indeed running consecutively, not
concurrently. Your Python functions write scripts and then use subprocess.call()
to make qsub (an external program) to submit those scripts to a job queue. What
you are calling a "function" in your post are these scripts. Please don't call
them "functions". It's confusing.
Python is not running these scripts concurrently. Your job queue is.
subprocess.call() will wait until qsub returns. However, qsub just submits the
script to the job queue; it does not wait until the job is completed. Most
qsub-using job queues can be set up to make jobs depend on the completion of
other jobs. You will need to read the documentation of your job queue to figure
out how to do this. Once you figure out the right arguments to give to qsub,
your Python code is already more or less correct.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list