Updates for Python 3.10 and Ubuntu 22.04
[osm/POL.git] / osm_policy_module / autoscaling / service.py
index d195bb7..fd96da3 100644 (file)
@@ -22,7 +22,6 @@
 # For those usages not covered by the Apache License, Version 2.0 please
 # contact: bdiaz@whitestack.com or glavado@whitestack.com
 ##
-import asyncio
 import datetime
 import json
 import logging
@@ -50,14 +49,11 @@ log = logging.getLogger(__name__)
 
 
 class AutoscalingService:
-    def __init__(self, config: Config, loop=None):
+    def __init__(self, config: Config):
         self.conf = config
-        if not loop:
-            loop = asyncio.get_event_loop()
-        self.loop = loop
         self.db_client = CommonDbClient(config)
-        self.mon_client = MonClient(config, loop=self.loop)
-        self.lcm_client = LcmClient(config, loop=self.loop)
+        self.mon_client = MonClient(config)
+        self.lcm_client = LcmClient(config)
 
     async def configure_scaling_groups(self, nsr_id: str, vnf_member_index=None):
         """
@@ -198,7 +194,7 @@ class AutoscalingService:
                                                     operation=scaling_criteria[
                                                         "scale-in-relational-operation"
                                                     ],
-                                                    action="scale_in"
+                                                    action="scale_in",
                                                 )
                                             )
                                             alarm = ScalingAlarmRepository.create(
@@ -262,8 +258,10 @@ class AutoscalingService:
                     if vnf_member_index is None:
                         scale_conditions = ScalingGroup.nsr_id == nsr_id
                     else:
-                        query_list = [ScalingGroup.nsr_id == nsr_id,
-                                      ScalingGroup.vnf_member_index == vnf_member_index]
+                        query_list = [
+                            ScalingGroup.nsr_id == nsr_id,
+                            ScalingGroup.vnf_member_index == vnf_member_index,
+                        ]
                         scale_conditions = functools.reduce(operator.and_, query_list)
                     for scaling_group in ScalingGroupRepository.list(scale_conditions):
                         for scaling_policy in scaling_group.scaling_policies: