Skip to content

Commit

Permalink
some apidocs
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksii Moskalenko <[email protected]>
  • Loading branch information
pyalex committed May 20, 2022
1 parent acbfe84 commit 301f61e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sdk/python/feast/dqm/profilers/ge_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ def analyze_dataset(self, df: pd.DataFrame) -> Profile:
return GEProfile(expectation_suite=self.user_defined_profiler(dataset))

def to_proto(self):
# keep only the code and drop context for now
# ToDo (pyalex): include some context, but not all (dill tries to pull too much)
udp = FunctionType(self.user_defined_profiler.__code__, {})
return GEValidationProfilerProto(
profiler=GEValidationProfilerProto.UserDefinedProfiler(
Expand Down
18 changes: 18 additions & 0 deletions sdk/python/feast/saved_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,12 +224,30 @@ class ValidationReference:
_dataset: Optional[SavedDataset] = None

def __init__(self, name: str, dataset_name: str, profiler: Profiler):
"""
Validation reference combines a reference dataset (currently only a saved dataset object can be used as
a reference) and a profiler function to generate a validation profile.
The validation profile can be cached in this object, and in this case
the saved dataset retrieval and the profiler call will happen only once.
Validation reference is being stored in the Feast registry and can be retrieved by its name, which
must be unique within one project.
Args:
name: unique name
dataset_name: name of a saved dataset
profiler: profiler function used to generate profile from a saved dataset
"""
self.name = name
self.dataset_name = dataset_name
self.profiler = profiler

@classmethod
def from_saved_dataset(cls, name: str, dataset: SavedDataset, profiler: Profiler):
"""
Internal constructor to create validation reference object with actual saved dataset object
(regular constructor requires only its name).
"""
ref = ValidationReference(name, dataset.name, profiler)
ref._dataset = dataset
return ref
Expand Down

0 comments on commit 301f61e

Please sign in to comment.