Skip to content

Commit

Permalink
improvements to KWS deployment. Fixes dmwm#88
Browse files Browse the repository at this point in the history
  • Loading branch information
amaltaro committed Oct 22, 2013
1 parent 0ee2e0d commit 76e9295
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
19 changes: 14 additions & 5 deletions das/deploy
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,27 @@ deploy_das_post()

# initialize keylearning db
rm -f $mongodb_stage/{clean,update}_keylearning_db.js
rm -f $mongodb_stage/keylearning_db-schema-stamp
rm -f $mongodb_stage/inputvals_*-schema-stamp
(echo 'keylearning = db.getSisterDB("keylearning");'
echo 'keylearning.dropDatabase();'
echo 'inputvals = db.getSisterDB("inputvals");'
echo 'keylearning.dropDatabase();') > \
$mongodb_stage/clean_keylearning_db.js
# it's better to clean DBs separately, datatype_name is the first col to be updated so it will clean...
(echo 'inputvals = db.getSisterDB("inputvals");'
echo 'inputvals.dropDatabase();') > \
$mongodb_stage/clean_keylearning_db.js
$mongodb_stage/clean_inputvals_datatype_name.js
# clean each collection (currently update_db require clean to be present)
for col in group_name primary_dataset_name release_name site_name status_name tier_name
do
(echo 'inputvals = db.getSisterDB("inputvals");'
echo "inputvals.$col.drop();") > \
$mongodb_stage/clean_inputvals_$col.js
done

cp $das_root/kws_data/db_dumps/*.js $mongodb_stage/

# initialize whoosh IR index for keyword search
rm -Rf $root/state/das/kws_index
mkdir -p $root/state/das/kws_index
cp $das_root/kws_data/kws_index/* $root/state/das/kws_index/


}
9 changes: 6 additions & 3 deletions mongodb/manage
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,15 @@ cd $STATEDIR
clean_db()
{
set -e
if [ -f $STATEDIR/db/${1%_db}.ns ]; then
# db is the first item before underscore
db=$(echo $1 | cut -f1 -d_)
if [ -f $STATEDIR/db/${db}.ns ]; then
echo "Clean $1"
mongo --port 8230 stagingarea/clean_$1.js
fi
set +e
}

update_db()
{
stamp=$(cat stagingarea/update_$1.js | md5sum)
Expand Down Expand Up @@ -106,15 +109,15 @@ start()
if $started; then
echo "$ME is ready"
# keylearning is prerequisite for KWS to function
clean_db "keylearning_db"
update_db "keylearning_db"
# inputvals is less important, but currently it's not updated live...
for col in datatype_name group_name primary_dataset_name release_name site_name status_name tier_name
do
clean_db "inputvals_$col"
update_db "inputvals_$col"
done
# das
# TODO: clean db shall NEVER be called in here, as it do not check for stamps!
# TODO: check if this also could potentially cause some strange behaviour in das?!
clean_db "das_db"
update_db "mapping_db"

Expand Down

0 comments on commit 76e9295

Please sign in to comment.