-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Orion as a service #1023
Open
Delaunay
wants to merge
97
commits into
Epistimio:develop
Choose a base branch
from
Delaunay:orion_service_2
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Orion as a service #1023
Changes from all commits
Commits
Show all changes
97 commits
Select commit
Hold shift + click to select a range
5b297d6
init
Delaunay b95958d
Add Mongo setup script to test multi user
Delaunay 6a6be5c
Bybass singletons
Delaunay e4fcf57
Change to a ExperimentClient Broker
Delaunay 5436788
Patch more singleton
Delaunay c8d1ae4
Split brokers
Delaunay 99d543b
-
Delaunay c02bd93
add suggest for both remote and local broker
Delaunay db02301
-
Delaunay 7f4b591
-
Delaunay 330c2cf
-
Delaunay eab12dc
Merge branch 'develop' of github.com:Epistimio/orion into orion_service
Delaunay fba0384
Merge branch 'develop' of github.com:Epistimio/orion into orion_service
Delaunay 5ea9b01
pre-commit
Delaunay 5c901e1
-
Delaunay 46bab73
-
Delaunay 71339a0
-
Delaunay 37e792e
-
Delaunay 0957a4b
-
Delaunay 4c6ba50
Base client requests are working
Delaunay 3cd9547
Update error handling
Delaunay 23ca0b9
-
Delaunay 7d1baba
Metrics
Delaunay dbc2046
-
Delaunay 71b63f7
-
Delaunay 674bc9e
-
Delaunay 758ce0a
Merge branch 'develop' of github.com:Epistimio/orion into orion_service
Delaunay f3ec770
Add REST storage
Delaunay d8cf641
-
Delaunay ad09254
Testing
Delaunay 232d371
Make sure MongoDB admin gets the right port
Delaunay 681cf99
Add some variables required by the Runner
Delaunay 8b48cfb
Fix a few last issues
Delaunay fbe0786
Change init order to help testing
Delaunay ba212ca
Add missing requests
Delaunay ee51d46
Add client<->server request for ExperimentClient action
Delaunay 60574f3
-
Delaunay 19b9832
Enable experiment_client test to run for both storage and rest api
Delaunay ce0111d
-
Delaunay eae6612
Fix a few tests
Delaunay 8e62af9
Fix some tests
Delaunay f13c9c9
Fix a bunch of tests
Delaunay bd71ea6
Fix tests
Delaunay 4a418fd
-
Delaunay 8c950aa
pylint fixes
Delaunay d68a4a3
Remove debug assert
Delaunay 01f3a35
remove debug code
fabf5dc
Add config test
38c4841
Add owner_id to main experiment index
bed7de9
Update rest client API to match regular client
60df77b
Merge branch 'develop' of github.com:Epistimio/orion into orion_service
88c4211
Delete out.txt
Delaunay a7d63d5
-
d26ecb4
Merge branch 'orion_service' of github.com:Delaunay/orion into orion_…
6cf8c1e
-
1c0889a
-
82af20f
-
c899b93
-
e961be8
-
7a1c234
commit
8d0dd0e
Move the services tests to its own section
ab9fa98
Set inserted trials with new status #1015
978fce6
-
7a3df55
add tests
0f46d18
update tests
14be107
-
8b4e28d
-
2f2dfae
-
13307f4
Make sure all trials gets released
8e088c6
-
Delaunay f356fb0
Merge branch 'develop' of github.com:Epistimio/orion into orion_servi…
Delaunay 5854a17
-
99d670f
Merge branch 'develop' of github.com:Epistimio/orion into orion_servi…
2e5aa31
Merge branch 'orion_service_2' of github.com:Delaunay/orion into orio…
a987e19
Run all service related tests in their own block
f493f07
-
57bb8bf
Debug CI
d54c8d6
Make sure mongo tools are installed
26cb304
-
f8542e8
-
620b716
Merge branch 'develop' of github.com:Epistimio/orion into orion_servi…
3c0e3f2
Pylint
2c3093a
Merge branch 'develop' of github.com:Epistimio/orion into orion_servi…
8826eab
Update new tests for orion serviec
aed60e4
black
e6fbb57
update tests
4661da3
-
e39b99e
Uniformize storage env variable names
bouthilx 338f64a
Adjust config tests for storage env var names
bouthilx e73b72f
Prepare release 0.2.7
notoraptor 9a5f28d
Merge pull request #1087 from notoraptor/release-0.2.7rc
notoraptor b190d9b
Update backward comp test versions
notoraptor 7411b23
Merge pull request #1089 from Epistimio/ci/sync_master_back_to_dev
Delaunay 5abf4e5
Merge branch 'master' of github.com:Epistimio/orion into orion_service_2
f7f766e
-
98effa6
-
351f6dd
Merge branch 'develop' into orion_service_2
Delaunay File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,188 @@ | ||
#!/bin/bash | ||
|
||
# Setup a mongodb server for testing | ||
# this setup is done my IT when the DB is deployed | ||
# set -evx | ||
|
||
PORT=${MONGO_PORT:-"8123"} | ||
ADDRESS=${MONGO_ADDRESS:-"localhost"} | ||
ADMIN=${MONGO_ADMIN:-"god"} | ||
PASSWORD=${MONGO_PASS:-"god123"} | ||
DB_PATH=${MONGO_PATH:-"/tmp/db"} | ||
|
||
function start_init_mongod { | ||
# Start mongodb without Access Control, this is used to insert the admin user | ||
# the db is then stopped and started with Access Control | ||
|
||
if test -f "$DB_PATH/pid"; then | ||
pid=$(cat $DB_PATH/pid) | ||
kill -3 $pid || true | ||
fi | ||
|
||
rm -rf $DB_PATH | ||
mkdir -p $DB_PATH | ||
|
||
mongod --dbpath $DB_PATH/ --wiredTigerCacheSizeGB 1 --port $PORT --bind_ip localhost --pidfilepath $DB_PATH/pid & | ||
sleep 1 | ||
} | ||
|
||
function start_mongod { | ||
# start mongodb with Access Control | ||
mongod --auth --dbpath $DB_PATH/ --wiredTigerCacheSizeGB 1 --port $PORT --bind_ip $ADDRESS --pidfilepath $DB_PATH/pid --fork --logpath $DB_PATH/log.txt | ||
sleep 1 | ||
} | ||
|
||
function stop_mongod { | ||
# mongo --dbpath $DB_PATH --shutdown | ||
|
||
echo "$(pwd)" | ||
pid=$(cat $DB_PATH/pid) | ||
kill -s TERM $pid | ||
rm -rf $DB_PATH/pid | ||
sleep 1 | ||
} | ||
|
||
function add_admin_user { | ||
# create an admin user | ||
# userAdminAnyDatabase: create users, grant & revoke roles, create and modify roles | ||
|
||
CMD=$(cat <<EOM | ||
use admin | ||
db.createUser({ | ||
user: "$ADMIN", | ||
pwd: "$PASSWORD", | ||
roles: [ | ||
{ role: "userAdminAnyDatabase", db: "admin" }, | ||
{ role: "readWriteAnyDatabase", db: "admin" }, | ||
] | ||
}) | ||
EOM | ||
) | ||
|
||
echo "$CMD" | mongosh --port $PORT | ||
|
||
add_user $ADMIN $PASSWORD | ||
} | ||
|
||
function add_user { | ||
# Create a user for the orion database | ||
# | ||
# How to make a group setup | ||
# - make a Token => Group | ||
# - Token => User => Group | ||
|
||
username=$1 | ||
password=$2 | ||
token=$3 | ||
|
||
CMD=$(cat << EOM | ||
use orion | ||
db.createUser({ | ||
user: "$username", | ||
pwd: "$password", | ||
roles: [ | ||
{ role: "readWrite", db: "orion" } | ||
] | ||
}) | ||
|
||
db.users.insertOne({ | ||
username: "$username", | ||
password: "$password", | ||
token: "$token", | ||
}) | ||
EOM | ||
) | ||
|
||
echo "$CMD" | mongosh "mongodb://$ADDRESS:$PORT" --authenticationDatabase "admin" -u $ADMIN -p $PASSWORD | ||
} | ||
|
||
|
||
ASCENDING=1 | ||
DESCENDING=-1 | ||
|
||
function ensure_indexes { | ||
# User will have limited access to the collection | ||
# so orion's client cannot do this | ||
|
||
CMD=$(cat <<EOM | ||
use orion | ||
|
||
db.experiments.createIndex( | ||
{ | ||
"name": 1, | ||
"version": 1, | ||
"owner_id": 1 | ||
}, | ||
{ | ||
unique: true | ||
} | ||
) | ||
db.experiments.createIndex( | ||
{ | ||
"metadata.datetime": 1 | ||
} | ||
) | ||
|
||
db.trials.createIndex( | ||
{ | ||
"experiment": 1, | ||
"id": 1 | ||
}, | ||
{ | ||
unique: true | ||
} | ||
) | ||
db.trials.createIndex( | ||
{ | ||
"experiment": 1 | ||
} | ||
) | ||
db.trials.createIndex( | ||
{ | ||
"status": 1 | ||
} | ||
) | ||
db.trials.createIndex( | ||
{ | ||
"results": 1 | ||
} | ||
) | ||
db.trials.createIndex( | ||
{ | ||
"start_time": 1 | ||
} | ||
) | ||
db.trials.createIndex( | ||
{ | ||
"end_time": -1 | ||
} | ||
) | ||
db.algo.createIndex( | ||
{ | ||
"experiment": 1 | ||
} | ||
) | ||
EOM | ||
) | ||
|
||
echo "$CMD" | mongosh --port $PORT | ||
} | ||
|
||
function launch { | ||
# Setup a mongodb for testing | ||
start_init_mongod | ||
add_admin_user | ||
ensure_indexes | ||
stop_mongod | ||
|
||
# Start mongodb with access control | ||
start_mongod | ||
|
||
add_user User1 Pass1 Tok1 | ||
add_user User2 Pass2 Tok2 | ||
add_user User3 Pass3 Tok3 | ||
} | ||
|
||
export MONGO_RUNNING="${DB_PATH}" | ||
launch | ||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why move this to ExpelimentClient.create_experiment which calls _build_experiment? Is it to support different subclasses of ExperimentClient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes