Package etl :: Package component :: Package transform :: Module logger_bloc
[hide private]
[frames] | no frames]

Source Code for Module etl.component.transform.logger_bloc

 1  # -*- encoding: utf-8 -*- 
 2  ############################################################################## 
 3  # 
 4  #    ETL system- Extract Transfer Load system 
 5  #    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved 
 6  #    $Id$ 
 7  # 
 8  #    This program is free software: you can redistribute it and/or modify 
 9  #    it under the terms of the GNU General Public License as published by 
10  #    the Free Software Foundation, either version 3 of the License, or 
11  #    (at your option) any later version. 
12  # 
13  #    This program is distributed in the hope that it will be useful, 
14  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
15  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
16  #    GNU General Public License for more details. 
17  # 
18  #    You should have received a copy of the GNU General Public License 
19  #    along with this program.  If not, see <http://www.gnu.org/licenses/>. 
20  # 
21  ############################################################################## 
22  """ 
23   To display log detail in end of process. 
24   
25   Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).  
26   GNU General Public License. 
27  """ 
28   
29  from etl.component import component 
30  import sys 
31 -class logger_bloc(component):
32 """ 33 This is an ETL Component that displays log detail at the end of process. 34 35 Type : Data Component. 36 Computing Performance : Bloc. 37 Input Flows : 0-x. 38 * .* : The main data flow with input data. 39 Output Flows : 0-y. 40 * .* : Returns the main flow. 41 """
42 - def __init__(self, output=sys.stdout, name='component.output.logger_bloc'):
43 super(logger_bloc, self).__init__(name=name) 44 self._type = 'component.transfer.logger_bloc' 45 self.output = output
46
47 - def __copy__(self):
48 res = logger_bloc(self.output, self.name) 49 return res
50
51 - def process(self):
52 datas = [] 53 for channel, trans in self.input_get().items(): 54 for iterator in trans: 55 for d in iterator: 56 datas.append(d) 57 for d in datas: 58 self.output.write('\tBloc Log ' + self.name + str(d) + '\n') 59 yield d, 'main' 60