Skip to content

Commit

Permalink
♻️orchestrator is initialized before first view
Browse files Browse the repository at this point in the history
  • Loading branch information
PitButtchereit committed Jan 9, 2024
1 parent 2cf24d8 commit 24a0741
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
5 changes: 5 additions & 0 deletions tracex/extraction/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ class ExtractionConfig(AppConfig):

default_auto_field = "django.db.models.BigAutoField"
name = "extraction"

def ready(self):
from extraction.logic import orchestrator
orchestrator = orchestrator.Orchestrator()
print("Orchestrator ready")
6 changes: 4 additions & 2 deletions tracex/extraction/logic/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@


class Orchestrator:
def __init__(self, config):
def __init__(self):
print("test")
self.config = config
self.modules = {
"patient_journey_generation": PatientJourneyGenerator(
name="Patient Journey Generator",
Expand All @@ -29,3 +28,6 @@ def built_configuration(self, anforderungen):
3. Module initialisieren
"""
pass

def testing(self):
print("Test successful")
4 changes: 1 addition & 3 deletions tracex/extraction/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""This file contains the views for the extraction app.
Some unused imports have to be made because of architectual requirement."""
Some unused imports have to be made because of architectural requirement."""
# pylint: disable=unused-argument
import os
import tempfile
Expand Down Expand Up @@ -49,8 +49,6 @@ def form_valid(self, form):
cache.set("event_types", form.cleaned_data["event_types"])
cache.set("locations", form.cleaned_data["locations"])
cache.set("is_extracted", False)
orchestrator = getattr(self.request, "orchestrator", None)
print("success")
return super().form_valid(form)


Expand Down
1 change: 0 additions & 1 deletion tracex/tracex/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
]

MIDDLEWARE = [
"extraction.logic.orchestrator.Orchestrator",
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
Expand Down

0 comments on commit 24a0741

Please sign in to comment.