@@ -216,16 +216,6 @@ def inputs(self):
216
216
def __init__ (self , * args , ** kwargs ):
217
217
warnings .filterwarnings ("ignore" , module = "numpy" , category = VisibleDeprecationWarning )
218
218
warnings .filterwarnings ("ignore" , module = "luigi.task" , category = DeprecationWarning )
219
- event_handler = super ().event_handler
220
-
221
- # pylint: disable=unused-variable
222
- @event_handler (luigi .Event .SUCCESS )
223
- def success_summary (self ):
224
- """Summary report of the task."""
225
- L .info ("==========================================" )
226
- task_summary = f"SUMMARY { self .task_name } : { self .nb_valid } / { self .nb_total } passed"
227
- L .info (task_summary )
228
- L .info ("==========================================" )
229
219
230
220
super ().__init__ (* args , ** kwargs )
231
221
@@ -646,6 +636,15 @@ def __specifications__(self):
646
636
return self .__doc__
647
637
648
638
639
+ @BaseValidationTask .event_handler (luigi .Event .SUCCESS )
640
+ def success_summary (self ):
641
+ """Hook to log a summary report of the task."""
642
+ L .info ("==========================================" )
643
+ task_summary = f"SUMMARY { self .task_name } : { self .nb_valid } / { self .nb_total } passed"
644
+ L .info (task_summary )
645
+ L .info ("==========================================" )
646
+
647
+
649
648
class ElementValidationTask (BaseValidationTask ):
650
649
"""A class to validate each element of a data set without considering the other elements.
651
650
@@ -733,23 +732,6 @@ class ValidationWorkflow(SetValidationTask, luigi.WrapperTask):
733
732
gather_inputs = True
734
733
735
734
def __init__ (self , * args , ** kwargs ):
736
- event_handler = super ().event_handler
737
-
738
- # pylint: disable=unused-variable
739
- @event_handler (luigi .Event .SUCCESS )
740
- def spec_report (current_task ):
741
- """Hook to create a specification report."""
742
- L .debug ("Generating report of %s" , current_task )
743
- if current_task .generate_report :
744
- try :
745
- make_report (current_task , config = self .report_config )
746
- # pylint: disable=broad-except
747
- except Exception as e : # pragma: no cover
748
- L .error (
749
- "The report could not be generated because of the following exception: %s" ,
750
- e ,
751
- )
752
-
753
735
super ().__init__ (* args , ** kwargs )
754
736
755
737
if self .specifications_only :
@@ -768,6 +750,21 @@ def validation_function(*args, **kwargs):
768
750
"""
769
751
770
752
753
+ @ValidationWorkflow .event_handler (luigi .Event .SUCCESS )
754
+ def spec_report (current_task ):
755
+ """Hook to create a specification report."""
756
+ L .debug ("Generating report of %s" , current_task )
757
+ if current_task .generate_report :
758
+ try :
759
+ make_report (current_task , config = current_task .report_config )
760
+ # pylint: disable=broad-except
761
+ except Exception as e : # pragma: no cover
762
+ L .error (
763
+ "The report could not be generated because of the following exception: %s" ,
764
+ e ,
765
+ )
766
+
767
+
771
768
def _skippable_element_validation_function (validation_function , skip , * args , ** kwargs ):
772
769
"""Skipping wrapper for an element validation function."""
773
770
if skip :
0 commit comments