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


Groups > comp.lang.python > #61763 > unrolled thread

Re: Tracking the status of python script execution

Started byNed Batchelder <ned@nedbatchelder.com>
First post2013-12-12 17:00 -0500
Last post2013-12-12 17:00 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#61763 — Re: Tracking the status of python script execution

FromNed Batchelder <ned@nedbatchelder.com>
Date2013-12-12 17:00 -0500
SubjectRe: Tracking the status of python script execution
Message-ID<mailman.4031.1386885625.18130.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web