How to use the mozregression.dates.to_datetime function in mozregression

To help you get started, we’ve selected a few mozregression 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 / mozregression / mozregression / telemetry.py View on Github external
def _send_telemetry_ping(metrics):
    METRICS.usage.variant.set(metrics.variant)
    METRICS.usage.app.set(metrics.appname)
    METRICS.usage.build_type.set(metrics.build_type)
    if is_date_or_datetime(metrics.good):
        METRICS.usage.good_date.set(to_datetime(metrics.good))
    if is_date_or_datetime(metrics.bad):
        METRICS.usage.bad_date.set(to_datetime(metrics.bad))
    if is_date_or_datetime(metrics.launch):
        METRICS.usage.launch_date.set(to_datetime(metrics.launch))
    PINGS.usage.submit()
github mozilla / mozregression / mozregression / telemetry.py View on Github external
def _send_telemetry_ping(metrics):
    METRICS.usage.variant.set(metrics.variant)
    METRICS.usage.app.set(metrics.appname)
    METRICS.usage.build_type.set(metrics.build_type)
    if is_date_or_datetime(metrics.good):
        METRICS.usage.good_date.set(to_datetime(metrics.good))
    if is_date_or_datetime(metrics.bad):
        METRICS.usage.bad_date.set(to_datetime(metrics.bad))
    if is_date_or_datetime(metrics.launch):
        METRICS.usage.launch_date.set(to_datetime(metrics.launch))
    PINGS.usage.submit()
github mozilla / mozregression / mozregression / bisector.py View on Github external
def _print_progress(self, new_data):
        next_good_date = new_data[0].build_date
        next_bad_date = new_data[-1].build_date
        next_days_range = abs((to_datetime(next_bad_date) - to_datetime(next_good_date)).days)
        LOG.info(
            "Narrowed nightly regression window from"
            " [%s, %s] (%d days) to [%s, %s] (%d days)"
            " (~%d steps left)"
            % (
                self.good_date,
                self.bad_date,
                abs((to_datetime(self.bad_date) - to_datetime(self.good_date)).days),
                next_good_date,
                next_bad_date,
                next_days_range,
                compute_steps_left(next_days_range),
            )
github mozilla / mozregression / mozregression / bisector.py View on Github external
def _print_progress(self, new_data):
        next_good_date = new_data[0].build_date
        next_bad_date = new_data[-1].build_date
        next_days_range = abs((to_datetime(next_bad_date) - to_datetime(next_good_date)).days)
        LOG.info(
            "Narrowed nightly regression window from"
            " [%s, %s] (%d days) to [%s, %s] (%d days)"
            " (~%d steps left)"
            % (
                self.good_date,
                self.bad_date,
                abs((to_datetime(self.bad_date) - to_datetime(self.good_date)).days),
                next_good_date,
                next_bad_date,
                next_days_range,
                compute_steps_left(next_days_range),
            )
github mozilla / mozregression / mozregression / build_range.py View on Github external
def _check_date(obj):
        if is_date_or_datetime(obj):
            if to_datetime(obj) < time_limit:
                LOG.info(
                    "TaskCluster only keeps builds for one year."
                    " Using %s instead of %s." % (time_limit, obj)
                )
                obj = time_limit
        return obj
github mozilla / mozregression / mozregression / cli.py View on Github external
self.logger.info("No 'good' option specified, using %s" % options.good)
            else:
                options.good = self._convert_to_bisect_arg(options.good)

            self.action = "bisect_integration"
            if is_date_or_datetime(options.good) and is_date_or_datetime(options.bad):
                if not options.find_fix and to_datetime(options.good) > to_datetime(options.bad):
                    raise MozRegressionError(
                        (
                            "Good date %s is later than bad date %s."
                            " Maybe you wanted to use the --find-fix"
                            " flag?"
                        )
                        % (options.good, options.bad)
                    )
                elif options.find_fix and to_datetime(options.good) < to_datetime(options.bad):
                    raise MozRegressionError(
                        (
                            "Bad date %s is later than good date %s."
                            " You should not use the --find-fix flag"
                            " in this case..."
                        )
                        % (options.bad, options.good)
                    )
                if fetch_config.should_use_archive():
                    self.action = "bisect_nightlies"
        if (
            self.action in ("launch_integration", "bisect_integration")
            and not fetch_config.is_integration()
        ):
            raise MozRegressionError(
                "Unable to bisect integration for `%s`" % fetch_config.app_name
github mozilla / mozregression / gui / mozregui / wizard.py View on Github external
def validatePage(self):
        start, end = self.get_start(), self.get_end()
        if isinstance(start, str) or isinstance(end, str):
            # do not check revisions
            return True
        try:
            start_date = to_datetime(start)
            end_date = to_datetime(end)
        except DateFormatError as exc:
            QMessageBox.critical(self, "Error", str(exc))
            return False
        current = datetime.datetime.now()
        if start_date < end_date:
            if end_date <= current:
                return True
            else:
                QMessageBox.critical(self, "Error", "You can't define a date in the future.")
        else:
            QMessageBox.critical(
                self, "Error", "The first date must be earlier than the second one."
            )

        return False