def do_landing(git_gecko, git_wpt, *args, **kwargs): import errors import landing import update current_landing = landing.current(git_gecko, git_wpt) accept_failures = kwargs["accept_failures"] def update_landing(): landing.update_landing(git_gecko, git_wpt, kwargs["prev_wpt_head"], kwargs["wpt_head"], kwargs["include_incomplete"], retry=kwargs["retry"], accept_failures=accept_failures) if current_landing and current_landing.latest_try_push: with SyncLock("landing", None) as lock: try_push = current_landing.latest_try_push logger.info("Found try push %s" % try_push.treeherder_url) if try_push.taskgroup_id is None: update.update_taskgroup_ids(git_gecko, git_wpt, try_push) assert try_push.taskgroup_id is not None with try_push.as_mut(lock), current_landing.as_mut(lock): if kwargs["retry"]: update_landing() elif try_push.status == "open": tasks = try_push.tasks() try_result = current_landing.try_result(tasks=tasks) if try_result == landing.TryPushResult.pending: logger.info( "Landing in bug %s is waiting for try results" % landing.bug) else: try: landing.try_push_complete( git_gecko, git_wpt, try_push, current_landing, allow_push=kwargs["push"], accept_failures=accept_failures, tasks=tasks) except errors.AbortError: # Don't need to raise an error here because # the logging is the important part return else: update_landing() else: update_landing()
def do_landing(git_gecko, git_wpt, *args, **kwargs): import landing import update current_landing = landing.current(git_gecko, git_wpt) accept_failures = kwargs["accept_failures"] def update_landing(): landing.update_landing(git_gecko, git_wpt, kwargs["prev_wpt_head"], kwargs["wpt_head"], kwargs["include_incomplete"], kwargs["retry"]) if current_landing and current_landing.latest_try_push: try_push = current_landing.latest_try_push logger.info("Found try push %s" % try_push.treeherder_url(try_push.try_rev)) if try_push.taskgroup_id is None: update.update_taskgroup_ids(git_gecko, git_wpt) assert try_push.taskgroup_id is not None if try_push.status == "complete" and try_push.failure_limit_exceeded( ) and accept_failures: try_push.status = "open" if (try_push.status == "open" and try_push.wpt_tasks( force_update=True).is_complete(allow_unscheduled=True)): if try_push.infra_fail: update_landing() else: landing.try_push_complete(git_gecko, git_wpt, try_push, current_landing, allow_push=kwargs["push"], accept_failures=accept_failures) elif try_push.status == "complete" and not try_push.infra_fail: landing.push_to_gecko(git_gecko, git_wpt, current_landing, allow_push=kwargs["push"]) elif try_push.status == "complete": if kwargs["retry"]: update_landing() else: logger.info( "Last try push was complete, but has failures or errors. " "Rerun with --accept-failures or --retry") else: logger.info("Landing in bug %s is waiting for try results" % landing.bug) else: update_landing()
def __call__(self, git_gecko, git_wpt, body): newrelic.agent.set_transaction_name("TaskGroupHandler") taskgroup_id = tc.normalize_task_id(body["taskGroupId"]) newrelic.agent.add_custom_parameter("tc_task", taskgroup_id) try_push = trypush.TryPush.for_taskgroup(git_gecko, taskgroup_id) if not try_push: logger.debug("No try push for taskgroup %s" % taskgroup_id) # this is not one of our try_pushes return logger.info("Found try push for taskgroup %s" % taskgroup_id) sync = try_push.sync(git_gecko, git_wpt) with SyncLock.for_process(sync.process_name) as lock: with sync.as_mut(lock), try_push.as_mut(lock): # We sometimes see the taskgroup ID being None. If it isn't set but found via its # taskgroup ID, it is safe to set it here. if try_push.taskgroup_id is None: logger.info( "Try push for taskgroup %s does not have its ID set, setting now" % taskgroup_id) try_push.taskgroup_id = taskgroup_id newrelic.agent.record_custom_event("taskgroup_id_missing", params={ "taskgroup-id": taskgroup_id, "try_push": try_push, "sync": sync, }) elif try_push.taskgroup_id != taskgroup_id: msg = ( "TryPush %s, expected taskgroup ID %s, found %s instead" % (try_push, taskgroup_id, try_push.taskgroup_id)) logger.error(msg) exc = ValueError(msg) newrelic.agent.record_exception(exc=exc) raise exc if sync: logger.info("Updating try push for sync %r" % sync) if isinstance(sync, downstream.DownstreamSync): downstream.try_push_complete(git_gecko, git_wpt, try_push, sync) elif isinstance(sync, landing.LandingSync): landing.try_push_complete(git_gecko, git_wpt, try_push, sync)
def __call__(self, git_gecko, git_wpt, body): taskgroup_id = tc.normalize_task_id(body["taskGroupId"]) try_push = trypush.TryPush.for_taskgroup(git_gecko, taskgroup_id) if not try_push: logger.debug("No try push for taskgroup %s" % taskgroup_id) # this is not one of our try_pushes return logger.info("Found try push for taskgroup %s" % taskgroup_id) sync = try_push.sync(git_gecko, git_wpt) if sync: logger.info("Updating try push for sync %r" % sync) if isinstance(sync, downstream.DownstreamSync): downstream.try_push_complete(git_gecko, git_wpt, try_push, sync) elif isinstance(sync, landing.LandingSync): landing.try_push_complete(git_gecko, git_wpt, try_push, sync)