Loading required libraries for python script from shell just once

R

raviforlkml

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!
 
M

Miki

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,
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top