11import logging
22
3+ from mongodb_consistent_backup .Errors import Error , NotifyError
34from mongodb_consistent_backup .Notify .Nsca import Nsca
45from mongodb_consistent_backup .Pipeline import Stage
56
@@ -9,7 +10,6 @@ def __init__(self, manager, config, timer, base_dir, backup_dir):
910 super (Notify , self ).__init__ (self .__class__ .__name__ , manager , config , timer , base_dir , backup_dir )
1011 self .task = self .config .notify .method
1112
12- self .completed = False
1313 self .notifications = []
1414 self .init ()
1515
@@ -19,19 +19,19 @@ def notify(self, message, success=False):
1919
2020 def run (self , * args ):
2121 if self ._task and len (self .notifications ) > 0 :
22- logging . info ( "Sending %i notification(s) to: %s" % ( len ( self . notifications ), self . _task . server ))
23- self . timers . start ( self .stage )
24- while len (self .notifications ) > 0 :
25- try :
26- (success , message ) = self .notifications .pop ()
27- state = self ._task .failed
28- if success :
29- state = self ._task .success
30- self ._task .run (state , message )
31- except :
32- continue
33- self . timers . stop ( self . stage )
34- self . completed = True
22+ try :
23+ logging . info ( "Sending %i notification(s) to: %s" % ( len ( self .notifications ), self . _task . server ) )
24+ while len (self .notifications ) > 0 :
25+ try :
26+ (success , message ) = self .notifications .pop ()
27+ state = self ._task .failed
28+ if success == True :
29+ state = self ._task .success
30+ self ._task .run (state , message )
31+ except NotifyError :
32+ continue
33+ except Exception , e :
34+ raise Error ( e )
3535
3636 def close (self ):
3737 if self ._task :
0 commit comments