Script execution

This commit is contained in:
sfop
2017-03-15 13:29:02 +01:00
parent ffd51982cf
commit 0596c47e37

View File

@@ -1,7 +1,7 @@
###################################################################################################
# Deployment specific global definitions - executed after startup.py
###################################################################################################
from mathutils import estimate_peak_indexes, fit_gaussians, create_fit_point_list, Gaussian
from mathutils import fit_polynomial,fit_gaussian, fit_harmonic, calculate_peaks
from mathutils import PolynomialFunction, Gaussian, HarmonicOscillator
@@ -273,11 +273,25 @@ if get_context().isServerEnabled():
def is_camtool_running():
return int(exec_cmd("pgrep cam_server | wc -l")) > 0
def kill_camtool():
return exec_cmd("killall -9 cam_server")
def run_camtool():
try:
cmd = "source /opt/gfa/python\n"
cmd = cmd + "cam_server -p 10000 -b /afs/psi.ch/intranet/SF/Applications/config/camtool_n > /dev/null &"
print exec_cmd(cmd)
except:
import traceback
print >> sys.stderr, traceback.format_exc()
def check_camtool():
if is_camtool_running():
return None
cmd = "source /opt/gfa/python\n"
cmd = cmd + "cam_server -p 10000 -b /afs/psi.ch/intranet/SF/Applications/config/camtool_n &"
return exec_cmd(cmd)
return False
fork(run_camtool)
start =time.time()
while not is_camtool_running():
if time.time() - start > 2.0:
raise Exception("Error starting camtool process")
time.sleep(0.1)