Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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()
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()
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()
):
# inform users on windows that we are using 64 bit builds.
self.logger.info("bits option not specified, using 64-bit builds.")
if options.bits == 32 and mozinfo.os == "mac":
self.logger.info("only 64-bit builds available for mac, using " "64-bit builds")
if fetch_config.is_integration() and fetch_config.tk_needs_auth():
creds = tc_authenticate(self.logger)
fetch_config.set_tk_credentials(creds)
# set action for just use changset or data to bisect
if options.launch:
options.launch = self._convert_to_bisect_arg(options.launch)
self.action = "launch_integration"
if is_date_or_datetime(options.launch) and fetch_config.should_use_archive():
self.action = "launch_nightlies"
else:
# define good/bad default values if required
default_good_date, default_bad_date = get_default_date_range(fetch_config)
if options.find_fix:
default_bad_date, default_good_date = (
default_good_date,
default_bad_date,
)
if not options.bad:
options.bad = default_bad_date
self.logger.info("No 'bad' option specified, using %s" % options.bad)
else:
options.bad = self._convert_to_bisect_arg(options.bad)
if not options.good:
options.good = default_good_date
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
def init_worker(self, fetch_config, options):
AbstractBuildRunner.init_worker(self, fetch_config, options)
self.worker.test_runner.evaluate_started.connect(self.evaluate)
self.worker.finished.connect(self.bisection_finished)
self.worker.handle_merge.connect(self.handle_merge)
self.worker.choose_next_build.connect(self.choose_next_build)
good, bad = options.get("good"), options.get("bad")
if (
is_date_or_datetime(good)
and is_date_or_datetime(bad)
and fetch_config.should_use_archive()
):
handler = NightlyHandler(find_fix=options["find_fix"])
else:
handler = IntegrationHandler(find_fix=options["find_fix"])
self.worker._bisect_args = (handler, good, bad)
self.worker.download_in_background = self.global_prefs["background_downloads"]
if self.global_prefs["approx_policy"]:
self.worker.approx_chooser = ApproxPersistChooser(7)
return self.worker.bisect
def pushes_within_changes(self, fromchange, tochange, verbose=True, **kwargs):
"""
Returns a list of Push objects, including fromchange and tochange.
This will return at least one Push. In case of error it will raise
a MozRegressionError.
"""
from_is_date = is_date_or_datetime(fromchange)
to_is_date = is_date_or_datetime(tochange)
kwargs = {}
if not from_is_date:
# the first changeset is not taken into account in the result.
# let's add it directly with this request
chsets = self.pushes(changeset=fromchange)
kwargs["fromchange"] = fromchange
else:
chsets = []
kwargs["startdate"] = fromchange.strftime("%Y-%m-%d")
if not to_is_date:
kwargs["tochange"] = tochange
else:
# add one day to take the last day in account
kwargs["enddate"] = (tochange + datetime.timedelta(days=1)).strftime("%Y-%m-%d")
def init_worker(self, fetch_config, options):
AbstractBuildRunner.init_worker(self, fetch_config, options)
self.worker.test_runner.evaluate_started.connect(self.evaluate)
self.worker.finished.connect(self.bisection_finished)
self.worker.handle_merge.connect(self.handle_merge)
self.worker.choose_next_build.connect(self.choose_next_build)
good, bad = options.get("good"), options.get("bad")
if (
is_date_or_datetime(good)
and is_date_or_datetime(bad)
and fetch_config.should_use_archive()
):
handler = NightlyHandler(find_fix=options["find_fix"])
else:
handler = IntegrationHandler(find_fix=options["find_fix"])
self.worker._bisect_args = (handler, good, bad)
self.worker.download_in_background = self.global_prefs["background_downloads"]
if self.global_prefs["approx_policy"]:
self.worker.approx_chooser = ApproxPersistChooser(7)
return self.worker.bisect
default_good_date,
default_bad_date,
)
if not options.bad:
options.bad = default_bad_date
self.logger.info("No 'bad' option specified, using %s" % options.bad)
else:
options.bad = self._convert_to_bisect_arg(options.bad)
if not options.good:
options.good = default_good_date
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..."
)