Skip to content

Commit e3e5ac4

Browse files
committed
fix: Force implementation of finalize in subclasses of AnakysisType
1 parent a9f6386 commit e3e5ac4

5 files changed

Lines changed: 13 additions & 2 deletions

File tree

uvdat/core/tasks/analytics/analysis_type.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ def validate_inputs(self, inputs):
3737

3838
@abstractmethod
3939
def finalize(self, result):
40-
# Override this to perform custom finalization
41-
pass
40+
raise NotImplementedError
4241

4342

4443
class AnalysisInputError(Exception):

uvdat/core/tasks/analytics/create_road_network.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ def run_task(self, *, project, **inputs):
5151
create_road_network.delay(result.id)
5252
return result
5353

54+
def finalize(self, result):
55+
pass
56+
5457

5558
def metadata_for_row(row):
5659
return {

uvdat/core/tasks/analytics/flood_network_failure.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ def validate_inputs(self, inputs):
6868
# data is at 10 meter resolution
6969
raise AnalysisInputError("Station radius must be greater than 10")
7070

71+
def finalize(self, result):
72+
pass
73+
7174

7275
def _get_station_region(point: Point, radius_meters: float) -> dict[str, Any]:
7376
"""Get a rectangular region around a point, sized by radius_meters."""

uvdat/core/tasks/analytics/geoai_segmentation.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ def run_task(self, *, project, **inputs):
5959
geoai_segmentation.delay(result.id)
6060
return result
6161

62+
def finalize(self, result):
63+
pass
64+
6265

6366
@shared_task(base=AnalysisTask)
6467
def geoai_segmentation(result_id): # noqa: PLR0915

uvdat/core/tasks/analytics/network_recovery.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ def validate_inputs(self, inputs):
7979
if mode not in RECOVERY_MODES:
8080
raise AnalysisInputError("Recovery mode not a valid option")
8181

82+
def finalize(self, result):
83+
pass
84+
8285

8386
def get_network_graph(network):
8487
network = {

0 commit comments

Comments
 (0)