Loading required libraries for python script from shell just once

Discussion in 'Python' started by raviforlkml@gmail.com, Dec 2, 2008.

  1. Guest

    I have a linux-like host running busybox with the python installation
    mounted over NFS and have the corresponding symlinks setup in /usr/bin
    and /usr/lib for python to run smoothly.

    A shell script runs my python script several times, each time with
    different paramters. E.g.

    # cat foo.sh

    # Lot of setup stuff

    ${TEST_DIR}/bin/run-test.py --arg1 foo1 --arg2 bar1 --arg3 baz1
    ${TEST_DIR}/bin/run-test.py --arg1 foo2 --arg2 bar2 --arg3 baz2
    ${TEST_DIR}/bin/run-test.py --arg1 foo3 --arg2 bar3 --arg3 baz3


    There is a delay of about 10-15 seconds before run-test.py starts
    executing. Can someone suggest a method to speed up this process? Most
    of the delay seems to be due to python loading up the required
    modules. Is it possible to load all the modules used by run-test.py in
    a pre-execution environment in order to prevent this delay?

    I considered a rewrite of the shell script into python, but it has too
    many dependencies on shell libraries and I don't want to go that route
    (unless an alternative solution is impossible).

    Thanks!
     
    , Dec 2, 2008
    #1
    1. Advertising

  2. Miki Guest

    > Is it possible to load all the modules used by run-test.py in
    > a pre-execution environment in order to prevent this delay?

    Only if you have one script the calls "main" (or any other entry
    point) in the tests.

    > I considered a rewrite of the shell script into python, but it has too
    > many dependencies on shell libraries and I don't want to go that route
    > (unless an alternative solution is impossible).

    One other option is to have the python libraries on local disk, but
    IMO the first solution is better.

    HTH,
    --
    Miki <>
    http://pythonwise.blogspot.com
     
    Miki, Dec 2, 2008
    #2
    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. Karsten Wutzke
    Replies:
    21
    Views:
    936
    Roedy Green
    Jun 29, 2007
  2. Christian Heimes
    Replies:
    0
    Views:
    613
    Christian Heimes
    Feb 27, 2008
  3. Gerardo Herzig
    Replies:
    1
    Views:
    1,108
    Philipp Pagel
    Feb 27, 2008
  4. D'Arcy J.M. Cain
    Replies:
    0
    Views:
    880
    D'Arcy J.M. Cain
    Feb 27, 2008
  5. moongeegee

    execute a shell script in a shell script

    moongeegee, Dec 3, 2007, in forum: Perl Misc
    Replies:
    2
    Views:
    261
    Ben Morrow
    Dec 4, 2007
Loading...

Share This Page