dev
Steve Nyemba 2 years ago
parent 7e92571d0a
commit d89daf76d6

@ -59,7 +59,7 @@ class Learner(Process):
# @TODO: allow for verbose mode so we have a sens of what is going on within the newtork
#
_log = {'action':'init','context':self.info['context'],'gpu':(self.gpu if self.gpu is not None else -1)}
_log = {'action':'init','gpu':(self.gpu if self.gpu is not None else -1)}
self.log(**_log)
# self.logpath= _args['logpath'] if 'logpath' in _args else 'logs'
@ -67,8 +67,10 @@ class Learner(Process):
def log(self,**_args):
# self.lock.acquire()
try:
_context = self.info['context']
_label = self.info['info'] if 'info' in self.info else _context
logger = transport.factory.instance(**self.store['logger']) if 'logger' in self.store else transport.factory.instance(provider='console',context='write',lock=True)
_args = dict({'ndx':self.ndx,'module':self.name,'table':self.info['from'],'info':self.info['context'],**_args})
_args = dict({'ndx':self.ndx,'module':self.name,'table':self.info['from'],'context':_context,'info':_info,**_args})
logger.write(_args)
self.ndx += 1
if hasattr(logger,'close') :
@ -345,7 +347,7 @@ class Generator (Learner):
_type = np.float
if _type :
_df[name] = _df[name].fillna(0).replace('',0).replace('NA',0).replace('nan',0).astype(_type)
_df[name] = _df[name].fillna(0).replace(' ',0).replace('',0).replace('NA',0).replace('nan',0).astype(_type)
# else:
# _df[name] = _df[name].astype(str)
# _df = _df.replace('NaT','').replace('NA','')
@ -397,7 +399,10 @@ class Generator (Learner):
# print (_df[cols])
writer = transport.factory.instance(**_store)
writer.write(_df[:],schema=_schema)
if _store['provider'] == 'bigquery':
writer.write(_df,schema=[],table=self.info['from'])
else:
writer.write(_df,table=self.info['from'])

Loading…
Cancel
Save