Skip to content

Commit

Permalink
Model lineage bug (#190)
Browse files Browse the repository at this point in the history
* merge changes

* Changes for model lineage bug

* Removed a print statement
  • Loading branch information
annmary-roy authored Sep 30, 2024
1 parent b7fae9c commit 4313d34
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmflib/cmf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ def log_model(
input_name=model_uri,
event_type=event_type,
)
model_uri = artifact.name
model_uri = model_uri + ":" + str(self.execution.id)
else:
uri = c_hash if c_hash and c_hash.strip() else str(uuid.uuid1())
model_uri = model_uri + ":" + str(self.execution.id)
Expand Down
11 changes: 6 additions & 5 deletions cmflib/graph_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,15 +304,16 @@ def _create_dataslice_syntax(name: str, path: str, uri: str,
@staticmethod
def _create_model_syntax(name: str, uri: str, pipeline_id: int, pipeline_name: str, custom_properties):
custom_properties["Name"] = name
custom_properties["uri"] = uri
custom_properties["pipeline_id"] = str(pipeline_id)
custom_properties["pipeline_name"] = pipeline_name
syntax_str = "MERGE (a:Model {" # + str(props) + ")"
syntax_str = "MERGE (a:Model {uri:\"" + uri + "\"}) SET "
for k, v in custom_properties.items():
k = re.sub('\W+', '', k)
syntax_str = syntax_str + k + ":" + "\"" + str(v) + "\"" + ","
syntax_str = syntax_str.rstrip(syntax_str[-1])
syntax_str = syntax_str + "})"
props_str = "a." + k + \
" = coalesce([x in a." + k + " where x <>\"" + str(v) + "\"], []) + \"" + str(v) + "\","
#syntax_str = syntax_str + k + ":" + "\"" + str(v) + "\"" + ","
syntax_str = syntax_str + props_str
syntax_str = syntax_str.rstrip(",")
syntax_str = syntax_str + " RETURN ID(a) as node_id"
return syntax_str

Expand Down

0 comments on commit 4313d34

Please sign in to comment.