From a028b2f3c60aa80be0046bb1a2b4744538e93c54 Mon Sep 17 00:00:00 2001 From: yanheven Date: Sun, 8 Feb 2015 15:45:35 +0000 Subject: [PATCH] Also parse related task for each bug Many bugs have related tasks, we should parse this task by sending a request to launchpad by this param "related_tasks_collection_link". if the bug has related tasks,the key "entries" in return data will be a list, we can treat it as a normal bug "entries". Change-Id: Ic5b625146b7f3eee641cd8d39ca99f72f792ac48 Closes-Bug:1419460 --- stackalytics/processor/launchpad_utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/stackalytics/processor/launchpad_utils.py b/stackalytics/processor/launchpad_utils.py index 4dec7b656..68df70b9c 100644 --- a/stackalytics/processor/launchpad_utils.py +++ b/stackalytics/processor/launchpad_utils.py @@ -98,4 +98,13 @@ def lp_bug_generator(module, modified_since): for record in chunk['entries']: yield record + related_tasks_uri = record['related_tasks_collection_link'] + LOG.debug('Reading related task from uri %s', related_tasks_uri) + related_tasks = utils.read_json_from_uri(related_tasks_uri) + if not related_tasks: + LOG.warn('No data was read from uri %s', uri) + elif related_tasks['entries']: + for related_task in related_tasks['entries']: + yield related_task + uri = chunk.get('next_collection_link')