def do_update()

in mozetl/graphics/graphics_telemetry_trends.py [0:0]


def do_update(trends):
    root = TrendGroup("root", trends)
    root.prepare()

    # Start each analysis slice on a Sunday.
    latest = most_recent_sunday()
    end = latest

    while True:
        start = end - datetime.timedelta(7)
        assert latest.weekday() == 6

        if not root.will_update(start):
            break

        try:
            with Prof("fetch {0}".format(start)) as _:
                pings = fetch_and_format(start, end)
        except Exception:
            if not ForceMaxBackfill:
                raise

        with Prof("compute {0}".format(start)) as _:
            if not root.update(pings, start_date=start, end_date=end):
                break

        end = start

    root.finish()