1919import shutil
2020import zipfile
2121import getopt
22- import traceback
2322
2423import pyrunner .serde as serde
2524import pyrunner .notification as notification
@@ -60,7 +59,7 @@ def __init__(self, **kwargs):
6059 raise OSError ('Another process for "{}" is already running!' .format (self .config ['app_name' ]))
6160 else :
6261 # Clear signals, if any, to ensure clean start.
63- self .signal_handler .consume ()
62+ self .signal_handler .consume_all ()
6463
6564 def reset_env (self ):
6665 os .environ .clear ()
@@ -360,7 +359,8 @@ def parse_args(self, run_getopts=True):
360359 'env=' , 'cvar=' , 'context=' , 'time-between-tasks=' ,
361360 'to=' , 'from=' , 'descendants=' , 'ancestors=' ,
362361 'norun=' , 'exec-only=' , 'exec-proc-name=' ,
363- 'max-procs=' , 'serde=' , 'exec-loop-interval='
362+ 'max-procs=' , 'serde=' , 'exec-loop-interval=' ,
363+ 'notify-on-fail=' , 'notify-on-success=' , 'as-service'
364364 ]
365365
366366 if run_getopts :
@@ -396,6 +396,10 @@ def parse_args(self, run_getopts=True):
396396 self .config ['email_on_fail' ] = arg
397397 elif opt in ['--email-on-success' ]:
398398 self .config ['email_on_success' ] = arg
399+ elif opt == '--notify-on-fail' :
400+ self .config ['notify_on_fail' ] = arg
401+ elif opt == '--notify-on-success' :
402+ self .config ['nitory_on_success' ] = arg
399403 elif opt == '--env' :
400404 parts = arg .split ('=' )
401405 os .environ [parts [0 ]] = parts [1 ]
@@ -420,6 +424,8 @@ def parse_args(self, run_getopts=True):
420424 self .config ['allow_duplicate_jobs' ] = True
421425 elif opt in ['--exec-proc-name' ]:
422426 self .config ['exec_proc_name' ] = arg
427+ elif opt == '--as-service' :
428+ self .config ['as_service' ] = True
423429 elif opt == '--abort' :
424430 abort = True
425431 elif opt == '--silent' :
0 commit comments