Repository: dask/distributed

Issue:
`last_seen` in worker info page
When workers die or halted it can be useful to see when that worker was last seen by the scheduler.  We should bubble this information up to the dashboard

> client.scheduler_info()
```
'tcp://172.17.0.2:43161': {'type': 'Worker',
   'id': 'tcp://172.17.0.2:43161',
   'host': '172.17.0.2',
   'resources': {},
   'local_directory': '/notebooks/dask-worker-space/worker-k540965f',
   'name': 'tcp://172.17.0.2:43161',
   'ncores': 1,
   'memory_limit': 67619300864,
   'last_seen': 1554412409.6942942,
   'services': {'nanny': 46010, 'bokeh': 34120},
   'metrics': {'cpu': 101.7,
    'memory': 472141824,
    'time': 1554412409.1895998,
    'read_bytes': 10374.966431182967,
    'write_bytes': 38095.74065486942,
    'num_fds': 69,
    'executing': 1,
    'in_memory': 2,
    'ready': 2,
    'in_flight': 1}}}}
```


Discussion:
We might place this here

https://github.com/dask/distributed/blob/master/distributed/dashboard/templates/worker.html

or here

https://github.com/dask/distributed/blob/master/distributed/dashboard/templates/worker-table.html

It might be nice to show not last-seen, but time since last seen or
something similar.

On Thu, Apr 4, 2019 at 4:22 PM Benjamin Zaitlen <notifications@github.com>
wrote:

> When workers die or halted it can be useful to see when that worker was
> last seen by the scheduler. We should bubble this information up to the
> dashboard
>
> client.scheduler_info()
>
> 'tcp://172.17.0.2:43161': {'type': 'Worker',
>    'id': 'tcp://172.17.0.2:43161',
>    'host': '172.17.0.2',
>    'resources': {},
>    'local_directory': '/notebooks/dask-worker-space/worker-k540965f',
>    'name': 'tcp://172.17.0.2:43161',
>    'ncores': 1,
>    'memory_limit': 67619300864,
>    'last_seen': 1554412409.6942942,
>    'services': {'nanny': 46010, 'bokeh': 34120},
>    'metrics': {'cpu': 101.7,
>     'memory': 472141824,
>     'time': 1554412409.1895998,
>     'read_bytes': 10374.966431182967,
>     'write_bytes': 38095.74065486942,
>     'num_fds': 69,
>     'executing': 1,
>     'in_memory': 2,
>     'ready': 2,
>     'in_flight': 1}}}}
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <https://github.com/dask/distributed/issues/2595>, or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AASszP7cYTSNOwyoXJHAJKLw-K0qfoNBks5vdmz4gaJpZM4cdvHE>
> .
>

@mrocklin, the links above are broken. When you get a chance, can you update them? It appears that  the `bokeh` directory was renamed to `dashboard`. 
Links updated

Resolving patch:
diff --git a/distributed/dashboard/scheduler.py b/distributed/dashboard/scheduler.py
--- a/distributed/dashboard/scheduler.py
+++ b/distributed/dashboard/scheduler.py
@@ -50,12 +50,14 @@
 from .proxy import GlobalProxyHandler
 from .utils import RequestHandler, redirect
 from ..diagnostics.websocket import WebsocketPlugin
+from ..metrics import time
 from ..utils import log_errors, format_time
 from ..scheduler import ALL_TASK_STATES
 
 
 ns = {
-    func.__name__: func for func in [format_bytes, format_time, datetime.fromtimestamp]
+    func.__name__: func
+    for func in [format_bytes, format_time, datetime.fromtimestamp, time]
 }
 
 rel_path_statics = {"rel_path_statics": "../../"}


Test patch: