3232from pyrunner .core .signal import SignalHandler , SIG_ABORT , SIG_PAUSE , SIG_PULSE
3333from pyrunner .version import __version__
3434
35+ from pyrunner .notification import Notification
36+
3537from datetime import datetime as datetime
3638import pickle
3739import time
@@ -41,7 +43,7 @@ class PyRunner:
4143 def __init__ (self , ** kwargs ):
4244 self ._environ = os .environ .copy ()
4345 self .config = Config ()
44- self .notification = notification .EmailNotification ()
46+ self ._notification = notification .EmailNotification ()
4547 self .signal_handler = SignalHandler (self .config )
4648
4749 self .serde_obj = serde .ListSerDe ()
@@ -84,6 +86,16 @@ def load_proc_file(self, proc_file, restart=False):
8486
8587 return True
8688
89+ @property
90+ def notification (self ):
91+ return self ._notification
92+ @notification .setter
93+ def notification (self , o ):
94+ if not issubclass (o , Notification ):
95+ raise TypeError ('Not an extension of pyrunner.notification.Notification' )
96+ self ._notification = o
97+ return self
98+
8799 @property
88100 def version (self ):
89101 return __version__
@@ -342,7 +354,7 @@ def parse_args(self, run_getopts=True):
342354 opt_list = 'c:l:n:e:x:N:D:A:t:drhiv'
343355 longopt_list = [
344356 'setup' , 'help' , 'nozip' , 'interactive' , 'abort' ,
345- 'restart' , 'version' , 'dryrun' , 'debug' ,
357+ 'restart' , 'version' , 'dryrun' , 'debug' , 'silent' ,
346358 'preserve-context' , 'dump-logs' , 'allow-duplicate-jobs' ,
347359 'email=' , 'email-on-fail=' , 'email-on-success=' ,
348360 'env=' , 'cvar=' , 'context=' , 'time-between-tasks=' ,
@@ -410,6 +422,8 @@ def parse_args(self, run_getopts=True):
410422 self .config ['exec_proc_name' ] = arg
411423 elif opt == '--abort' :
412424 abort = True
425+ elif opt == '--silent' :
426+ self .config ['silent' ] = True
413427 elif opt in ['--serde' ]:
414428 if arg .lower () == 'json' :
415429 self .plugin_serde (serde .JsonSerDe ())
0 commit comments