Commit 76c05ae8 authored by Julien Muchembled's avatar Julien Muchembled

runner: force instantiation of partitions on manual action

With slapos.core!125,
this is not the case anymore by default.

This commit does not nothing when using older slapproxy.

/reviewed-on !62
parent b5cc2bee
...@@ -902,11 +902,20 @@ def buildAndRun(config): ...@@ -902,11 +902,20 @@ def buildAndRun(config):
runInstanceWithLock(config) runInstanceWithLock(config)
def runSlapgridUntilSuccess(config, step): def runSlapgridUntilSuccess(config, step, bang=False):
"""Run slapos several times, """Run slapos several times,
in the maximum of the constant MAX_RUN_~~~~""" in the maximum of the constant MAX_RUN_~~~~"""
params = getBuildAndRunParams(config) params = getBuildAndRunParams(config)
if step == "instance": if step == "instance":
if bang:
# We'd prefer that 'node instance' is invoked with --all but that's
# not possible with current design. The alternative is to bang,
# assuming that the requested partition is partition 0.
slap = slapos.slap.slap()
slap.initializeConnection(config['master_url'])
partition = slap.registerComputerPartition(
config['computer_id'], 'slappart0')
partition.bang('manual instantiation')
max_tries = (params['max_run_instance'] if params['run_instance'] else 0) max_tries = (params['max_run_instance'] if params['run_instance'] else 0)
runSlapgridWithLock = runInstanceWithLock runSlapgridWithLock = runInstanceWithLock
elif step == "software": elif step == "software":
...@@ -938,7 +947,7 @@ def runSlapgridUntilSuccess(config, step): ...@@ -938,7 +947,7 @@ def runSlapgridUntilSuccess(config, step):
# run instance only if we are deploying the software release, # run instance only if we are deploying the software release,
# if it is defined so, and sr is correctly deployed # if it is defined so, and sr is correctly deployed
if step == "software" and params['run_instance'] and slapgrid == 0: if step == "software" and params['run_instance'] and slapgrid == 0:
return (max_tries, runSlapgridUntilSuccess(config, "instance")) return (max_tries, runSlapgridUntilSuccess(config, "instance", bang))
else: else:
return max_tries return max_tries
......
...@@ -161,7 +161,8 @@ def removeSoftware(): ...@@ -161,7 +161,8 @@ def removeSoftware():
def runSoftwareProfile(): def runSoftwareProfile():
_thread.start_new_thread(runSlapgridUntilSuccess, (app.config, "software")) _thread.start_new_thread(runSlapgridUntilSuccess,
(app.config, "software", True))
return jsonify(result=True) return jsonify(result=True)
...@@ -234,7 +235,8 @@ def removeInstance(): ...@@ -234,7 +235,8 @@ def removeInstance():
def runInstanceProfile(): def runInstanceProfile():
if not os.path.exists(app.config['instance_root']): if not os.path.exists(app.config['instance_root']):
os.mkdir(app.config['instance_root']) os.mkdir(app.config['instance_root'])
_thread.start_new_thread(runSlapgridUntilSuccess, (app.config, "instance")) _thread.start_new_thread(runSlapgridUntilSuccess,
(app.config, "instance", True))
return jsonify(result=True) return jsonify(result=True)
......
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