How to use the libmozdata.utils.get_date_ymd function in libmozdata

To help you get started, we’ve selected a few libmozdata examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mozilla / relman-auto-nag / auto_nag / utils.py View on Github external
def is_merge_day():
    next_merge = get_merge_day()
    today = lmdutils.get_date_ymd("today")

    return next_merge == today
github mozilla / relman-auto-nag / auto_nag / utils.py View on Github external
def search_prev_merge(beta):
    tables = rc.get_all()

    # the first table is the future and the second is the recent past
    table = tables[1]
    central = table[0].index("Central")
    central = rc.get_versions(table[1][central])[0][0]

    # just check consistency
    assert beta == central

    merge = table[0].index("Merge Date")

    return lmdutils.get_date_ymd(table[1][merge])
github mozilla / relman-auto-nag / auto_nag / scripts / no_crashes.py View on Github external
def get_stats(self, signatures, date):
        def handler(json, data):
            if json["errors"]:
                raise SocorroError()
            del json["hits"]
            for facet in json["facets"].get("signature", {}):
                data.remove(facet["term"])

        date = lmdutils.get_date_ymd(date) - relativedelta(weeks=self.nweeks)
        search_date = SuperSearch.get_search_date(date)
        chunks, size = self.chunkify(signatures)
        base = {
            "date": search_date,
            "signature": "",
            "_result_number": 0,
            "_facets": "signature",
            "_facets_size": size,
        }

        searches = []
        for chunk in chunks:
            params = base.copy()
            params["signature"] = ["=" + x for x in chunk]
            searches.append(
                SuperSearch(
github mozilla / relman-auto-nag / auto_nag / utils.py View on Github external
def get_cycle_span():
    global _CYCLE_SPAN
    if _CYCLE_SPAN is None:
        cal = get_release_calendar()
        now = lmdutils.get_date_ymd("today")
        cycle = None
        for i, c in enumerate(cal):
            if now < c["merge"]:
                if i == 0:
                    cycle = [search_prev_merge(c["beta"]), c["merge"]]
                else:
                    cycle = [cal[i - 1]["merge"], c["merge"]]
                break
        if cycle:
            _CYCLE_SPAN = "-".join(x.strftime("%Y%m%d") for x in cycle)

    return _CYCLE_SPAN