-
Notifications
You must be signed in to change notification settings - Fork 313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lab4: Sentiment Analysis only works randomly, and requests.get() does't work #191
Comments
I guess I know where the problem is my first question and totally fix my second question where requests.get() does't work. The solution to my second question: requests.get() does't work KubernetesSuffix the gateway host with r = requests.get("http://gateway.openfaas:8080/function/sentimentanalysis", text= test_sentence) But it should be
KubernetesSuffix the gateway host with r = requests.get("http://gateway.openfaas:8080/function/sentimentanalysis", text= test_sentence) Or via an environmental variable: gateway_hostname = os.getenv("gateway_hostname", "gateway") # uses a default of "gateway" for when "gateway_hostname" is not set
test_sentence = "California is great, it's always sunny there."
r = requests.get("http://" + gateway_hostname + ":8080/function/sentimentanalysis", data= test_sentence) However, "Or via an environmental variable" part description is the syntax for swarm rather than for k8s. For k8s it should be As for my first question: Sentiment Analysis only works randomly |
Two problems when doing lab4:
echo -n "California is great, it's always sunny there." | faas-cli invoke sentimentanalysis
, sometimes it works, but most of time it returns:Server returned unexpected status code: 502 -
Expected Behaviour
$ echo -n "California is great, it's always sunny there." | faas-cli invoke sentimentanalysis {"polarity": 0.8, "sentence_count": 1, "subjectivity": 0.75}
"That was probably positive"
Current Behaviour
Server returned unexpected status code: 502 -
Server returned unexpected status code: 500 - exit status 1
Traceback (most recent call last):
File "/home/app/python/urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "/home/app/python/urllib3/util/connection.py", line 73, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/local/lib/python3.9/socket.py", line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name does not resolve
During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/app/python/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/home/app/python/urllib3/connectionpool.py", line 394, in _make_request conn.request(method, url, **httplib_request_kw) File "/home/app/python/urllib3/connection.py", line 234, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/usr/local/lib/python3.9/http/client.py", line 1255, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.9/http/client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.9/http/client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/local/lib/python3.9/http/client.py", line 1010, in _send_output self.send(msg) File "/usr/local/lib/python3.9/http/client.py", line 950, in send self.connect() File "/home/app/python/urllib3/connection.py", line 200, in connect conn = self._new_conn() File "/home/app/python/urllib3/connection.py", line 181, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [Errno -2] Name does not resolve
Possible Solution
Steps to Reproduce (for bugs)
Context
Your Environment
FaaS-CLI version ( Full output from:
faas-cli version
): 0.13.6Docker version ( Full output from:
docker version
): Client: Docker Engine - CommunityCloud integration: 1.0.7
Version: 20.10.2
API version: 1.41
Go version: go1.13.15
Git commit: 2291f61
Built: Mon Dec 28 16:12:42 2020
OS/Arch: darwin/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.2
API version: 1.41 (minimum version 1.12)
Go version: go1.13.15
Git commit: 8891c58
Built: Mon Dec 28 16:15:28 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.4.3
GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
runc:
Version: 1.0.0-rc92
GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Are you using Docker Swarm (FaaS-swarm ) or Kubernetes (FaaS-netes)? Kubernetes
Operating System and version (e.g. Linux, Windows, MacOS): MacOS
Link to your project or a code example to reproduce issue:
The text was updated successfully, but these errors were encountered: