Skip to content

Commit cfa19a4

Browse files
authored
Merge pull request #176 from WengLab-InformaticsResearch/reload_biolink_mappings
Reload biolink mappings
2 parents 016a9e7 + e8f5bdd commit cfa19a4

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

cohd/biolink_mapper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ def prefetch_mappings():
150150
mapping_rows = cur.fetchall()
151151
BiolinkConceptMapper._map_omop = {r['omop_id']:r for r in mapping_rows}
152152
BiolinkConceptMapper._map_biolink = {r['biolink_id']:r for r in mapping_rows if r['preferred']}
153+
logging.info('Biolink mappings prefetch completed')
153154

154155
@staticmethod
155156
def map_to_omop(curies: List[str]) -> Optional[Tuple[Dict[str, Optional[OmopBiolinkMapping]], Dict[str, Optional[NormalizedNode]]]]:

cohd/cohd_trapi_14.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class CohdTrapi140(CohdTrapi):
3737
edge_types_negative = ['biolink:negatively_correlated_with']
3838
default_negative_predicate = edge_types_negative[0]
3939

40-
tool_version = f'{CohdTrapi._SERVICE_NAME} 6.3.6'
40+
tool_version = f'{CohdTrapi._SERVICE_NAME} 6.3.7'
4141
schema_version = '1.4.2'
4242
biolink_version = bm_version
4343

cohd/scheduled_tasks.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,20 @@ def task_build_cache():
1010
print('Running scheduled task to build cache')
1111
BiolinkConceptMapper.build_mappings()
1212

13+
# Schedule a task to update the Biolink Mapping cache nightly (all environments)
14+
scheduler = BackgroundScheduler()
15+
scheduler.add_job(func=BiolinkConceptMapper.prefetch_mappings, trigger='cron', hour=6)
1316

1417
# Schedule a task to build the cache every first Saturday of the month (in ITRB-CI and Dev only)
1518
deployment_env = app.config.get('DEPLOYMENT_ENV', 'dev').lower()
16-
if deployment_env in ('itrb-ci', 'dev'):
17-
scheduler = BackgroundScheduler()
18-
scheduler.add_job(func=task_build_cache, trigger='cron', day='1st sat', hour=0)
19-
scheduler.start()
19+
if False:
20+
scheduler.add_job(func=task_build_cache, trigger='cron', day='1st sat', hour=0)
2021
logging.info(f'Background task scheduled to build Biolink mappings (env: {deployment_env})')
2122
else:
2223
logging.info(f'Background task NOT scheduled to build Biolink mappings (env: {deployment_env})')
2324

25+
scheduler.start()
26+
2427

2528
# Registering a shutdown seems to cause UWSGI to have issues shutting down COHD, even with the wait=False option.
2629
# Since the default job store does not persist jobs anyway, remove this line for now

0 commit comments

Comments
 (0)