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


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

Re: Tracking the status of python script execution

Started byChris Angelico <rosuav@gmail.com>
First post2013-12-12 06:34 +1100
Last post2013-12-12 06:34 +1100
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 Chris Angelico <rosuav@gmail.com> - 2013-12-12 06:34 +1100

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

FromChris Angelico <rosuav@gmail.com>
Date2013-12-12 06:34 +1100
SubjectRe: Tracking the status of python script execution
Message-ID<mailman.3925.1386790844.18130.python-list@python.org>
On Thu, Dec 12, 2013 at 6:26 AM, Shyam Parimal Katti <spk265@nyu.edu> wrote:
> 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.

That's a bit tricky. More useful would probably be to explicitly
pepper your code with calls to some "still active" function, but it's
going to be nearly impossible to get any sort of viable percent-done
based on lines of code. There might be one primary loop that takes 80%
of the execution time or more.

You mention SQL queries. Can you wrap up the query handler in
something that effectively treats _those_ as your fundamental
divisions of "job-done-ness"? I'm not sure how (in either case,
actually) you'd automatically figure out how many there are to do
(either lines or queries), so you may still have to have something
externally count them up - which would still not work if there's a
loop, though with queries it's less sane to have a loop executing them
than lines of code.

ChrisA

[toc] | [standalone]


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


csiph-web