dev
Steve Nyemba 3 years ago
parent 260f102186
commit d6fd7bceba

@ -214,7 +214,7 @@ class Learner(Process):
self.logger = transport.factory.instance(_args['logger']) if 'logger' in self.store else transport.factory.instance(provider='console',context='write',lock=True)
if 'network_args' not in _args :
self.network_args ={
'context':_args['context'] if 'context' in _args else 'GENERAL',
'context':self.info['context'] ,
'logs':_args['logpath'] if 'logpath' in _args else 'logs',
'max_epochs':int(_args['epochs']) if 'epochs' in _args else 2,
'batch_size':int (_args['batch']) if 'batch' in _args else 2000
@ -363,7 +363,13 @@ class Generator (Learner):
#-- synthetic date
_date = datetime(year=year,month=month,day=day)
FORMAT = _args['format'] if 'format' in _args else '%Y-%m-%d'
FORMAT = '%Y-%m-%d'
if 'format' in self.info and 'field' in _args and _args['field'] in self.info['format']:
_name = _args['field']
FORMAT = self.info['format'][_name]
r = []
if offset :
r = [_date.strftime(FORMAT)]
@ -382,6 +388,8 @@ class Generator (Learner):
_store = self.store['target'] if 'target' in self.store else {'provider':'console'}
_store['lock'] = True
_store['context'] = 'write' #-- Just in case
if 'table' not in _store :
_store['table'] = self.info['from']
writer = transport.factory.instance(**_store)
for _iodf in _candidates :
@ -398,11 +406,12 @@ class Generator (Learner):
iname = self.info['make_date'][name]
years = _df[iname]
_dates = [self.make_date(year=year) for year in years]
_dates = [self.make_date(year=year,field=name) for year in years]
if _dates :
_df[name] = _dates
writer.write(_df[['birth_datetime']+self.columns],schema=self.get_schema())
_schema = self.get_schema()
_schema = [{'name':_item.name,'type':_item.field_type} for _item in _schema]
writer.write(_df[['birth_datetime']+self.columns],schema=_schema)
pass
class factory :
_infocache = {}

Loading…
Cancel
Save