dask / distributed

A distributed task scheduler for Dask
https://distributed.dask.org
BSD 3-Clause "New" or "Revised" License
1.57k stars 717 forks source link

Optional additional CI for developer tools #4622

Open jacobtomlinson opened 3 years ago

jacobtomlinson commented 3 years ago

I mostly work in VSCode and use the Python plugin which has a debugger and test runner.

Occasionally something changes in distributed which breaks my development setup. For example right now the test runner is failing to discover tests and is reporting the error

____________ ERROR collecting distributed/comm/tests/test_comms.py _____________
distributed/utils.py:142: in _get_ip
    sock.connect((host, port))
E   OSError: [Errno 65] No route to host

During handling of the above exception, another exception occurred:
distributed/comm/tests/test_comms.py:48: in <module>
    EXTERNAL_IP6 = get_ipv6()
distributed/utils.py:173: in get_ipv6
    return _get_ip(host, port, family=socket.AF_INET6)
cytoolz/functoolz.pyx:476: in cytoolz.functoolz._memoize.__call__
    ???
distributed/utils.py:151: in _get_ip
    addr_info = socket.getaddrinfo(
../../../miniconda3/envs/dask/lib/python3.8/socket.py:918: in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
E   socket.gaierror: [Errno 8] nodename nor servname provided, or not known

I can work around this by setting the DISABLE_IPV6 env var. Or by using pdb and breakpoint outside of the editor.

The same issue doesn't happen when running pytest from the terminal.

My initial reaction is to debug and fix the issue and add some CI to run the test discovery that is failing. But given that development tools boil down to personal preference (and installing them in CI can be arduous) perhaps we don't want some VSCode specific checks in our tests.

Does anyone have any thoughts or preferences about this?

jrbourbeau commented 3 years ago

My personal inclination is to not include a CI build for developer tooling as it seems like a somewhat slippery slope due to the wide variety of tools we may want to test.

Out of curiosity, do you have a sense for how often changes in distributed break your development setup?

FWIW I tend to not use these types of developer tools so it would be great to get thoughts from others who do use things like, for example, VSCode plugins

martindurant commented 3 years ago

It seems to me that when we still had "emacs or vi", we could have covered IDE setup. I use pycharm to edit, but tests in the terminal, I generally don't bother figuring out where various environment settings go. Perhaps if someone did the work for me...

jacobtomlinson commented 3 years ago

Out of curiosity, do you have a sense for how often changes in distributed break your development setup?

I would guess maybe 3 times in the last year. It's always small things that seem to raise exceptions during test discovery. So not enough to be a big issue, but enough to prompt a discussion.

The main features I enjoy from using VSCode (and I expect other things like PyChart) are:

I expect around 90% of the time I just run pytest in the terminal, but occasionally I want to toggle a breakpoint and run the test in debug mode so I can look at the inspector and maybe step through a few lines.

My .vscode/settings.json looks like this for most projects.

{
    "python.pythonPath": "/path/to/conda/env/bin/python",
    "python.formatting.provider": "black",
    "python.testing.pytestEnabled": true
}

This is usually enough to get things working as described above.

jacobtomlinson commented 3 years ago

For distributed specifically I also have this .vscode/launch.json file which allows me to either start a scheduler or just an interactive ipython shell in debug mode if I want to do a bit of interactive bug hunting.

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "IPython",
      "type": "python",
      "request": "launch",
      "module": "IPython"
    },
    {
      "name": "Dask Scheduler",
      "type": "python",
      "request": "launch",
      "module": "distributed.cli.dask_scheduler",
      "args": [
        "--host",
        "localhost",
        "--port",
        "18786",
        "--dashboard-address",
        ":18787"
      ],
      "console": "integratedTerminal"
    }
  ]
}
gforsyth commented 3 years ago
E   socket.gaierror: [Errno 8] nodename nor servname provided, or not known

This hits me very frequently on a corporate proxy where our VPN overwrites /etc/hosts

jacobtomlinson commented 3 years ago

This hits me very frequently on a corporate proxy where our VPN overwrites /etc/hosts

Ah that might explain what is happening to me.