|
|
@ -48,6 +48,9 @@ class IO:
|
|
|
|
_date = str(datetime.now())
|
|
|
|
_date = str(datetime.now())
|
|
|
|
_data = dict({'pid':os.getpid(),'date':_date[:10],'time':_date[11:19]},**_args)
|
|
|
|
_data = dict({'pid':os.getpid(),'date':_date[:10],'time':_date[11:19]},**_args)
|
|
|
|
for key in _data :
|
|
|
|
for key in _data :
|
|
|
|
|
|
|
|
if type(_data[key]) == list :
|
|
|
|
|
|
|
|
_data[key] = [_item.__name__ if type(_item).__name__== 'function' else _item for _item in _data[key]]
|
|
|
|
|
|
|
|
|
|
|
|
_data[key] = str(_data[key]) if type(_data[key]) not in [list,dict] else json.dumps(_data[key])
|
|
|
|
_data[key] = str(_data[key]) if type(_data[key]) not in [list,dict] else json.dumps(_data[key])
|
|
|
|
self._logger.write(pd.DataFrame([_data])) #,table=self._logTable)
|
|
|
|
self._logger.write(pd.DataFrame([_data])) #,table=self._logTable)
|
|
|
|
def _init_plugins(self,_items):
|
|
|
|
def _init_plugins(self,_items):
|
|
|
@ -57,7 +60,8 @@ class IO:
|
|
|
|
registry.plugins.init()
|
|
|
|
registry.plugins.init()
|
|
|
|
self._plugins = PluginLoader(registry=registry.plugins)
|
|
|
|
self._plugins = PluginLoader(registry=registry.plugins)
|
|
|
|
[self._plugins.set(_name) for _name in _items]
|
|
|
|
[self._plugins.set(_name) for _name in _items]
|
|
|
|
self.log(action='init-plugins',caller='read', input =[_name for _name in _items])
|
|
|
|
|
|
|
|
|
|
|
|
self.log(action='init-plugins',caller='read',object=self.getClassName(self),input =[_name for _name in _items])
|
|
|
|
# if 'path' in _args and 'names' in _args :
|
|
|
|
# if 'path' in _args and 'names' in _args :
|
|
|
|
# self._plugins = PluginLoader(**_args)
|
|
|
|
# self._plugins = PluginLoader(**_args)
|
|
|
|
# else:
|
|
|
|
# else:
|
|
|
@ -69,7 +73,8 @@ class IO:
|
|
|
|
if hasattr(self._agent,'meta') :
|
|
|
|
if hasattr(self._agent,'meta') :
|
|
|
|
return self._agent.meta(**_args)
|
|
|
|
return self._agent.meta(**_args)
|
|
|
|
return []
|
|
|
|
return []
|
|
|
|
|
|
|
|
def getClassName (self,_object):
|
|
|
|
|
|
|
|
return '.'.join([_object.__class__.__module__,_object.__class__.__name__])
|
|
|
|
def close(self):
|
|
|
|
def close(self):
|
|
|
|
if hasattr(self._agent,'close') :
|
|
|
|
if hasattr(self._agent,'close') :
|
|
|
|
self._agent.close()
|
|
|
|
self._agent.close()
|
|
|
@ -79,6 +84,7 @@ class IO:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
for _pointer in self._plugins :
|
|
|
|
for _pointer in self._plugins :
|
|
|
|
_data = _pointer(_data)
|
|
|
|
_data = _pointer(_data)
|
|
|
|
|
|
|
|
time.sleep(1)
|
|
|
|
def apply(self,_query):
|
|
|
|
def apply(self,_query):
|
|
|
|
if hasattr(self._agent,'apply') :
|
|
|
|
if hasattr(self._agent,'apply') :
|
|
|
|
return self._agent.apply(_query)
|
|
|
|
return self._agent.apply(_query)
|
|
|
|