Skip to content
Snippets Groups Projects
Commit 2b58a3b5 authored by AndiMajore's avatar AndiMajore
Browse files

added env variable to toggle startup update

Former-commit-id: da8017732756d3bd9956f1da010b3187b34c4d16 [formerly ea203bffa93fcb1941bc3ceb7221bcb85b5dd4e8]
Former-commit-id: 57f29f748fe0ecb1b857be59a827eab886e2c0d8
parent a21100c6
No related branches found
No related tags found
No related merge requests found
...@@ -12,4 +12,5 @@ REDIS_HOST=redis ...@@ -12,4 +12,5 @@ REDIS_HOST=redis
REDIS_PORT=6379 REDIS_PORT=6379
GT_THREADS=16 GT_THREADS=16
DJANGO_SETTINGS_MODULE=drugstone.settings DJANGO_SETTINGS_MODULE=drugstone.settings
CELERY_BROKER_URL=redis://redis:6379/0 CELERY_BROKER_URL=redis://redis:6379/0
\ No newline at end of file DB_UPDATE_ON_START=0
\ No newline at end of file
...@@ -14,4 +14,5 @@ DJANGO_SETTINGS_MODULE=drugstone.settings ...@@ -14,4 +14,5 @@ DJANGO_SETTINGS_MODULE=drugstone.settings
CELERY_BROKER_URL=redis://redis:6379/0 CELERY_BROKER_URL=redis://redis:6379/0
FLOWER_PORT=8888 FLOWER_PORT=8888
FLOWER_BASIC_AUTH=drugstone:test FLOWER_BASIC_AUTH=drugstone:test
GT_THREADS=2 GT_THREADS=2
\ No newline at end of file DB_UPDATE_ON_START=0
\ No newline at end of file
...@@ -150,20 +150,20 @@ def populate(kwargs): ...@@ -150,20 +150,20 @@ def populate(kwargs):
print(f'Populated {n} Expressions.') print(f'Populated {n} Expressions.')
if kwargs['protein_drug']: if kwargs['protein_drug']:
print('Importing PDIs from unlicenced NeDRexDB...') print('Importing PDIs from unlicensed NeDRexDB...')
n = NedrexImporter.import_drug_target_interactions(importer, n = NedrexImporter.import_drug_target_interactions(importer,
DatasetLoader.get_drug_target_nedrex(nedrex_api_url_open, False), DatasetLoader.get_drug_target_nedrex(nedrex_api_url_open, False),
update) update)
total_n += n total_n += n
print(f'Imported {n} PDIs from unlicenced NeDRexDB') print(f'Imported {n} PDIs from unlicensed NeDRexDB')
print('Importing PDIs from licenced NeDRexDB...') print('Importing PDIs from licensed NeDRexDB...')
n = NedrexImporter.import_drug_target_interactions(importer, n = NedrexImporter.import_drug_target_interactions(importer,
DatasetLoader.get_drug_target_nedrex(nedrex_api_url_licensed, True), DatasetLoader.get_drug_target_nedrex(nedrex_api_url_licensed, True),
update) update)
total_n += n total_n += n
nedrex_update = True nedrex_update = True
print(f'Imported {n} PDIs from licenced NeDRexDB') print(f'Imported {n} PDIs from licensed NeDRexDB')
print('Populating PDIs from Chembl...') print('Populating PDIs from Chembl...')
n = DataPopulator.populate_pdi_chembl(populator, DatasetLoader.get_drug_target_chembl(), update) n = DataPopulator.populate_pdi_chembl(populator, DatasetLoader.get_drug_target_chembl(), update)
...@@ -176,13 +176,13 @@ def populate(kwargs): ...@@ -176,13 +176,13 @@ def populate(kwargs):
print(f'Populated {n} PDIs from DGIdb.') print(f'Populated {n} PDIs from DGIdb.')
if kwargs['protein_disorder']: if kwargs['protein_disorder']:
print('Importing PDis from unlicenced NeDRexDB...') print('Importing PDis from unlicensed NeDRexDB...')
n = NedrexImporter.import_protein_disorder_associations(importer, n = NedrexImporter.import_protein_disorder_associations(importer,
DatasetLoader.get_protein_disorder_nedrex( DatasetLoader.get_protein_disorder_nedrex(
nedrex_api_url_open, False), nedrex_api_url_open, False),
update) update)
total_n += n total_n += n
print(f'Imported {n} PDis from unlicenced NeDRexDB') print(f'Imported {n} PDis from unlicensed NeDRexDB')
print('Importing PDis from licenced NeDRexDB...') print('Importing PDis from licenced NeDRexDB...')
n = NedrexImporter.import_protein_disorder_associations(importer, n = NedrexImporter.import_protein_disorder_associations(importer,
...@@ -194,12 +194,12 @@ def populate(kwargs): ...@@ -194,12 +194,12 @@ def populate(kwargs):
print(f'Imported {n} PDis from licenced NeDRexDB') print(f'Imported {n} PDis from licenced NeDRexDB')
if kwargs['drug_disorder']: if kwargs['drug_disorder']:
print('Importing DrDis from unlicenced NeDRexDB...') print('Importing DrDis from unlicensed NeDRexDB...')
n = NedrexImporter.import_drug_disorder_indications(importer, n = NedrexImporter.import_drug_disorder_indications(importer,
DatasetLoader.get_drug_disorder_nedrex(nedrex_api_url_open, False), DatasetLoader.get_drug_disorder_nedrex(nedrex_api_url_open, False),
update) update)
total_n += n total_n += n
print(f'Imported {n} DrDis from unlicenced NeDRexDB') print(f'Imported {n} DrDis from unlicensed NeDRexDB')
print('Importing DrDis from licenced NeDRexDB...') print('Importing DrDis from licenced NeDRexDB...')
n = NedrexImporter.import_drug_disorder_indications(importer, n = NedrexImporter.import_drug_disorder_indications(importer,
...@@ -215,12 +215,12 @@ def populate(kwargs): ...@@ -215,12 +215,12 @@ def populate(kwargs):
print(f'Populated {n} DrDi associations from DrugBank.') print(f'Populated {n} DrDi associations from DrugBank.')
if kwargs['protein_protein']: if kwargs['protein_protein']:
print('Importing PPIs from unlicenced NeDRexDB...') print('Importing PPIs from unlicensed NeDRexDB...')
n = NedrexImporter.import_protein_protein_interactions(importer, n = NedrexImporter.import_protein_protein_interactions(importer,
DatasetLoader.get_ppi_nedrex(nedrex_api_url_open, False), DatasetLoader.get_ppi_nedrex(nedrex_api_url_open, False),
update) update)
total_n += n total_n += n
print(f'Imported {n} PPIs from unlicended NeDRexDB') print(f'Imported {n} PPIs from unlicensed NeDRexDB')
print('Importing PPIs from licenced NeDRexDB...') print('Importing PPIs from licenced NeDRexDB...')
n = NedrexImporter.import_protein_protein_interactions(importer, n = NedrexImporter.import_protein_protein_interactions(importer,
DatasetLoader.get_ppi_nedrex(nedrex_api_url_licensed, DatasetLoader.get_ppi_nedrex(nedrex_api_url_licensed,
...@@ -228,7 +228,7 @@ def populate(kwargs): ...@@ -228,7 +228,7 @@ def populate(kwargs):
update) update)
total_n += n total_n += n
nedrex_update = True nedrex_update = True
print(f'Imported {n} PPIs from licended NeDRexDB') print(f'Imported {n} PPIs from licensed NeDRexDB')
print('Populating PPIs from STRING...') print('Populating PPIs from STRING...')
n = DataPopulator.populate_ppi_string(populator, DatasetLoader.get_ppi_string(), update) n = DataPopulator.populate_ppi_string(populator, DatasetLoader.get_ppi_string(), update)
total_n += n total_n += n
......
...@@ -3,7 +3,7 @@ from celery.schedules import crontab ...@@ -3,7 +3,7 @@ from celery.schedules import crontab
CELERY_BEAT_SCHEDULE = { CELERY_BEAT_SCHEDULE = {
'update_db': { 'update_db': {
'task': 'drugstone.tasks.task_update_db_from_nedrex', 'task': 'drugstone.tasks.task_update_db_from_nedrex',
'schedule': crontab(day_of_week=1, hour=5, minute=0), 'schedule': crontab(day_of_week=2, hour=3, minute=0),
# 'schedule': crontab(minute='*/1'), # 'schedule': crontab(minute='*/1'),
}, },
} }
...@@ -4,7 +4,11 @@ python3 manage.py makemigrations drugstone ...@@ -4,7 +4,11 @@ python3 manage.py makemigrations drugstone
python3 manage.py migrate python3 manage.py migrate
python3 manage.py createfixtures python3 manage.py createfixtures
python3 manage.py cleanuptasks python3 manage.py cleanuptasks
python3 manage.py populate_db --update -a if [[ -z "$DB_UPDATE_ON_START" ]] || [[ "$DB_UPDATE_ON_START" = "0" ]]
python3 manage.py make_graphs then
echo "Update on startup disabled!"
else
python3 manage.py populate_db --update -a
python3 manage.py make_graphs
fi
/usr/bin/supervisord -c "/etc/supervisor/conf.d/supervisord.conf" /usr/bin/supervisord -c "/etc/supervisor/conf.d/supervisord.conf"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment