Permalink
Browse files

logExceptions now takes a logger not a logger-getter function. Someon…

…e's earlier PR failed to fix them all up, so this should do the trick.
  • Loading branch information...
1 parent fb30f5d commit 8b45d872e7df50b9679749dbaa715877b326d3d1 @vitaly-krugl vitaly-krugl committed Sep 17, 2016
@@ -39,7 +39,9 @@
from nupic.data.fieldmeta import FieldMetaInfo
from nupic.data.record_stream import RecordStreamIface
from nupic.frameworks.opf.modelfactory import ModelFactory
-from nupic.support.decorators import logExceptions
+
+from nta.utils.error_handling import logExceptions
+from nta.utils.logging_support_raw import LoggingSupport
from htmengine import htmengineerrno
from htmengine.htmengine_logging import getExtendedLogger, getStandardLogPrefix
@@ -51,8 +53,6 @@
ModelCommand, ModelCommandResult, ModelInferenceResult, ModelInputRow,
ModelSwapperInterface)
-from nta.utils.logging_support_raw import LoggingSupport
-
_MODULE_NAME = "htmengine.model_runner"
@@ -169,7 +169,7 @@ def close(self):
self._swapperAPI.close()
- @logExceptions(_getLogger)
+ @logExceptions(_getLogger())
def run(self):
startTime = time.time()
@@ -33,11 +33,11 @@
import threading
-from nupic.support.decorators import logExceptions
+from nta.utils.error_handling import abortProgramOnAnyException
+from nta.utils.error_handling import logExceptions
-from htmengine import htmengine_logging
-from nta.utils.error_handling import abortProgramOnAnyException
+from htmengine import htmengine_logging
@@ -163,7 +163,7 @@ def flush(self):
@abortProgramOnAnyException(
_EXIT_CODE_ON_UNHANDLED_EXCEPTION_IN_THREAD,
logger=_getLogger())
- @logExceptions(_getLogger)
+ @logExceptions(_getLogger())
def _runProcessMonitorThread(self):
self._logger.debug("%s: _runProcessMonitorThread is running", self)
self._process.wait()
@@ -279,7 +279,7 @@ def releaseSlot(self):
@abortProgramOnAnyException(
_EXIT_CODE_ON_UNHANDLED_EXCEPTION_IN_THREAD,
logger=_getLogger())
- @logExceptions(_getLogger)
+ @logExceptions(_getLogger())
def _runEventLoop(self):
""" Thread function for servicing the slot: starts the ModelRunner process,
feeds data to it, stops it, detects the stop, and notifies user that it
@@ -31,13 +31,15 @@
import threading
import time
-from nupic.support.decorators import logExceptions, logEntryExit
+from nupic.support.decorators import logEntryExit
+
+from nta.utils.error_handling import abortProgramOnAnyException
+from nta.utils.error_handling import logExceptions
from htmengine.model_swapper import ModelSwapperConfig
from htmengine.model_swapper.model_swapper_interface import (
ModelSwapperInterface)
from htmengine.model_swapper.slot_agent import SlotAgent
-from nta.utils.error_handling import abortProgramOnAnyException
from htmengine import htmengine_logging
@@ -131,7 +133,7 @@ def __init__(self, concurrency):
@logEntryExit(_getLogger, logging.INFO)
- @logExceptions(_getLogger)
+ @logExceptions(_getLogger())
def run(self):
""" Run SwapController; blocking """
# Start our input-reader thread
@@ -376,7 +378,7 @@ def _requestPreemptionOfRunningSlotIfNeededAndPossible(self):
_EXIT_CODE_ON_FAILURE_OF_NOTIFICATION_READER_THREAD,
logger=_getLogger())
@logEntryExit(_getLogger, logging.INFO)
- @logExceptions(_getLogger)
+ @logExceptions(_getLogger())
def _runNotificationReaderThread(self):
""" Read model data notifications and pass them to the event loop """
self._logger.info("Notification Reader thread is running")
@@ -30,7 +30,7 @@
import threading
-from nupic.support.decorators import logExceptions
+from nta.utils.error_handling import logExceptions
from htmengine.model_swapper.model_swapper_interface import (
ModelSwapperInterface)
@@ -136,7 +136,7 @@ def _unregister(self, cb):
self._callbacks.remove(cb)
- @logExceptions(_getLogger)
+ @logExceptions(_getLogger())
def _runReaperThread(self):
while True:
try:

0 comments on commit 8b45d87

Please sign in to comment.