Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-02-18 20:22:29 +0100
committerErich Eckner <git@eckner.net>2018-02-18 20:22:29 +0100
commit7bc95ff14d099110736feb6298aedf07bc6b67a6 (patch)
treeec5c9158d78dbb815e76b2237134fa85dc83bb49
parentb8b37df3177987401574462fe17c3be9a9ed94f7 (diff)
bin/get-assignment: hand out jobs by last-trial date, not by trial-count
-rwxr-xr-xbin/get-assignment15
1 files changed, 7 insertions, 8 deletions
diff --git a/bin/get-assignment b/bin/get-assignment
index 083b162..3dbd386 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -166,8 +166,6 @@ if [ -n "${currently_building}" ]; then
hand_out_assignment ${currently_building}
fi
-# TODO: actually implement the below criteria (a.k.a.: "I'm out of time")
-
# a package with [all dependencies met or which is part of a loop]
# and which is currently not being built, ordered by:
# 1: we requested it
@@ -184,16 +182,16 @@ next_building=$(
base64 -w0
)"
printf '`build_assignments`.`priority`,'
- printf '('
- printf 'SELECT COUNT(*)'
- printf ' FROM `failed_builds`'
- printf ' WHERE `failed_builds`.`build_assignment`=`build_assignments`.`id`'
- printf ') AS `trials`,'
+ printf 'COALESCE('
+ printf 'MAX(`failed_builds`.`date`),0'
+ printf ') AS `last_trial`,'
mysql_query_is_part_of_loop '`build_assignments`.`id`'
printf ' AS `part_of_loop`,'
mysql_query_select_pkgbase_and_revision
mysql_join_build_assignments_binary_packages
mysql_join_binary_packages_repositories
+ printf ' LEFT'
+ mysql_join_build_assignments_failed_builds
printf ' WHERE `repositories`.`name`="build-list"'
printf ' AND NOT EXISTS ('
printf ' SELECT *'
@@ -212,7 +210,8 @@ next_building=$(
printf ' OR NOT '
mysql_query_has_pending_dependencies '`build_assignments`.`id`'
printf ')'
- printf ' ORDER BY `requested` DESC, `priority` DESC, `trials`, `part_of_loop`, `build_assignments`.`id`'
+ printf ' GROUP BY `build_assignments`.`id`'
+ printf ' ORDER BY `requested` DESC, `priority` DESC, `last_trial`, `part_of_loop`, `build_assignments`.`id`'
printf ' LIMIT 1;\n'
} | \
${mysql_command} --batch --raw | \