pyrolab.configure.DaemonConfiguration

pyrolab.configure.DaemonConfiguration#

class DaemonConfiguration(_env_file: DotenvType | None = '<object object>', _env_file_encoding: str | None = None, _env_nested_delimiter: str | None = None, _secrets_dir: StrPath | None = None, *, module: str = 'pyrolab.server', classname: str = 'Daemon', host: str = 'localhost', port: int = 0, unixsocket: str | None = None, nathost: str | None = None, natport: int = 0, servertype: str = 'thread', nameservers: List[str] = [])[source]#

Bases: BaseSettings, PyroConfigMixin, YAMLMixin

Server configuration object.

Note that for the host parameter, the string “public” will always be reevaluated to the computer’s public IP address.

Parameters:
modulestr, optional

The module that contains the Daemon class (default “pyrolab.server”).

classnamestr, optional

The name of the Daemon class to use (default is basic “Daemon”).

hoststr, optional

The hostname of the local server, or the string “public”, which is converted to the host’s public IP address (default “localhost”).

portint, optional

Port to bind the server on (default 0, which means to pick a random port).

unixsocketstr, optional

The name of a Unix domain socket to use instead of a TCP/IP socket (default None, which means don’t use).

nathoststr, optional

Hostname to use in published addresses (useful when running behind a NAT firewall/router). Default is None which means to just use the normal host. For more details about NAT, see the Pyro5 docs about using Pyro5 behind a NAT router/firewall.

natportint, optional

Port to use in published addresses (useful when running behind a NAT firewall/router). If you use 0 here (default), Pyro will replace the NAT-port by the internal port number to facilitate one-to-one NAT port mappings.

servertypestr, optional

Either thread or multiplex (default “thread”).

nameserversList[str], optional

Whether to register the daemon itself with known nameservers. Useful if the daemon provides functions for managing local instruments that would be useful to remote clients. Services declare their own nameserver registrations; belonging to a daemon that registers itself with a specific nameserver does not mean that its services will also be registered with that nameserver.

Examples

The following is an example of a valid configuration file “daemons” section. Keys not defined assume the default values.

daemons:
    lockable:
        classname: LockableDaemon
        host: public
        servertype: thread
        nameservers:
            - production
    multiplexed:
        host: public
        servertype: multiplex

Methods

construct([_fields_set])

Creates a new model setting __dict__ and __fields_set__ from trusted or pre-validated data.

copy(*[, include, exclude, update, deep])

Duplicate a model, optionally choose which fields to include, exclude and change.

dict(*[, include, exclude, by_alias, ...])

Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

from_file(filename)

Loads a configuration from a YAML file.

from_yaml(yaml)

Loads a YAML representation of the configuration.

json(*[, include, exclude, by_alias, ...])

Generate a JSON representation of the model, include and exclude arguments as per dict().

update_forward_refs(**localns)

Try to update ForwardRefs on fields based on this Model, globalns and localns.

update_pyro_config([values])

Sets all key-value attributes that are Pyro5 configuration options.

yaml([sort_keys, default_flow_style, ...])

Returns a YAML representation of the configuration.

Config

from_orm

parse_file

parse_obj

parse_raw

schema

schema_json

validate