#7636 Make find_failures.py show all maintainer
Merged 5 years ago by mohanboddu. Opened 5 years ago by tibbs.
tibbs/releng master  into  master

file modified
+10 -14
@@ -29,6 +29,7 @@ 

  epoch = '2018-07-12 17:00:00.000000' # Date to check for failures from

  failures = {} # dict of owners to lists of packages that failed.

  failed = [] # raw list of failed packages

+ ownerdataurl = 'https://src.fedoraproject.org/extras/pagure_owner_alias.json'

  

  

  def retry_session():
@@ -46,6 +47,11 @@ 

      return session

  

  

+ def get_owner_data():

+     owners = requests.get(ownerdataurl).json()

+     return owners

+ 

+ 

  def get_failed_builds(kojisession, epoch, buildtag, desttag):

      """This function returns list of all failed builds since epoch within

      buildtag that were not rebuilt succesfully in desttag
@@ -90,19 +96,8 @@ 

      taskinfos = kojisession.multiCall()

      for build, [taskinfo] in zip(failbuilds, taskinfos):

          build['taskinfo'] = taskinfo

-     # Get owners of the packages with failures

-     http = retry_session()

-     for build in failbuilds:

-         build['package_owner'] = get_package_owner(http, build['package_name'])

      return failbuilds

  

- def get_package_owner(http, package):

-     url = 'https://src.fedoraproject.org/api/0/rpms/{0}'.format(package)

-     response = http.get(url, timeout=30)

-     if not bool(response):

-         return 'releng'

-     return response.json()['access_users']['owner'][0]

- 

  

  if __name__ == '__main__':

      # Create a koji session
@@ -110,17 +105,18 @@ 

  

      failbuilds = get_failed_builds(kojisession, epoch, buildtag, desttag)

  

+     owners = get_owner_data()

  

      # Generate the dict with the failures and urls

      for build in failbuilds:

          if not build['taskinfo']['request'][1] == buildtag:

              continue

          taskurl = 'https://koji.fedoraproject.org/koji/taskinfo?taskID=%s' % build['task_id']

-         owner = build['package_owner']

          pkg = build['package_name']

-         if not pkg in failed:

+         for owner in owners['rpms'][pkg]:

+             failures.setdefault(owner, {})[pkg] = taskurl

+         if pkg not in failed:

              failed.append(pkg)

-         failures.setdefault(owner, {})[pkg] = taskurl

  

      now = datetime.datetime.now()

      now_str = "%s UTC" % str(now.utcnow())

Previously the find_failures.py would use only the first result
provided by pagure, which caused some package maintainers to fail to
notice problems from the mass rebuild.

In addition, the script would make one API call per failed package,
which was quite slow.

This patch converts the script to show list packages under each
maintainer, and to use the data which is cached (and updated hourly) for
just this use case.

Instead of this, used the data which is cached for the express this, and
list packages under each maintainer.

For me, the runtime drops from 2 minutes 41 seconds to 18 seconds. The
resulting list is of course a bit longer and many packages are listed
under multiple usernames but the end result looks much the same.

Signed-off-by: Jason Tibbitts tibbs@math.uh.edu

I'm basically terrible at git so please let me know if I screwed something up.

LGTM

I really like to notify who are all maintaining the package, rather than just one person.

Pull-Request has been merged by mohanboddu

5 years ago
Metadata