Feature #1137
closed
running appion script in another appion script
Added by Anchi Cheng almost 14 years ago.
Updated almost 7 years ago.
Description
I want this for the auto tomograghy pipeline. Wonder if this is generally useful that I ought to put it in appionScript base class. Also maybe it is there already?
The input is command and the path for its appionsub.runname.log file.
Will use the typical supprocess
- Assignee set to Neil Voss
What do you want me to do?
Just want to know if you have already something like this in place and if you see any problem in doing so. If it is not done yet and you agree with me that it is reasonable to make it general, Assign it back to me.
I have done this before, but I do not think I have done it for anything in production. Since you cannot reliably 'import makestack2' because the appion bin directory is not in the PYTHONPATH, I would have called it using the subprocess.Popen command.
For example in satEuler.py, I run the appionScript program satAverage.py. Which not yet part of the pipeline.
- Status changed from New to In Code Review
r15333 moved my runAppionScriptInSubprocess in tomoautorecon.py to appionscript.py so that other appion scripts can call it. It is still a problem if appionwrapper is used to modify $PATH and $PYTHONPATH because I had to use shell=True for python 2.4. Jim's python 2.6 works with sell=False. We will have to solve this problem some day. Will open a separate issue for this general problem.
Neil, if you don't have time to code review, you can assign to someone else. I just thought you would be the best person since you have done it before.
Hey Anchi, when proc.communicate()
is called does the python wait for the function to finish? I ask because you have the 60 second check loop.
Also, what if you are running a program that takes 3 seconds to run, do you really want to wait 60 seconds. I use a power series in the spyder.py
method.
Otherwise, I think it would be a useful function.
Actually I use a geometric series, power series has too much growth.
- Status changed from In Code Review to Assigned
- Assignee changed from Neil Voss to Anchi Cheng
So far the two scripts I ran indicated that proc.communicate does wait for the process to finish since it went through without obvioius delay for that 60 seconds, I don't remember where I got that 60 sec wait idea from, but I do like your geometric series idea. Will put that in.
- Status changed from Assigned to In Code Review
- Assignee changed from Anchi Cheng to Jim Pulokas
- Target version set to Appion/Leginon 2.2.0
Has been used in tomoautorecon for a while now without problem. Can be closed after review.
- Status changed from In Code Review to Closed
Also available in: Atom
PDF