Skip to content

Commit

Permalink
Merge pull request #20 from openkim/update-montydb
Browse files Browse the repository at this point in the history
Update montydb
  • Loading branch information
ilia-nikiforov-umn authored Nov 4, 2024
2 parents 5ec7fd4 + 86b40f8 commit 2275566
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 262,364 deletions.
2 changes: 0 additions & 2 deletions docker/config/excerpts/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,5 +388,3 @@ def __str__(self):
# os.environ['ASAP_KIM_INC'] = conf.get('ASAP_KIM_INC')
# os.environ['ASAP_KIM_LIB'] = conf.get('ASAP_KIM_LIB')

# For montydb. Required because our `pipeline-database` tool uses pymongo
os.environ["MONTY_ENABLE_BSON"] = "1"
5 changes: 3 additions & 2 deletions docker/config/excerpts/mongodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import re
import datetime

from montydb import MontyClient
from montydb import MontyClient,set_storage

from . import config as cf
from . import util
Expand All @@ -17,7 +17,8 @@

PIPELINE_LOCAL_DB_PATH = cf.LOCAL_DATABASE_PATH

client = MontyClient(PIPELINE_LOCAL_DB_PATH, cache_modified=0)
set_storage(repository=PIPELINE_LOCAL_DB_PATH, use_bson=True, cache_modified="0")
client = MontyClient(PIPELINE_LOCAL_DB_PATH)
db = client.db

PATH_RESULT = cf.LOCAL_REPOSITORY_PATH
Expand Down
8 changes: 6 additions & 2 deletions docker/config/tools/pipeline-database
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ def action_delete(args):


def action_import(args):
# To set up the directory and monty.storage.cfg if it does not exist
import excerpts.mongodb
try:
with open_repo(PIPELINE_LOCAL_DB_PATH):
montyimport("db", "data", args["database-file"])
montyimport("db", "data", args["database-file"], use_bson=True)
except (UnicodeDecodeError, JSONDecodeError):
print(
"Database file {} is not valid JSON. Exiting...".format(
Expand All @@ -90,10 +92,12 @@ def action_import(args):

def action_export(args):
with open_repo(PIPELINE_LOCAL_DB_PATH):
montyexport("db", "data", args["database-file"])
montyexport("db", "data", args["database-file"], use_bson=True)


def action_restore(args):
# To set up the directory and monty.storage.cfg if it does not exist
import excerpts.mongodb
try:
with open_repo(PIPELINE_LOCAL_DB_PATH):
montyrestore("db", "data", args["database-file"])
Expand Down
2 changes: 1 addition & 1 deletion docker/install/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RUN ${PIP} install numpy==1.19.5
RUN ${PIP} install scipy==1.5.4
RUN ${PIP} install matplotlib==3.7.1
RUN ${PIP} install pymongo==3.11.3
RUN ${PIP} install montydb==2.1.1
RUN ${PIP} install montydb==2.5.3
RUN ${PIP} install pybind11==2.6.2
RUN ${PIP} install spglib==2.1.0
RUN ${PIP} install numdifftools==0.9.41
Expand Down
2 changes: 1 addition & 1 deletion test/run_all.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
DOCKER_COMMAND="cd /home/openkim/test_scripts_and_data && bash set_up_and_run_$2.sh && python compare_dbs.py $2 && bash compare_vcs.sh $2"
DOCKER_COMMAND="cd /home/openkim/test_scripts_and_data && bash set_up_and_run_$2.sh && export PYTHONPATH=\$PYTHONPATH:/pipeline/ && python compare_dbs.py $2 && bash compare_vcs.sh $2"
docker run --rm --mount type=bind,src=$PWD/test/test_scripts_and_data,target=/home/openkim/test_scripts_and_data --env LD_LIBRARY_PATH=:/usr/local/lib $1 /bin/bash -c "$DOCKER_COMMAND"
2 changes: 0 additions & 2 deletions test/run_tests.sh

This file was deleted.

Loading

0 comments on commit 2275566

Please sign in to comment.