示例#1
0
def toolchain_reg(turff):
    response = Response()
    turff_args = turff.get_arg_parser()
    for jfile in os.listdir(turff_args.jsonRoot + "/"):
        if jfile.endswith(".json"):
            jdata = turff.load_json(turff_args.jsonRoot +
                    "/" + jfile, turff_args.dockerURL)
            if jdata is not None:
                url = "http://" + turff_args.ip + ":" + \
                str(turff_args.port) + "/codi/register-toolchain"
                response = turff.send_registration(url, jdata)
            else:
                response.status_code = 400

            if response.status_code == 200:
                print("Registration successful : " + jfile)
            else:
                print("Registration failed : " + jfile)
                return False
    return True
示例#2
0
def toolchain_reg(turff):
    response = Response()
    turff_args = turff.get_arg_parser()
    for jfile in os.listdir(turff_args.jsonRoot + "/"):
        if jfile.endswith(".json"):
            jdata = turff.load_json(turff_args.jsonRoot + "/" + jfile,
                                    turff_args.dockerURL)
            if jdata is not None:
                url = "http://" + turff_args.ip + ":" + \
                str(turff_args.port) + "/codi/register-toolchain"
                response = turff.send_registration(url, jdata)
            else:
                response.status_code = 400

            if response.status_code == 200:
                print("Registration successful : " + jfile)
            else:
                print("Registration failed : " + jfile)
                return False
    return True
示例#3
0
import os

def toolchain_reg(turff):
    response = Response()
    turff_args = turff.get_arg_parser()
    for jfile in os.listdir(turff_args.jsonRoot + "/"):
        if jfile.endswith(".json"):
            jdata = turff.load_json(turff_args.jsonRoot +
                    "/" + jfile, turff_args.dockerURL)
            if jdata is not None:
                url = "http://" + turff_args.ip + ":" + \
                str(turff_args.port) + "/codi/register-toolchain"
                response = turff.send_registration(url, jdata)
            else:
                response.status_code = 400

            if response.status_code == 200:
                print("Registration successful : " + jfile)
            else:
                print("Registration failed : " + jfile)
                return False
    return True

if __name__ == '__main__':
    turff = turff.Turff()
    retries = turff.get_arg_parser().retries
    success = False
    while (bool(retries) & (not success)):
        success=toolchain_reg(turff)
        retries -= 1
示例#4
0
def toolchain_reg(turff):
    response = Response()
    turff_args = turff.get_arg_parser()
    for jfile in os.listdir(turff_args.jsonRoot + "/"):
        if jfile.endswith(".json"):
            jdata = turff.load_json(turff_args.jsonRoot + "/" + jfile,
                                    turff_args.dockerURL)
            if jdata is not None:
                url = "http://" + turff_args.ip + ":" + \
                str(turff_args.port) + "/codi/register-toolchain"
                response = turff.send_registration(url, jdata)
            else:
                response.status_code = 400

            if response.status_code == 200:
                print("Registration successful : " + jfile)
            else:
                print("Registration failed : " + jfile)
                return False
    return True


if __name__ == '__main__':
    turff = turff.Turff()
    retries = turff.get_arg_parser().retries
    success = False
    while (bool(retries) & (not success)):
        success = toolchain_reg(turff)
        retries -= 1