-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add versioning support for MedPerf APIs (#354)
* Add versioning support for MedPerf APIs * Fix flake8 issues * Fix CI tests * Support versioning from the CLI * Ignore lint error for __init__ * Adapt tests to changes * Fix linter error * Moving API version to common settings * Fix flake8 * Move full url logic to utils function * Pass base url to full_url * Move full url logic to comms * Use API version from settings * Remove deprecated import * Remove deprecated import * make parse_url a class method * Use correct decorator order * use version 0.1.0 * fix version in integration tests --------- Co-authored-by: Alejandro Aristizábal <[email protected]> Co-authored-by: hasan7n <[email protected]>
- Loading branch information
1 parent
96377ee
commit 19b692f
Showing
32 changed files
with
260 additions
and
156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ CERT_FILE="${AUTH_CERT:-$(realpath server/cert.crt)}" | |
MEDPERF_STORAGE=~/.medperf | ||
MEDPERF_SUBSTORAGE="$MEDPERF_STORAGE/$(echo $SERVER_URL | cut -d '/' -f 3 | sed -e 's/[.:]/_/g')" | ||
MEDPERF_LOG_STORAGE="$MEDPERF_SUBSTORAGE/logs/medperf.log" | ||
VERSION_PREFIX="/api/v0" | ||
|
||
echo "Server URL: $SERVER_URL" | ||
echo "Storage location: $MEDPERF_SUBSTORAGE" | ||
|
@@ -83,15 +84,15 @@ METRIC_PARAMS="$ASSETS_URL/metrics/mlcube/workspace/parameters.yaml" | |
METRICS_SING_IMAGE="$ASSETS_URL/metrics/mlcube/workspace/.image/image.tar.gz" | ||
|
||
# admin token | ||
ADMIN_TOKEN=$(curl -sk -X POST https://127.0.0.1:8000/auth-token/ -d '{"username": "admin", "password": "admin"}' -H 'Content-Type: application/json' | jq -r '.token') | ||
ADMIN_TOKEN=$(curl -sk -X POST $SERVER_URL$VERSION_PREFIX/auth-token/ -d '{"username": "admin", "password": "admin"}' -H 'Content-Type: application/json' | jq -r '.token') | ||
|
||
# create users | ||
MODELOWNER="mockmodelowner" | ||
DATAOWNER="mockdataowner" | ||
BENCHMARKOWNER="mockbenchmarkowner" | ||
curl -sk -X POST https://127.0.0.1:8000/users/ -d '{"first_name": "model", "last_name": "owner", "username": "'"$MODELOWNER"'", "password": "test", "email": "[email protected]"}' -H 'Content-Type: application/json' -H "Authorization: Token $ADMIN_TOKEN" | ||
curl -sk -X POST https://127.0.0.1:8000/users/ -d '{"first_name": "bmk", "last_name": "owner", "username": "'"$BENCHMARKOWNER"'", "password": "test", "email": "[email protected]"}' -H 'Content-Type: application/json' -H "Authorization: Token $ADMIN_TOKEN" | ||
curl -sk -X POST https://127.0.0.1:8000/users/ -d '{"first_name": "data", "last_name": "owner", "username": "'"$DATAOWNER"'", "password": "test", "email": "[email protected]"}' -H 'Content-Type: application/json' -H "Authorization: Token $ADMIN_TOKEN" | ||
curl -sk -X POST $SERVER_URL$VERSION_PREFIX/users/ -d '{"first_name": "model", "last_name": "owner", "username": "'"$MODELOWNER"'", "password": "test", "email": "[email protected]"}' -H 'Content-Type: application/json' -H "Authorization: Token $ADMIN_TOKEN" | ||
curl -sk -X POST $SERVER_URL$VERSION_PREFIX/users/ -d '{"first_name": "bmk", "last_name": "owner", "username": "'"$BENCHMARKOWNER"'", "password": "test", "email": "[email protected]"}' -H 'Content-Type: application/json' -H "Authorization: Token $ADMIN_TOKEN" | ||
curl -sk -X POST $SERVER_URL$VERSION_PREFIX/users/ -d '{"first_name": "data", "last_name": "owner", "username": "'"$DATAOWNER"'", "password": "test", "email": "[email protected]"}' -H 'Content-Type: application/json' -H "Authorization: Token $ADMIN_TOKEN" | ||
|
||
########################################################## | ||
################### Start Testing ######################## | ||
|
@@ -184,7 +185,7 @@ medperf benchmark submit --name bmk --description bmk --demo-url $DEMO_URL --dat | |
checkFailed "Benchmark submission failed" | ||
BMK_UID=$(medperf benchmark ls | tail -n 1 | tr -s ' ' | cut -d ' ' -f 2) | ||
|
||
curl -sk -X PUT https://127.0.0.1:8000/benchmarks/$BMK_UID/ -d '{"approval_status": "APPROVED"}' -H 'Content-Type: application/json' -H "Authorization: Token $ADMIN_TOKEN" | ||
curl -sk -X PUT $SERVER_URL$VERSION_PREFIX/benchmarks/$BMK_UID/ -d '{"approval_status": "APPROVED"}' -H 'Content-Type: application/json' -H "Authorization: Token $ADMIN_TOKEN" | ||
checkFailed "Benchmark approval failed" | ||
########################################################## | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from ._version import __version__ # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
__version__ = "0.1.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.