Skip to content

Paging - #426

Merged
mfeurer merged 13 commits into
developfrom
feature358
Mar 28, 2018
Merged

Paging#426
mfeurer merged 13 commits into
developfrom
feature358

Conversation

@ArlindKadra

@ArlindKadraArlindKadra commented Mar 25, 2018

Copy link
Copy Markdown
Member

Incorporated paging in the list_* functions #358. Refactored the code.

@ArlindKadraArlindKadra changed the title Paging #358PagingMar 25, 2018

@mfeurermfeurer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add documentation for the function arguments which explains why they can be set separately (i.e. not as part of the kwargs)?

Comment threadopenml/datasets/functions.py Outdated

if size is not None:
api_call += "/limit/%d" % int(size)
return openml.utils.list_all(_list_datasets, offset=offset, size=size, status=status, **kwargs)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to be >80 lines. Could you please try to stick to PEP8 as much as possible?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, I will keep the line length under 80. Regarding the arguments documentation, I kept the arguments as they were since we did not discuss any changes to them. In this case they can be included in the **kwargs as they are not positional and can all be set in one go. However, in other functions when we have lists, I would say we keep the list arguments separate from the primitives.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, given the structure of the REST API and the fact that the usage of the method right now is really unclear, it would be good if revert function signature. Also, I think calling it **filters instead of **kwargs will make the whole thing more similar to the REST API.

Comment threadopenml/datasets/functions.py Outdated
xml_string = _perform_api_call(api_call)
except OpenMLServerNoResult:
return dict()
except OpenMLServerNoResult as e:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why you changed this? I think returning a dict is more natural because it behaves like when listing an empty directory.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, it appears to me that this piece of code is repeated in all listing functions. Could you please put that code into the utils module?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a reason. It breaks the way that the list method in the utils works. As an example, without a limit, the previous implementation would never throw an error and we would be stuck in a loop.

In my opinion we should not change that, as we are performing checks and also actually creating the dict there. We can however remove the try and except as we are actually catching in the utils method.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically utils.list_all -> loops list* -> forms the api call and passes it to the _list* function.
With the current flow it is not possible to do that.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, got it, that makes sense. Thanks for removing the try/except, this should make the code a lot easier.

@codecov-io

codecov-io commented Mar 27, 2018

Copy link
Copy Markdown

Codecov Report

Merging #426 into develop will increase coverage by 0.57%.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@## develop #426 +/- ##
===========================================
+ Coverage 88.96% 89.53% +0.57% 
===========================================
Files 32 32 Lines 2682 2676 -6 ===========================================
+ Hits 2386 2396 +10 + Misses 296 280 -16
Impacted FilesCoverage Δ
openml/utils.py92.3% <100%> (+30.6%)⬆️
openml/flows/functions.py92.22% <100%> (-0.26%)⬇️
openml/runs/functions.py86.16% <100%> (-0.13%)⬇️
openml/tasks/functions.py85.89% <100%> (-0.27%)⬇️
openml/setups/functions.py95.93% <100%> (+0.62%)⬆️
openml/evaluations/functions.py94.73% <100%> (+2.05%)⬆️
openml/datasets/functions.py90.43% <100%> (+0.19%)⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3e99d99...dbf6a99. Read the comment docs.

…ask_type for runs, filter by multipple operator for tasks and also refactored the code according to PEP8
@mfeurer
mfeurer merged commit 2513667 into developMar 28, 2018
@mfeurer
mfeurer deleted the feature358 branch March 28, 2018 16:03
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@ArlindKadra@codecov-io@mfeurer