A ro_task can contain several 'tasks', each one with a target, where to store the results
"""
-import logging
-import queue
-import threading
-import time
-import yaml
from copy import deepcopy
from http import HTTPStatus
+import logging
from os import mkdir
-from pkg_resources import iter_entry_points
+import queue
from shutil import rmtree
+import threading
+import time
from unittest.mock import Mock
-# from osm_common import dbmongo, dbmemory, fslocal, fsmongo, msglocal, msgkafka, version as common_version
+from importlib_metadata import entry_points
from osm_common.dbbase import DbException
-from osm_ro_plugin.vim_dummy import VimDummyConnector
-from osm_ro_plugin.sdn_dummy import SdnDummyConnector
-from osm_ro_plugin import vimconn, sdnconn
from osm_ng_ro.vim_admin import LockRenew
-
+from osm_ro_plugin import sdnconn, vimconn
+from osm_ro_plugin.sdn_dummy import SdnDummyConnector
+from osm_ro_plugin.vim_dummy import VimDummyConnector
+import yaml
__author__ = "Alfonso Tierno"
__date__ = "$28-Sep-2017 12:07:15$"
)
elif len(vim_images) > 1:
raise NsWorkerException(
- "More than one network found with this criteria: '{}'".format(
+ "More than one image found with this criteria: '{}'".format(
task["find_params"]
)
)
return self.plugins[name]
try:
- for v in iter_entry_points("osm_ro{}.plugins".format(type), name):
- self.plugins[name] = v.load()
+ for ep in entry_points(group="osm_ro{}.plugins".format(type), name=name):
+ self.plugins[name] = ep.load()
except Exception as e:
raise NsWorkerException("Cannot load plugin osm_{}: {}".format(name, e))
next_check_at = min(
next_check_at, dependency_ro_task["to_check_at"]
)
+ # must allow dependent task to be processed first
+ # to do this set time after last_task_processed
+ next_check_at = max(
+ self.time_last_task_processed, next_check_at
+ )
break
elif dependency_task["status"] == "FAILED":
error_text = "Cannot {} {} because depends on failed {} {} id={}): {}".format(