"model_file_name": model_file_name,
        "check_status_only": False,
        "model_class_name": model_class_name,
        "model_class_file": model_class_file,
        "endpoint_url": s3_url,
        "access_key_id": s3_username,
        "secret_access_key": s3_password,
        "training_results_bucket": bucket_name,
        "training_id": model_id,
    }

    # Deploy model with Knative route.
    if cleanup:
        if local_cluster_deployment:
            # Using K8s api
            metrics = run_safe(formData, "DELETE")
        else:
            response = requests.delete(kfserving_url, params=formData)
            metrics = response.json()
        print("Successfully cleanup old deployments")
    else:
        if local_cluster_deployment:
            # Using K8s api
            metrics = run_safe(formData, "POST")
        else:
            response = requests.post(kfserving_url, json=formData)
            metrics = response.json()

        # Print out the necessary endpoints and debugging outputs.
        metrics[
            'Prediction_Host'] = deployment_name + "." + namespace + "." + knative_custom_domain
예제 #2
0
    f.close()

    model_id = args.model_id
    deployment_name = args.deployment_name
    model_class_name = args.model_class_name
    model_class_file = args.model_class_file
    serving_image = args.serving_image

    formData = {
        "public_ip": seldon_ip,
        "aws_endpoint_url": s3_url,
        "aws_access_key_id": s3_access_key_id,
        "aws_secret_access_key": s3_secret_access_key,
        "training_results_bucket": bucket_name,
        "model_file_name": "model.pt",
        "deployment_name": deployment_name,
        "training_id": model_id,
        "container_image": serving_image,
        "check_status_only": False,
        "model_class_name": model_class_name,
        "model_class_file": model_class_file
    }

    metrics = run_safe(formData, "POST")
    print(metrics)

    with open('/tmp/deployment_result.txt', "w") as report:
        report.write(json.dumps(metrics))

    print('\nThe Model is running at ' + metrics['deployment_url'])