From 4313d3487a127c1d73e1586ce2114432f82ca2a6 Mon Sep 17 00:00:00 2001 From: ANNMARY JUSTINE Date: Mon, 30 Sep 2024 13:19:28 -0600 Subject: [PATCH] Model lineage bug (#190) * merge changes * Changes for model lineage bug * Removed a print statement --- cmflib/cmf.py | 2 +- cmflib/graph_wrapper.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/cmflib/cmf.py b/cmflib/cmf.py index ced11eb4..a1a2d4f0 100644 --- a/cmflib/cmf.py +++ b/cmflib/cmf.py @@ -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) diff --git a/cmflib/graph_wrapper.py b/cmflib/graph_wrapper.py index d2eee21f..29b5ab41 100644 --- a/cmflib/graph_wrapper.py +++ b/cmflib/graph_wrapper.py @@ -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