|
|
|
@ -23,13 +23,15 @@ class IO:
|
|
|
|
|
"""
|
|
|
|
|
Base wrapper class for read/write and support for logs
|
|
|
|
|
"""
|
|
|
|
|
def __init__(self,_agent,plugins,_logger=None):
|
|
|
|
|
def __init__(self,**_args):
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# We need to initialize the logger here ...
|
|
|
|
|
#
|
|
|
|
|
# registry.init()
|
|
|
|
|
|
|
|
|
|
_agent = _args['agent']
|
|
|
|
|
plugins = _args['plugins']
|
|
|
|
|
_logger = _args['logger']
|
|
|
|
|
self._logger = _logger if not type(_agent) in [IReader,IWriter] else _agent._logger #transport.get.writer(label='logger') #if registry.has('logger') else None
|
|
|
|
|
# if not _logger and hasattr(_agent,'_logger') :
|
|
|
|
|
# self._logger = getattr(_agent,'_logger')
|
|
|
|
@ -100,9 +102,9 @@ class IReader(IO):
|
|
|
|
|
"""
|
|
|
|
|
This is a wrapper for read functionalities
|
|
|
|
|
"""
|
|
|
|
|
def __init__(self,_agent,_plugins=None,_logger=None):
|
|
|
|
|
super().__init__(_agent,_plugins,_logger)
|
|
|
|
|
self._args = if 'args' in _args else None
|
|
|
|
|
def __init__(self,**_args):
|
|
|
|
|
super().__init__(_args['agent'],_args['plugins'],_args['logger'])
|
|
|
|
|
self._args = _args['args']if 'args' in _args else None
|
|
|
|
|
def _stream (self,_data ):
|
|
|
|
|
# self.log(action='streaming',object=self._agent._engine.name, input= type(_data).__name__)
|
|
|
|
|
_shape = []
|
|
|
|
@ -148,8 +150,8 @@ class IReader(IO):
|
|
|
|
|
|
|
|
|
|
class IWriter(IO):
|
|
|
|
|
lock = RLock()
|
|
|
|
|
def __init__(self,_agent,pipeline=None,_logger=None):
|
|
|
|
|
super().__init__(_agent,pipeline,_logger)
|
|
|
|
|
def __init__(self,**_args):
|
|
|
|
|
super().__init__(_args['agent'],_args['plugins'],_args['logger'])
|
|
|
|
|
def write(self,_data,**_args):
|
|
|
|
|
if 'plugins' in _args :
|
|
|
|
|
self._init_plugins(_args['plugins'])
|
|
|
|
|