To start a script run through XML-RPC, you will need to write a little XML-RPC server that runs the desired script from the command line.
There is no way for Eggplant to know how much longer a script may run, so it can’t determine the script’s progress as a percentage of completion. The best way to get this type of information is probably to have your script periodically write information about its progress into a status file that could be read by another process (such as a web interface). Here’s a simple example showing how this might work:
put the time into startTime -- so we can record how long it is taking
put "/tmp/myScriptStatus.txt" into statusFile -- name of the status file
put the time - startTime && "0% complete" into file statusFile
-- do the first quarter of the work here
put the time - startTime && "25% complete" into file statusFile
-- do the second quarter of the work here
put the time - startTime && "50% complete" into file statusFile
-- do the third quarter of the work here
put the time - startTime && "75% complete" into file statusFile
-- do the last quarter of the work here
put the time - startTime && "100% complete" into file statusFile
Notice that this example puts the elapsed time (number of seconds) into the status file, followed by approximate percentage of the work that has been done, and updates this information as it runs. If your script is iterating over a large data set, you could indicate the number of records that have been processed or calculate a percentage complete based on that value.
The main ways to integrate Eggplant with another language such as Python are these:
- Have Python start an Eggplant script from the command line, and check its return value
- Have Eggplant start a Python script from the command line (using the “shell” function)
- In either case, if you want the two scripts to communicate with each other while they are running, the simplest way would be to write information into a file that is read by the other script. Sockets could also be used, but would be much more complex.