Skip to content
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

Predictoor output too verbose due to "connection timed out" subgraph logs #73

Closed
trentmc opened this issue Aug 23, 2023 · 1 comment · Fixed by #74
Closed

Predictoor output too verbose due to "connection timed out" subgraph logs #73

trentmc opened this issue Aug 23, 2023 · 1 comment · Fixed by #74
Assignees
Labels
Type: Enhancement New feature or request

Comments

@trentmc
Copy link
Member

trentmc commented Aug 23, 2023

Background / motivation

In predictoor.md, at the point of running random predictoor agent:

(venv) trentmc@tlm-macbook:~/code/pdr-backend $ python3 pdr_backend/predictoor/main.py
Starting main loop...
HTTPConnectionPool(host='172.15.0.15', port=8000): Max retries exceeded with url: /subgraphs/name/oceanprotocol/ocean-subgraph (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x1060747d0>, 'Connection to 172.15.0.15 timed out. (connect timeout=1.5)'))
Got new block: 19371 with 0 topics
HTTPConnectionPool(host='172.15.0.15', port=8000): Max retries exceeded with url: /subgraphs/name/oceanprotocol/ocean-subgraph (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x106077410>, 'Connection to 172.15.0.15 timed out. (connect timeout=1.5)'))
Got new block: 19373 with 0 topics
HTTPConnectionPool(host='172.15.0.15', port=8000): Max retries exceeded with url: /subgraphs/name/oceanprotocol/ocean-subgraph (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x10607e150>, 'Connection to 172.15.0.15 timed out. (connect timeout=1.5)'))
...
Got new block: 19548 with 0 topics
HTTPConnectionPool(host='172.15.0.15', port=8000): Max retries exceeded with url: /subgraphs/name/oceanprotocol/ocean-subgraph (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x1060a5c90>, 'Connection to 172.15.0.15 timed out. (connect timeout=1.5)'))
Got new block: 19549 with 0 topics

<<hit-ctrl-c>>

Traceback (most recent call last):
  File "/Users/trentmc/code/pdr-backend/pdr_backend/predictoor/main.py", line 113, in <module>
    main()
  File "/Users/trentmc/code/pdr-backend/pdr_backend/predictoor/main.py", line 107, in main
    log_loop(block)
  File "/Users/trentmc/code/pdr-backend/pdr_backend/predictoor/main.py", line 97, in log_loop
    process_block(block)
  File "/Users/trentmc/code/pdr-backend/pdr_backend/predictoor/main.py", line 36, in process_block
    topics = get_all_interesting_prediction_contracts(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/enforce_typing/decorator.py", line 29, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/pdr_backend/utils/subgraph.py", line 203, in get_all_interesting_prediction_contracts
    result = query_subgraph(subgraph_url, query)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/enforce_typing/decorator.py", line 29, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/pdr_backend/utils/subgraph.py", line 121, in query_subgraph
    request = requests.post(subgraph_url, "", json={"query": query}, timeout=1.5)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/requests/api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 790, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 496, in _make_request
    conn.request(
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/urllib3/connection.py", line 395, in request
    self.endheaders()
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1281, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 1041, in _send_output
    self.send(msg)
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/http/client.py", line 979, in send
    self.connect()
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/urllib3/connection.py", line 243, in connect
    self.sock = self._new_conn()
                ^^^^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/urllib3/connection.py", line 203, in _new_conn
    sock = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trentmc/code/pdr-backend/venv/lib/python3.11/site-packages/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
KeyboardInterrupt

(venv) trentmc@tlm-macbook:~/code/pdr-backend $ 

TODOs

In the predictoor main.py, wrap the subgraph call with a try/catch.

@trentmc
Copy link
Member Author

trentmc commented Aug 23, 2023

Output afterwards:

(venv) trentmc@tlm-macbook:~/code/pdr-backend $ python3 pdr_backend/predictoor/main.py
Starting main loop...
HTTPConnectionPool(host='172.15.0.15', port=8000): Max retries exceeded with url: /subgraphs/name/oceanprotocol/ocean-subgraph (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x10d829b50>, 'Connection to 172.15.0.15 timed out. (connect timeout=1.5)'))
Got new block: 21146 with 0 topics
HTTPConnectionPool(host='172.15.0.15', port=8000): Max retries exceeded with url: /subgraphs/name/oceanprotocol/ocean-subgraph (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x10d838710>, 'Connection to 172.15.0.15 timed out. (connect timeout=1.5)'))
Got new block: 21148 with 0 topics
HTTPConnectionPool(host='172.15.0.15', port=8000): Max retries exceeded with url: /subgraphs/name/oceanprotocol/ocean-subgraph (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x10d83b410>, 'Connection to 172.15.0.15 timed out. (connect timeout=1.5)'))
Future errors like this will be hidden
Got new block: 21149 with 0 topics
Got new block: 21151 with 0 topics
Got new block: 21152 with 0 topics
Got new block: 21154 with 0 topics
Got new block: 21155 with 0 topics

trentmc added a commit that referenced this issue Aug 23, 2023
… subgraph logs (PR #74)

Fix #73 - Predictoor output too verbose due to "connection timed out" subgraph logs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement New feature or request
Projects
None yet
1 participant