Hello, I am trying to use Openscoring as a web service to get APIs. I am very new to this so I do hope to get some help.
This part runs on Jupyter Notebook without issue, however attempting to go to the base url, results in the site not being able to be reached. The main error will be in the next line of code for deploying the pmml file.
ConnectionRefusedError Traceback (most recent call last)
D:\anaconda3\lib\site-packages\urllib3\connection.py in _new_conn(self)
168 try:
--> 169 conn = connection.create_connection(
170 (self._dns_host, self.port), self.timeout, **extra_kw
D:\anaconda3\lib\site-packages\urllib3\util\connection.py in create_connection(address, timeout, source_address, socket_options)
95 if err is not None:
---> 96 raise err
97
D:\anaconda3\lib\site-packages\urllib3\util\connection.py in create_connection(address, timeout, source_address, socket_options)
85 sock.bind(source_address)
---> 86 sock.connect(sa)
87 return sock
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
NewConnectionError Traceback (most recent call last)
D:\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
698 # Make the request on the httplib connection object.
--> 699 httplib_response = self._make_request(
700 conn,
D:\anaconda3\lib\site-packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
393 else:
--> 394 conn.request(method, url, **httplib_request_kw)
395
D:\anaconda3\lib\site-packages\urllib3\connection.py in request(self, method, url, body, headers)
233 headers["User-Agent"] = _get_default_user_agent()
--> 234 super(HTTPConnection, self).request(method, url, body=body, headers=headers)
235
D:\anaconda3\lib\http\client.py in request(self, method, url, body, headers, encode_chunked)
1254 """Send a complete request to the server."""
-> 1255 self._send_request(method, url, body, headers, encode_chunked)
1256
D:\anaconda3\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked)
1300 body = _encode(body, 'body')
-> 1301 self.endheaders(body, encode_chunked=encode_chunked)
1302
D:\anaconda3\lib\http\client.py in endheaders(self, message_body, encode_chunked)
1249 raise CannotSendHeader()
-> 1250 self._send_output(message_body, encode_chunked=encode_chunked)
1251
D:\anaconda3\lib\http\client.py in _send_output(self, message_body, encode_chunked)
1009 del self._buffer[:]
-> 1010 self.send(msg)
1011
D:\anaconda3\lib\http\client.py in send(self, data)
949 if self.auto_open:
--> 950 self.connect()
951 else:
D:\anaconda3\lib\site-packages\urllib3\connection.py in connect(self)
199 def connect(self):
--> 200 conn = self._new_conn()
201 self._prepare_conn(conn)
D:\anaconda3\lib\site-packages\urllib3\connection.py in _new_conn(self)
180 except SocketError as e:
--> 181 raise NewConnectionError(
182 self, "Failed to establish a new connection: %s" % e
NewConnectionError: <urllib3.connection.HTTPConnection object at 0x0000014AB7CBFEB0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it
During handling of the above exception, another exception occurred:
MaxRetryError Traceback (most recent call last)
D:\anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
438 if not chunked:
--> 439 resp = conn.urlopen(
440 method=request.method,
D:\anaconda3\lib\site-packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
754
--> 755 retries = retries.increment(
756 method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
D:\anaconda3\lib\site-packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
573 if new_retry.is_exhausted():
--> 574 raise MaxRetryError(_pool, url, error or ResponseError(cause))
575
MaxRetryError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /openscoring/model/Traffic (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000014AB7CBFEB0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
During handling of the above exception, another exception occurred:
ConnectionError Traceback (most recent call last)
<ipython-input-3-38aa5e890439> in <module>
----> 1 os.deployFile("Traffic", "lr_model.pmml")
D:\anaconda3\lib\site-packages\openscoring\__init__.py in deployFile(self, id, file, **kwargs)
77 def deployFile(self, id, file, **kwargs):
78 with open(file, "rb") as instream:
---> 79 return self.deploy(id, instream, **kwargs)
80
81 def evaluate(self, id, payload = {}, **kwargs):
D:\anaconda3\lib\site-packages\openscoring\__init__.py in deploy(self, id, pmml, **kwargs)
71 def deploy(self, id, pmml, **kwargs):
72 kwargs = _merge_dicts(kwargs, data = pmml, json = None, auth = self.auth, headers = {"content-type" : "application/xml"})
---> 73 response = self._check_response(requests.put(self._model_url(id), **kwargs))
74 modelResponse = ModelResponse(**json.loads(response.text))
75 return modelResponse.ensureSuccess()
D:\anaconda3\lib\site-packages\requests\api.py in put(url, data, **kwargs)
132 """
133
--> 134 return request('put', url, data=data, **kwargs)
135
136
D:\anaconda3\lib\site-packages\requests\api.py in request(method, url, **kwargs)
59 # cases, and look like a memory leak in others.
60 with sessions.Session() as session:
---> 61 return session.request(method=method, url=url, **kwargs)
62
63
D:\anaconda3\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
540 }
541 send_kwargs.update(settings)
--> 542 resp = self.send(prep, **send_kwargs)
543
544 return resp
D:\anaconda3\lib\site-packages\requests\sessions.py in send(self, request, **kwargs)
653
654 # Send the request
--> 655 r = adapter.send(request, **kwargs)
656
657 # Total elapsed time of the request (approximately)
D:\anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
514 raise SSLError(e, request=request)
515
--> 516 raise ConnectionError(e, request=request)
517
518 except ClosedPoolError as e:
ConnectionError: HTTPConnectionPool(host='localhost', port=8080): Max retries exceeded with url: /openscoring/model/Traffic (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000014AB7CBFEB0>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))
I sincerely apologize if this is a dumb issue, but I do not know why or what is wrong. I have also ran spark-shell --jars D:\spark-3.0.2-bin-hadoop2.7\bin\jpmml-sparkml-executable-${1.6.5}.jar with no issues. I am currently using Spark 3.0.2 and Python 3.8.8. Thank you for your time and considerations. Please do let me know if more information is required from me.