class pxblat.Server(contextlib.ContextDecorator)[source]

A context manager and decorator for managing a server process.

This class can be used as a context manager or decorator to manage a server process. It starts the server with the given options, and can run it as a daemon process or block until it is ready.

host

The hostname or IP address to bind the server to.

Type:

str

port

The port number to bind the server to.

Type:

int

two_bit

The path to the 2bit file or the URL of the 2bit file.

Type:

Path | str

option

The options to use when starting the server.

Type:

ServerOption

daemon

Whether to run the server as a daemon process. Defaults to True.

Type:

bool, optional

use_others

Whether to allow other users to access the server. Defaults to False.

Type:

bool, optional

timeout

The number of seconds to wait for the server to start. Defaults to 60.

Type:

int, optional

block

Whether to block until the server is ready. Defaults to False.

Type:

bool, optional

Raises:
  • ValueError – If the given two_bit file or URL is invalid.

  • OSError – If there is an error starting the server process.

Constructors

Server(host: str, port: int, two_bit: Path | str, *, ...)[source]

Initializes a gfServer object with the given parameters.

Public members

property host

The hostname or IP address to bind the server to.

property port : int

The port number to bind the server to.

start()[source]

Starts the gfServer instance in either blocking or non-blocking mode.

stop()[source]

Stops the gfServer instance if it is running.

status(*, instance=False) dict[str, str] | Status[source]

Retrieves the status of the gfServer instance.

files() list[str][source]

Retrieves the list of files served by the gfServer instance.

query(intype: str, faName: str, *, isComplex: bool, isProt) str[source]

Queries the gfServer instance with the given parameters.

is_ready() bool[source]

Returns True if the server is ready to accept queries, False otherwise.

is_open() bool[source]

Returns True if the server is open, False otherwise.

wait_ready(*, restart: bool = False)[source]

Wait server ready in block mode.

__enter__()[source]

Starts the gfServer instance in blocking mode when used as a context manager.

__exit__(*exc)[source]

Stops the gfServer.

property can_stop : bool
property log : str
property log_facility : str
property mask : bool
property max_aa_size : int
property max_dna_hits : int
property max_gap : int
property max_nt_size : int
property max_trans_hits : int
property min_match : int
property rep_match : int
property seq_log : bool
property ip_log : bool
property debug_log : bool
property trans : bool
property syslog : bool
property no_simp_rep_mask : bool
property per_seq_max : str
property index_file : str
__call__(func)

Call self as a function.

String representation

__str__() str[source]
__repr__() str

Return server option as a string.