1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# ETL system- Extract Transfer Load system
5
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
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.
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.
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/>.
21
##############################################################################
24
The class for ETL transition.
29
class transition(signal.signal):
31
Base class of ETL transition.
35
def action_start(self,key,signal_data={},data={}):
37
self.logger.notifyChannel("transition", logger.LOG_INFO,
38
'the '+str(self)+' is start now...')
41
def action_pause(self,key,signal_data={},data={}):
43
self.logger.notifyChannel("transition", logger.LOG_INFO,
44
'the '+str(self)+' is pause now...')
47
def action_stop(self,key,signal_data={},data={}):
49
self.logger.notifyChannel("transition", logger.LOG_INFO,
50
'the '+str(self)+' is stop now...')
54
return str(self.source)+' to '+str(self.destination)
56
def __init__(self, source, destination, channel_source='main', channel_destination='main', type='data'):
57
super(transition, self).__init__()
60
self.destination = destination
61
self.channel_source = channel_source
62
self.channel_destination = channel_destination
63
self.destination.trans_in.append((channel_destination,self))
64
self.source.trans_out.append((channel_source,self))
65
self.status='open' # open,start,pause,stop,close
66
# open : active, start : in running, pause : pause, stop: stop, close : inactive
68
self.logger = logger.logger()
69
self.signal_connect(self,'start',self.action_start)
70
self.signal_connect(self,'pause',self.action_pause)
71
self.signal_connect(self,'stop',self.action_stop)