in src/smexperiments/tracker.py [0:0]
def _log_graph_artifact(self, name, data, graph_type, output_artifact):
"""Logs an artifact by uploading data to S3, creating an artifact, and associating that
artifact with the tracker's Trial Component.
Args:
name (str): Name of the artifact.
data (dict): Artifacts data that will be saved to S3.
graph_type (str): The type of the artifact.
output_artifact (bool): Determines the direction of association with the
trial component. Defaults to True (output association). If False will be input
association.
"""
# generate an artifact name
artifact_name = name
if not artifact_name:
artifact_name = (
graph_type + "-" + str(datetime.datetime.now(dateutil.tz.tzlocal()).timestamp()).split(".")[0]
)
# create a json file in S3
s3_uri, etag = self._artifact_uploader.upload_object_artifact(artifact_name, data, file_extension="json")
# create an artifact and association for the table
if output_artifact:
self._lineage_artifact_tracker.add_output_artifact(artifact_name, s3_uri, etag, graph_type)
else:
self._lineage_artifact_tracker.add_input_artifact(artifact_name, s3_uri, etag, graph_type)