def clusterdeleteUI(): really = str( input( "This will remove your whole Cluster configuration. Are you sure you will delete it? [y/n] > " )) if (really == "y"): FileOperations.clearFile("clusterIndex.cli") print("Configuration removed") else: print("Aborted")
def clusterinitUI(): ClusterCount = int(input("Please enter the amount of cluster servers in your network > ")) counter = 1 while counter <= ClusterCount: ip = input("Please enter the IP of server #" + str(counter) + " > ") ip = ip + " " cluster = FileOperations.readFile("clusterIndex.cli") FileOperations.writeFile("clusterIndex.cli", (cluster + ip)) counter += 1 print("Done!")
def clusterinitUI(): ClusterCount = int( input("Please enter the amount of cluster servers in your network > ")) counter = 1 while counter <= ClusterCount: ip = input("Please enter the IP of server #" + str(counter) + " > ") ip = ip + " " cluster = FileOperations.readFile("clusterIndex.cli") FileOperations.writeFile("clusterIndex.cli", (cluster + ip)) counter += 1 print("Done!")
def clustercheck(): success = True clusterIndexRaw = FileOperations.readFile("clusterIndex.cli") clusterIndex = clusterIndexRaw.split() ClusterCount = len(clusterIndex) counter = 0 while counter < ClusterCount: try: get = client.connect(clusterIndex[counter], 10008, "1+1") if(int(get) == 2): counter += 1 else: counter += 1 success = False except Exception: counter += 1 success = False return success
def clustercheck(): success = True clusterIndexRaw = FileOperations.readFile("clusterIndex.cli") clusterIndex = clusterIndexRaw.split() ClusterCount = len(clusterIndex) counter = 0 while counter < ClusterCount: try: get = client.connect(clusterIndex[counter], 10008, "1+1") if (int(get) == 2): counter += 1 else: counter += 1 success = False except Exception: counter += 1 success = False return success
def clustercheckUI(): success = True clusterIndexRaw = FileOperations.readFile("clusterIndex.cli") clusterIndex = clusterIndexRaw.split() ClusterCount = len(clusterIndex) counter = 0 while counter < ClusterCount: try: get = client.connect(clusterIndex[counter], 10008, "1+1") if(int(float(get)) == 2): print("Server " + clusterIndex[counter] + " OK") counter += 1 else: print("Server " + clusterIndex[counter] + " FAIL") counter += 1 success = False except Exception: print("Server " + clusterIndex[counter] + " FAIL (EXCEPTION IN CODE)") counter += 1 success = False print("Done!") return success
def getClusterLenght(): get = "" clusterIndexRaw = FileOperations.readFile("clusterIndex.cli") clusterIndex = clusterIndexRaw.split() clusterLenght = len(clusterIndex) return clusterLenght
def execute(clusterComputer, command, highValue): clusterIndexRaw = FileOperations.readFile("clusterIndex.cli") clusterIndex = clusterIndexRaw.split() clusterLenght = len(clusterIndex) get = "" if(clusterComputer > clusterLenght): get = "ERROR!" elif highValue == 1: get = highValueClient.connect(clusterIndex[(clusterComputer - 1)], 10008, command) else: get = client.connect(clusterIndex[(clusterComputer - 1)], 10008, command) return get
def execute(clusterComputer, command, highValue): clusterIndexRaw = FileOperations.readFile("clusterIndex.cli") clusterIndex = clusterIndexRaw.split() clusterLenght = len(clusterIndex) get = "" if (clusterComputer > clusterLenght): get = "ERROR!" elif highValue == 1: get = highValueClient.connect(clusterIndex[(clusterComputer - 1)], 10008, command) else: get = client.connect(clusterIndex[(clusterComputer - 1)], 10008, command) return get
def clustercheckUI(): success = True clusterIndexRaw = FileOperations.readFile("clusterIndex.cli") clusterIndex = clusterIndexRaw.split() ClusterCount = len(clusterIndex) counter = 0 while counter < ClusterCount: try: get = client.connect(clusterIndex[counter], 10008, "1+1") if (int(float(get)) == 2): print("Server " + clusterIndex[counter] + " OK") counter += 1 else: print("Server " + clusterIndex[counter] + " FAIL") counter += 1 success = False except Exception: print("Server " + clusterIndex[counter] + " FAIL (EXCEPTION IN CODE)") counter += 1 success = False print("Done!") return success
def clusterdeleteUI(): really = str(input("This will remove your whole Cluster configuration. Are you sure you will delete it? [y/n] > ")) if(really == "y"): FileOperations.clearFile("clusterIndex.cli") print("Configuration removed") else: print("Aborted")