Skip to content

Commit

Permalink
use gcThresholdSec label instead of max_age if present (#82)
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksii Moskalenko <moskalenko.alexey@gmail.com>
  • Loading branch information
pyalex committed Jul 27, 2021
1 parent 93f1f5b commit f4fcc0b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion python/feast_spark/pyspark/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@ def _source_to_argument(source: DataSource, config: Config):
def _feature_table_to_argument(
client: "Client", project: str, feature_table: FeatureTable
):
max_age = feature_table.max_age.ToSeconds() if feature_table.max_age else None
try:
gc_threshold = int(feature_table.labels["gcThresholdSec"])
except (KeyError, ValueError, TypeError):
pass
else:
max_age = max(max_age or 0, gc_threshold)

return {
"features": [
{"name": f.name, "type": ValueType(f.dtype).name}
Expand All @@ -157,7 +165,7 @@ def _feature_table_to_argument(
}
for n in feature_table.entities
],
"max_age": feature_table.max_age.ToSeconds() if feature_table.max_age else None,
"max_age": max_age,
"labels": dict(feature_table.labels),
}

Expand Down

0 comments on commit f4fcc0b

Please sign in to comment.