0001-cron-do-not-abort-on-unhandled-exceptions-by-default.patch
wcs/qommon/management/commands/cron.py | ||
---|---|---|
39 | 39 |
action='store_true', |
40 | 40 |
help='Run even if DISABLE_CRON_JOBS is set in settings', |
41 | 41 |
) |
42 |
parser.add_argument( |
|
43 |
'--abort-on-exception', |
|
44 |
dest='abort_on_exception', |
|
45 |
action='store_true', |
|
46 |
help='Abort on unhandled exception', |
|
47 |
) |
|
42 | 48 |
parser.add_argument('--job', dest='job_name', metavar='NAME') |
43 | 49 | |
44 | 50 |
def handle(self, verbosity, **options): |
... | ... | |
63 | 69 |
if verbosity > 1: |
64 | 70 |
print('cron work on %s' % hostname) |
65 | 71 |
publisher.set_tenant_by_hostname(hostname) |
66 |
cron_worker(publisher, now, job_name=options.get('job_name')) |
|
72 |
try: |
|
73 |
cron_worker(publisher, now, job_name=options.get('job_name')) |
|
74 |
except Exception as e: |
|
75 |
if options.get('abort_on_exception'): |
|
76 |
raise |
|
77 |
print('unhandled exception during cron work on %s (%s)' % (hostname, e)) |
|
67 | 78 |
if verbosity > 2: |
68 | 79 |
print('cron end (release lock %s)' % lockfile) |
69 | 80 |
except locket.LockError: |
70 |
- |