pkgcheck.jobserver module

Client for the POSIX jobserver protocol.

See https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html

class pkgcheck.jobserver.JobServer(read_fd=None, write_fd=None, close=False)[source]

Bases: object

Holder of job tokens taken from a jobserver.

Instances are always usable; one that found no jobserver to connect to is falsy and simply never hands out a token.

acquire()[source]

Wait for a job token, returning False if stopped or none can be had.

close()[source]

Return all tokens and disconnect.

classmethod connect()[source]

Connect to the jobserver exported in the environment, if there is one.

property held

Number of tokens currently held.

release()[source]

Give every held token back.

Tokens must be returned by the process that took them, which some jobservers enforce, so this has to run before that process exits.

stop()[source]

Interrupt a pending acquire() and refuse to hand out further tokens.

pkgcheck.jobserver.path_from_env()[source]

Path of the jobserver exported in the environment, if it has one.