[launchpad] Add support for launchpad#851
Conversation
|
Hi @valeriocos, here is the first iteration of launchpad backend for ELK. |
|
Hi @imnitishng ! The start looks promising!
In this PR, I would suggest to limit the scope of the enriched data to be produced. The studies and further enriched attributes can be added later on. It would be also convenient to list some metrics to be visualized (as done here: #831 (comment)) You can take a look at the following enrichers to see which is the typical information produced.
Thank you for the info. To speed up the testing of this backend, we can focus on small repos. Once we have a mature implementation, we can test it on something like Ubuntu. WDYT? |
|
Sure, I'll get back to you with the metrics. |
|
Hi @valeriocos Here are some metrics I have in mind - For a general overview
For timing study or in a different menu (like GitHub issues timing)
A geolocation study can be an option giving us the visualization for
|
|
Thank you @imnitishng for advancing on this pull request. Could you share some launchpad repos to have a common base to test the backend? The metrics look good! I would skip the last metric ( Thanks! |
|
Yes sure.
Sure. Waiting on your suggestions for this iteration. |
|
Hi @valeriocos, I will start the work on panels and tests, would love to have a review so we can think upon adding or modifying some attributes. |
|
Thank you @imnitishng ! As soon as the work on the Gitter dashboard is completed, I'll review this PR. The idea behind this decision is to concentrate the effort in one thing, finalize it and move then to another task. |
|
Oh, okay sure. Thanks. |
|
Sorry @imnitishng , I'm late with this PR. I'll have a look at it at most tomorrow |
There was a problem hiding this comment.
Hi @imnitishng sorry for the late review. Overall the code looks good and easy to ready, I left some comments.
I have tested the PR with:
setup.cfg
[launchpad]
raw_index = launchpad_raw_test
enriched_index = launchpad_enrich_test
projects.json
"launchpad": [
"https://launchpad.net/launchpad"
]
Please check also the comments below:
-
Note that the Perceval backend (ref here) allows also to fetch data from a package in a distribution. This case doesn't seem to be covered by the current implementation
-
Rebase your PR, it isn't aligned with
master -
Start adding tests when you have time, the review process will be easier.
-
Update the PR description with the repos you are using (or plan to) to test the PR.
-
Update the documentation in ELK and mordred
Thanks!
8c98976 to
878ad25
Compare
878ad25 to
006bbf8
Compare
|
@valeriocos Should I open a new PR, cannot get rid of this problem after I did a rebase. Please help. |
|
Hi @imnitishng , yes open a new PR, if you cannot advance. However, it is convenient to use this PR to get familiar with the rebase. Can you list the steps you did when rebasing this PR? Thanks! |
|
Thank you @valeriocos Could not rebase Squashed commits I think it happened because I fetched before committing? |
|
I get the problem, trying to fix it. |
|
I guess that the problem could have been with the last instruction: |
006bbf8 to
9ebcb9e
Compare
|
Well okay. I also fixed this PR. We can close #863 if we use this PR. |
9ebcb9e to
52c3f79
Compare
Pull Request Test Coverage Report for Build 2181
💛 - Coveralls |
|
Hi @imnitishng , no worries ! I'm fine with any of the two PRs. Please close one and I'll review the other one. Thanks! |
|
Let's go with this one. Thanks. |
|
Hi @imnitishng , can you rebase your PR to include the changes of #864? Thanks! |
52c3f79 to
ce0c627
Compare
|
Done 😄 |
valeriocos
left a comment
There was a problem hiding this comment.
Hi @imnitishng sorry for the late reply! The PR is in good shape, but some work is still needed.
|
Hi @valeriocos, thank you for the review. |
|
Hi @imnitishng , thank you for the quick reply and comments! I have answered your queries, let me know if I missed something. |
|
Hi @valeriocos I have updated the PR, please have a look. |
valeriocos
left a comment
There was a problem hiding this comment.
Thank you @imnitishng for working on it. We are close to finalize the PR, please check the comments when you have time.
Please make sure that the schema is consistent with the final version of the enricher.
Thanks!
grimoire_elk/enriched/launchpad.py
Outdated
| rich_bugtask["time_open_days"] = get_time_diff_days(data['date_created'], datetime_utcnow().replace(tzinfo=None)) | ||
| else: | ||
| rich_bugtask["time_open_days"] = get_time_diff_days(data['date_closed'], data['date_created']) | ||
| rich_bugtask["created_to_assigned"] = get_time_diff_days(data['date_created'], data['date_assigned']) |
There was a problem hiding this comment.
for consistency with the other time metrics, this attribute should start with time
grimoire_elk/enriched/launchpad.py
Outdated
| else: | ||
| rich_bugtask["time_open_days"] = get_time_diff_days(data['date_closed'], data['date_created']) | ||
| rich_bugtask["created_to_assigned"] = get_time_diff_days(data['date_created'], data['date_assigned']) | ||
| rich_bugtask['assigned_to_closed'] = get_time_diff_days(data['date_assigned'], data['date_closed']) |
grimoire_elk/enriched/launchpad.py
Outdated
| # Extract info related to bug | ||
| rich_bugtask.update(self.__extract_bug_info(data['bug_data'])) | ||
|
|
||
| if len(data['activity_data']) > 1: |
There was a problem hiding this comment.
With the recent change on Perceval (chaoss/grimoirelab-perceval@317e7f8), issues on package distribution cannot be fetched
Collection for launchpad: starting...
2020-05-03 11:25:45,534 [launchpad] Incremental from: None for https://launchpad.net/python-defaults
2020-05-03 11:25:45,546 Fetching issues of 'python-defaults' distribution from 1970-01-01 00:00:00+00:00
2020-05-03 11:25:45,811 Error feeding raw from launchpad (https://launchpad.net/python-defaults): 404 Client Error: Not Found for url: https://api.launchpad.net/1.0/python-defaults?order_by=date_last_updated&omit_duplicates=false&status=New&status=Incomplete&status=Opinion&status=Invalid&status=Won%27t+Fix&status=Expired&status=Confirmed&status=Triaged&status=In+Progress&status=Fix+Committed&status=Fix+Released&status=Incomplete+%28with+response%29&status=Incomplete+%28without+response%29&ws.op=searchTasks&modified_since=1970-01-01T00%3A00%3A00%2B00%3A00
Traceback (most recent call last):
File "/home/slimbook/Escritorio/sources/ELK/grimoire_elk/elk.py", line 166, in feed_backend
ocean_backend.feed(**params)
File "/home/slimbook/Escritorio/sources/ELK/grimoire_elk/raw/elastic.py", line 228, in feed
self.feed_items(items)
File "/home/slimbook/Escritorio/sources/ELK/grimoire_elk/raw/elastic.py", line 244, in feed_items
for item in items:
File "/home/slimbook/Escritorio/sources/perceval/perceval/backend.py", line 226, in fetch
for item in self.fetch_items(category, **kwargs):
File "/home/slimbook/Escritorio/sources/perceval/perceval/backends/core/launchpad.py", line 141, in fetch_items
for issue in self._fetch_issues(from_date):
File "/home/slimbook/Escritorio/sources/perceval/perceval/backends/core/launchpad.py", line 221, in _fetch_issues
for raw_issues in issues_groups:
File "/home/slimbook/Escritorio/sources/perceval/perceval/backends/core/launchpad.py", line 485, in __fetch_items
raise e
File "/home/slimbook/Escritorio/sources/perceval/perceval/backends/core/launchpad.py", line 477, in __fetch_items
raw_content = self.__send_request(url_next, payload)
File "/home/slimbook/Escritorio/sources/perceval/perceval/backends/core/launchpad.py", line 445, in __send_request
r = self.fetch(url, payload=params)
File "/home/slimbook/Escritorio/sources/perceval/perceval/client.py", line 143, in fetch
response = self._fetch_from_remote(url, payload, headers, method, stream, auth)
File "/home/slimbook/Escritorio/sources/perceval/perceval/client.py", line 186, in _fetch_from_remote
raise e
File "/home/slimbook/Escritorio/sources/perceval/perceval/client.py", line 181, in _fetch_from_remote
response.raise_for_status()
File "/home/slimbook/Escritorio/sources/venv/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://api.launchpad.net/1.0/python-defaults?order_by=date_last_updated&omit_duplicates=false&status=New&status=Incomplete&status=Opinion&status=Invalid&status=Won%27t+Fix&status=Expired&status=Confirmed&status=Triaged&status=In+Progress&status=Fix+Committed&status=Fix+Released&status=Incomplete+%28with+response%29&status=Incomplete+%28without+response%29&ws.op=searchTasks&modified_since=1970-01-01T00%3A00%3A00%2B00%3A00
2020-05-03 11:25:45,815 [launchpad] Done collection for https://launchpad.net/python-defaults
Please add a test case for the method get_perceval_params_from_url, thanks
schema/launchpad.csv
Outdated
| time_open_days,float,true,"Time difference from bug created to bug closed for closed bugs, time created to now for open bugs(in days). """ | ||
| time_to_close_days,float,true,"Time difference from bug created to bug closed (in days). " | ||
| time_to_confirm,float,true,"Time difference from bug created to bug confirmed (in days). " | ||
| time_to_first_activity,float,true,"Time difference from bug created to first activity in bug (in days). " |
There was a problem hiding this comment.
This name hasn't been updated
| reopened,boolean,true,"True if the bug was reopened. " | ||
| security_related,boolean,true,"True if the bug is security related. " | ||
| status,keyword,true,"Current status of the bug. " | ||
| tags,list,true,"Tags the bug was marked with. " |
There was a problem hiding this comment.
tag is missing (this field comes from Perceval)
| for eitem in res.json()['hits']['hits']: | ||
| self.assertEqual(eitem['_source']['project'], "Main") | ||
|
|
||
| def test_perceval_params(self): |
There was a problem hiding this comment.
This test should enhanced to cover URLs including package info.
There was a problem hiding this comment.
I included it in the previous iteration.
Had to change it because of the new perceval implementation.
Will add it after packages discussion is finalized.
Hi @valeriocos, regarding this issue. This will be a problem since now we need to change our projects file to add the URL to which this package belongs. Also, now we cannot run micro-mordred to fetch and enrich data from both packages and distributions in a single run which completely defies the purpose of
able to fetch data from both distros and packages without any concern. This will be used for retrieving packages This for distribution We can add a detailed note in README so the users know usages for both the cases. I did think of including an optional boolean parameter |
|
Hi @imnitishng , thank you for having a look at this!
You are right! We cannot pass this param via the setup.cfg, since the latter is not suitable to handle params for the single repositories. ELK provides the method Similar solutions are applied to other backends to pass optional params:
WDYT? |
This commit adds support for launchpad perceval backend. Added raw and enriched indexes. Added tests and schemas. Signed-off-by: Nitish Gupta <imnitish.ng@gmail.com>
|
@valeriocos, thank you. So stupid of me, I did not think it this way. |
There was a problem hiding this comment.
You're welcome @imnitishng ! No worries!
LGTM, thanks! good job!
This commit adds support for Launchpad perceval backend in ELK.
Raw and enriched classes have been added.
Signed-off-by: Nitish Gupta imnitish.ng@gmail.com