Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions manager/uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@

set -e

echo -e "Spinning down the cluster ... (this will take a few minutes)\n"
echo -e "spinning down the cluster ... (this will take a few minutes)\n"

eksctl delete cluster --name=$CORTEX_CLUSTER_NAME --region=$CORTEX_REGION

echo -e "\n✓ Spun down the cluster"
echo -e "\n✓ spun down the cluster"
8 changes: 4 additions & 4 deletions pkg/operator/workloads/api_workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ type downloadContainerArg struct {
HideUnzippingLog bool `json:"hide_unzipping_log"` // if true, don't log when unzipping
}

const downloaderLastLog = "pulling the %s Serving image"
const downloaderLastLog = "pulling the %s serving image"

func tfAPISpec(
ctx *context.Context,
Expand Down Expand Up @@ -279,7 +279,7 @@ func tfAPISpec(
}

downloadConfig := downloadContainerConfig{
LastLog: fmt.Sprintf(downloaderLastLog, "TensorFlow"),
LastLog: fmt.Sprintf(downloaderLastLog, "tensorflow"),
DownloadArgs: []downloadContainerArg{
{
From: ctx.APIs[api.Name].TensorFlow.Model,
Expand Down Expand Up @@ -477,7 +477,7 @@ func predictorAPISpec(
}

downloadConfig := downloadContainerConfig{
LastLog: fmt.Sprintf(downloaderLastLog, "Predictor"),
LastLog: fmt.Sprintf(downloaderLastLog, "predictor"),
DownloadArgs: []downloadContainerArg{
{
From: config.AWS.S3Path(ctx.ProjectKey),
Expand Down Expand Up @@ -637,7 +637,7 @@ func onnxAPISpec(
}

downloadConfig := downloadContainerConfig{
LastLog: fmt.Sprintf(downloaderLastLog, "ONNX"),
LastLog: fmt.Sprintf(downloaderLastLog, "onnx"),
DownloadArgs: []downloadContainerArg{
{
From: ctx.APIs[api.Name].ONNX.Model,
Expand Down
2 changes: 1 addition & 1 deletion pkg/workloads/cortex/lib/api_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


API_SUMMARY_MESSAGE = (
"send a POST request to this endpoint with a sample in JSON to make a prediction"
"send a post request to this endpoint with a sample in json to make a prediction"
)


Expand Down
2 changes: 1 addition & 1 deletion pkg/workloads/cortex/lib/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def __init__(self, **kwargs):

if self.api_version != consts.CORTEX_VERSION:
raise ValueError(
"API version mismatch (Context: {}, Image: {})".format(
"api version mismatch (context: {}, image: {})".format(
self.api_version, consts.CORTEX_VERSION
)
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/workloads/cortex/lib/storage/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def _read_bytes_from_s3_single(self, key, allow_missing=False, ext_bucket=None):
except Exception as e:
raise CortexException(
'key "{}" in bucket "{}" could not be accessed; '.format(key, bucket)
+ "it may not exist, or you may not have suffienct permissions"
+ "it may not exist, or you may not have sufficient permissions"
) from e

return byte_array.strip()
Expand Down
16 changes: 8 additions & 8 deletions pkg/workloads/cortex/onnx_serve/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,24 +308,24 @@ def start(args):
except Exception as e:
cx_logger().warn("an error occurred while attempting to load classes", exc_info=True)

cx_logger().info("{} API is live".format(api["name"]))
cx_logger().info("{} api is live".format(api["name"]))
serve(app, listen="*:{}".format(args.port))


def main():
parser = argparse.ArgumentParser()
na = parser.add_argument_group("required named arguments")
na.add_argument("--workload-id", required=True, help="Workload ID")
na.add_argument("--port", type=int, required=True, help="Port (on localhost) to use")
na.add_argument("--workload-id", required=True, help="workload id")
na.add_argument("--port", type=int, required=True, help="port (on localhost) to use")
na.add_argument(
"--context",
required=True,
help="S3 path to context (e.g. s3://bucket/path/to/context.json)",
help="s3 path to context (e.g. s3://bucket/path/to/context.json)",
)
na.add_argument("--api", required=True, help="Resource id of api to serve")
na.add_argument("--model-dir", required=True, help="Directory to download the model to")
na.add_argument("--cache-dir", required=True, help="Local path for the context cache")
na.add_argument("--project-dir", required=True, help="Local path for the project zip file")
na.add_argument("--api", required=True, help="resource id of api to serve")
na.add_argument("--model-dir", required=True, help="directory to download the model to")
na.add_argument("--cache-dir", required=True, help="local path for the context cache")
na.add_argument("--project-dir", required=True, help="local path for the project zip file")

parser.set_defaults(func=start)

Expand Down
27 changes: 11 additions & 16 deletions pkg/workloads/cortex/predictor_serve/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,7 @@ def predict():

@app.route("/predict", methods=["GET"])
def get_summary():
return jsonify(
{
"model_signature": extract_signature(local_cache["input_metadata"]),
"message": api_utils.API_SUMMARY_MESSAGE,
}
)
return jsonify({"message": api_utils.API_SUMMARY_MESSAGE})


@app.errorhandler(Exception)
Expand All @@ -126,7 +121,7 @@ def start(args):
if api.get("predictor") is None:
raise CortexException(api["name"], "predictor key not configured")

cx_logger().info("loading the Predictor from {}".format(api["predictor"]["path"]))
cx_logger().info("loading the predictor from {}".format(api["predictor"]["path"]))
local_cache["predictor"] = ctx.get_predictor_impl(api["name"], args.project_dir)

if util.has_function(local_cache["predictor"], "init"):
Expand All @@ -138,7 +133,7 @@ def start(args):
args.model_dir, os.path.basename(os.path.normpath(prefix))
)

cx_logger().info("calling the Predictor's init() function")
cx_logger().info("calling the predictor's init() function")
local_cache["predictor"].init(model_path, api["predictor"]["metadata"])
except Exception as e:
raise UserRuntimeException(api["predictor"]["path"], "init", str(e)) from e
Expand All @@ -154,24 +149,24 @@ def start(args):
except Exception as e:
cx_logger().warn("an error occurred while attempting to load classes", exc_info=True)

cx_logger().info("{} API is live".format(api["name"]))
cx_logger().info("{} api is live".format(api["name"]))
serve(app, listen="*:{}".format(args.port))


def main():
parser = argparse.ArgumentParser()
na = parser.add_argument_group("required named arguments")
na.add_argument("--workload-id", required=True, help="Workload ID")
na.add_argument("--port", type=int, required=True, help="Port (on localhost) to use")
na.add_argument("--workload-id", required=True, help="workload id")
na.add_argument("--port", type=int, required=True, help="port (on localhost) to use")
na.add_argument(
"--context",
required=True,
help="S3 path to context (e.g. s3://bucket/path/to/context.json)",
help="s3 path to context (e.g. s3://bucket/path/to/context.json)",
)
na.add_argument("--api", required=True, help="Resource id of api to serve")
na.add_argument("--model-dir", required=True, help="Directory to download the model to")
na.add_argument("--cache-dir", required=True, help="Local path for the context cache")
na.add_argument("--project-dir", required=True, help="Local path for the project zip file")
na.add_argument("--api", required=True, help="resource id of api to serve")
na.add_argument("--model-dir", required=True, help="directory to download the model to")
na.add_argument("--cache-dir", required=True, help="local path for the context cache")
na.add_argument("--project-dir", required=True, help="local path for the project zip file")

parser.set_defaults(func=start)

Expand Down
26 changes: 13 additions & 13 deletions pkg/workloads/cortex/tf_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def predict():
try:
sample = request.get_json()
except Exception as e:
return "Malformed JSON", status.HTTP_400_BAD_REQUEST
return "malformed json", status.HTTP_400_BAD_REQUEST

ctx = local_cache["ctx"]
api = local_cache["api"]
Expand Down Expand Up @@ -310,8 +310,8 @@ def get_summary():
return jsonify(response)


tf_expected_dir_structure = """TensorFlow model directories must have the following structure:
1523423423/ (Version prefix, usually a timestamp)
tf_expected_dir_structure = """tensorflow model directories must have the following structure:
1523423423/ (version prefix, usually a timestamp)
├── saved_model.pb
└── variables/
├── variables.index
Expand Down Expand Up @@ -429,7 +429,7 @@ def start(args):
except Exception as e:
if i > 6:
cx_logger().warn(
"unable to read model metadata - model is still loading. Retrying..."
"unable to read model metadata - model is still loading, retrying..."
)
if i == limit - 1:
cx_logger().exception("retry limit exceeded")
Expand All @@ -445,27 +445,27 @@ def start(args):
local_cache["parsed_signature"] = parsed_signature
cx_logger().info("model_signature: {}".format(local_cache["parsed_signature"]))

cx_logger().info("{} API is live".format(api["name"]))
cx_logger().info("{} api is live".format(api["name"]))
serve(app, listen="*:{}".format(args.port))


def main():
parser = argparse.ArgumentParser()
na = parser.add_argument_group("required named arguments")
na.add_argument("--workload-id", required=True, help="Workload ID")
na.add_argument("--port", type=int, required=True, help="Port (on localhost) to use")
na.add_argument("--workload-id", required=True, help="workload id")
na.add_argument("--port", type=int, required=True, help="port (on localhost) to use")
na.add_argument(
"--tf-serve-port", type=int, required=True, help="Port (on localhost) where TF Serving runs"
"--tf-serve-port", type=int, required=True, help="port (on localhost) where tf serving runs"
)
na.add_argument(
"--context",
required=True,
help="S3 path to context (e.g. s3://bucket/path/to/context.json)",
help="s3 path to context (e.g. s3://bucket/path/to/context.json)",
)
na.add_argument("--api", required=True, help="Resource id of api to serve")
na.add_argument("--model-dir", required=True, help="Directory to download the model to")
na.add_argument("--cache-dir", required=True, help="Local path for the context cache")
na.add_argument("--project-dir", required=True, help="Local path for the project zip file")
na.add_argument("--api", required=True, help="resource id of api to serve")
na.add_argument("--model-dir", required=True, help="directory to download the model to")
na.add_argument("--cache-dir", required=True, help="local path for the context cache")
na.add_argument("--project-dir", required=True, help="local path for the project zip file")
parser.set_defaults(func=start)

args = parser.parse_args()
Expand Down