I'd like to ask if it's possible to export list of pagure groups, their members and their packages into json in a similar manner as there is https://src.fedoraproject.org/extras/pagure_owner_alias.json .
Having such json would speed up syncing of packager dashboard as fetching pagure groups is one of the slowest tasks we're periodically running.
I am currently using this code to get the data I need:
def get_pagure_groups(): """ Returns dictionary mapping all packager groups in pagure, it's members and packages "group_name" : { "users": [user_a, ...], "packages": [package_a, ...] } """ groups_users = {} resp = get_json("https://src.fedoraproject.org/api/0/groups?per_page=100") # TODO: Handle pagination properly if not resp: return None for group in resp["groups"]: app.logger.debug("Checking out Pagure group %s" % group) group_resp = get_json("https://src.fedoraproject.org/api/0/group/%s?projects=1&acl=commit" % group) if not group_resp: continue try: groups_users[group] = { "users": group_resp["members"], "packages": [project["name"] for project in group_resp["projects"]] } except TypeError: app.logger.error("Skipped Pagure group %s because of an error" % group) continue return groups_users
I can try to write the code myself, if somebody points me out to the code handling pagure_owner_alias.json (I assume it's not created from data obtained by public api).
Thanks a lot!
This is not time critical at all.
The scripts generating these json files are at: https://pagure.io/pagure-dist-git/blob/master/f/scripts
Then we have a cron to run them hourly: https://pagure.io/fedora-infra/ansible/blob/master/f/roles/distgit/pagure/tasks/main.yml#_320-354
Metadata Update from @pingou: - Issue priority set to: Waiting on Assignee (was: Needs Review) - Issue tagged with: pagure
Metadata Update from @mohanboddu: - Issue tagged with: groomed, low-gain, low-trouble
@pingou Can we move this to pagure-dist-git repo and close this ticket here?
pagure-dist-git
@frantisekz if you have all the info you need I think we should close this ticket and either open a ticket or a PR to discuss further on https://pagure.io/pagure-dist-git/
What do you think?
@frantisekz if you have all the info you need I think we should close this ticket and either open a ticket or a PR to discuss further on https://pagure.io/pagure-dist-git/ What do you think?
Sure thing!
Thanks :)
Metadata Update from @frantisekz: - Issue close_status updated to: Fixed - Issue status updated to: Closed (was: Open)
Log in to comment on this ticket.