Closed tschaffter closed 3 years ago
@thomasyu888 My bad. The issue stemmed from the fact that the following python code in an R notebook will not fully return.
from nlpsandboxclient import client
data_node_host = "http://fake-data-node:8080/api/v1"
datasets = client.list_datasets(host=data_node_host)
for dataset in datasets:
print(dataset)
Terminal output (note the ...
on the last line, which shows that the code block has not fully returned. Pressing ENTER in the terminal will show the print output):
>>> from nlpsandboxclient import client
>>>
>>> data_node_host = "http://fake-data-node:8080/api/v1"
>>>
>>> datasets = client.list_datasets(host=data_node_host)
>>>
>>> for dataset in datasets:
... print(dataset)
...
@thomasyu888 @yy6linda The solution I found is to always add a blank line at the end of a Python code block:
from nlpsandboxclient import client
data_node_host = "http://fake-data-node:8080/api/v1"
datasets = client.list_datasets(host=data_node_host)
for dataset in datasets:
print(dataset)
# blank line
EDIT: I added the string # blank line
to represent the blank line, otherwise GitHub crops this blank line to make the code block smaller.
Back to the error issue, the error is then clearly printed in the terminal:
>>> from nlpsandboxclient import client
>>>
>>> data_node_host = "http://fake-data-node:8080/api/v1"
>>>
>>> datasets = client.list_datasets(host=data_node_host)
>>>
>>> for dataset in datasets:
... print(dataset)
...
MaxRetryError: HTTPConnectionPool(host='fake-data-node', port=8080): Max retries exceeded with url: /api/v1/datasets?offset=0&limit=10 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fee2dff3df0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I would expect the following Python code to throw an error because the endpoint used is invalid (note the
v2
portion of the host). The current behavior is that the code run without error.Tagging @yy6linda as she is now using the client to pull predictions from data nodes (first local instance then Sage data node)