Skip to content

Commit

Permalink
separate tasks cluster, new env var names
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Dec 11, 2024
1 parent 2850ad9 commit 03a358b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion emmet-api/defect_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

default_settings = MAPISettings() # type: ignore

db_uri = os.environ.get("MPCONTRIBS_MONGO_HOST", None)
db_uri = os.environ.get("MPMATERIALS_MONGO_HOST", None)
db_version = default_settings.DB_VERSION
db_suffix = os.environ["MAPI_DB_NAME_SUFFIX"]

Expand Down
8 changes: 6 additions & 2 deletions emmet-api/material_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@

default_settings = MAPISettings() # type: ignore

db_uri = os.environ.get("MPCONTRIBS_MONGO_HOST", None)
db_uri = os.environ.get("MPMATERIALS_MONGO_HOST", None)
db_uri_tasks = os.environ.get("MPTASKS_MONGO_HOST", db_uri)
db_version = default_settings.DB_VERSION
db_suffix = os.environ["MAPI_DB_NAME_SUFFIX"]

Expand All @@ -18,6 +19,9 @@
if len(db_uri.split("://", 1)) < 2:
db_uri = "mongodb+srv://" + db_uri

if len(db_uri_tasks.split("://", 1)) < 2:
db_uri_tasks = "mongodb+srv://" + db_uri_tasks

materials_store = MongoURIStore(
uri=db_uri,
database=f"mp_core_{db_suffix}",
Expand Down Expand Up @@ -54,7 +58,7 @@
)

task_store = MongoURIStore(
uri=db_uri, database="mp_core", key="task_id", collection_name="tasks"
uri=db_uri_tasks, database="mp_core", key="task_id", collection_name="tasks"
)

thermo_store = MongoURIStore(
Expand Down

0 comments on commit 03a358b

Please sign in to comment.