diff --git a/ion/agents/instrument/instrument_agent.py b/ion/agents/instrument/instrument_agent.py index d1f628372..9ef9259a2 100644 --- a/ion/agents/instrument/instrument_agent.py +++ b/ion/agents/instrument/instrument_agent.py @@ -42,14 +42,6 @@ import numpy import gevent -# MI exceptions -from ion.core.includes.mi_exceptions import InstrumentTimeoutException -from ion.core.includes.mi_exceptions import InstrumentParameterException -from ion.core.includes.mi_exceptions import SampleException -from ion.core.includes.mi_exceptions import InstrumentStateException -from ion.core.includes.mi_exceptions import InstrumentProtocolException -from ion.core.includes.mi_exceptions import InstrumentException - # ION imports. from ion.agents.instrument.driver_process import DriverProcess from ion.agents.instrument.common import BaseEnum @@ -355,12 +347,12 @@ def _handler_inactive_go_active(self, *args, **kwargs): try: next_state = self._dvr_client.cmd_dvr('discover_state') break - except InstrumentTimeoutException, InstrumentProtocolException: + except Timeout, ResourceError: no_tries += 1 if no_tries >= max_tries: self._dvr_client.cmd_dvr('disconnect') - # fixfix - raise ResourceError('Could not discover instrument state.') + log.error("Could not discover instrument state") + raise return (next_state, None) diff --git a/ion/agents/instrument/test/test_instrument_agent.py b/ion/agents/instrument/test/test_instrument_agent.py index bbea9f7f0..f4f3b86dc 100644 --- a/ion/agents/instrument/test/test_instrument_agent.py +++ b/ion/agents/instrument/test/test_instrument_agent.py @@ -121,7 +121,7 @@ IA_CLS = 'InstrumentAgent' # A seabird driver. -DRV_URI = 'http://sddevrepo.oceanobservatories.org/releases/seabird_sbe37smb_ooicore-0.0.4-py2.7.egg' +DRV_URI = 'http://sddevrepo.oceanobservatories.org/releases/seabird_sbe37smb_ooicore-0.0.5-py2.7.egg' DRV_MOD = 'mi.instrument.seabird.sbe37smb.ooicore.driver' DRV_CLS = 'SBE37Driver' diff --git a/ion/core/includes/mi_exceptions.py b/ion/core/includes/mi_exceptions.py deleted file mode 100644 index 5e0f200cd..000000000 --- a/ion/core/includes/mi_exceptions.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python - -""" -@package ion.core.includes.mi_exceptions Exception classes for MI work -@file ion/services/mi/exceptions.py -@author Edward Hunter -@brief Common exceptions used in the MI work. Specific ones can be subclassed -in the driver code. -""" - -##### -## For goodish reasons this file is maintained in both the marine-integration -## repository AND coi-services (HERE). It is required to keep these files -## synced. -## -## To maintain backwards capability exceptions in this file should not be -## changed or remove. We should only add. -##### - -__author__ = 'Edward Hunter' -__license__ = 'Apache 2.0' - -from ion.agents.instrument.common import BaseEnum -import traceback - -class InstErrorCode(BaseEnum): - """Error codes generated by instrument drivers and agents""" - - TIMEOUT = ['ERROR_TIMEOUT','The message or operation timed out.'] - REQUIRED_PARAMETER = ['ERROR_REQUIRED_PARAMETER','A required parameter was not specified.'] - -class InstrumentException(Exception): - """Base class for an exception related to physical instruments or their - representation in ION. - """ - - def __init__ (self, msg=None, error_code=None): - self.args = (error_code, msg) - self.error_code = error_code - self.msg = msg - -class InstrumentConnectionException(InstrumentException): - """Exception related to connection with a physical instrument""" - pass - -class InstrumentProtocolException(InstrumentException): - """Exception related to an instrument protocol problem - - These are generally related to parsing or scripting of what is supposed - to happen when talking at the lowest layer protocol to a device. - @todo Add partial result property? - """ - pass - -class InstrumentStateException(InstrumentException): - """Exception related to an instrument state of any sort""" - pass - -class InstrumentTimeoutException(InstrumentException): - """Exception related to a command, request, or communication timing out""" - def __init__(self, error_code=InstErrorCode.TIMEOUT, msg=None): - InstrumentException.__init__(self, msg=msg, error_code=error_code) - -class InstrumentDataException(InstrumentException): - """Exception related to the data returned by an instrument or developed - along the path of handling that data""" - pass - -class TestModeException(InstrumentException): - """Attempt to run a test command while not in test mode""" - pass - -class InstrumentCommandException(InstrumentException): - """A problem with the command sent toward the instrument""" - pass - -class InstrumentParameterException(InstrumentException): - """A required parameter is not supplied""" - def __init__(self, msg=None, error_code=None): - if error_code == None: - error_code = InstErrorCode.REQUIRED_PARAMETER - if msg == None: - msg = "" - - InstrumentException.__init__(self, error_code, msg) - -class NotImplementedException(InstrumentException): - """ - A driver function is not implemented. - """ - pass - -class ReadOnlyException(InstrumentException): - """ - A driver function is not implemented. - """ - pass - -class SampleException(InstrumentException): - """ - An expected sample could not be extracted. - """ - pass - -class SchedulerException(InstrumentException): - """ - An error occurred in the scheduler - """ - pass