C2W3_Assignment - Exercise 12 - display_artifacts function

Hi, I’m having an issue with the last exercise of this assignment, more explicitly I’m getting this attribute error :


AttributeError Traceback (most recent call last)
in
9
10 # Display the results
—> 11 display_artifacts(store, parent_artifacts, base_dir)

~/work/util.py in display_artifacts(store, artifacts, base_dir)
45 table = {‘artifact id’: , ‘type’: , ‘uri’: }
46 for a in artifacts:
—> 47 table[‘artifact id’].append(a.id)
48 artifact_type = store.get_artifact_types_by_id([a.type_id])[0]
49 table[‘type’].append(artifact_type.name)

AttributeError: id

However, I checked manually the contents of parent_artifacts :

# Get an artifact instance from the metadata store
artifact_instance = store.get_artifacts_by_type('TransformGraph')[0]

# Retrieve the parent artifacts of the instance
parent_artifacts = get_parent_artifacts(store, artifact_instance)

for a in parent_artifacts :
    print(a)

# Display the results
display_artifacts(store, parent_artifacts, base_dir)

And end up with, to give one example from the list :

artifact_id: 1
execution_id: 1
path {
steps {
key: “examples”
}
steps {
index: 0
}
}
type: OUTPUT
milliseconds_since_epoch: 1660893055931

So it seems that in util.py, the function display_artifacts tries to access the attribute “id” when it is in reality “artifact_id” (coming from store.get_events_by_artifact_ids(parent_artifact_ids) in get_parent_artifacts).

Am I missing something or is there a typo in util.py ?

Thanks in advance, not getting 100% is frustrating :rage: !

Please click my name and message your notebook as an attachment.

The bug is inside function get_parent_artifacts. Please fix the way you are retrieving parent artifacts from their ids.
Hint: Don’t get events associated with artifacts ids but get the artifacts based on the ids.

Ok I indeed found the problem; I simply wasn’t using the right function ! Thanks a lot for your answer and reactivity !