Skip to content

[Feature Request] Make DecentralizedAverager resistant to KeyboardInterrupt #382

@justheuristic

Description

@justheuristic

Update: The issue is fixed for the DHT but remains unsolved for DecentralizedAverager.

Currently, if you're running hivemind.DHT in jupyter (or an interactive console), you will sometimes need to hit "interrupt" when prototyping. Unfortunately, KeyboardInterrupt will also be caught by the DHT process and will shutdown that DHT instance.

To reproduce:

import time
import hivemind


dht = DHT(start=True)

while True:
    time.sleep(1)
    dht.store('key', 'value', expiration_time=hivemind.get_dht_time() + 999)
    print(end='.', flush=True)
    # [interrupt here via kernel -> interrupt]
    
# and then check:
assert dht.is_alive()

Notes:

  • Whatever fix we implement must still be able to shutdown DHT if it gets deallocated or when calling .shutdown()
  • This problem also applies to DecentralizedAverager (fix or create an issue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions