After a period of time, the requests library in the Agent appears to run out of connections to GUI/Server, at least that is what I currently believe is happening.
Will try to fix this by creating a session object for the connection to the GUI/Server, then all calls can use the session.
RFSwarmAgent: mainloop: Running 2019-11-12 21:51:38 ( 1573559498 )isrunning: False isconnected: True
RFSwarmAgent: mainloop: Running 2019-11-12 21:51:48 ( 1573559508 )isrunning: False isconnected: True
RFSwarmAgent: mainloop: Running 2019-11-12 21:51:58 ( 1573559518 )isrunning: False isconnected: True
getscripts: Exception: HTTPConnectionPool(host='davesmbpsg.fritz.box', port=8138): Max retries exceeded with url: /Scripts (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9d88a10390>: Failed to establish a new connection: [Errno -2] Name or service not known',))
getjobs: Exception: HTTPConnectionPool(host='davesmbpsg.fritz.box', port=8138): Max retries exceeded with url: /Jobs (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9d8819b3c8>: Failed to establish a new connection: [Errno -2] Name or service not known',))
Exception in thread Thread-117:
Traceback (most recent call last):
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 61, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/connection.py", line 184, in connect
conn = self._new_conn()
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/connection.py", line 169, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f9d8819b3c8>: Failed to establish a new connection: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dave/.local/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='davesmbpsg.fritz.box', port=8138): Max retries exceeded with url: /Jobs (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9d8819b3c8>: Failed to establish a new connection: [Errno -2] Name or service not known',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "rfswarm_agent.py", line 318, in getjobs
r = requests.post(uri, json=payload)
File "/home/dave/.local/lib/python3.6/site-packages/requests/api.py", line 116, in post
return request('post', url, data=data, json=json, **kwargs)
File "/home/dave/.local/lib/python3.6/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/home/dave/.local/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/home/dave/.local/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/home/dave/.local/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='davesmbpsg.fritz.box', port=8138): Max retries exceeded with url: /Jobs (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9d8819b3c8>: Failed to establish a new connection: [Errno -2] Name or service not known',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "rfswarm_agent.py", line 361, in getjobs
print("getjobs: resp: ", r.status_code, r.text)
UnboundLocalError: local variable 'r' referenced before assignment
RFSwarmAgent: mainloop: Running 2019-11-12 21:52:08 ( 1573559528 )isrunning: False isconnected: False
RFSwarmAgent: connectserver: Try connecting to http://DavesMBPSG.fritz.box:8138/
getjobs: Exception: HTTPConnectionPool(host='davesmbpsg.fritz.box', port=8138): Max retries exceeded with url: /Jobs (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9d8c087a20>: Failed to establish a new connection: [Errno -2] Name or service not known',))
getscripts: Exception: HTTPConnectionPool(host='davesmbpsg.fritz.box', port=8138): Max retries exceeded with url: /Scripts (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9d88a36dd8>: Failed to establish a new connection: [Errno -2] Name or service not known',))
Exception in thread Thread-122:
Traceback (most recent call last):
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/util/connection.py", line 61, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/connection.py", line 184, in connect
conn = self._new_conn()
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/connection.py", line 169, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f9d8c087a20>: Failed to establish a new connection: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/dave/.local/lib/python3.6/site-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "/home/dave/.local/lib/python3.6/site-packages/urllib3/util/retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='davesmbpsg.fritz.box', port=8138): Max retries exceeded with url: /Jobs (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9d8c087a20>: Failed to establish a new connection: [Errno -2] Name or service not known',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "rfswarm_agent.py", line 318, in getjobs
r = requests.post(uri, json=payload)
File "/home/dave/.local/lib/python3.6/site-packages/requests/api.py", line 116, in post
return request('post', url, data=data, json=json, **kwargs)
File "/home/dave/.local/lib/python3.6/site-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/home/dave/.local/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/home/dave/.local/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/home/dave/.local/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='davesmbpsg.fritz.box', port=8138): Max retries exceeded with url: /Jobs (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9d8c087a20>: Failed to establish a new connection: [Errno -2] Name or service not known',))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "rfswarm_agent.py", line 361, in getjobs
print("getjobs: resp: ", r.status_code, r.text)
UnboundLocalError: local variable 'r' referenced before assignment