Skip to content

Commit

Permalink
fix: "no output found" error at end of id stitcher audit model run (#480
Browse files Browse the repository at this point in the history
)
  • Loading branch information
shekhar-rudder authored Oct 15, 2024
1 parent 6608d10 commit 8632b9a
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/predictions/profiles_mlcorelib/py_native/id_stitcher/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ class AuditIdStitcherModel(BaseModelType):
}

def __init__(self, build_spec: dict, schema_version: int, pb_version: str) -> None:
build_spec["materialization"] = {"output_type": "ephemeral"}
super().__init__(build_spec, schema_version, pb_version)
self.recipe = ModelRecipe(self.build_spec)

def get_material_recipe(self) -> PyNativeRecipe:
return ModelRecipe(self.build_spec)
return self.recipe

def validate(self):
return super().validate()
Expand All @@ -36,21 +38,20 @@ def __init__(self, build_spec: dict) -> None:
self.build_spec = build_spec
self.logger = Logger("AuditIdStitcherModelRecipe")
self.id_stitcher_model: Optional[WhtModel] = None
# There is no guarantee that the register_dependencies will be called only once
# So we need to keep track of whether the run has been completed
self.run_completed = False

def describe(self, this: WhtMaterial):
return (
f"""
Material - {this.name()}
""",
".txt",
)
pass

def register_dependencies(self, this: WhtMaterial):
self._set_id_stitcher_model(this)
edge_sources = self.id_stitcher_model.build_spec()["edge_sources"]
for edge_source in edge_sources:
input_model_ref = edge_source["from"]
this.de_ref(input_model_ref)
self._run(this)

def _set_id_stitcher_model(self, this: WhtMaterial):
if self.id_stitcher_model is not None:
Expand All @@ -67,7 +68,10 @@ def _set_id_stitcher_model(self, this: WhtMaterial):
selected_model_name = list(id_stitcher_models.keys())[0]
self.id_stitcher_model = id_stitcher_models[selected_model_name]

def execute(self, this: WhtMaterial):
def _run(self, this: WhtMaterial):
if self.run_completed:
return

edge_sources = self.id_stitcher_model.build_spec()["edge_sources"]
for edge_source in edge_sources:
input_model_ref = edge_source["from"]
Expand All @@ -93,6 +97,7 @@ def execute(self, this: WhtMaterial):
reports = [yaml_report, table_report, cluster_report, llm_report]
for report in reports:
report.run()
# FIXME:
# 1. material warehouse object does not exist after material run
# 2. Stop generating the .txt file
self.run_completed = True

def execute(self, this: WhtMaterial):
pass

0 comments on commit 8632b9a

Please sign in to comment.