runner: add startAllProcesses API.

parent a3852b8d
...@@ -460,6 +460,13 @@ def svcStopAll(config): ...@@ -460,6 +460,13 @@ def svcStopAll(config):
except: except:
pass pass
def svcStartAll(config):
"""Start all Instance processes on this computer"""
try:
return Popen([config['slapos'], 'node', 'supervisorctl', '--cfg', config['configuration_file_path'],
'start', 'all']).communicate()[0]
except:
pass
def removeInstanceRoot(config): def removeInstanceRoot(config):
"""Clean instance directory and stop all its running processes""" """Clean instance directory and stop all its running processes"""
......
...@@ -30,7 +30,7 @@ from slapos.runner.utils import (checkSoftwareFolder, configNewSR, ...@@ -30,7 +30,7 @@ from slapos.runner.utils import (checkSoftwareFolder, configNewSR,
saveSession, saveBuildAndRunParams, saveSession, saveBuildAndRunParams,
setMiniShellHistory, setMiniShellHistory,
stopProxy, stopProxy,
svcStartStopProcess, svcStopAll, tail, svcStartStopProcess, svcStartAll, svcStopAll, tail,
updateInstanceParameter) updateInstanceParameter)
from slapos.runner.fileBrowser import FileBrowser from slapos.runner.fileBrowser import FileBrowser
...@@ -252,6 +252,9 @@ def stopAllPartition(): ...@@ -252,6 +252,9 @@ def stopAllPartition():
svcStopAll(app.config) svcStopAll(app.config)
return redirect(url_for('inspectInstance')) return redirect(url_for('inspectInstance'))
def startAllPartition():
svcStartAll(app.config)
return redirect(url_for('inspectInstance'))
def tailProcess(process): def tailProcess(process):
return render_template('processTail.html', return render_template('processTail.html',
...@@ -792,6 +795,8 @@ app.add_url_rule("/getFileLog", 'getFileLog', getFileLog, ...@@ -792,6 +795,8 @@ app.add_url_rule("/getFileLog", 'getFileLog', getFileLog,
methods=['POST']) methods=['POST'])
app.add_url_rule('/stopAllPartition', 'stopAllPartition', app.add_url_rule('/stopAllPartition', 'stopAllPartition',
stopAllPartition, methods=['GET']) stopAllPartition, methods=['GET'])
app.add_url_rule('/startAllPartition', 'startAllPartition',
startAllPartition, methods=['GET'])
app.add_url_rule('/tailProcess/name/<process>', 'tailProcess', app.add_url_rule('/tailProcess/name/<process>', 'tailProcess',
tailProcess, methods=['GET']) tailProcess, methods=['GET'])
app.add_url_rule('/startStopProccess/name/<process>/cmd/<action>', app.add_url_rule('/startStopProccess/name/<process>/cmd/<action>',
......
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