forked from feathr-ai/feathr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add flag to enable generation non-agg features (feathr-ai#719)
* Add flag to enable generation non-agg features * Typo * Resolve comments
- Loading branch information
Showing
6 changed files
with
56 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,8 +3,12 @@ | |
from pathlib import Path | ||
|
||
from feathr import (BackfillTime, MaterializationSettings) | ||
from feathr import RedisSink | ||
# from feathr import * | ||
from feathr.client import FeathrClient | ||
from feathr.definition.dtype import ValueType | ||
from feathr.definition.query_feature_list import FeatureQuery | ||
from feathr.definition.settings import ObservationSettings | ||
from feathr.definition.typed_key import TypedKey | ||
from test_fixture import (basic_test_setup, get_online_test_table_name) | ||
from test_utils.constants import Constants | ||
|
||
|
@@ -22,6 +26,35 @@ def test_feathr_online_store_agg_features(): | |
# Maven package as the dependency and `noop.jar` as the main file | ||
client: FeathrClient = basic_test_setup(os.path.join(test_workspace_dir, "feathr_config_maven.yaml")) | ||
|
||
|
||
|
||
location_id = TypedKey(key_column="DOLocationID", | ||
key_column_type=ValueType.INT32, | ||
description="location id in NYC", | ||
full_name="nyc_taxi.location_id") | ||
|
||
feature_query = FeatureQuery( | ||
feature_list=["f_location_avg_fare"], key=location_id) | ||
settings = ObservationSettings( | ||
observation_path="wasbs://[email protected]/sample_data/green_tripdata_2020-04.csv", | ||
event_timestamp_column="lpep_dropoff_datetime", | ||
timestamp_format="yyyy-MM-dd HH:mm:ss") | ||
|
||
now = datetime.now() | ||
# set output folder based on different runtime | ||
if client.spark_runtime == 'databricks': | ||
output_path = ''.join(['dbfs:/feathrazure_cijob','_', str(now.minute), '_', str(now.second), ".avro"]) | ||
else: | ||
output_path = ''.join(['abfss://[email protected]/demo_data/output','_', str(now.minute), '_', str(now.second), ".avro"]) | ||
|
||
|
||
client.get_offline_features(observation_settings=settings, | ||
feature_query=feature_query, | ||
output_path=output_path) | ||
|
||
# assuming the job can successfully run; otherwise it will throw exception | ||
client.wait_job_to_finish(timeout_sec=Constants.SPARK_JOB_TIMEOUT_SECONDS) | ||
return | ||
backfill_time = BackfillTime(start=datetime( | ||
2020, 5, 20), end=datetime(2020, 5, 20), step=timedelta(days=1)) | ||
redisSink = RedisSink(table_name=online_test_table) | ||
|
@@ -51,4 +84,4 @@ def test_feathr_online_store_agg_features(): | |
assert res['239'][0] != None | ||
assert res['239'][1] != None | ||
assert res['265'][0] != None | ||
assert res['265'][1] != None | ||
assert res['265'][1] != None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters