def GET(request): authentication.login(request) runningState = vazelsmanager.vazelsRunning() if runningState is True: return request.response({"control_centre_status": "running"}) elif runningState is False: return request.response({"control_centre_status": "ready"}) else: return request.response({"control_centre_status": runningState})
def __applyWorkloadsToControlCentre(interval) : while(True): # Keep checking until we don't have to anymore runningState = vazelsmanager.vazelsRunning() #Don't use a dict/switch structure because we want to control flow if runningState is True: #### Apply the workload files themselves #### workloads = config.getSettings("workloads") workloadDefs = workloads["defs"] groups = config.getSettings("groups") # For each group, scan through its workloads & apply each one in turn for group in groups: print("Managing group: " + group) for wkld in groups[group]["workloads"]: print ("Adding workload(" + wkld + ") to group("+group+")") if wkld != "SUE" : __applyWorkload(workload_def=workloadDefs[wkld], target_group=groups[group]) __extractActors(workload_def=workloadDefs[wkld], target_group=groups[group]) elif runningState == "starting": # Go round again, after a quick pause print("Control Centre not yet started") sleep(interval) continue elif runningState == "timeout": # TODO: Do we really want to terminate it in this case? I'd say so. print("Doing ssh stuff...") sleep(interval) continue else: # Workload application has failed; the CCentre isn't running. print("Workload application failed; the control centre isn't running") print runningState break; print("Finished monitoring for startup")