Skip to content

Commit bb0d3cd

Browse files
committed
lint check for List --> list, Tuple --> tuple; tried addressing TODO in code
1 parent 5548c22 commit bb0d3cd

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

src/palimpzest/query/execution/execution_strategy.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import time
22
from abc import ABC, abstractmethod
33
from enum import Enum
4-
from typing import List, Tuple
54

65
from palimpzest.core.data.dataclasses import ExecutionStats, PlanStats
76
from palimpzest.core.elements.records import DataRecord
@@ -26,7 +25,7 @@ def __init__(self,
2625
scan_start_idx: int = 0,
2726
datadir: DataDirectory | None = None,
2827
max_workers: int | None = None,
29-
nocache: bool = False,
28+
nocache: bool = True,
3029
verbose: bool = False):
3130
self.scan_start_idx = scan_start_idx
3231
self.datadir = datadir
@@ -42,23 +41,23 @@ def execute_plan(
4241
plan: PhysicalPlan,
4342
num_samples: int | float = float("inf"),
4443
workers: int = 1
45-
) -> Tuple[List[DataRecord], PlanStats]:
44+
) -> tuple[list[DataRecord], PlanStats]:
4645
"""Execute a single plan according to strategy"""
4746
pass
4847

4948

5049
@abstractmethod
5150
def _should_stop_execution(
5251
self,
53-
records: List[DataRecord],
54-
plan_stats: List[PlanStats]
52+
records: list[DataRecord],
53+
plan_stats: list[PlanStats]
5554
) -> bool:
5655
"""Override to implement early stopping logic"""
5756
return False
5857

5958
def _create_execution_stats(
6059
self,
61-
plan_stats: List[PlanStats],
60+
plan_stats: list[PlanStats],
6261
start_time: float
6362
) -> ExecutionStats:
6463
"""Create execution statistics"""
@@ -71,8 +70,8 @@ def _create_execution_stats(
7170

7271
def _should_stop_execution(
7372
self,
74-
records: List[DataRecord],
75-
plan_stats: List[PlanStats]
73+
records: list[DataRecord],
74+
plan_stats: list[PlanStats]
7675
) -> bool:
7776
"""Override to implement early stopping logic"""
7877
return False

src/palimpzest/query/operators/datasource.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import time
4+
from abc import ABC, abstractmethod
45

56
from palimpzest.constants import (
67
LOCAL_SCAN_TIME_PER_KB,
@@ -12,7 +13,7 @@
1213
from palimpzest.query.operators.physical import PhysicalOperator
1314

1415

15-
class DataSourcePhysicalOp(PhysicalOperator):
16+
class DataSourcePhysicalOp(PhysicalOperator, ABC):
1617
"""
1718
Physical operators which implement DataSources require slightly more information
1819
in order to accurately compute naive cost estimates. Thus, we use a slightly
@@ -59,8 +60,9 @@ def naive_cost_estimates(
5960
raise NotImplementedError("Abstract method")
6061

6162
# TODO: we need to revisit this to make get_datasource() unified for DataScan operators
63+
@abstractmethod
6264
def get_datasource(self):
63-
return self.datadir.get_registered_dataset(self.dataset_id)
65+
raise NotImplementedError("Abstract method")
6466

6567

6668
class MarshalAndScanDataOp(DataSourcePhysicalOp):
@@ -196,3 +198,6 @@ def __call__(self, candidate: DataRecord) -> DataRecordSet:
196198
record_set = DataRecordSet(records, record_op_stats_lst)
197199

198200
return record_set
201+
202+
def get_datasource(self):
203+
return self.datadir.get_cached_result(self.dataset_id)

0 commit comments

Comments
 (0)