def compare_artifact_pair_and_execution_properties()

in tfx_airflow/notebooks/utils.py [0:0]


  def compare_artifact_pair_and_execution_properties(
      self, artifact_id, other_artifact_id, execution_type_name):
    """Displays properties of 2 artifacts and executions that generated them.

    Args:
      artifact_id: A `int` indicating the id of one artifact.
      other_artifact_id: A `int` indicating the id of another artifact.
      execution_type_name: A `str` indicating the type of executions that
          generated `artifact_id` and `other_artifact_id`.
    """
    # Get data frame to visualize properties of the 2 artifacts.
    df = self.get_df_from_artifacts_or_executions(
        self.metadata_store.get_artifacts_by_id(
            [artifact_id, other_artifact_id]))
    artifacts_df_styler = df.style.set_caption(
        'Properties for Artifacts {}, {}'.format(
            artifact_id, other_artifact_id))

    # Compare properties of the executions that generated these artifacts.
    execution = self.get_execution_for_output_artifact(
        artifact_id, execution_type_name)
    other_execution = self.get_execution_for_output_artifact(
        other_artifact_id, execution_type_name)
    if not execution or not other_execution:
      return
    executions_df = self.get_df_from_artifacts_or_executions([
        execution, other_execution])
    executions_df_styler = executions_df.style.set_caption(
        'Properties for Executions that generated Artifacts {}, {}'.format(
            artifact_id, other_artifact_id))

    # Display the HTML.
    # pylint: disable=protected-access
    display_html(
        artifacts_df_styler._repr_html_() + executions_df_styler._repr_html_(),
        raw=True)