Exemplo n.º 1
0
def monitor(n, timeout):
	allStarted=True
	
	for i in range(0,n):
		allStarted=True
		getSpotRequests()
		#getRunningInstances()
		for n in GF.requests:
			if n.status=="open":
				allStarted=False
		if allStarted is True:
			break
		time.sleep(timeout)
	if allStarted is False:	
		print "All instances did not start during designated time."
		if GF.confirmQuestion("Would you like to continue?") is True:
			monitor(n, timeout)
		else:
			sys.exit()
	else:
		for i in range(0,n):
			allStarted=True
			getRunningInstances()
			for n in GF.nodes:
				if n.status=="pending":
					allStarted=False
			if allStarted is True:
				break
		if allStarted is False:
			print "All instances did not start during designated time."
			if GF.confirmQuestion("Would you like to continue?") is True:
				monitor(n, timeout)
			else:
				sys.exit()
		else:
			#launch?!
			print "stuff"
Exemplo n.º 2
0
			for node in GF.reqests:
				if node.status == "active":
					runcnt+=1
				if node.status == "open":
					ocnt+=1
				node.desc()
			GF.log("There are a total of "+str(runcnt)+" active and "+str(ocnt)+" waiting to launch",0)
			saveState()
			sys.exit()
		elif o in ("--master"):
			withlaunch=False
			for o2, a2 in opts:
				if o2 in ("--launch"):
					withlaunch=True
			if withlaunch is False:
				if GF.confirmQuestion("This will create a master node of size "+a2+" \nAre you sure you want to continue?") is False:
							sys.exit()
				launchMaster(ami,a,key)
			saveState()
		elif o in ("--launch"):
			for o2, a2 in opts:
				if o2 in ("--master"):
					if GF.confirmQuestion("This will create a master node of size "+a2+" \nAre you sure you want to continue?") is False:
							sys.exit()
					launchMaster(ami,a2,key)
			saveState() #save incase something fails ami-1aad5273
			if  len(a.split(',')) == 2:
				cnt=a.split(',')[0]
				size=a.split(',')[1]
				maxPrice=curSpotCost(size)
			elif  len(a.split(',')) == 3: