PR#1718: also nudge reused components after 10 minutes

Merges #1718
https://pagure.io/fm-orchestrator/pull-request/1718

Fixes: #1621
https://pagure.io/fm-orchestrator/issue/1621
unable to recover from failed tag operation
This commit is contained in:
Mike McLean
2021-07-19 14:23:51 -04:00

View File

@@ -105,6 +105,7 @@ def fail_lost_builds():
# TODO re-use
if conf.system == "koji":
ten_minutes = timedelta(minutes=10)
# We don't do this on behalf of users
koji_session = get_session(conf, login=False)
log.info("Querying tasks for statuses:")
@@ -119,15 +120,17 @@ def fail_lost_builds():
if not component_build.task_id:
continue
# Don't check tasks for components which have been reused,
# they may have BUILDING state temporarily before we tag them
# to new module tag. Checking them would be waste of resources.
# For components which have been reused, wait 10 minutes before checking.
# They may be in BUILDING state temporarily before we tag them
# to new module tag. Checking them at that point would be waste of resources.
if component_build.reused_component_id:
log.debug(
'Skipping check for task "%s", the component has been reused ("%s").',
component_build.task_id, component_build.reused_component_id
)
continue
now = datetime.utcnow()
if (now - component_build.module_build.time_modified) < ten_minutes:
log.debug(
'Skipping check for task "%s", the component has been reused ("%s").',
component_build.task_id, component_build.reused_component_id
)
continue
task_id = component_build.task_id
@@ -165,6 +168,7 @@ def fail_lost_builds():
build_name=component_build.package,
build_release=build_release,
build_version=build_version,
module_build_id=component_build.module_build.id,
)
elif conf.system == "mock":