Browse Source

initialize the workers for the airports and destroy them during shutdown

Sven Czarnian 3 years ago
parent
commit
744ad71b6c
1 changed files with 10 additions and 1 deletions
  1. 10 1
      aman/AMAN.py

+ 10 - 1
aman/AMAN.py

@@ -8,6 +8,7 @@ from aman.com.Euroscope import Euroscope
 from aman.config.AircraftPerformance import AircraftPerformance
 from aman.config.Airport import Airport
 from aman.config.System import System
+from aman.sys.Worker import Worker
 
 class AMAN:
     def findConfigPath():
@@ -27,6 +28,7 @@ class AMAN:
         self.systemConfig = None
         self.aircraftPerformance = None
         self.receiver = None
+        self.workers = []
 
         configPath = AMAN.findConfigPath()
 
@@ -50,7 +52,11 @@ class AMAN:
             print('Parsing planner configuration for ' + icao)
             airportConfig = Airport(file, icao)
 
-            # TODO initialize the planner thread
+            # initialize the worker thread
+            worker = Worker(icao, airportConfig)
+            worker.start()
+            self.workers.append(worker)
+            print('Starter worker for ' + icao)
 
         # create the EuroScope receiver
         self.receiver = Euroscope(configPath, self.systemConfig.Server)
@@ -59,3 +65,6 @@ class AMAN:
         if None != self.receiver:
             del self.receiver
         self.receiver = None
+
+        for worker in self.workers:
+            worker.stop()