def after_run(self, run_context, run_values):
    num_attempted_trees = run_values.results['num_attempted_trees']
    num_finalized_trees = run_values.results['num_finalized_trees']
    assert (num_attempted_trees is not None)
    assert (num_finalized_trees is not None)
    if ((num_finalized_trees >= self._num_trees) or (num_attempted_trees > (2 * self._num_trees))):
        logging.info('Requesting stop since we have reached %d trees.', num_finalized_trees)
        run_context.request_stop()
def after_run(self, run_context, run_values):
    num_attempted_trees = run_values.results['num_attempted_trees']
    num_finalized_trees = run_values.results['num_finalized_trees']
    assert (num_attempted_trees is not None)
    assert (num_finalized_trees is not None)
    if ((num_finalized_trees >= self._num_trees) or (num_attempted_trees > (2 * self._num_trees))):
        logging.info('Requesting stop since we have reached %d trees.', num_finalized_trees)
        run_context.request_stop()