Skip to content
Snippets Groups Projects
Commit 80d7fa21 authored by AndiMajore's avatar AndiMajore
Browse files

added env variable to toggle startup update

parent 06bb1de1
No related branches found
No related tags found
No related merge requests found
Pipeline #63334 canceled
......@@ -13,3 +13,4 @@ REDIS_PORT=6379
GT_THREADS=16
DJANGO_SETTINGS_MODULE=drugstone.settings
CELERY_BROKER_URL=redis://redis:6379/0
DB_UPDATE_ON_START=0
\ No newline at end of file
......@@ -15,3 +15,4 @@ CELERY_BROKER_URL=redis://redis:6379/0
FLOWER_PORT=8888
FLOWER_BASIC_AUTH=drugstone:test
GT_THREADS=2
DB_UPDATE_ON_START=0
\ No newline at end of file
......@@ -150,20 +150,20 @@ def populate(kwargs):
print(f'Populated {n} Expressions.')
if kwargs['protein_drug']:
print('Importing PDIs from unlicenced NeDRexDB...')
print('Importing PDIs from unlicensed NeDRexDB...')
n = NedrexImporter.import_drug_target_interactions(importer,
DatasetLoader.get_drug_target_nedrex(nedrex_api_url_open, False),
update)
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,
DatasetLoader.get_drug_target_nedrex(nedrex_api_url_licensed, True),
update)
total_n += n
nedrex_update = True
print(f'Imported {n} PDIs from licenced NeDRexDB')
print(f'Imported {n} PDIs from licensed NeDRexDB')
print('Populating PDIs from Chembl...')
n = DataPopulator.populate_pdi_chembl(populator, DatasetLoader.get_drug_target_chembl(), update)
......@@ -176,13 +176,13 @@ def populate(kwargs):
print(f'Populated {n} PDIs from DGIdb.')
if kwargs['protein_disorder']:
print('Importing PDis from unlicenced NeDRexDB...')
print('Importing PDis from unlicensed NeDRexDB...')
n = NedrexImporter.import_protein_disorder_associations(importer,
DatasetLoader.get_protein_disorder_nedrex(
nedrex_api_url_open, False),
update)
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...')
n = NedrexImporter.import_protein_disorder_associations(importer,
......@@ -194,12 +194,12 @@ def populate(kwargs):
print(f'Imported {n} PDis from licenced NeDRexDB')
if kwargs['drug_disorder']:
print('Importing DrDis from unlicenced NeDRexDB...')
print('Importing DrDis from unlicensed NeDRexDB...')
n = NedrexImporter.import_drug_disorder_indications(importer,
DatasetLoader.get_drug_disorder_nedrex(nedrex_api_url_open, False),
update)
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...')
n = NedrexImporter.import_drug_disorder_indications(importer,
......@@ -215,12 +215,12 @@ def populate(kwargs):
print(f'Populated {n} DrDi associations from DrugBank.')
if kwargs['protein_protein']:
print('Importing PPIs from unlicenced NeDRexDB...')
print('Importing PPIs from unlicensed NeDRexDB...')
n = NedrexImporter.import_protein_protein_interactions(importer,
DatasetLoader.get_ppi_nedrex(nedrex_api_url_open, False),
update)
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...')
n = NedrexImporter.import_protein_protein_interactions(importer,
DatasetLoader.get_ppi_nedrex(nedrex_api_url_licensed,
......@@ -228,7 +228,7 @@ def populate(kwargs):
update)
total_n += n
nedrex_update = True
print(f'Imported {n} PPIs from licended NeDRexDB')
print(f'Imported {n} PPIs from licensed NeDRexDB')
print('Populating PPIs from STRING...')
n = DataPopulator.populate_ppi_string(populator, DatasetLoader.get_ppi_string(), update)
total_n += n
......
......@@ -3,7 +3,7 @@ from celery.schedules import crontab
CELERY_BEAT_SCHEDULE = {
'update_db': {
'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'),
},
}
......@@ -4,7 +4,11 @@ python3 manage.py makemigrations drugstone
python3 manage.py migrate
python3 manage.py createfixtures
python3 manage.py cleanuptasks
if [[ -z "$DB_UPDATE_ON_START" ]] || [[ "$DB_UPDATE_ON_START" = "0" ]]
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"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment