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
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
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