From 2ad7711884a762a569b2c22c392075fc14585c53 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 24 Mar 2021 21:03:50 -0400 Subject: [PATCH] chore: update tests to handle stricter validation --- .../applications/ekf/by_iteration/spec.json | 3 +++ .../applications/ekf/one_iteration/spec.json | 1 + .../applications/imageclassification/spec.json | 1 + .../applications/imageresize/by_resolution/run.sh | 2 +- .../imageresize/by_resolution/spec.json | 3 +++ .../applications/imageresize/test/spec.json | 1 + .../licenseplate/by_plate_count/debug.sh | 2 +- .../licenseplate/by_plate_count/spec.json | 3 +++ .../experiments/applications/ocr/by_dpi/spec.json | 9 ++++++--- .../experiments/applications/ocr/by_font/spec.json | 13 ++++++++----- .../experiments/applications/ocr/by_word/spec.json | 13 ++++++++----- .../applications/ocr/fivebyeight/spec.json | 4 ++-- .../applications/ocr/handwriting/spec.json | 3 ++- runtime/experiments/applications/ocr/hyde/spec.json | 3 ++- runtime/src/module.c | 5 ++++- 15 files changed, 46 insertions(+), 20 deletions(-) diff --git a/runtime/experiments/applications/ekf/by_iteration/spec.json b/runtime/experiments/applications/ekf/by_iteration/spec.json index 0d45e40..ed1858d 100644 --- a/runtime/experiments/applications/ekf/by_iteration/spec.json +++ b/runtime/experiments/applications/ekf/by_iteration/spec.json @@ -3,6 +3,7 @@ "name": "ekf_first_iter", "path": "ekf_wasm.so", "port": 10000, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], @@ -17,6 +18,7 @@ "name": "ekf_second_iter", "path": "ekf_wasm.so", "port": 10001, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], @@ -31,6 +33,7 @@ "name": "ekf_third_iter", "path": "ekf_wasm.so", "port": 10002, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], diff --git a/runtime/experiments/applications/ekf/one_iteration/spec.json b/runtime/experiments/applications/ekf/one_iteration/spec.json index a98c2d3..7384d50 100644 --- a/runtime/experiments/applications/ekf/one_iteration/spec.json +++ b/runtime/experiments/applications/ekf/one_iteration/spec.json @@ -3,6 +3,7 @@ "name": "resize", "path": "ekf_wasm.so", "port": 10000, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], diff --git a/runtime/experiments/applications/imageclassification/spec.json b/runtime/experiments/applications/imageclassification/spec.json index 32ef760..6d08e30 100644 --- a/runtime/experiments/applications/imageclassification/spec.json +++ b/runtime/experiments/applications/imageclassification/spec.json @@ -3,6 +3,7 @@ "name": "cifar10", "path": "cifar10_wasm.so", "port": 10000, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], diff --git a/runtime/experiments/applications/imageresize/by_resolution/run.sh b/runtime/experiments/applications/imageresize/by_resolution/run.sh index 294fb92..6303c73 100755 --- a/runtime/experiments/applications/imageresize/by_resolution/run.sh +++ b/runtime/experiments/applications/imageresize/by_resolution/run.sh @@ -51,7 +51,7 @@ for ((i = 0; i < total_count; i++)); do done echo "$success_count / $total_count" -rm result_*.png +rm -f result_*.png if [ "$1" != "-d" ]; then sleep 5 diff --git a/runtime/experiments/applications/imageresize/by_resolution/spec.json b/runtime/experiments/applications/imageresize/by_resolution/spec.json index 3da8650..283c0e5 100644 --- a/runtime/experiments/applications/imageresize/by_resolution/spec.json +++ b/runtime/experiments/applications/imageresize/by_resolution/spec.json @@ -3,6 +3,7 @@ "name": "resize_small", "path": "resize_wasm.so", "port": 10000, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], @@ -17,6 +18,7 @@ "name": "resize_medium", "path": "resize_wasm.so", "port": 10001, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], @@ -31,6 +33,7 @@ "name": "resize_large", "path": "resize_wasm.so", "port": 10002, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], diff --git a/runtime/experiments/applications/imageresize/test/spec.json b/runtime/experiments/applications/imageresize/test/spec.json index 7ec404a..de67977 100644 --- a/runtime/experiments/applications/imageresize/test/spec.json +++ b/runtime/experiments/applications/imageresize/test/spec.json @@ -3,6 +3,7 @@ "name": "resize", "path": "resize_wasm.so", "port": 10000, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/debug.sh b/runtime/experiments/applications/licenseplate/by_plate_count/debug.sh index a561392..6ab3666 100755 --- a/runtime/experiments/applications/licenseplate/by_plate_count/debug.sh +++ b/runtime/experiments/applications/licenseplate/by_plate_count/debug.sh @@ -5,7 +5,7 @@ # Also disables pagination and stopping on SIGUSR1 experiment_directory=$(pwd) -project_directory=$(cd ../../.. && pwd) +project_directory=$(cd ../../../.. && pwd) binary_directory=$(cd "$project_directory"/bin && pwd) export LD_LIBRARY_PATH="$binary_directory:$LD_LIBRARY_PATH" diff --git a/runtime/experiments/applications/licenseplate/by_plate_count/spec.json b/runtime/experiments/applications/licenseplate/by_plate_count/spec.json index 4860426..0d106d3 100644 --- a/runtime/experiments/applications/licenseplate/by_plate_count/spec.json +++ b/runtime/experiments/applications/licenseplate/by_plate_count/spec.json @@ -3,6 +3,7 @@ "name": "lpd1", "path": "lpd_wasm.so", "port": 10000, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], @@ -17,6 +18,7 @@ "name": "lpd2", "path": "lpd_wasm.so", "port": 10001, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], @@ -31,6 +33,7 @@ "name": "lpd4", "path": "lpd_wasm.so", "port": 10002, + "expected-execution-us": 5000, "relative-deadline-us": 50000, "argsize": 1, "http-req-headers": [], diff --git a/runtime/experiments/applications/ocr/by_dpi/spec.json b/runtime/experiments/applications/ocr/by_dpi/spec.json index 6811c40..4b08dff 100644 --- a/runtime/experiments/applications/ocr/by_dpi/spec.json +++ b/runtime/experiments/applications/ocr/by_dpi/spec.json @@ -3,7 +3,8 @@ "name": "gocr_72_dpi", "path": "gocr_wasm.so", "port": 10000, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -17,7 +18,8 @@ "name": "gocr_108_dpi", "path": "gocr_wasm.so", "port": 10001, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -31,7 +33,8 @@ "name": "gocr_144_dpi", "path": "gocr_wasm.so", "port": 10002, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", diff --git a/runtime/experiments/applications/ocr/by_font/spec.json b/runtime/experiments/applications/ocr/by_font/spec.json index ebfd967..18cea93 100644 --- a/runtime/experiments/applications/ocr/by_font/spec.json +++ b/runtime/experiments/applications/ocr/by_font/spec.json @@ -1,9 +1,10 @@ -({ +{ "active": true, "name": "gocr_mono", "path": "gocr_wasm.so", "port": 10000, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -17,7 +18,8 @@ "name": "gocr_urw_gothic", "path": "gocr_wasm.so", "port": 10001, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -31,7 +33,8 @@ "name": "gocr_lobster_2", "path": "gocr_wasm.so", "port": 10002, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -39,4 +42,4 @@ "http-resp-headers": [], "http-resp-size": 5335057, "http-resp-content-type": "text/plain" -}) +} diff --git a/runtime/experiments/applications/ocr/by_word/spec.json b/runtime/experiments/applications/ocr/by_word/spec.json index 8cf921b..6bde0e1 100644 --- a/runtime/experiments/applications/ocr/by_word/spec.json +++ b/runtime/experiments/applications/ocr/by_word/spec.json @@ -1,9 +1,10 @@ -({ +{ "active": true, "name": "gocr_1_word", "path": "gocr_wasm.so", "port": 10000, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -17,7 +18,8 @@ "name": "gocr_10_words", "path": "gocr_wasm.so", "port": 10001, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -31,7 +33,8 @@ "name": "gocr_100_words", "path": "gocr_wasm.so", "port": 10002, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", @@ -39,4 +42,4 @@ "http-resp-headers": [], "http-resp-size": 5335057, "http-resp-content-type": "text/plain" -}) +} diff --git a/runtime/experiments/applications/ocr/fivebyeight/spec.json b/runtime/experiments/applications/ocr/fivebyeight/spec.json index bc2005c..335243a 100644 --- a/runtime/experiments/applications/ocr/fivebyeight/spec.json +++ b/runtime/experiments/applications/ocr/fivebyeight/spec.json @@ -3,8 +3,8 @@ "name": "gocr", "path": "gocr_wasm.so", "port": 10000, - "relative-deadline-us": 500000000, - "expected-execution-us": 5000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", diff --git a/runtime/experiments/applications/ocr/handwriting/spec.json b/runtime/experiments/applications/ocr/handwriting/spec.json index f2ab4f6..335243a 100644 --- a/runtime/experiments/applications/ocr/handwriting/spec.json +++ b/runtime/experiments/applications/ocr/handwriting/spec.json @@ -3,7 +3,8 @@ "name": "gocr", "path": "gocr_wasm.so", "port": 10000, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 36000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", diff --git a/runtime/experiments/applications/ocr/hyde/spec.json b/runtime/experiments/applications/ocr/hyde/spec.json index 4c90d23..f413591 100644 --- a/runtime/experiments/applications/ocr/hyde/spec.json +++ b/runtime/experiments/applications/ocr/hyde/spec.json @@ -3,7 +3,8 @@ "name": "gocr", "path": "gocr_wasm.so", "port": 10000, - "relative-deadline-us": 50000000000, + "expected-execution-us": 5000, + "relative-deadline-us": 360000, "argsize": 1, "http-req-headers": [], "http-req-content-type": "text/plain", diff --git a/runtime/src/module.c b/runtime/src/module.c index 893bf73..669f94b 100644 --- a/runtime/src/module.c +++ b/runtime/src/module.c @@ -488,8 +488,11 @@ module_new_from_json(char *file_name) } i += ntoks; - /* Validate presence of required fields */ + /* If the ratio is too big, admissions control is too coarse */ + uint32_t ratio = relative_deadline_us / expected_execution_us; + if (ratio > 1000000) panic("Ratio of Deadline to Execution time cannot exceed 1000000"); + /* Validate presence of required fields */ if (strlen(module_name) == 0) panic("name field is required\n"); if (strlen(module_path) == 0) panic("path field is required\n"); if (port == 0) panic("port field is required\n");