@@ -387,7 +387,7 @@ def run(
387
387
return False
388
388
389
389
# Catch unhandled errors in the setup step
390
- except Exception as e : # noqa
390
+ except Exception :
391
391
log .exception (
392
392
'An unhandled exception was raised during build setup' ,
393
393
extra = {
@@ -411,14 +411,14 @@ def run(
411
411
self .setup_env .update_build (BUILD_STATE_FINISHED )
412
412
413
413
# Send notifications for unhandled errors
414
- self .send_notifications ()
414
+ self .send_notifications (version_pk , build_pk )
415
415
return False
416
416
else :
417
417
# No exceptions in the setup step, catch unhandled errors in the
418
418
# build steps
419
419
try :
420
420
self .run_build (docker = docker , record = record )
421
- except Exception as e : # noqa
421
+ except Exception :
422
422
log .exception (
423
423
'An unhandled exception was raised during project build' ,
424
424
extra = {
@@ -439,7 +439,7 @@ def run(
439
439
self .build_env .update_build (BUILD_STATE_FINISHED )
440
440
441
441
# Send notifications for unhandled errors
442
- self .send_notifications ()
442
+ self .send_notifications (version_pk , build_pk )
443
443
return False
444
444
445
445
return True
@@ -497,7 +497,7 @@ def run_setup(self, record=True):
497
497
# triggered before the previous one has finished (e.g. two webhooks,
498
498
# one after the other)
499
499
if not isinstance (self .setup_env .failure , VersionLockedError ):
500
- self .send_notifications ()
500
+ self .send_notifications (self . version . pk , self . build [ 'id' ] )
501
501
502
502
return False
503
503
@@ -566,15 +566,14 @@ def run_build(self, docker, record):
566
566
# TODO the build object should have an idea of these states,
567
567
# extend the model to include an idea of these outcomes
568
568
outcomes = self .build_docs ()
569
- build_id = self .build .get ('id' )
570
569
except vcs_support_utils .LockTimeout as e :
571
570
self .task .retry (exc = e , throw = False )
572
571
raise VersionLockedError
573
572
except SoftTimeLimitExceeded :
574
573
raise BuildTimeoutError
575
574
576
575
# Finalize build and update web servers
577
- if build_id :
576
+ if self . build . get ( 'id' ) :
578
577
self .update_app_instances (
579
578
html = bool (outcomes ['html' ]),
580
579
search = bool (outcomes ['search' ]),
@@ -586,7 +585,7 @@ def run_build(self, docker, record):
586
585
log .warning ('No build ID, not syncing files' )
587
586
588
587
if self .build_env .failed :
589
- self .send_notifications ()
588
+ self .send_notifications (self . version . pk , self . build [ 'id' ] )
590
589
591
590
build_complete .send (sender = Build , build = self .build_env .build )
592
591
@@ -920,9 +919,9 @@ def build_docs_class(self, builder_class):
920
919
builder .move ()
921
920
return success
922
921
923
- def send_notifications (self ):
922
+ def send_notifications (self , version_pk , build_pk ):
924
923
"""Send notifications on build failure."""
925
- send_notifications .delay (self . version . pk , build_pk = self . build [ 'id' ] )
924
+ send_notifications .delay (version_pk , build_pk = build_pk )
926
925
927
926
def is_type_sphinx (self ):
928
927
"""Is documentation type Sphinx."""
0 commit comments