def put_report()

in crashclouseau/update.py [0:0]


def put_report(uuid, buildid, channel, product, chgset):
    """Put a report in the database"""
    if channel == "nightly":
        mindate = buildid - relativedelta(days=config.get_ndays())
    else:
        mindate = models.Build.get_pushdate_before(buildid, channel, product)
        mindate += relativedelta(seconds=1)

    interesting_chgsets = set()
    res = inspector.get_crash(
        uuid,
        buildid,
        channel,
        mindate,
        chgset,
        models.Changeset.find,
        interesting_chgsets,
    )
    if res is None:
        # 'json_dump' is not in crash data
        return

    useless = True
    chgsets = models.Changeset.to_analyze(chgsets=interesting_chgsets, channel=channel)
    for nodeid, node in chgsets:
        data = patch.parse(node, channel=channel)
        models.Changeset.add_analyzis(data, nodeid, channel)

    frames = res.get("nonjava")
    sh = jsh = ""
    if frames:
        sh = frames["hash"]
        if not models.UUID.is_stackhash_existing(sh, buildid, channel, product, False):
            models.CrashStack.put_frames(uuid, frames, False, commit=True)
            useless = False

    jframes = res.get("java")
    if jframes:
        jsh = jframes["hash"]
        if not models.UUID.is_stackhash_existing(jsh, buildid, channel, product, True):
            models.CrashStack.put_frames(uuid, jframes, True, commit=True)
            useless = False

    models.UUID.add_stack_hash(uuid, sh, jsh)
    models.UUID.set_analyzed(uuid, useless)