Re: Tracking the status of python script execution

Discussion in 'Python' started by Ned Batchelder, Dec 12, 2013.

  1. 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
    Ned Batchelder, Dec 12, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sophie_newbie
    Replies:
    1
    Views:
    401
    Sion Arrowsmith
    Mar 13, 2008
  2. Replies:
    2
    Views:
    134
    Sean O'Halpin
    Dec 17, 2008
  3. nati

    tracking filter status

    nati, Dec 31, 2003, in forum: Javascript
    Replies:
    2
    Views:
    121
    Thomas 'PointedEars' Lahn
    Jan 11, 2004
  4. Shyam Parimal Katti

    Tracking the status of python script execution

    Shyam Parimal Katti, Dec 11, 2013, in forum: Python
    Replies:
    0
    Views:
    59
    Shyam Parimal Katti
    Dec 11, 2013
  5. Chris Angelico
    Replies:
    0
    Views:
    67
    Chris Angelico
    Dec 11, 2013
Loading...

Share This Page