pyrolab.manager.NameServerRunner

Contents

pyrolab.manager.NameServerRunner#

class NameServerRunner(*args, name: str = '', nsconfig: NameServerConfiguration = None, msg_queue: Queue = None, msg_polling: float = 1.0, **kwargs)[source]#

Bases: Process

A process for running nameservers using Python’s multiprocessing.

Advantages of using a child Process include the fact that if a server dies or hangs up, the entire program doesn’t stall or need to be restarted, just the process that contained the server. Thus errors can be handled and servers autonomously restarted and managed.

Parameters:
namestr

The name of the nameserver being run.

nsconfigNameServerConfiguration

The configuration for the nameserver.

msg_queuemultiprocessing.Queue

A message queue. ResourceRunner listens for when None is placed in the queue, which is a sentinel value to shutdown the process.

msg_pollingfloat, optional

The time in seconds between polling the message queue.

Attributes:
authkey
daemon

Return whether process is a daemon

exitcode

Return exit code of process or None if it has yet to stop

ident

Return identifier (PID) of process or None if it has yet to start

name
pid

Return identifier (PID) of process or None if it has yet to start

sentinel

Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.

Methods

close()

Close the Process object.

is_alive()

Return whether process is alive

join([timeout])

Wait until child process terminates

kill()

Terminate process; sends SIGKILL signal or uses TerminateProcess()

process_message_queue()

A message handler.

run()

Creates and runs the child process.

start()

Start child process

stay_alive()

A callback listener; if the sentinel value None is placed in the message queue, returns True signifying a shutdown signal has been received.

terminate()

Terminate process; sends SIGTERM signal or uses TerminateProcess()