Example #1
0
  def set_processed_counts(self, shards_processed):
    """Updates a chart url to display processed count for each shard.

    Args:
      shards_processed: list of integers with number of processed entities in
        each shard
    """
    chart = google_chart_api.BarChart(shards_processed)
    shard_count = len(shards_processed)

    if shards_processed:

      stride_length = max(1, shard_count / 16)
      chart.bottom.labels = []
      for x in xrange(shard_count):
        if (x % stride_length == 0 or
            x == shard_count - 1):
          chart.bottom.labels.append(x)
        else:
          chart.bottom.labels.append("")
      chart.left.labels = ['0', str(max(shards_processed))]
      chart.left.min = 0

    self.chart_width = min(700, max(300, shard_count * 20))
    self.chart_url = chart.display.Url(self.chart_width, 200)
Example #2
0
    def set_processed_counts(self, shards_processed):
        """Updates a chart url to display processed count for each shard.

    Args:
      shards_processed: list of integers with number of processed entities in
        each shard
    """
        chart = google_chart_api.BarChart(shards_processed)
        if self.mapreduce_spec and shards_processed:
            chart.bottom.labels = [
                str(x) for x in xrange(self.mapreduce_spec.mapper.shard_count)
            ]
            chart.left.labels = ['0', str(max(shards_processed))]
            chart.left.min = 0
        self.chart_url = chart.display.Url(300, 200)