コード例 #1
0
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")
コード例 #2
0
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!")
コード例 #3
0
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!")
コード例 #4
0
ファイル: ClusterAPI.py プロジェクト: LFUnion/PythonCluster
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
コード例 #5
0
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
コード例 #6
0
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
コード例 #7
0
ファイル: ClusterAPI.py プロジェクト: LFUnion/PythonCluster
def getClusterLenght():

    get = ""

    clusterIndexRaw = FileOperations.readFile("clusterIndex.cli")

    clusterIndex = clusterIndexRaw.split()

    clusterLenght = len(clusterIndex)

    return clusterLenght
コード例 #8
0
def getClusterLenght():

    get = ""

    clusterIndexRaw = FileOperations.readFile("clusterIndex.cli")

    clusterIndex = clusterIndexRaw.split()

    clusterLenght = len(clusterIndex)

    return clusterLenght
コード例 #9
0
ファイル: ClusterAPI.py プロジェクト: LFUnion/PythonCluster
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
コード例 #10
0
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
コード例 #11
0
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
コード例 #12
0
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")