Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!multikabel.net!newsfeed20.multikabel.net!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'function,': 0.07; 'python': 0.08; 'scripts': 0.09; 'correct.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'underlying': 0.09; 'clues': 0.16; 'confusing.': 0.16; 'enigma': 0.16; 'kern': 0.16; 'mean,': 0.16; 'subject:function': 0.16; 'wrote:': 0.18; 'arguments': 0.18; 'header:In-Reply-To:1': 0.22; 'runs': 0.23; 'messages.': 0.25; 'code': 0.26; 'figure': 0.26; 'function': 0.27; 'tried': 0.27; 'depends': 0.28; 'script': 0.28; 'second': 0.28; 'interpret': 0.29; 'pm,': 0.29; 'completed.': 0.30; 'queue': 0.30; "i've": 0.32; 'does': 0.32; 'this.': 0.33; 'header:User-Agent:1': 0.33; 'appreciated.': 0.34; 'header:X-Complaints-To:1': 0.34; 'causing': 0.34; 'calling': 0.34; 'running': 0.34; 'another.': 0.34; 'to:addr:python-list': 0.35; 'however,': 0.35; 'external': 0.35; 'post': 0.36; 'list,': 0.36; 'received:org': 0.36; 'depend': 0.37; 'run': 0.37; 'but': 0.37; 'another': 0.37; 'third': 0.38; 'url:org': 0.39; 'goes': 0.39; 'to:addr:python.org': 0.40; 'more': 0.61; 'your': 0.61; 'world': 0.61; 'is.': 0.63; 'received:86': 0.63; 'our': 0.63; 'results': 0.64; 'believe': 0.65; 'here:': 0.67; 'completion': 0.82; 'returns.': 0.84; 'eco': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Robert Kern Subject: Re: concatenate function Date: Tue, 13 Mar 2012 15:02:12 +0000 References: <1331649332216-4574176.post@n6.nabble.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host86-161-237-213.range86-161.btcentralplus.com User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 In-Reply-To: <1331649332216-4574176.post@n6.nabble.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 33 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1331650948 news.xs4all.nl 6929 [2001:888:2000:d::a6]:43942 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:21565 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: > http://ompldr.org/vZDB4OQ 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. -- Robert Kern "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