Skip to content

Commit

Permalink
More env work
Browse files Browse the repository at this point in the history
  • Loading branch information
fwhigh committed Jan 31, 2019
1 parent 826de26 commit 1705fd9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pmip/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def possible_types(value):
)
model = load_from_s3_and_unpickle(
filename='model.pkl',
subdirectory=f'models/{latest_model_id}',
subdirectory=f'models/{os.getenv("ENVIRONMENT")}/{latest_model_id}',
bucket=os.getenv('BUCKET')
)

Expand Down Expand Up @@ -99,10 +99,10 @@ def post(self):
@api.route('/model-info')
class ModelInfo(Resource):

# @api.marshal_with(request, code=201)
def get(self):
result = {
"model_id": latest_model_id
"model_id": latest_model_id,
"ENVIRONMENT": os.getenv('ENVIRONMENT', '')
}

return {'result': result}, 200
Expand Down
4 changes: 2 additions & 2 deletions scripts/train.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

MODEL_ID=`date +%Y%m%d`
S3_DIR=s3://$BUCKET/models/$MODEL_ID
S3_DIR=s3://$BUCKET/models/$ENVIRONMENT/$MODEL_ID
DIR=data

echo MODEL_ID $MODEL_ID
Expand All @@ -28,7 +28,7 @@ papermill notebooks/model-training.ipynb $DIR/model-training-$MODEL_ID.ipynb -p
jupyter nbconvert --to html $DIR/model-training-$MODEL_ID.ipynb

# Push any assets to the cloud
if [ "$ENVIRONMENT" == "staging" ]; then
if [ "$ENVIRONMENT" == "staging" ] || [ "$ENVIRONMENT" == "prod" ]; then
echo Pushing model to S3
aws s3 cp $DIR/ $S3_DIR/ \
--recursive --exclude "*" --include "*.ipynb" --include "*.html" --include "*.pkl"
Expand Down

0 comments on commit 1705fd9

Please sign in to comment.