Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e0af15e
Making some unit tests work
Neeratyoy Nov 10, 2020
14aa11d
Waiting for dataset to be processed
Neeratyoy Nov 16, 2020
31d48d8
Minor test collection fix
Neeratyoy Nov 16, 2020
431447c
Template to handle missing tasks
Neeratyoy Nov 30, 2020
cc3199e
Accounting for more missing tasks:
Neeratyoy Nov 30, 2020
8a29668
Fixing some more unit tests
Neeratyoy Nov 30, 2020
405e03c
Simplifying check_task_existence
Neeratyoy Nov 30, 2020
caf4f46
black changes
Neeratyoy Dec 4, 2020
b308e71
Minor formatting
Neeratyoy Dec 8, 2020
436a9fe
Handling task exists check
Neeratyoy Dec 9, 2020
ddd8b04
Testing edited check task func
Neeratyoy Dec 14, 2020
74ae622
Merge branch 'fix_unit_tests' of https://github.com/openml/openml-pyt…
Neeratyoy Dec 14, 2020
50ce90e
Flake fix
Neeratyoy Dec 15, 2020
56cd639
More retries on connection error
Neeratyoy Dec 16, 2020
8e8ea2e
Adding max_retries to config default
Neeratyoy Dec 17, 2020
d518beb
Update database retry unit test
Neeratyoy Dec 17, 2020
37d9f6b
Print to debug hash exception
Neeratyoy Dec 17, 2020
9bd4892
Fixing checksum unit test
Neeratyoy Dec 17, 2020
dc41b5d
Retry on _download_text_file
Neeratyoy Dec 18, 2020
396cb8d
Update datasets_tutorial.py
mfeurer Dec 21, 2020
8f380de
Update custom_flow_tutorial.py
mfeurer Dec 21, 2020
bc1745e
Update test_study_functions.py
mfeurer Dec 21, 2020
d95b5e6
Update test_dataset_functions.py
mfeurer Dec 21, 2020
91c6cf5
more retries, but also more time between retries
mfeurer Dec 21, 2020
a9430b3
allow for even more retries on get calls
mfeurer Dec 21, 2020
e9cfba8
Catching failed get task
Neeratyoy Dec 21, 2020
c13f6ce
Merge branch 'fix_unit_tests' of https://github.com/openml/openml-pyt…
Neeratyoy Dec 21, 2020
3d7abc2
undo stupid change
mfeurer Dec 21, 2020
94576b1
Merge branch 'fix_unit_tests' of https://github.com/openml/openml-pyt…
Neeratyoy Dec 21, 2020
b5e1242
fix one more test
mfeurer Dec 21, 2020
f5e4a3e
Refactoring md5 hash check inside _send_request
Neeratyoy Dec 21, 2020
07ce722
Fixing a fairly common unit test fail
Neeratyoy Dec 22, 2020
82e1b72
Reverting loose check on unit test
Neeratyoy Dec 23, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adding max_retries to config default
  • Loading branch information
Neeratyoy committed Dec 17, 2020
commit 8e8ea2e5cd611112ce7ece5fd6d421f45107ffea
14 changes: 7 additions & 7 deletions openml/_api_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def _send_request(
request_method, url, data, files=None,
):
n_retries = config.connection_n_retries
max_retries = 10
max_retries = config.max_retries
retry_counter = 0
response = None
with requests.Session() as session:
Expand All @@ -199,13 +199,13 @@ def _send_request(
OpenMLServerException,
) as e:
if isinstance(e, OpenMLServerException):
if e.code != 107:
# 107 is a database connection error - only then do retries
raise e
else:
if e.code in [107, 500]:
# 107: database connection error
# 500: internal server error
wait_time = 0.3
# increase retries if database connection error
n_retries = min(n_retries + 1, max_retries)
n_retries = min(n_retries + 1, max_retries) # increase retries
else:
raise
else:
wait_time = 0.1
if retry_counter == n_retries:
Expand Down
10 changes: 7 additions & 3 deletions openml/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def set_file_log_level(file_output_level: int):
"cachedir": os.path.expanduser(os.path.join("~", ".openml", "cache")),
"avoid_duplicate_runs": "True",
"connection_n_retries": 2,
"max_retries": 20,
Comment thread
mfeurer marked this conversation as resolved.
}

config_file = os.path.expanduser(os.path.join("~", ".openml", "config"))
Expand Down Expand Up @@ -116,6 +117,7 @@ def get_server_base_url() -> str:

# Number of retries if the connection breaks
connection_n_retries = _defaults["connection_n_retries"]
max_retries = _defaults["max_retries"]


class ConfigurationForExamples:
Expand Down Expand Up @@ -183,6 +185,7 @@ def _setup():
global cache_directory
global avoid_duplicate_runs
global connection_n_retries
global max_retries

# read config file, create cache directory
try:
Expand All @@ -207,10 +210,11 @@ def _setup():

avoid_duplicate_runs = config.getboolean("FAKE_SECTION", "avoid_duplicate_runs")
connection_n_retries = config.get("FAKE_SECTION", "connection_n_retries")
if connection_n_retries > 20:
max_retries = config.get("FAKE_SECTION", "max_retries")
if connection_n_retries > max_retries:
raise ValueError(
"A higher number of retries than 20 is not allowed to keep the "
"server load reasonable"
"A higher number of retries than {} is not allowed to keep the "
"server load reasonable".format(max_retries)
)


Expand Down
9 changes: 0 additions & 9 deletions openml/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,6 @@ def check_task_existence(
Parameter
---------
task_type : openml.tasks.TaskType
ID of the task type as detailed `here <https://www.openml.org/search?type=task_type>`_.
- Supervised classification: 1
- Supervised regression: 2
- Learning curve: 3
- Supervised data stream classification: 4
- Clustering: 5
- Machine Learning Challenge: 6
- Survival Analysis: 7
- Subgroup Discovery: 8
dataset_id : int
target_name : str

Expand Down
3 changes: 0 additions & 3 deletions tests/test_runs/test_run_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,6 @@ def test_run_and_upload_linear_regression(self):
if _task_id is not None:
task_id = _task_id
else:
task_meta_data["task_type"] = TaskType.SUPERVISED_REGRESSION
new_task = openml.tasks.create_task(**task_meta_data)
# publishes the new task
try:
Expand Down Expand Up @@ -996,7 +995,6 @@ def test_initialize_model_from_run(self):
if _task_id is not None:
task_id = _task_id
else:
task_meta_data["task_type"] = TaskType.SUPERVISED_CLASSIFICATION
new_task = openml.tasks.create_task(**task_meta_data)
# publishes the new task
try:
Expand Down Expand Up @@ -1556,7 +1554,6 @@ def test_format_prediction_task_regression(self):
if _task_id is not None:
task_id = _task_id
else:
task_meta_data["task_type"] = TaskType.SUPERVISED_REGRESSION
new_task = openml.tasks.create_task(**task_meta_data)
# publishes the new task
try:
Expand Down
3 changes: 1 addition & 2 deletions tests/test_study/test_study_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,8 @@ def test_study_attach_illegal(self):
def test_study_list(self):
study_list = openml.study.list_studies(status="in_preparation")
# might fail if server is recently resetted
self.assertGreater(len(study_list), 2)
self.assertGreaterEqual(len(study_list), 2)

def test_study_list_output_format(self):
study_list = openml.study.list_studies(status="in_preparation", output_format="dataframe")
self.assertIsInstance(study_list, pd.DataFrame)
self.assertGreater(len(study_list), 2)
Comment thread
mfeurer marked this conversation as resolved.
1 change: 0 additions & 1 deletion tests/test_tasks/test_regression_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ def setUp(self, n_levels: int = 1):
if _task_id is not None:
task_id = _task_id
else:
task_meta_data["task_type"] = TaskType.SUPERVISED_REGRESSION
new_task = openml.tasks.create_task(**task_meta_data)
# publishes the new task
try:
Expand Down