#1 Support fetching data from blockerbugs
Merged 5 years ago by frantisekz. Opened 5 years ago by frantisekz.

@@ -11,6 +11,8 @@ 

  import collections

  import time

  

+ from werkzeug.contrib.cache import SimpleCache

+ 

  from oraculum.config import EASYFIX_CACHE_PROJECTINFO, EASYFIX_CACHE_TICKETS

  from oraculum.utils import Action, ACTION_TIMES

  
@@ -108,52 +110,184 @@ 

                  ])

      return list(set(cts.keys()) - ignore)

  

- def get_actions():

+ IGNORE = [

+         'fedora-commops', 'fedora-diversity', 'fedora-infrastructure', 'fedora-docs/docs-fp-o', 'fedora-docs/quick-docs',

+         'fedora-hubs', 'fedora-join/Fedora-Join', 'fedora-qa'

+         ]

+ 

+ 

+ PROJINFO_DB = {

+     'RITlug/TigerOS': {'description': 'Fedora Remix maintained by the Rochester Institute of Technology (RIT) Linux Users '

+                        'Group, targeted at users new to Linux and RIT students, faculty, and staff ',

+                        'languages': ['Ruby', 'Bash']},

+     'RITlug/teleirc': {'description': 'NodeJS implementation of a Telegram <=> IRC bridge for use with any IRC channel '

+                        'and Telegram group',

+                        'languages': ['JavaScript']},

+     'SSSD/sssd': {'description': 'SSSD provides a set of daemons to manage access to remote directories and '

+                   'authentication mechanisms such as LDAP, Kerberos or FreeIPA.',

+                   'languages': ['C', 'Python', 'D']},

+     'fedocal': {'description': 'fedocal is a web based calendar application.', 'languages': ['Python', 'JavaScript']},

+     'fedora-infra/bodhi': {'description': 'Bodhi is a web-system that facilitates the process of publishing updates for a '

+                            'Fedora-based software distribution.',

+                            'languages': ['Python']},

+     'fedora-infra/fas': {'description': 'The Fedora Account System is a community oriented accounts system which aims to '

+                          'provide a self-driven and self-controled management to its registered users.',

+                          'languages': ['JavaScript', 'HTML', 'Python']},

+     'fedora-infra/fedmsg': {'description': 'fedmsg (Federated Message Bus) is a library built on ZeroMQ using the PyZMQ '

+                             'Python bindings. fedmsg aims to make it easy to connect services together '

+                             'using ZeroMQ publishers and subscribers.',

+                             'languages': ['Python']},

+     'fedora-infra/fedora-packages': {'description': 'A webapp that allows searching packages in Fedora. Written in Python '

+                                      'using TurboGears2 and Moksha.',

+                                      'languages': ['JavaScript', 'Python']},

+     'fedora-infra/fedora-tagger': {'description': 'Flask app for helping us tag Fedora packages.',

+                                    'languages': ['Python', 'JavaScript']},

+     'fedora-infra/fmn.consumer': {'description': 'fmn is a family of systems to manage end-user notifications triggered '

+                                   'by fedmsg, the FEDerated MESsage bus. fmn provides a single place for '

+                                   'all applications using fedmsg to notify users of events. Notifications '

+                                   'can be delivered by email, irc, and server-sent events. Users can '

+                                   'configure their notifications for all the applications they use in one '

+                                   'place.',

+                                   'languages': ['Python']},

+     'fedora-infra/fmn.web': {'description': 'fmn is a family of systems to manage end-user notifications triggered by '

+                              'fedmsg, the FEDerated MESsage bus. fmn provides a single place for all '

+                              'applications using fedmsg to notify users of events. Notifications can be '

+                              'delivered by email, irc, and server-sent events. Users can configure their '

+                              'notifications for all the applications they use in one place.',

+                              'languages': ['HTML', 'Python']},

+     'fedora-infra/pkgdb2': {'description': 'PackageDB is the application handling who is allowed to commit on the git of '

+                             'the Fedora packages, it also handles who is the person getting the bugs on '

+                             'the bugzilla and who get the notifications for changes in the git, builds or '

+                             'bugs.',

+                             'languages': ['JavaScript', 'Python']},

+     'fedora-qa/os-autoinst-distri-fedora': {'description': 'openQA tests for the Fedora distribution',

+                                             'languages': ['Perl']},

+     'fedora-qa/testdays-web': {'description': 'Simple Flask web-app for reporting Fedora test days results.',

+                                'languages': ['HTML', 'Python']},

+     'fedora-websites': {'description': 'This is the Fedora Websites GIT repo used to build the websites starting from the '

+                         'F24 release cycle.',

+                         'languages': ['HTML', 'Python', 'Bash', 'PHP', 'JavaScript', 'C#']},

+     'freeipa': {'description': 'FreeIPA is an integrated Identity and Authentication solution for Linux/UNIX networked '

+                 'environments.',

+                 'languages': ['Python', 'Bash', 'C']},

+     'ipsilon': {'description': 'The Ipsilon project implements an Identity Provider that is easy to use and configure.',

+                 'languages': ['Python']},

+     'kushaldas/autocloud': {'description': 'In simple words this services listens to fedmsg messages for successful koji '

+                             'builds of cloud base, and atomic images. When found, it downloads those '

+                             'images, and test them locally using Tunir.',

+                             'languages': ['HTML', 'JavaScript', 'Python']},

+     'pagure': {'description': 'With pagure you can host your project with its documentation, let your users report issues '

+                'or request enhancements using the ticketing system and build your community of '

+                'contributors by allowing them to fork your projects and contribute to it via the '

+                'now-popular pull-request mechanism.',

+                'languages': ['HTML', 'JavaScript', 'Python']},

+     'pungi': {'description': 'Distribution compose tool', 'languages': ['Python']},

+     'release-monitoring/anitya': {'description': 'Anitya is a release monitoring project. It provides a user-friendly '

+                                   'interface to add, edit, or browse projects.',

+                                   'languages': ['Python', 'JavaScript']},

+     'taskotron/libtaskotron': {'description': 'libtaskotron is a library for running automated tasks as part of the '

+                                'Taskotron system. The initial objective is (but is not limited to) '

+                                'automating selected package checks in Fedora. ',

+                                'languages': ['Python']},

+     'taskotron/task-rpmlint': {'description': 'Taskotron task to run rpmlint on all new Koji builds',

+                                'languages': ['Python']}}

+ 

+ EASYFIX_CACHE = SimpleCache()

+ 

+ def get_actions(): # FIXME - store/load the projects data for realz

+     actions  = EASYFIX_CACHE.get('easyfix_actions')

+     if actions is not None:

+         return actions

+ 

      actions = []

-     project_info = {}

-     projects = {}

-     if os.path.isfile(EASYFIX_CACHE_PROJECTINFO):

-         with open(EASYFIX_CACHE_PROJECTINFO) as f:

-             project_info = json.load(f)

-     if os.path.isfile(EASYFIX_CACHE_TICKETS) and (time.time() - os.stat(EASYFIX_CACHE_TICKETS).st_mtime) < 3600: # FIXME

-         with open(EASYFIX_CACHE_TICKETS) as f:

-             projects = json.load(f)

-     else:

-         print("Parsing Easyfix page")

-         projects = parse_easyfix_page()

-         with open(EASYFIX_CACHE_TICKETS, 'w') as f:

-             json.dump(projects, f)

+     print("Parsing Easyfix page")

+     projects = parse_easyfix_page()

+ 

  

      for p in projects:

-         if p['url'] in project_info:

-             p.update(project_info[p['url']])

-         else:

-             print("Cloning project", p['name'], p['url'])

-             data = grab_project_metadata(p['url'])

-             if data is None:

-                 continue

-             p.update(data)

-             project_info[p['url']] = data

+         if p['name'] in IGNORE:

+             continue

+         if p['name'] not in PROJINFO_DB:

+             print("MISS on %s - %s" % (p['name'], p['url']))

+             continue

+ 

          for t in p['tickets']:

-             tags=filter_content_types(p['content_types'])

-             if not tags:

-                 continue

+             tags = PROJINFO_DB[p['name']]['languages']

              tags.append('Programming')

+             project_org = p['name'].split('/', 1)[0]

+             project_name = p['name'].split('/', 1)[-1]

              actions.append(Action(

-                 name="%s: %s" % (p['name'], t['title']),

+                 name=t['title'],

                  tags=tags,

                  duration=ACTION_TIMES['couple of days'],

                  provider="easyfix",

-                 extra_data={"ticket_url": t['url']},

+                 extra_data={

+                     "ticket_url": t['url'],

+                     'repo_org': project_org,

+                     'repo_name': project_name,

+                     'repo_fullname': p['name'],

+                     'repo_url': p['url'],

+                     'description': PROJINFO_DB[p['name']]['description'],

+                     'languages': PROJINFO_DB[p['name']]['languages'],

+                   },

                  )

                )

  

-     with open(EASYFIX_CACHE_PROJECTINFO, 'w') as f:

-         json.dump(project_info, f)

- 

+     EASYFIX_CACHE.set('easyfix_actions', actions, timeout=3600)

      return actions

  

  

+ #def get_actions():

+ #    actions = []

+ #    project_info = {}

+ #    projects = {}

+ #    if os.path.isfile(EASYFIX_CACHE_PROJECTINFO):

+ #        with open(EASYFIX_CACHE_PROJECTINFO) as f:

+ #            project_info = json.load(f)

+ #    if os.path.isfile(EASYFIX_CACHE_TICKETS) and (time.time() - os.stat(EASYFIX_CACHE_TICKETS).st_mtime) < 3600: # FIXME

+ #        with open(EASYFIX_CACHE_TICKETS) as f:

+ #            projects = json.load(f)

+ #    else:

+ #        print("Parsing Easyfix page")

+ #        projects = parse_easyfix_page()

+ #        with open(EASYFIX_CACHE_TICKETS, 'w') as f:

+ #            json.dump(projects, f)

+ #

+ #    for p in projects:

+ #        if p['url'] in project_info:

+ #            p.update(project_info[p['url']])

+ #        else:

+ #            if p['name'] in IGNORE:

+ #                continue

+ #            print("Cloning project", p['name'], p['url'])

+ #            data = grab_project_metadata(p['url'])

+ #            if data is None:

+ #                continue

+ #            p.update(data)

+ #            project_info[p['url']] = data

+ #        for t in p['tickets']:

+ #            tags=filter_content_types(p['content_types'])

+ #            if not tags:

+ #                continue

+ #            tags.append('Programming')

+ #            project_org = p['name'].split('/', 1)[0]

+ #            project_name = p['name'].split('/', 1)[-1]

+ #            actions.append(Action(

+ #                name="%s: %s" % (p['name'], t['title']),

+ #                tags=tags,

+ #                duration=ACTION_TIMES['couple of days'],

+ #                provider="easyfix",

+ #                extra_data={"ticket_url": t['url'], 'project_org': project_org, 'project_name': project_name, 'project_fullname': p['name'], 'languages': tags[:-1]},

+ #                )

+ #              )

+ #            break

+ #

+ #    with open(EASYFIX_CACHE_PROJECTINFO, 'w') as f:

+ #        json.dump(project_info, f)

+ #

+ #    return actions

+ #

+ 

  if __name__ == "__main__":

      import pprint

      pprint.pprint(get_actions())

no initial comment

rebased onto 410af3b

5 years ago

Looks kind of reasonable, the only "problem" I have is the return value - why return a list of one dict?

1 new commit added

  • No need to return list of one dict
5 years ago

1 new commit added

  • Add blockerbugs to the API
5 years ago

1 new commit added

  • Add proposed bugs, use early returns not to indent so deep
5 years ago

1 new commit added

  • Remove redundant parenthesis
5 years ago

rebased onto 300db04

5 years ago

rebased onto 3906484

5 years ago

Pull-Request has been merged by frantisekz

5 years ago
Metadata