Repository: opendatacube/datacube-core

Issue:
Dask Executor broken after latest Dask Distributed release
### Expected behaviour

**datacube ingest** is able to parallelise using a Dask Distributed scheduler. The `--executor distributed` command line option no longer works with the latest release of Distributed ([2.19.0 - 2020-06-19](https://distributed.dask.org/en/latest/changelog.html)). In particular [PR #3842](https://github.com/dask/distributed/pull/3842/files)

### Actual behaviour



<details>
  <summary>Crash, stack trace attached:</summary>

```
2020-06-29 16:55:26,614 2441 datacube INFO Running datacube command: /g/data/v10/public/modules/dea/unstable/bin/datacube -v ingest --allow-product-changes --load-tasks tasks.bin --queue-size
10000 --executor distributed gadi-cpu-clx-0224.gadi.nci.org.au:4077
Traceback (most recent call last):
  File "/g/data/v10/public/modules/dea/unstable/bin/datacube", line 8, in <module>
    sys.exit(cli())
  File "/g/data/v10/public/modules/dea-env/20200622/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/g/data/v10/public/modules/dea-env/20200622/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/g/data/v10/public/modules/dea-env/20200622/lib/python3.6/site-packages/click/core.py", line 1257, in invoke
    sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
  File "/g/data/v10/public/modules/dea-env/20200622/lib/python3.6/site-packages/click/core.py", line 700, in make_context
    self.parse_args(ctx, args)
  File "/g/data/v10/public/modules/dea-env/20200622/lib/python3.6/site-packages/click/core.py", line 1048, in parse_args
    value, args = param.handle_parse_result(ctx, opts, args)
  File "/g/data/v10/public/modules/dea-env/20200622/lib/python3.6/site-packages/click/core.py", line 1630, in handle_parse_result
    value = invoke_param_callback(self.callback, ctx, self, value)
  File "/g/data/v10/public/modules/dea-env/20200622/lib/python3.6/site-packages/click/core.py", line 123, in invoke_param_callback
    return callback(ctx, param, value)
  File "/g/data/v10/public/modules/dea/unstable/lib/python3.6/site-packages/datacube/ui/click.py", line 278, in _setup_executor
    return EXECUTOR_TYPES[value[0]](value[1])
  File "/g/data/v10/public/modules/dea/unstable/lib/python3.6/site-packages/datacube/ui/click.py", line 269, in <lambda>
    'distributed': lambda addr: get_executor(parse_endpoint(addr), True),
  File "/g/data/v10/public/modules/dea/unstable/lib/python3.6/site-packages/datacube/executor.py", line 242, in get_executor
    distributed_exec = _get_distributed_executor(scheduler)
  File "/g/data/v10/public/modules/dea/unstable/lib/python3.6/site-packages/datacube/executor.py", line 141, in _get_distributed_executor
    executor = DistributedExecutor(distributed.Client(scheduler))
  File "/g/data/v10/public/modules/dea-env/20200622/lib/python3.6/site-packages/distributed/client.py", line 663, in __init__
    type(address)
TypeError: Scheduler address must be a string or a Cluster instance, got <class 'tuple'>
```
  
</details>


### Steps to reproduce the behaviour

Running on the NCI/Gadi:

```
module load dea/unstable
cd /g/data/v10/work/ingest/ls8_nbar_albers/2020-06-29
/g/data/v10/public/modules/dea/unstable/bin/datacube -v ingest --allow-product-changes --load-tasks tasks.bin --queue-size 10000 --executor distributed gadi-cpu-clx-0224.gadi.nci.org.au:4077
```



### Environment information

* Which ``datacube --version`` are you using?

`Open Data Cube core, version 1.8.1.dev33+gbefeea1c`

* What datacube deployment/enviornment are you running against?

`dea/unstable` dated Mon 29 June 2020.


Discussion:
Is it just the matter of getting rid of `parse_endpoint` call here:

https://github.com/opendatacube/datacube-core/blob/75996f5f6105589192259da49e3b41df6cb43936/datacube/ui/click.py#L269
Yep, just tested, and that fixes it.

Resolving patch:
diff --git a/datacube/ui/click.py b/datacube/ui/click.py
--- a/datacube/ui/click.py
+++ b/datacube/ui/click.py
@@ -14,7 +14,6 @@
 
 from datacube.executor import get_executor, mk_celery_executor
 from datacube.index import index_connect
-from pathlib import Path
 
 from datacube.ui.expression import parse_expressions
 from sqlalchemy.exc import OperationalError, ProgrammingError
@@ -74,7 +73,7 @@ def emit(self, record):
         try:
             msg = self.format(record)
             click.echo(msg, err=True)
-        except:  # pylint: disable=bare-except
+        except:  # noqa: E772  pylint: disable=bare-except
             self.handleError(record)
 
 
@@ -266,7 +265,7 @@ def parse_endpoint(value):
 EXECUTOR_TYPES = {
     'serial': lambda _: get_executor(None, None),
     'multiproc': lambda workers: get_executor(None, int(workers)),
-    'distributed': lambda addr: get_executor(parse_endpoint(addr), True),
+    'distributed': lambda addr: get_executor(addr, True),
     'celery': lambda addr: mk_celery_executor(*parse_endpoint(addr))
 }
 
@@ -330,7 +329,7 @@ def parsed_search_expressions(f):
         f.__doc__ = ""
     f.__doc__ += """
     EXPRESSIONS
-    
+
     Select datasets using [EXPRESSIONS] to filter by date, product type,
     spatial extents or other searchable fields.
 
@@ -343,7 +342,7 @@ def parsed_search_expressions(f):
     DATE-RANGE is one of YYYY, YYYY-MM or YYYY-MM-DD
     START and END can be either numbers or dates
 
-    FIELD: x, y, lat, lon, time, product, ... 
+    FIELD: x, y, lat, lon, time, product, ...
 
     \b
     eg. 'time in [1996-01-01, 1996-12-31]'


Test patch: