#3402 Correct getAverageDuration values for most GC builds
Merged 2 years ago by tkopecek. Opened 2 years ago by tkopecek.
tkopecek/koji issue1128  into  master

file modified
+6 -1
@@ -12479,12 +12479,17 @@ 

          if not packageID:

              return None

          st_complete = koji.BUILD_STATES['COMPLETE']

+         # we need to filter out builds without tasks (imports) as they'll reduce

+         # time average. CG imported builds often contain *_koji_task_id instead.

          query = """SELECT date_part('epoch', avg(build.completion_time - events.time))

                       FROM build

                       JOIN events ON build.create_event = events.id

                       WHERE build.pkg_id = %(packageID)i

                         AND build.state = %(st_complete)i

-                        AND build.task_id IS NOT NULL"""

+                        AND (

+                          build.task_id IS NOT NULL OR

+                          build.extra LIKE '%koji_task_id%'

+                        )"""

          if age is not None:

              query += " AND build.completion_time >  NOW() - '%s months'::interval" % int(age)

  

I was a bit afraid of query speed but it is almost the same query plan - just extended filter on build_by_pkg_id index scan. Nevertheless, execution time grows ~10x. Random package (10ms vs 94ms) It seems acceptable as it is not called too often.

rebased onto 47d3f89

2 years ago

pretty please pagure-ci rebuild

2 years ago

It's not an idea solution, but I guess it's the best we can do until we get a better solution for associating tasks with CG builds.

It seems acceptable as it is not called too often.

Specifically, it is called:

  • at the start of each buildArch task. A few milliseconds here makes no real difference.
  • for each load of a taskinfo and buildinfo pages in the web ui. This is a much shorter timescale than buildArch, but still not an issue to add a few milliseconds.
  • Ken's chatbot plugin, as described in #1128. Similarly ok.

It's possible that another outside system could be using this call, but I would expect a similar usage pattern if so.

Metadata Update from @tkopecek:
- Pull-request tagged with: no_qe

2 years ago

Commit b5ff9d8 fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago
Metadata