def process(self, element):
    """Tries to convert an example, skipping it if conversion fails."""
    beam.metrics.Metrics.counter(self._name, "num_examples").inc()
    try:
      tf_example = self._converter.convert(element)
      num_nodes = self._converter.max_sizes["num_nodes"]
      beam.metrics.Metrics.distribution(self._name,
                                        "num_nodes").update(num_nodes)
      yield tf_example
    except ValueError:
      beam.metrics.Metrics.counter(self._name, "num_failed").inc()
Tries to convert an example, skipping it if conversion fails.
language/compgen/csl/model/data/write_examples_beam.py