diff --git a/docker-django.env b/docker-django.env index 9bf4bf33e4554aafa7a51088eb57885b753ab769..defd3e70b9c0efba92870547a9b16ef0e84aecc5 100755 --- a/docker-django.env +++ b/docker-django.env @@ -12,4 +12,5 @@ REDIS_HOST=redis REDIS_PORT=6379 GT_THREADS=16 DJANGO_SETTINGS_MODULE=drugstone.settings -CELERY_BROKER_URL=redis://redis:6379/0 \ No newline at end of file +CELERY_BROKER_URL=redis://redis:6379/0 +DB_UPDATE_ON_START=0 \ No newline at end of file diff --git a/docker-django.env.dev b/docker-django.env.dev index 1f3d65dea9913d1be665c036f47ee209a4720f20..91d6c04b8f6b37a168562414a91cbc79cff2a676 100644 --- a/docker-django.env.dev +++ b/docker-django.env.dev @@ -14,4 +14,5 @@ DJANGO_SETTINGS_MODULE=drugstone.settings CELERY_BROKER_URL=redis://redis:6379/0 FLOWER_PORT=8888 FLOWER_BASIC_AUTH=drugstone:test -GT_THREADS=2 \ No newline at end of file +GT_THREADS=2 +DB_UPDATE_ON_START=0 \ No newline at end of file diff --git a/drugstone/management/commands/populate_db.py b/drugstone/management/commands/populate_db.py index 497b3d172a9b598064b0803515860849590a2a2d..690ec3bea84e2029e305aba16b876bfb49c69a80 100755 --- a/drugstone/management/commands/populate_db.py +++ b/drugstone/management/commands/populate_db.py @@ -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 diff --git a/drugstone/settings/celery_schedule.py b/drugstone/settings/celery_schedule.py index d33a3a059a54118677f43435c369fd7ec2ada5e5..6c068944fe4b6bf516a180d5677b32c2ff0d7250 100644 --- a/drugstone/settings/celery_schedule.py +++ b/drugstone/settings/celery_schedule.py @@ -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'), }, } diff --git a/scripts/docker-entrypoint.sh b/scripts/docker-entrypoint.sh index 43bf32df3da5898d25d96f8abd734edf4872ea3c..8ce3250f785930fabb2bb27e59d52e18cae71e40 100755 --- a/scripts/docker-entrypoint.sh +++ b/scripts/docker-entrypoint.sh @@ -4,7 +4,11 @@ python3 manage.py makemigrations drugstone python3 manage.py migrate python3 manage.py createfixtures python3 manage.py cleanuptasks -python3 manage.py populate_db --update -a -python3 manage.py make_graphs - +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"