pull/1/head
Steve L. Nyemba 5 years ago
parent b0380be861
commit aaad4003a9

@ -20,8 +20,8 @@ class DiskReader(Reader) :
return os.path.exists(self.path) return os.path.exists(self.path)
def read(self,size=-1): def read(self,size=-1):
""" """
This function reads the rows from a designated location on disk This function reads the rows from a designated location on disk
@param size number of rows to be read, -1 suggests all rows @param size number of rows to be read, -1 suggests all rows
""" """
f = open(self.path,'rU') f = open(self.path,'rU')
@ -47,8 +47,8 @@ class DiskWriter(Writer):
self.name = params['name']; self.name = params['name'];
else: else:
self.name = 'out.log' self.name = 'out.log'
if os.path.exists(self.path) == False: # if os.path.exists(self.path) == False:
os.mkdir(self.path) # os.mkdir(self.path)
def isready(self): def isready(self):
""" """
@ -66,20 +66,20 @@ class DiskWriter(Writer):
@param row row to be written @param row row to be written
""" """
label = params['label'] # label = params['label']
row = params['row'] row = params['row']
xchar = None # xchar = None
if 'xchar' is not None: # if 'xchar' is not None:
xchar = params['xchar'] # xchar = params['xchar']
#path = ''.join([self.path,os.sep,label]) #path = ''.join([self.path,os.sep,label])
path = ''.join([self.path,os.sep,self.name]) # path = ''.join([self.path,os.sep,self.name])
#if os.path.exists(path) == False: #if os.path.exists(path) == False:
# os.mkdir(path) ; # os.mkdir(path) ;
path = ''.join([path,os.sep,self.name]) # path = ''.join([path,os.sep,self.name])
f = open(path,'a') f = open(self.path,'a')
if isinstance(row,object): if isinstance(row,object):
row = json.dumps(row) row = json.dumps(row)
#row = self.format(row,xchar); #row = self.format(row,xchar);
f.write(row) f.write(row+"\n")
f.close() f.close()

Loading…
Cancel
Save