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

Error: ConnectError: [Errno 8] nodename nor servname provided, or not known #10

Closed
KyleKing opened this issue Jun 23, 2023 · 13 comments
Closed

Comments

@KyleKing
Copy link

KyleKing commented Jun 23, 2023

When using git runs for an in-progress action, I see the live updating display, but once the actions finish, watchgha exits and reports this error:

> git runs
Error: ConnectError: [Errno 8] nodename nor servname provided, or not known

I'm using the latest watchgha installed with pix:

   package watchgha 1.0.0, installed using Python 3.11.4
    - watch_gha_runs
@nedbat
Copy link
Owner

nedbat commented Jun 24, 2023

Is that the full output? What is the complete git alias for runs?

@KyleKing
Copy link
Author

KyleKing commented Jun 24, 2023

Yeah, that's the full output. There is no traceback shown

Here is my full alias (which is just the default recommended from the README)

# .gitconfig
runs = "!f() { \
    watch_gha_runs $@ \
        \"$(git remote get-url origin)\" \
        \"$(git rev-parse --abbrev-ref HEAD)\"; \
}; f"

@KyleKing
Copy link
Author

I'll see if I can capture a traceback on Monday

Maybe adding a catch for Exception here might show what is going wrong: https://github.com/nedbat/watchgha/blob/830e536f5663147ea8fb2272773ca1377fe39d6a/src/watchgha/utils.py#L76C35-L76C35

One other thing to note is that I was using a GitHub token with:

export GITHUB_TOKEN=$(gh auth token)

@KyleKing
Copy link
Author

KyleKing commented Jun 27, 2023

I have the whole trace back!

Traceback (most recent call last):
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
    yield
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/backends/trio.py", line 132, in connect_tcp
    stream: trio.abc.Stream = await trio.open_tcp_stream(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_highlevel_open_tcp_stream.py", line 259, in open_tcp_stream
    targets = await getaddrinfo(host, port, type=SOCK_STREAM)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_socket.py", line 183, in getaddrinfo
    return await trio.to_thread.run_sync(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_threads.py", line 215, in to_thread_run_sync
    return await trio.lowlevel.wait_task_rescheduled(abort)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_core/_traps.py", line 166, in wait_task_rescheduled
    return (await _async_yield(WaitTaskRescheduled(abort_func))).unwrap()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/outcome/_impl.py", line 138, in unwrap
    raise captured_error
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_threads.py", line 161, in do_release_then_return_result
    return result.unwrap()
           ^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/outcome/_impl.py", line 138, in unwrap
    raise captured_error
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_threads.py", line 175, in worker_fn
    ret = sync_fn(*args)
          ^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
    yield
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 261, in handle_async_request
    raise exc
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
    response = await connection.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_async/connection.py", line 92, in handle_async_request
    raise exc
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_async/connection.py", line 69, in handle_async_request
    stream = await self._connect(request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_async/connection.py", line 117, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/backends/auto.py", line 31, in connect_tcp
    return await self._backend.connect_tcp(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/backends/trio.py", line 130, in connect_tcp
    with map_exceptions(exc_map):
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 8] nodename nor servname provided, or not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/utils.py", line 70, in get_data
    resp = await client.get(
           ^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_client.py", line 1757, in get
    return await self.request(
           ^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_client.py", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_client.py", line 1617, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_client.py", line 1719, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_transports/default.py", line 352, in handle_async_request
    with map_httpcore_exceptions():
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 8] nodename nor servname provided, or not known

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "~/.local/bin/watch_gha_runs", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/watch_runs.py", line 164, in main
    doit()
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/watch_runs.py", line 137, in doit
    done, succeeded = draw_runs(
                      ^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/watch_runs.py", line 188, in draw_runs
    events = trio.run(get_events, url, datafn)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_core/_run.py", line 2010, in run
    raise runner.main_task_outcome.error
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/watch_runs.py", line 196, in get_events
    async with trio.open_nursery() as nursery:
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_core/_run.py", line 850, in __aexit__
    raise combined_error_from_nursery
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/watch_runs.py", line 227, in load_run
    run["jobs"] = json.loads(await datafn(run["jobs_url"]))["jobs"]
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/utils.py", line 77, in get_data
    raise WatchGhaError(e)
watchgha.utils.WatchGhaError: [Errno 8] nodename nor servname provided, or not known

I had to remove the exceptiongroups contextmanager to see it:

diff --git a/src/watchgha/watch_runs.py b/src/watchgha/watch_runs.py
index 18a5cda..8c2b8e6 100644
--- a/src/watchgha/watch_runs.py
+++ b/src/watchgha/watch_runs.py
@@ -149,19 +149,19 @@ def main(sha, poll, repo_url, branch_name):
     def handle_keyboardinterrupt(excgroup):
         print("** interrupted **")

-    with exceptiongroup.catch(
-        {
-            WatchGhaError: handle_watchghaerror,
-            KeyboardInterrupt: handle_keyboardinterrupt,
-        }
-    ):
-        doit()
-        if not done:
-            with console.screen() as screen:
-                while not done:
-                    screen.update(output)
-                    time.sleep(poll)
-                    doit()
+    # with exceptiongroup.catch(
+    #     {
+    #         WatchGhaError: handle_watchghaerror,
+    #         KeyboardInterrupt: handle_keyboardinterrupt,
+    #     }
+    # ):
+    doit()
+    if not done:
+        with console.screen() as screen:
+            while not done:
+                screen.update(output)
+                time.sleep(poll)
+                doit()

     if watch_gha_errors:
         orig = watch_gha_errors[0].args[0]

It looks like the if watch_gha_errors: logic filtered too much of the traceback. Maybe there could be a verbosity setting to raise instead of using this handler?

@nedbat
Copy link
Owner

nedbat commented Jun 27, 2023

I'll have to think about how to do better with the error handling. In the meantime, I still don't understand why you get a failure of any kind once the actions finish.

I changed the error handling a bit on a branch. Can you give it a try?

python3 -m pip install git+https://github.com/nedbat/watchgha@nedbat/more-error-info#egg=watchgha==0.0

@KyleKing
Copy link
Author

KyleKing commented Jun 28, 2023

Thanks, below is the latest traceback with the changes to error handling

I can test the URL standalone with: gh api /repos/kyleking/private-project/actions/runs/5401984803/jobs (and it works as expected)


Traceback (most recent call last):
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
    yield
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/backends/trio.py", line 132, in connect_tcp
    stream: trio.abc.Stream = await trio.open_tcp_stream(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_highlevel_open_tcp_stream.py", line 259, in open_tcp_stream
    targets = await getaddrinfo(host, port, type=SOCK_STREAM)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_socket.py", line 183, in getaddrinfo
    return await trio.to_thread.run_sync(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_threads.py", line 215, in to_thread_run_sync
    return await trio.lowlevel.wait_task_rescheduled(abort)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_core/_traps.py", line 166, in wait_task_rescheduled
    return (await _async_yield(WaitTaskRescheduled(abort_func))).unwrap()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/outcome/_impl.py", line 138, in unwrap
    raise captured_error
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_threads.py", line 161, in do_release_then_return_result
    return result.unwrap()
           ^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/outcome/_impl.py", line 138, in unwrap
    raise captured_error
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_threads.py", line 175, in worker_fn
    ret = sync_fn(*args)
          ^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno 8] nodename nor servname provided, or not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_transports/default.py", line 60, in map_httpcore_exceptions
    yield
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 261, in handle_async_request
    raise exc
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
    response = await connection.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_async/connection.py", line 92, in handle_async_request
    raise exc
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_async/connection.py", line 69, in handle_async_request
    stream = await self._connect(request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_async/connection.py", line 117, in _connect
    stream = await self._network_backend.connect_tcp(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/backends/auto.py", line 31, in connect_tcp
    return await self._backend.connect_tcp(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/backends/trio.py", line 130, in connect_tcp
    with map_exceptions(exc_map):
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 8] nodename nor servname provided, or not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/utils.py", line 70, in get_data
    resp = await client.get(
           ^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_client.py", line 1757, in get
    return await self.request(
           ^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_client.py", line 1530, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_client.py", line 1617, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_client.py", line 1719, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_transports/default.py", line 352, in handle_async_request
    with map_httpcore_exceptions():
  File "/opt/homebrew/Cellar/python@3.11/3.11.4_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/contextlib.py", line 155, in __exit__
    self.gen.throw(typ, value, traceback)
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/httpx/_transports/default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 8] nodename nor servname provided, or not known

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/watch_runs.py", line 164, in main
    doit()
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/watch_runs.py", line 137, in doit
    done, succeeded = draw_runs(
                      ^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/watch_runs.py", line 191, in draw_runs
    events = trio.run(get_events, url, datafn)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_core/_run.py", line 2010, in run
    raise runner.main_task_outcome.error
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/watch_runs.py", line 199, in get_events
    async with trio.open_nursery() as nursery:
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/trio/_core/_run.py", line 850, in __aexit__
    raise combined_error_from_nursery
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/watch_runs.py", line 230, in load_run
    run["jobs"] = json.loads(await datafn(run["jobs_url"]))["jobs"]
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/.local/pipx/venvs/watchgha/lib/python3.11/site-packages/watchgha/utils.py", line 80, in get_data
    raise WatchGhaError(f"Couldn't get {url!r}: {e}") from e
watchgha.utils.WatchGhaError: Couldn't get 'https://api.github.com/repos/kyleking/private-project/actions/runs/5401984803/jobs': [Errno 8] nodename nor servname provided, or not known
****************************************************************************************
Couldn't get 'https://api.github.com/repos/kyleking/private-project/actions/runs/5401984803/jobs': [Errno 8] nodename nor servname provided, or not known

@nedbat
Copy link
Owner

nedbat commented Jun 28, 2023

I thought maybe this had to do with it being a private project (which I usually am not using). But I made a private project and couldn't reproduce it.

Couldn't get 'https://api.github.com/repos/kyleking/private-project/actions/runs/5401984803/jobs': [Errno 8] nodename nor servname provided, or not known

This error seems even more confusing: the URL is clearly ok, so why the error, and why only when the actions complete? There's no difference in the code for before completion or after completion. Are you sure that the trigger is completion?

@KyleKing
Copy link
Author

You're right, this isn't from the Actions completing. Most of the actions are quick, so I missed the timing, but I ran a longer action this morning and can confirm that it cutoff sometime during the action running with no apparent association to an a change in status

The errors are very consistent when tasks are actively running. I have my GitHub token configured, so maybe there just needs to be some logic for exponential backoff on retriable exceptions?

HTTPX recommends tenacity, which supports predicate logic to filter HTTP status codes: https://tenacity.readthedocs.io/en/latest/index.html#whether-to-retry

@nedbat
Copy link
Owner

nedbat commented Jun 29, 2023

I'm not sure why retrying that error would help, but I also don't understand why it would fail in the first place. Try the latest code on my branch. I've added a universal retry.

@KyleKing
Copy link
Author

I agree that it is an unexpected error and can't imagine why it is happening. Given its transient nature, the fix you've pushed appears to work!

I haven't had any issues with watchgha today

@nedbat nedbat closed this as completed in c548069 Jun 30, 2023
nedbat added a commit that referenced this issue Jun 30, 2023
@nedbat
Copy link
Owner

nedbat commented Jun 30, 2023

Fixed in 25812cd.

@KyleKing
Copy link
Author

Thanks!

@nedbat
Copy link
Owner

nedbat commented Jul 3, 2023

This is now released as part of watchgha 2.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants