Skip to content

Conversation

@ArlindKadra
Copy link
Member

@ArlindKadra ArlindKadra commented Mar 25, 2018

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

@ArlindKadra ArlindKadra requested a review from mfeurer March 25, 2018 14:20
@ArlindKadra ArlindKadra changed the title Paging #358 Paging Mar 25, 2018
Copy link
Collaborator

@mfeurer mfeurer left a comment

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)?


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
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
Member Author

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
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.

xml_string = _perform_api_call(api_call)
except OpenMLServerNoResult:
return dict()
except OpenMLServerNoResult as e:
Copy link
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
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
Member Author

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
Member Author

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
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
Copy link

codecov-io commented Mar 27, 2018

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 Files Coverage Δ
openml/utils.py 92.3% <100%> (+30.6%) ⬆️
openml/flows/functions.py 92.22% <100%> (-0.26%) ⬇️
openml/runs/functions.py 86.16% <100%> (-0.13%) ⬇️
openml/tasks/functions.py 85.89% <100%> (-0.27%) ⬇️
openml/setups/functions.py 95.93% <100%> (+0.62%) ⬆️
openml/evaluations/functions.py 94.73% <100%> (+2.05%) ⬆️
openml/datasets/functions.py 90.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 develop Mar 28, 2018
@mfeurer mfeurer deleted the feature358 branch March 28, 2018 16:03
Sign up for free to 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.

4 participants