Skip to content

Conversation

@mfeurer
Copy link
Collaborator

@mfeurer mfeurer commented Feb 14, 2019

Fixes jamming the server with too many concurrent requests by adding a new flag.

@codecov-io
Copy link

codecov-io commented Feb 14, 2019

Codecov Report

❗ No coverage uploaded for pull request base (develop@b71325c). Click here to learn what that means.
The diff coverage is 85.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##             develop     #618   +/-   ##
==========================================
  Coverage           ?   89.76%           
==========================================
  Files              ?       32           
  Lines              ?     3077           
  Branches           ?        0           
==========================================
  Hits               ?     2762           
  Misses             ?      315           
  Partials           ?        0
Impacted Files Coverage Δ
openml/testing.py 93.82% <100%> (ø)
openml/config.py 89.09% <75%> (ø)
openml/_api_calls.py 89.47% <85.18%> (ø)

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 b71325c...7bb6d0d. Read the comment docs.

return response.text


def send_request(request_method, url, kwargs):
Copy link
Member

Choose a reason for hiding this comment

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

i hate kwargs, it's so vague. Do we need this level of flexibility or can we just add optional arguments?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed.



def _perform_api_call(call, data=None, file_elements=None,
add_authentication=True):
Copy link
Contributor

Choose a reason for hiding this comment

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

don't you need the authentication flag? GET requests don't require authentication, POST/DELETE requests do.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That is handled internally and does not need to be an argument to the openml-api call API.


# Increase the number of retries to avoid spurios server failures
self.connection_n_retries = openml.config.connection_n_retries
openml.config.connection_n_retries = 10
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit confused about the number of retries being stored in the _default dict, the openml.config file and self.connection_n_retries. So, by default it is 2, then when that doesn't work, it is increased to 10 and stored in the openml.config, and then it stops (it doesn't get higher than 10)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Nope, it's increased to 10 for testing in every case. It is stored in the class to restore the original value afterwards.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree that it is unfortunate that the value of 2 is twice in the original file, I just made a note to change it later.

if i == n_retries:
raise e
else:
time.sleep(0.1 * i)
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

@mfeurer mfeurer merged commit cefd097 into develop Feb 14, 2019
@mfeurer mfeurer deleted the fix_issues branch February 14, 2019 16:55
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.

5 participants