Remove updateJobParentData method

This method was added as part of the initial deduplication work in
959a0b9834.  Since we now collect
parent data at the time that we run the job, this method doesn't
actually do anything other than decide when jobs are ready to run.

This change moves that logic back into the findJobsToRun method
and removes the unecessary updateJobParentData method.

Change-Id: Iac744a24ee3902360eeaef371808657a8eeb2080
This commit is contained in:
James E. Blair 2024-02-07 10:45:02 -08:00
parent fa274fcf25
commit 1bec2014bc
2 changed files with 41 additions and 61 deletions

View File

@ -1602,7 +1602,6 @@ class PipelineManager(metaclass=ABCMeta):
self.scheduleGlobalRepoState(item)
if build_set.repo_state_state == build_set.PENDING:
return False
item.updateJobParentData()
return True
@ -1911,20 +1910,9 @@ class PipelineManager(metaclass=ABCMeta):
build, item)
return
item = build.build_set.item
# We don't care about some actions below if this build
# isn't in the current buildset, so determine that before
# it is potentially removed with setResult.
if build not in item.current_build_set.getBuilds():
current = False
else:
current = True
item.setResult(build)
log.debug("Item %s status is now:\n %s", item, item.formatStatus())
if not current:
return
build_set = item.current_build_set
build_set = build.build_set
if build.retry:
if build_set.getJobNodeSetInfo(build.job):

View File

@ -2292,8 +2292,7 @@ class FrozenJob(zkobject.ZKObject):
def __init__(self):
super().__init__()
self._set(_ready_to_run=False,
ref=None,
self._set(ref=None,
other_refs=[])
def __repr__(self):
@ -5354,51 +5353,6 @@ class QueueItem(zkobject.ZKObject):
self.setResult(fakebuild)
return False
def updateJobParentData(self):
job_graph = self.current_build_set.job_graph
failed_job_ids = set() # Jobs that run and failed
ignored_job_ids = set() # Jobs that were skipped or canceled
unexecuted_job_ids = set() # Jobs that were not started yet
jobs_not_started = set()
for job in job_graph.getJobs():
job._set(_ready_to_run=False)
build = self.current_build_set.getBuild(job)
if build:
if build.result == 'SUCCESS' or build.paused:
pass
elif build.result == 'SKIPPED':
ignored_job_ids.add(job.uuid)
else: # elif build.result in ('FAILURE', 'CANCELED', ...):
failed_job_ids.add(job.uuid)
else:
unexecuted_job_ids.add(job.uuid)
jobs_not_started.add(job)
for job in job_graph.getJobs():
if job not in jobs_not_started:
continue
if not self.jobRequirementsReady(job):
continue
all_parent_jobs_successful = True
parent_builds_with_data = {}
for parent_job in job_graph.getParentJobsRecursively(job):
if parent_job.uuid in unexecuted_job_ids \
or parent_job.uuid in failed_job_ids:
all_parent_jobs_successful = False
break
parent_build = self.current_build_set.getBuild(parent_job)
if parent_build.result_data:
parent_builds_with_data[parent_job.uuid] = parent_build
for parent_job in job_graph.getParentJobsRecursively(
job, skip_soft=True):
if parent_job.uuid in ignored_job_ids:
all_parent_jobs_successful = False
break
if all_parent_jobs_successful:
job._set(_ready_to_run=True)
def getArtifactData(self, job):
data = []
self.providesRequirements(job, data)
@ -5447,8 +5401,46 @@ class QueueItem(zkobject.ZKObject):
return []
job_graph = self.current_build_set.job_graph
failed_job_ids = set() # Jobs that run and failed
ignored_job_ids = set() # Jobs that were skipped or canceled
unexecuted_job_ids = set() # Jobs that were not started yet
jobs_not_started = set()
for job in job_graph.getJobs():
if job._ready_to_run:
build = self.current_build_set.getBuild(job)
if build:
if build.result == 'SUCCESS' or build.paused:
pass
elif build.result == 'SKIPPED':
ignored_job_ids.add(job.uuid)
else: # elif build.result in ('FAILURE', 'CANCELED', ...):
failed_job_ids.add(job.uuid)
else:
unexecuted_job_ids.add(job.uuid)
jobs_not_started.add(job)
for job in job_graph.getJobs():
if job not in jobs_not_started:
continue
if not self.jobRequirementsReady(job):
continue
all_parent_jobs_successful = True
parent_builds_with_data = {}
for parent_job in job_graph.getParentJobsRecursively(job):
if parent_job.uuid in unexecuted_job_ids \
or parent_job.uuid in failed_job_ids:
all_parent_jobs_successful = False
break
parent_build = self.current_build_set.getBuild(parent_job)
if parent_build.result_data:
parent_builds_with_data[parent_job.uuid] = parent_build
for parent_job in job_graph.getParentJobsRecursively(
job, skip_soft=True):
if parent_job.uuid in ignored_job_ids:
all_parent_jobs_successful = False
break
if all_parent_jobs_successful:
nodeset = self.current_build_set.getJobNodeSetInfo(job)
if nodeset is None:
# The nodes for this job are not ready, skip