Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #61763

Re: Tracking the status of python script execution

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'configure': 0.05; 'output': 0.05; 'lines,': 0.07; 'modifying': 0.07; 'executed': 0.09; 'executes': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:script': 0.09; 'python': 0.11; "chris'": 0.16; 'i.e': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'ways:': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'library': 0.18; 'all,': 0.19; 'header:User- Agent:1': 0.23; 'script': 0.25; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'idea': 0.28; 'point': 0.28; 'program,': 0.31; 'lines': 0.31; 'usually': 0.31; 'trace': 0.31; 'run': 0.32; 'running': 0.33; 'subject:the': 0.34; 'could': 0.34; 'problem': 0.35; 'tool': 0.35; 'but': 0.35; 'there': 0.35; 'seconds': 0.37; 'two': 0.37; 'being': 0.38; 'button': 0.38; 'ahead': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'track': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'tracking': 0.61; 'simply': 0.61; 'complete': 0.62; 'more': 0.64; 'different': 0.65; 'taking': 0.65; 'account': 0.65; 'specialized': 0.65; 'within': 0.65; 'background:': 0.68; 'informed': 0.78; '(no.': 0.84; 'execution.': 0.84; 'factors': 0.97
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Ned Batchelder <ned@nedbatchelder.com>
Subject Re: Tracking the status of python script execution
Date Thu, 12 Dec 2013 17:00:11 -0500
References <CALVX-oZ6Z-36zc4YSA995D+-+UC1j3Aiw9-7f8EAhcp=XRsfkg@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 18.189.108.96
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.1.1
In-Reply-To <CALVX-oZ6Z-36zc4YSA995D+-+UC1j3Aiw9-7f8EAhcp=XRsfkg@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4031.1386885625.18130.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386885625 news.xs4all.nl 2915 [2001:888:2000:d::a6]:51112
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61763

Show key headers only | View raw


On 12/11/13 2:26 PM, Shyam Parimal Katti wrote:
> Hello All,
>
> I am looking for a library that can help me trace the status of a live
> python script execution. i.e if I have a python script `x.py` with 200
> lines, when I execute the script with `python x.py`, is there a way to
> trace the status of this execution in terms of number of lines executed
> so far?
>
> Background: We have a Web page with "Run" button that executes the
> program `x.py` when a user clicks it. We were looking of a way to keep
> the user informed about the status of run by using: (no. of lines
> executed/total lines) *100. Since the script `x.py` is running multiple
> sql queries, it usually won't be the case that the script would complete
> within few seconds of its execution.

Using sys.settrace, you could write a tool to track the lines being 
executed in any Python program.  But your problem is different than that 
in two ways:

1) You don't need to track any Python program, you need to track your 
particular Python program.

2) You want the output to take into account the "total number of lines", 
which means you have to somehow configure it ahead of time.

Both of these factors point to using a more specialized approach, by way 
of modifying your program.  I like Chris' idea of simply tracking the 
progress of the SQL queries since they are taking the time.


-- 
Ned Batchelder, http://nedbatchelder.com

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Tracking the status of python script execution Ned Batchelder <ned@nedbatchelder.com> - 2013-12-12 17:00 -0500

csiph-web