diff --git a/scheduler/.env.dist b/scheduler/.env.dist new file mode 100644 index 0000000000000000000000000000000000000000..08657e8cd3c5a1f341a62aca57d35bdc64d7d8c8 --- /dev/null +++ b/scheduler/.env.dist @@ -0,0 +1,6 @@ +DYNACONF_SQLALCHEMY_DATABASE_URI= +DYNACONF_SECRET= +DYNACONF_CELERY_BROKER_URL = +DYNACONF_CELERY_RESULT_BACKEND = +DYNACONF_ANALYTICS_BACKEND_URL = +DYNACONF_RIGHTS_ENGINE_BACKEND_URL = \ No newline at end of file diff --git a/scheduler/scheduler/tasks.py b/scheduler/scheduler/tasks.py index 8289e02b6e61a2d589421d687e2138eb66f3060b..72778f266359e2bf470d3ea1328d9e4f34488832 100644 --- a/scheduler/scheduler/tasks.py +++ b/scheduler/scheduler/tasks.py @@ -6,14 +6,17 @@ from subprocess import PIPE, STDOUT, Popen import git import requests from celery import shared_task +from dynaconf import settings from scheduler.ext.database import db from scheduler.models import Job +ANALYTICS_BACKEND = settings.get("ANALYTICS_BACKEND_URL", "") +RIGHTS_ENGINE_BACKEND = settings.get("RIGHTS_ENGINE_BACKEND_URL", "") def append_job_log(result_token, job_id, job_output, succeeded=True): - # TODO read from config - url = f"http://127.0.0.1:5000/api/v1/jobs/{job_id}/log" + url = f"{ANALYTICS_BACKEND}/api/v1/jobs/{job_id}/log" + print(url) response = requests.post( url, json={"result_token": result_token, "log": job_output, "succeeded": succeeded}, @@ -24,8 +27,7 @@ def append_job_log(result_token, job_id, job_output, succeeded=True): def run_results_retention(analytics_token): - # TODO read from config - url = f"http://127.0.0.1:8003/api/v1/provider/results-retention" + url = f"{RIGHTS_ENGINE_BACKEND}/api/v1/provider/results-retention" response = requests.post(url, headers={"Authorization": f"Basic {analytics_token}"}) if not response.ok: print(response.status_code) diff --git a/scheduler/settings.toml b/scheduler/settings.toml index e136ce79a53a9b14ca322cb6fb8d9b8770c6f92c..7ea67f50f868b225349779c2a7bb72aa98973e2f 100644 --- a/scheduler/settings.toml +++ b/scheduler/settings.toml @@ -12,6 +12,8 @@ EXTENSIONS = [ ] CELERY_BROKER_URL = "redis://localhost:6379/0" CELERY_RESULT_BACKEND = "redis://localhost:6379/1" +ANALYTICS_BACKEND_URL = "http://127.0.0.1:5000" +RIGHTS_ENGINE_BACKEND_URL = "http://127.0.0.1:8003" [development] EXTENSIONS = [