def get_parent_artifacts(store, artifact):
### START CODE HERE ###
# Get the artifact id of the input artifact
artifact_id = artifact.id
#artifact_ids = artifact.id
# Get events associated with the artifact id
artifact_id_events = artifact_id
# From the `artifact_id_events`, get the execution ids of OUTPUT events.
# Cast to a set to remove duplicates if any.
executions_id = set(
event.execution_id
for event in store.get_events_by_artifact_ids(artifact_ids)
if event.type == mlmd.proto.Event.OUTPUT)
# Get the events associated with the execution_id
execution_id_events = execution_id
# From execution_id_events, get the artifact ids of INPUT events.
# Cast to a set to remove duplicates if any.
parent_artifact_ids = set(
event.artifact_id
for event in execution_id_events
if event.type == metadata_store_pb2.Event.INPUT
)
# Get the list of artifacts associated with the parent_artifact_ids
parent_artifact_list = parent_artifact_ids
### END CODE HERE ###
return parent_artifact_list
NameError Traceback (most recent call last)
in
3
4 # Retrieve the parent artifacts of the instance
----> 5 parent_artifacts = get_parent_artifacts(store, artifact_instance)
6
7 # Display the results
in get_parent_artifacts(store, artifact)
14 executions_id = set(
15 event.execution_id
—> 16 for event in store.get_events_by_artifact_ids(artifact_ids)
17 if event.type == mlmd.proto.Event.OUTPUT)
18
NameError: name ‘artifact_ids’ is not defined
Expected Output:
Note: The ID numbers may differ.
artifact id type uri
1 Examples ./CsvExampleGen/examples/1
4 Schema ./updated_schema