def display_artifact_and_execution_properties()

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


  def display_artifact_and_execution_properties(self, artifact_id,
                                                execution_type_name):
    """Displays properties of artifact and the execution that generated it.

    Args:
      artifact_id: A `int` indicating the id of an artifact.
      execution_type_name: A `str` indicating the type of an execution that
          generated `artifact_id`.
    """
    execution = self.get_execution_for_output_artifact(
        artifact_id, execution_type_name)
    if not execution:
      return
    execution_id = execution.id

    # Get data frames to visualize the artifact and execution properties.
    artifact_df, execution_df = (
        self.get_artifact_df(artifact_id), self.get_execution_df(execution_id)
    )

    # Style the data frames to set captions.
    artifact_df_styler = artifact_df.style.set_caption(
        'Properties for Artifact {}'.format(artifact_id))
    execution_df_styler = execution_df.style.set_caption(
        'Properties for Execution {} that generated Artifact {}'.format(
            execution_id, artifact_id))

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