class_docstr: Base Handler for CLI.
  
  Attributes:
    flags_dict: A dictionary with flags provided in a command.
docstr: Read Schema from the latest SchemaGen output of the pipeline.
code: def _read_schema_from_pipeline_root(
      self, pipeline_name, pipeline_root
  ):
      """Read Schema from the latest SchemaGen output of the pipeline."""
      # Check if pipeline root created. If not, it means that the user has not
      # created a run yet or the pipeline is still running for the first time.
  
      if not fileio.exists(pipeline_root):
          sys.exit(
              "Create a run before inferring schema. If pipeline is already running, then wait for it to successfully finish."
          )
  
      # If pipeline_root exists, then check if SchemaGen output exists.
      components = fileio.listdir(pipeline_root)
      if "SchemaGen" not in components:
          sys.exit(
              "Either SchemaGen component does not exist or pipeline is still running. If pipeline is running, then wait for it to successfully finish."
          )
  
      # Get the latest SchemaGen output.
      component_output_dir = os.path.join(pipeline_root, "SchemaGen")
      schema_dir = os.path.join(component_output_dir, "schema")
      schemagen_outputs = fileio.listdir(schema_dir)
      latest_schema_folder = max(schemagen_outputs, key=int)
  
      # Copy schema to current dir.
      latest_schema_uri = base_driver._generate_output_uri(  # pylint: disable=protected-access
          component_output_dir, "schema", int(latest_schema_folder)
      )
      latest_schema_path = os.path.join(
          latest_schema_uri, "schema.pbtxt"
      )
      curr_dir_path = os.path.join(os.getcwd(), "schema.pbtxt")
      io_utils.copy_file(
          latest_schema_path, curr_dir_path, overwrite=True
      )
  
      # Print schema and path to schema
      click.echo("Path to schema: {}".format(curr_dir_path))
      click.echo(
          "*********SCHEMA FOR {}**********".format(
              pipeline_name.upper()
          )
      )
      with open(curr_dir_path, "r") as f:
          click.echo(f.read())
  
imports: import abc
  from importlib import machinery
  from importlib import util
  import json
  import os
  import subprocess
  import sys
  from typing import Any, Collection, Dict, List, Optional
  import click
  from tfx.dsl.components.base import base_driver
  from tfx.dsl.io import fileio
  from tfx.tools.cli import labels
  from tfx.tools.cli.handler import dag_runner_patcher
  from tfx.utils import io_utils
label_desc: Use image node_id 22 for calling the BaseHandler obj's underlying member method code with example usage: obj._read_schema_from_pipeline_root(pipeline_name, pipeline_root) without return types