Skip to content

Commit

Permalink
Fixed circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
MatsMoll committed Apr 7, 2024
1 parent a46cca0 commit 23d5061
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 130 deletions.
8 changes: 7 additions & 1 deletion aligned/retrival_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
TrainTestValidateSet,
)
from aligned.validation.interface import Validator
from aligned.feature_source import WritableFeatureSource

if TYPE_CHECKING:
from typing import AsyncIterator
from aligned.schemas.folder import DatasetMetadata, DatasetStore
from aligned.feature_source import WritableFeatureSource

from aligned.schemas.derivied_feature import AggregatedFeature, AggregateOver
from aligned.schemas.model import EventTrigger, Model
Expand Down Expand Up @@ -2258,6 +2258,8 @@ def remove_derived_features(self) -> RetrivalJob:
return self.job.remove_derived_features()

async def insert_into_output_source(self) -> None:
from aligned.feature_source import WritableFeatureSource

pred_source = self.model.predictions_view.source
if not pred_source:
raise ValueError('No source defined for predictions view')
Expand All @@ -2269,6 +2271,8 @@ async def insert_into_output_source(self) -> None:
await pred_source.insert(self, [req])

async def upsert_into_output_source(self) -> None:
from aligned.feature_source import WritableFeatureSource

pred_source = self.model.predictions_view.source
if not pred_source:
raise ValueError('No source defined for predictions view')
Expand All @@ -2280,6 +2284,8 @@ async def upsert_into_output_source(self) -> None:
await pred_source.upsert(self, [req])

async def overwrite_output_source(self) -> None:
from aligned.feature_source import WritableFeatureSource

pred_source = self.model.predictions_view.source
if not pred_source:
raise ValueError('No source defined for predictions view')
Expand Down
14 changes: 7 additions & 7 deletions test_data/credit_history.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dob_ssn,student_loan_due,credit_card_due,event_timestamp,due_sum,bankruptcies
19530219_5179,22328,8419,2020-04-26 18:01:04.746575+00:00,30747,0
19520816_8737,2515,2944,2020-04-26 18:01:04.746575+00:00,5459,0
19860413_2537,33000,833,2020-04-26 18:01:04.746575+00:00,33833,0
19530219_5179,48955,5936,2020-04-27 18:01:04.746575+00:00,54891,0
19520816_8737,9501,1575,2020-04-27 18:01:04.746575+00:00,11076,0
19860413_2537,35510,6263,2020-04-27 18:01:04.746575+00:00,41773,0
event_timestamp,credit_card_due,dob_ssn,due_sum,bankruptcies,student_loan_due
2020-04-26 18:01:04.746575+00:00,8419,19530219_5179,30747,0,22328
2020-04-26 18:01:04.746575+00:00,2944,19520816_8737,5459,0,2515
2020-04-26 18:01:04.746575+00:00,833,19860413_2537,33833,0,33000
2020-04-27 18:01:04.746575+00:00,5936,19530219_5179,54891,0,48955
2020-04-27 18:01:04.746575+00:00,1575,19520816_8737,11076,0,9501
2020-04-27 18:01:04.746575+00:00,6263,19860413_2537,41773,0,35510
Binary file modified test_data/credit_history_mater.parquet
Binary file not shown.
6 changes: 3 additions & 3 deletions test_data/data/csv_iso.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id,other,et,timestamp
1,foo,2024-04-02T20:31:42.129+UTC,2024-04-02T20:31:42.129150+UTC
2,bar,2024-04-01T20:31:42.129146+UTC,2024-04-03T20:31:42.129150+UTC
3,baz,2024-03-31T20:31:42.129149+UTC,2024-04-04T20:31:42.129151+UTC
1,foo,2024-04-07T17:03:43.252072+UTC,2024-04-07T17:03:43.252290+UTC
2,bar,2024-04-06T17:03:43.252286+UTC,2024-04-08T17:03:43.252290+UTC
3,baz,2024-04-05T17:03:43.252289+UTC,2024-04-09T17:03:43.252290+UTC
6 changes: 3 additions & 3 deletions test_data/data/csv_unix.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id,other,et,timestamp
1,foo,1712089902129000,1712089902129150
2,bar,1712003502129146,1712176302129150
3,baz,1711917102129149,1712262702129151
1,foo,1712509423252072,1712509423252290
2,bar,1712423023252286,1712595823252290
3,baz,1712336623252289,1712682223252290
Binary file modified test_data/data/parquet_iso.parquet
Binary file not shown.
Binary file modified test_data/data/parquet_unix.parquet
Binary file not shown.
2 changes: 1 addition & 1 deletion test_data/feature-store.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions test_data/loan.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
loan_id,loan_status,personal_income,loan_amount,event_timestamp
10000,True,59000,35000,2020-04-26 18:01:04.746575+00:00
10001,False,9600,1000,2020-04-26 18:01:04.746575+00:00
10002,True,9600,5500,2020-04-26 18:01:04.746575+00:00
10000,True,65500,35000,2020-04-27 18:01:04.746575+00:00
10001,True,54400,35000,2020-04-27 18:01:04.746575+00:00
10002,True,9900,2500,2020-04-27 18:01:04.746575+00:00
personal_income,event_timestamp,loan_status,loan_amount,loan_id
59000,2020-04-26 18:01:04.746575+00:00,True,35000,10000
9600,2020-04-26 18:01:04.746575+00:00,False,1000,10001
9600,2020-04-26 18:01:04.746575+00:00,True,5500,10002
65500,2020-04-27 18:01:04.746575+00:00,True,35000,10000
54400,2020-04-27 18:01:04.746575+00:00,True,35000,10001
9900,2020-04-27 18:01:04.746575+00:00,True,2500,10002
8 changes: 4 additions & 4 deletions test_data/test_model.csv
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
some_id,a
1,10
2,14
3,20
a,some_id
10,1
14,2
20,3
1,1
2,2
3,3
Binary file modified test_data/test_model.parquet
Binary file not shown.
1 change: 0 additions & 1 deletion test_data/titanic-sets.json

This file was deleted.

21 changes: 0 additions & 21 deletions test_data/titanic-test.csv

This file was deleted.

61 changes: 0 additions & 61 deletions test_data/titanic-train.csv

This file was deleted.

21 changes: 0 additions & 21 deletions test_data/titanic-validate.csv

This file was deleted.

0 comments on commit 23d5061

Please sign in to comment.