The nameserver – establishing connections¶
NameServer(run_id, working_directory=None, host=None, port=0, nic_name=None)¶
The nameserver serves as a phonebook-like lookup table for your workers. Unique names are created so the workers can work in parallel and register their results without creating racing conditions. The implementation uses PYRO4 as a backend and this class is basically a wrapper.
- run_id (str) – unique run_id associated with the HPB run
- working_directory (str) – path to the working directory of the HPB run to store the nameservers credentials. If None, no config file will be written.
- host (str) – the hostname to use for the nameserver
- port (int) – the port to be used. Default (=0) means a random port
- nic_name (str) – name of the network interface to use (only used if host is not given)
clean shutdown of the nameserver and the config file (if written)
starts a Pyro4 nameserver in a separate thread
Returns: the host name and the used port Return type: tuple (str, int)
helper function to translate the name of a network card into a valid host name