From f775d2e8a4a185e59031504e6e8eda8b330d066c Mon Sep 17 00:00:00 2001 From: Kevin Zhang Date: Wed, 11 May 2022 15:16:07 -0700 Subject: [PATCH] fix: Punt deprecation warnings and clean up some warnings. (#2670) * Add some fixes Signed-off-by: Kevin Zhang * Punt deprecation warnings to 0.23 Signed-off-by: Kevin Zhang * Fix lint Signed-off-by: Kevin Zhang --- sdk/python/feast/cli.py | 4 ++-- sdk/python/feast/diff/registry_diff.py | 2 +- sdk/python/feast/entity.py | 2 +- sdk/python/feast/feature_store.py | 2 +- sdk/python/feast/feature_view.py | 4 ++-- .../infra/offline_stores/bigquery_source.py | 4 ++-- .../contrib/spark_offline_store/spark.py | 3 +++ .../contrib/spark_offline_store/spark_source.py | 2 +- .../feast/infra/offline_stores/file_source.py | 2 +- .../feast/infra/offline_stores/offline_store.py | 2 ++ .../infra/offline_stores/redshift_source.py | 4 ++-- .../infra/offline_stores/snowflake_source.py | 4 ++-- sdk/python/feast/on_demand_feature_view.py | 16 ++++++++-------- 13 files changed, 28 insertions(+), 23 deletions(-) diff --git a/sdk/python/feast/cli.py b/sdk/python/feast/cli.py index 944ff1a21a..d87f6260a7 100644 --- a/sdk/python/feast/cli.py +++ b/sdk/python/feast/cli.py @@ -167,7 +167,7 @@ def data_source_describe(ctx: click.Context, name: str): warnings.warn( "Describing data sources will only work properly if all data sources have names or table names specified. " - "Starting Feast 0.21, data source unique names will be required to encourage data source discovery.", + "Starting Feast 0.23, data source unique names will be required to encourage data source discovery.", RuntimeWarning, ) print( @@ -194,7 +194,7 @@ def data_source_list(ctx: click.Context): warnings.warn( "Listing data sources will only work properly if all data sources have names or table names specified. " - "Starting Feast 0.21, data source unique names will be required to encourage data source discovery", + "Starting Feast 0.23, data source unique names will be required to encourage data source discovery", RuntimeWarning, ) print(tabulate(table, headers=["NAME", "CLASS"], tablefmt="plain")) diff --git a/sdk/python/feast/diff/registry_diff.py b/sdk/python/feast/diff/registry_diff.py index 6f372a7915..197bdfcefa 100644 --- a/sdk/python/feast/diff/registry_diff.py +++ b/sdk/python/feast/diff/registry_diff.py @@ -61,7 +61,7 @@ def to_string(self): if feast_object_diff.transition_type == TransitionType.UNCHANGED: continue if feast_object_diff.feast_object_type == FeastObjectType.DATA_SOURCE: - # TODO(adchia): Print statements out starting in Feast 0.21 + # TODO(adchia): Print statements out starting in Feast 0.23 continue action, color = message_action_map[feast_object_diff.transition_type] log_string += f"{action} {feast_object_diff.feast_object_type.value} {Style.BRIGHT + color}{feast_object_diff.name}{Style.RESET_ALL}\n" diff --git a/sdk/python/feast/entity.py b/sdk/python/feast/entity.py index 38c353857c..1e7c7cf307 100644 --- a/sdk/python/feast/entity.py +++ b/sdk/python/feast/entity.py @@ -110,7 +110,7 @@ def __init__( warnings.warn( ( "The `join_key` parameter is being deprecated in favor of the `join_keys` parameter. " - "Please switch from using `join_key` to `join_keys`. Feast 0.22 and onwards will not " + "Please switch from using `join_key` to `join_keys`. Feast 0.23 and onwards will not " "support the `join_key` parameter." ), DeprecationWarning, diff --git a/sdk/python/feast/feature_store.py b/sdk/python/feast/feature_store.py index 60517021e1..90bd35a213 100644 --- a/sdk/python/feast/feature_store.py +++ b/sdk/python/feast/feature_store.py @@ -2197,7 +2197,7 @@ def _validate_data_sources(data_sources: List[DataSource]): f"More than one data source with name {case_insensitive_ds_name} found. " f"Please ensure that all data source names are case-insensitively unique. " f"It may be necessary to ignore certain files in your feature repository by using a .feastignore " - f"file. Starting in Feast 0.21, unique names (perhaps inferred from the table name) will be " + f"file. Starting in Feast 0.23, unique names (perhaps inferred from the table name) will be " f"required in data sources to encourage data source discovery" ) else: diff --git a/sdk/python/feast/feature_view.py b/sdk/python/feast/feature_view.py index 65a4914a8f..4ff7618f2e 100644 --- a/sdk/python/feast/feature_view.py +++ b/sdk/python/feast/feature_view.py @@ -180,7 +180,7 @@ def __init__( warnings.warn( ( "The option to pass a Duration object to the ttl parameter is being deprecated. " - "Please pass a timedelta object instead. Feast 0.21 and onwards will not support " + "Please pass a timedelta object instead. Feast 0.23 and onwards will not support " "Duration objects." ), DeprecationWarning, @@ -195,7 +195,7 @@ def __init__( ( "The `features` parameter is being deprecated in favor of the `schema` parameter. " "Please switch from using `features` to `schema`. This will also requiring switching " - "feature definitions from using `Feature` to `Field`. Feast 0.21 and onwards will not " + "feature definitions from using `Feature` to `Field`. Feast 0.23 and onwards will not " "support the `features` parameter." ), DeprecationWarning, diff --git a/sdk/python/feast/infra/offline_stores/bigquery_source.py b/sdk/python/feast/infra/offline_stores/bigquery_source.py index f66b2066bd..06e9ce9f62 100644 --- a/sdk/python/feast/infra/offline_stores/bigquery_source.py +++ b/sdk/python/feast/infra/offline_stores/bigquery_source.py @@ -63,7 +63,7 @@ def __init__( warnings.warn( ( "The argument 'date_partition_column' is not supported for BigQuery sources. " - "It will be removed in Feast 0.21+" + "It will be removed in Feast 0.23+" ), DeprecationWarning, ) @@ -76,7 +76,7 @@ def __init__( else: warnings.warn( ( - f"Starting in Feast 0.21, Feast will require either a name for a data source (if using query) or `table`: {self.query}" + f"Starting in Feast 0.23, Feast will require either a name for a data source (if using query) or `table`: {self.query}" ), DeprecationWarning, ) diff --git a/sdk/python/feast/infra/offline_stores/contrib/spark_offline_store/spark.py b/sdk/python/feast/infra/offline_stores/contrib/spark_offline_store/spark.py index 770bd8adc2..2a0925d929 100644 --- a/sdk/python/feast/infra/offline_stores/contrib/spark_offline_store/spark.py +++ b/sdk/python/feast/infra/offline_stores/contrib/spark_offline_store/spark.py @@ -32,6 +32,9 @@ from feast.type_map import spark_schema_to_np_dtypes from feast.usage import log_exceptions_and_usage +# Make sure spark warning doesn't raise more than once. +warnings.simplefilter("once", RuntimeWarning) + class SparkOfflineStoreConfig(FeastConfigBaseModel): type: StrictStr = "spark" diff --git a/sdk/python/feast/infra/offline_stores/contrib/spark_offline_store/spark_source.py b/sdk/python/feast/infra/offline_stores/contrib/spark_offline_store/spark_source.py index dc92e08a50..c94b191359 100644 --- a/sdk/python/feast/infra/offline_stores/contrib/spark_offline_store/spark_source.py +++ b/sdk/python/feast/infra/offline_stores/contrib/spark_offline_store/spark_source.py @@ -57,7 +57,7 @@ def __init__( warnings.warn( ( "The argument 'date_partition_column' is not supported for Spark sources." - "It will be removed in Feast 0.21+" + "It will be removed in Feast 0.23+" ), DeprecationWarning, ) diff --git a/sdk/python/feast/infra/offline_stores/file_source.py b/sdk/python/feast/infra/offline_stores/file_source.py index 68c1835cb0..8b4b08bb87 100644 --- a/sdk/python/feast/infra/offline_stores/file_source.py +++ b/sdk/python/feast/infra/offline_stores/file_source.py @@ -95,7 +95,7 @@ def __init__( warnings.warn( ( "The argument 'date_partition_column' is not supported for File sources." - "It will be removed in Feast 0.21+" + "It will be removed in Feast 0.23+" ), DeprecationWarning, ) diff --git a/sdk/python/feast/infra/offline_stores/offline_store.py b/sdk/python/feast/infra/offline_stores/offline_store.py index 27a85046e5..2996a1ed59 100644 --- a/sdk/python/feast/infra/offline_stores/offline_store.py +++ b/sdk/python/feast/infra/offline_stores/offline_store.py @@ -32,6 +32,8 @@ if TYPE_CHECKING: from feast.saved_dataset import ValidationReference +warnings.simplefilter("once", RuntimeWarning) + class RetrievalMetadata: min_event_timestamp: Optional[datetime] diff --git a/sdk/python/feast/infra/offline_stores/redshift_source.py b/sdk/python/feast/infra/offline_stores/redshift_source.py index 93d811998a..ae9d8bab5c 100644 --- a/sdk/python/feast/infra/offline_stores/redshift_source.py +++ b/sdk/python/feast/infra/offline_stores/redshift_source.py @@ -73,7 +73,7 @@ def __init__( else: warnings.warn( ( - f"Starting in Feast 0.21, Feast will require either a name for a data source (if using query) " + f"Starting in Feast 0.23, Feast will require either a name for a data source (if using query) " f"or `table`: {self.query}" ), DeprecationWarning, @@ -82,7 +82,7 @@ def __init__( warnings.warn( ( "The argument 'date_partition_column' is not supported for Redshift sources." - "It will be removed in Feast 0.21+" + "It will be removed in Feast 0.23+" ), DeprecationWarning, ) diff --git a/sdk/python/feast/infra/offline_stores/snowflake_source.py b/sdk/python/feast/infra/offline_stores/snowflake_source.py index ef3ae52d28..d76131f837 100644 --- a/sdk/python/feast/infra/offline_stores/snowflake_source.py +++ b/sdk/python/feast/infra/offline_stores/snowflake_source.py @@ -79,7 +79,7 @@ def __init__( else: warnings.warn( ( - f"Starting in Feast 0.21, Feast will require either a name for a data source (if using query) " + f"Starting in Feast 0.23, Feast will require either a name for a data source (if using query) " f"or `table`: {self.query}" ), DeprecationWarning, @@ -89,7 +89,7 @@ def __init__( warnings.warn( ( "The argument 'date_partition_column' is not supported for Snowflake sources." - "It will be removed in Feast 0.21+" + "It will be removed in Feast 0.23+" ), DeprecationWarning, ) diff --git a/sdk/python/feast/on_demand_feature_view.py b/sdk/python/feast/on_demand_feature_view.py index d2cec18e52..244000c6de 100644 --- a/sdk/python/feast/on_demand_feature_view.py +++ b/sdk/python/feast/on_demand_feature_view.py @@ -127,7 +127,7 @@ def __init__( # noqa: C901 ( "The `features` parameter is being deprecated in favor of the `schema` parameter. " "Please switch from using `features` to `schema`. This will also requiring switching " - "feature definitions from using `Feature` to `Field`. Feast 0.21 and onwards will not " + "feature definitions from using `Feature` to `Field`. Feast 0.23 and onwards will not " "support the `features` parameter." ), DeprecationWarning, @@ -139,7 +139,7 @@ def __init__( # noqa: C901 warnings.warn( ( "The `inputs` parameter is being deprecated. Please use `sources` instead. " - "Feast 0.21 and onwards will not support the `inputs` parameter." + "Feast 0.23 and onwards will not support the `inputs` parameter." ), DeprecationWarning, ) @@ -181,7 +181,7 @@ def __init__( # noqa: C901 ( "The `features` parameter is being deprecated in favor of the `schema` parameter. " "Please switch from using `features` to `schema`. This will also requiring switching " - "feature definitions from using `Feature` to `Field`. Feast 0.21 and onwards will not " + "feature definitions from using `Feature` to `Field`. Feast 0.23 and onwards will not " "support the `features` parameter." ), DeprecationWarning, @@ -202,7 +202,7 @@ def __init__( # noqa: C901 warnings.warn( ( "The `inputs` parameter is being deprecated. Please use `sources` instead. " - "Feast 0.21 and onwards will not support the `inputs` parameter." + "Feast 0.23 and onwards will not support the `inputs` parameter." ), DeprecationWarning, ) @@ -548,7 +548,7 @@ def on_demand_feature_view( ( "The `features` parameter is being deprecated in favor of the `schema` parameter. " "Please switch from using `features` to `schema`. This will also requiring switching " - "feature definitions from using `Feature` to `Field`. Feast 0.21 and onwards will not " + "feature definitions from using `Feature` to `Field`. Feast 0.23 and onwards will not " "support the `features` parameter." ), DeprecationWarning, @@ -560,7 +560,7 @@ def on_demand_feature_view( warnings.warn( ( "The `inputs` parameter is being deprecated. Please use `sources` instead. " - "Feast 0.21 and onwards will not support the `inputs` parameter." + "Feast 0.23 and onwards will not support the `inputs` parameter." ), DeprecationWarning, ) @@ -599,7 +599,7 @@ def on_demand_feature_view( ( "The `features` parameter is being deprecated in favor of the `schema` parameter. " "Please switch from using `features` to `schema`. This will also requiring switching " - "feature definitions from using `Feature` to `Field`. Feast 0.21 and onwards will not " + "feature definitions from using `Feature` to `Field`. Feast 0.23 and onwards will not " "support the `features` parameter." ), DeprecationWarning, @@ -620,7 +620,7 @@ def on_demand_feature_view( warnings.warn( ( "The `inputs` parameter is being deprecated. Please use `sources` instead. " - "Feast 0.21 and onwards will not support the `inputs` parameter." + "Feast 0.23 and onwards will not support the `inputs` parameter." ), DeprecationWarning, )