class_docstr: Stores child ModelBlessing, ModelInfraBlessing, ModelPush for a Model.
class_docstr_tok: ["Stores","child","ModelBlessing",",","ModelInfraBlessing",",","ModelPush","for","a","Model","."]
docstr: Gets the latest created artifact with matching ArtifactType.
docstr_tok: ["Gets","the","latest","created","artifact","with","matching","ArtifactType","."]
code: def latest_created(
      self, artifact_type: metadata_store_pb2.ArtifactType
  ) -> types.Artifact:
      """Gets the latest created artifact with matching ArtifactType."""
      if artifact_type.name == ops_utils.MODEL_BLESSING_TYPE_NAME:
          artifacts = self.model_blessing_by_artifact_id.values()
      elif (
          artifact_type.name
          == ops_utils.MODEL_INFRA_BLESSSING_TYPE_NAME
      ):
          artifacts = self.infra_blessing_by_artifact_id.values()
      elif artifact_type.name == ops_utils.MODEL_PUSH_TYPE_NAME:
          artifacts = self.model_push_by_artifact_id.values()
      else:
          raise exceptions.InvalidArgument(
              "ModelRelations.latest_created() can only be called with an "
              "artifact_type.name in "
              f"{ops_utils.MODEL_BLESSSING_KEY, ops_utils.MODEL_INFRA_BLESSING_KEY, ops_utils.MODEL_PUSH_KEY}."
          )
  
      # Sort the artifacts by latest created, ties broken by id.
      sorted_artifacts = sorted(
          artifacts,
          key=lambda a: (a.create_time_since_epoch, a.id),
          reverse=True,
      )
  
      # Deserialize the MLMD artifact to a TFleX Artifact object.
      return artifact_utils.deserialize_artifact(
          artifact_type, sorted_artifacts[0]
      )
  
imports: import collections
  import enum
  from typing import Dict
  from tfx import types
  from tfx.dsl.input_resolution import resolver_op
  from tfx.dsl.input_resolution.ops import ops_utils
  from tfx.orchestration.portable.input_resolution import exceptions
  from tfx.orchestration.portable.mlmd import event_lib
  from tfx.orchestration.portable.mlmd import filter_query_builder
  from tfx.types import artifact_utils
  from tfx.utils import typing_utils
  from ml_metadata.proto import metadata_store_pb2
  from ml_metadata.tools.mlmd_resolver import metadata_resolver
label_desc: Use image node_id 3 for calling the ModelRelations obj's underlying member method code with example usage: obj.latest_created(artifact_type) and returns: artifact_utils