Commit 5a60f8f1 authored by Alain Takoudjou's avatar Alain Takoudjou

Merge branch 'slaprunner-paas' into slaprunner-layout

Conflicts:
	slapos/runner/static/js/scripts/process.js
	slapos/runner/utils.py
parents 47997b66 34b80fc2
...@@ -35,7 +35,10 @@ import sys ...@@ -35,7 +35,10 @@ import sys
import time import time
import traceback import traceback
from erp5.util import taskdistribution from erp5.util import taskdistribution
from erp5.util.testnode import Utils try:
from erp5.util.testnode import Utils
except ImportError:
pass
def importFrom(name): def importFrom(name):
""" """
......
...@@ -48,7 +48,7 @@ class Config: ...@@ -48,7 +48,7 @@ class Config:
""" """
Set options given by parameters. Set options given by parameters.
""" """
self.configuration_file_path = os.path.abspath(os.environ.get('CONFIG_FILE_PATH')) self.configuration_file_path = os.path.abspath(os.environ.get('RUNNER_CONFIG'))
# Load configuration file # Load configuration file
configuration_parser = ConfigParser.SafeConfigParser() configuration_parser = ConfigParser.SafeConfigParser()
......
...@@ -130,7 +130,7 @@ function bindRun() { ...@@ -130,7 +130,7 @@ function bindRun() {
} else { } else {
if (!isRunning()) { if (!isRunning()) {
setCookie("slapgridCMD", "Software"); setCookie("slapgridCMD", "Software");
window.location.href = $SCRIPT_ROOT + "/viewLog"; window.location.href = $SCRIPT_ROOT + "/viewLog?logfile=software.log";
} }
} }
return false; return false;
...@@ -142,7 +142,7 @@ function bindRun() { ...@@ -142,7 +142,7 @@ function bindRun() {
if (!isRunning()) { if (!isRunning()) {
setCookie("slapgridCMD", "Instance"); setCookie("slapgridCMD", "Instance");
if (window.location.pathname === "/viewLog") if (window.location.pathname === "/viewLog")
window.location.href = $SCRIPT_ROOT + "/viewLog"; window.location.href = $SCRIPT_ROOT + "/viewLog?logfile=instance.log";
} }
} }
return false; return false;
...@@ -166,6 +166,8 @@ function updateStatus(elt, val) { ...@@ -166,6 +166,8 @@ function updateStatus(elt, val) {
break; break;
case "running": case "running":
$(src).children('p').text("Processing"); $(src).children('p').text("Processing");
processType = elt;
getRunningState()
break; break;
} }
// in case of failure // in case of failure
...@@ -251,7 +253,7 @@ function runProcess(urlfor, data) { ...@@ -251,7 +253,7 @@ function runProcess(urlfor, data) {
} }
} }
setInterval('GetStateRegularly()', 800); setInterval('GetStateRegularly()', 5000);
function GetStateRegularly() { function GetStateRegularly() {
getRunningState(); getRunningState();
} }
......
...@@ -263,7 +263,7 @@ def removeProxyDb(config): ...@@ -263,7 +263,7 @@ def removeProxyDb(config):
def isSoftwareRunning(config=None): def isSoftwareRunning(config=None):
""" """
Return True if slapos is still running and false if slapgrid if not Return True if slapos is still running and false if slapos if not
""" """
# XXX-Marco what is 'config' for? # XXX-Marco what is 'config' for?
return isRunning('slapos') return isRunning('slapos')
...@@ -282,13 +282,15 @@ def runSoftwareWithLock(config, lock=True): ...@@ -282,13 +282,15 @@ def runSoftwareWithLock(config, lock=True):
os.mkdir(config['software_root']) os.mkdir(config['software_root'])
stopProxy(config) stopProxy(config)
startProxy(config) startProxy(config)
logfile = open(config['software_log'], 'w') # XXX Hackish and unreliable
if os.path.exists(config['software_log']):
os.remove(config['software_log'])
if not updateProxy(config): if not updateProxy(config):
return False return False
slapgrid = Popen([config['slapos'], 'node', 'software', '--all', slapgrid = Popen([config['slapos'], 'node', 'software', '--all',
'--cfg', config['slapos_cfg'], '--pidfile', slapgrid_pid, '--cfg', config['slapos_cfg'], '--pidfile', slapgrid_pid,
'--verbose', '--logfile', config['software_log']], '--verbose', '--logfile', config['software_log']],
stdout=logfile, name='slapos') name='slapgrid-sr')
if lock: if lock:
slapgrid.wait() slapgrid.wait()
#Saves the current compile software for re-use #Saves the current compile software for re-use
...@@ -370,13 +372,15 @@ def runInstanceWithLock(config, lock=True): ...@@ -370,13 +372,15 @@ def runInstanceWithLock(config, lock=True):
slapgrid_pid = os.path.join(config['run_dir'], 'slapgrid-cp.pid') slapgrid_pid = os.path.join(config['run_dir'], 'slapgrid-cp.pid')
startProxy(config) startProxy(config)
logfile = open(config['instance_log'], 'w') # XXX Hackish and unreliable
if os.path.exists(config['instance_log']):
os.remove(config['instance_log'])
if not (updateProxy(config) and requestInstance(config)): if not (updateProxy(config) and requestInstance(config)):
return False return False
slapgrid = Popen([config['slapos'], 'node', 'instance', '--all', slapgrid = Popen([config['slapos'], 'node', 'instance', '--all',
'--cfg', config['slapos_cfg'], '--pidfile', slapgrid_pid, '--cfg', config['slapos_cfg'], '--pidfile', slapgrid_pid,
'--verbose', '--logfile', config['instance_log']], '--verbose', '--logfile', config['instance_log']],
stdout=logfile, name='slapos') name='slapgrid-cp')
if lock: if lock:
slapgrid.wait() slapgrid.wait()
return ( True if slapgrid.returncode == 0 else False ) return ( True if slapgrid.returncode == 0 else False )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment