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

Commit f4a18f2

Browse files
BartoszCkidandruszak
authored andcommitted
Add-functional-tests-for-experiments
1 parent d81a781 commit f4a18f2

File tree

11 files changed

+672
-313
lines changed

11 files changed

+672
-313
lines changed

paperspace/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,22 @@ def post(self, url, json=None, params=None):
1717
path = self.get_path(url)
1818
logger.debug("Sending POST: {}\nto: {}\nwith headers: {}".format(json, path, self.headers))
1919
response = requests.post(path, json=json, params=params, headers=self.headers)
20+
logger.debug("Response status code: {}".format(response.status_code))
2021
logger.debug("Response content: {}".format(response.content))
2122
return response
2223

2324
def put(self, url):
2425
path = self.get_path(url)
2526
logger.debug("Sending PUT to {}\nwith headers: {}".format(path, self.headers))
2627
response = requests.put(path, headers=self.headers)
28+
logger.debug("Response status code: {}".format(response.status_code))
2729
logger.debug("Response content: {}".format(response.content))
2830
return response
2931

3032
def get(self, url):
3133
path = self.get_path(url)
3234
logger.debug("Sending GET to {}\nwith headers: {}".format(path, self.headers))
3335
response = requests.get(path, headers=self.headers)
36+
logger.debug("Response status code: {}".format(response.status_code))
3437
logger.debug("Response content: {}".format(response.content))
3538
return response

paperspace/commands.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import terminaltables
22

3-
from paperspace import version, logger, constants
4-
from paperspace.client import API
3+
from paperspace import version, logger, constants, client
54
from paperspace.config import config
65

76
default_headers = {"X-API-Key": config.PAPERSPACE_API_KEY,
87
"ps_client_name": "paperspace-python",
98
"ps_client_version": version.version}
109

11-
experiments_api = API(config.CONFIG_EXPERIMENTS_HOST, headers=default_headers)
10+
experiments_api = client.API(config.CONFIG_EXPERIMENTS_HOST, headers=default_headers)
1211

1312

1413
def _log_response(response, success_msg, error_msg, logger_=logger):
@@ -66,7 +65,7 @@ def stop_experiment(experiment_handle, api=experiments_api):
6665
def _make_experiments_list_table(experiments):
6766
data = [("Name", "Handle", "Status")]
6867
for experiment in experiments:
69-
name = experiment["templateHistory"]["params"]["name"]
68+
name = experiment["templateHistory"]["params"].get("name")
7069
handle = experiment["handle"]
7170
status = constants.ExperimentState.get_state_str(experiment["state"])
7271
data.append((name, handle, status))

tests/test.py

Lines changed: 0 additions & 97 deletions
This file was deleted.

tests/test_artifactsGet.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)