Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.

Commit 35c6b83

Browse files
committed
Minor changes to experiments list command
1 parent 52999c0 commit 35c6b83

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

paperspace/commands/experiments.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def __init__(self, api=experiments_api, logger_=logger):
5656
self.logger = logger_
5757

5858
def execute(self, project_handles=None):
59+
project_handles = project_handles or []
5960
params = self._get_query_params(project_handles)
6061
response = self.api.get("/experiments/", params=params)
6162

@@ -68,9 +69,7 @@ def execute(self, project_handles=None):
6869

6970
@staticmethod
7071
def _get_query_params(project_handles):
71-
# TODO: change to limit: -1 when PS-9535 is deployed to production
72-
# to list all experiments
73-
params = {"limit": 1000000}
72+
params = {"limit": -1} # so the API sends back full list without pagination
7473
for i, handle in enumerate(project_handles):
7574
key = "projectHandle[{}]".format(i)
7675
params[key] = handle

paperspace/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def get_api_key(config_dir_path, config_file_name):
1616

1717
_DEFAULT_CONFIG_HOST = "https://api.paperspace.io"
1818
_DEFAULT_CONFIG_LOG_HOST = "https://logs.paperspace.io"
19-
_DEFAULT_CONFIG_EXPERIMENTS_HOST = "https://services.paperspace.io/experiments/v1/" # TODO: validate this
19+
_DEFAULT_CONFIG_EXPERIMENTS_HOST = "https://services.paperspace.io/experiments/v1/"
2020
_DEFAULT_CONFIG_DIR_PATH = "~/.paperspace"
2121
_DEFAULT_CONFIG_FILE_NAME = os.path.expanduser("config.json")
2222

tests/functional/test_experiments.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ def test_should_send_get_request_and_print_list_of_experiments(self, get_patched
747747
get_patched.assert_called_once_with(self.URL,
748748
headers=self.EXPECTED_HEADERS,
749749
json=None,
750-
params={"limit": 1000000})
750+
params={"limit": -1})
751751

752752
assert result.output == self.DETAILS_STDOUT
753753
assert self.EXPECTED_HEADERS["X-API-Key"] != "some_key"
@@ -765,7 +765,7 @@ def test_should_send_get_request_and_paginate_list_when_output_table_len_is_gt_l
765765
get_patched.assert_called_once_with(self.URL,
766766
headers=self.EXPECTED_HEADERS,
767767
json=None,
768-
params={"limit": 1000000})
768+
params={"limit": -1})
769769

770770
pydoc_patched.pager.assert_called_once()
771771
assert result.exit_code == 0
@@ -781,7 +781,7 @@ def test_should_send_get_request_and_print_list_of_experiments_filtered_with_two
781781
get_patched.assert_called_once_with(self.URL,
782782
headers=self.EXPECTED_HEADERS,
783783
json=None,
784-
params={"limit": 1000000,
784+
params={"limit": -1,
785785
"projectHandle[0]": u"handle1",
786786
"projectHandle[1]": u"handle2"})
787787

@@ -799,7 +799,7 @@ def test_should_send_get_request_and_print_list_of_experiments_filtered_with_two
799799
get_patched.assert_called_once_with(self.URL,
800800
headers=self.EXPECTED_HEADERS,
801801
json=None,
802-
params={"limit": 1000000,
802+
params={"limit": -1,
803803
"projectHandle[0]": u"handle1",
804804
"projectHandle[1]": u"handle2"})
805805

0 commit comments

Comments
 (0)