toxicbuild.slave package

Submodules

toxicbuild.slave.build module

class toxicbuild.slave.build.BuildStep(name, command, warning_on_fail=False, timeout=3600, stop_on_fail=False)[source]

Bases: object

execute(cwd, out_fn=None, **envvars)[source]

Executes the step command. :param cwd: Directory where the command will be executed. :param out_fn: Function used to handle each line of the

command output.
Parameters:envvars – Environment variables to be used on execution.
class toxicbuild.slave.build.Builder(manager, name, workdir, **envvars)[source]

Bases: toxicbuild.core.utils.LoggerMixin

A builder executes build steps. Builders are configured in the toxicbuild.conf file

build()[source]

toxicbuild.slave.exceptions module

exception toxicbuild.slave.exceptions.BadBuilderConfig[source]

Bases: Exception

exception toxicbuild.slave.exceptions.BadData[source]

Bases: Exception

exception toxicbuild.slave.exceptions.BuilderNotFound[source]

Bases: Exception

exception toxicbuild.slave.exceptions.BusyRepository[source]

Bases: Exception

toxicbuild.slave.managers module

class toxicbuild.slave.managers.BuildManager(protocol, repo_url, vcs_type, branch, named_tree)[source]

Bases: toxicbuild.core.utils.LoggerMixin

A manager for remote build requests

building_repos = defaultdict(<function BuildManager.<lambda>>, {})
cloning_repos = set()
configmodule
current_build
is_cloning

Informs if this repository is being cloned.

is_updating

Informs it this repository is fetching changes

is_working

Informs if this repository is cloning or updating

list_builders()[source]

Returns a list with all builders names for this branch based on toxicbuild.conf file

load_builder(name)[source]

Load a builder from toxicbuild.conf :param name: builder name

log(msg, level='info')[source]
send_info(info)[source]
update_and_checkout(work_after_wait=True)[source]

Updates self.branch and checkout to self.named_tree. :param work_after_wait: Indicates if we should update and checkout

after waiting for other instance finishes its job.
updating_repos = set()
wait_all()[source]

Wait until clone and update are done.

wait_clone()[source]

Wait until the repository clone is complete.

wait_update()[source]

Wait until the repository update is complete.

workdir

The directory where the source code of this repository is cloned into

toxicbuild.slave.plugins module

class toxicbuild.slave.plugins.AptitudeInstallPlugin(packages, timeout=600)[source]

Bases: toxicbuild.slave.plugins.SlavePlugin

Installs packages using aptitude.

get_env_vars()[source]
get_steps_before()[source]
name = 'aptitude-install'
no_list = False
class toxicbuild.slave.plugins.AptitudeInstallStep(packages, timeout=600)[source]

Bases: toxicbuild.slave.build.BuildStep

class toxicbuild.slave.plugins.PythonCreateVenvStep(venv_dir, pyversion)[source]

Bases: toxicbuild.slave.build.BuildStep

Step that checks if the venv already exists before executing the command.

execute(cwd, **envvars)[source]
class toxicbuild.slave.plugins.PythonVenvPlugin(pyversion, requirements_file='requirements.txt', remove_env=False)[source]

Bases: toxicbuild.slave.plugins.SlavePlugin

get_env_vars()[source]
get_steps_after()[source]
get_steps_before()[source]
name = 'python-venv'
no_list = False
class toxicbuild.slave.plugins.SlavePlugin(*args, **kwargs)[source]

Bases: toxicbuild.core.plugins.Plugin

This is a base slave plugin. Slave plugins may add steps to a build before and/or after the used defined steps. It may also set enivronment variables to be used in the tests.

get_env_vars()[source]

Returns a dictionary containing values for environment variables.

get_steps_after()[source]

Returns a list of steps to be executed after the steps provided by the user.

get_steps_before()[source]

Returns a list of steps to be executed before the steps provided by the user.

name = 'BaseSlavePlugin'
no_list = False

toxicbuild.slave.protocols module

class toxicbuild.slave.protocols.BuildServerProtocol(loop, connection_lost_cb=None)[source]

Bases: toxicbuild.core.protocol.BaseToxicProtocol

A simple server for build requests.

build()[source]

Performs a build requested by the client using the params sent in the request data

client_connected()[source]
encrypted_token = '$2b$04$uPkH68HUDSFl5SFiAonXq.MOhW/0QGyCnRedEXi5IcqyrTvvvexUK'
get_buildmanager()[source]

Returns the builder manager for this request

healthcheck()[source]

Informs that the server is up and running

list_builders()[source]

Informs all builders’ names for this repo/branch/named_tree

log(msg, level='info')[source]
salt = '$2b$04$uPkH68HUDSFl5SFiAonXq.MOhW/0QGyCnRedEXi5IcqyrTvvvexUK'

toxicbuild.slave.server module

class toxicbuild.slave.server.BuildServer(addr='0.0.0.0', port=7777)[source]

Bases: object

get_protocol_instance()[source]
start()[source]
toxicbuild.slave.server.run_server(addr='0.0.0.0', port=7777)[source]

Module contents

toxicbuild.slave.create(root_dir)[source]

Create a new toxicslave environment.

Parameters:--root_dir – Root directory for toxicslave.
toxicbuild.slave.create_settings()[source]
toxicbuild.slave.restart(workdir, pidfile='toxicslave.pid')[source]

Restarts toxicslave

The instance of toxicslave in workdir will be restarted.

Parameters:
  • workdir – Workdir for master to be killed.
  • --pidfile – Name of the file to use as pidfile. Defaults to toxicslave.pid
toxicbuild.slave.start(workdir, daemonize=False, stdout='toxicslave.log', stderr='toxicslave.log', conffile=None, loglevel='info', pidfile='toxicslave.pid')[source]

Starts toxicslave.

Starts the build server to listen on the specified port for requests from addr (0.0.0.0 means everyone). Addr and port params came from the config file

Parameters:
  • workdir – Work directory for server.
  • --daemonize – Run as daemon. Defaults to False
  • --stdout – stdout path. Defaults to /dev/null
  • --stderr – stderr path. Defaults to /dev/null
  • --conffile (-c,) – path to config file. Defaults to None. If not conffile, will look for a file called toxicslave.conf inside workdir
  • --loglevel – Level for logging messages. Defaults to info.
  • --pidfile – Name of the file to use as pidfile. Defaults to toxicslave.pid
toxicbuild.slave.stop(workdir, pidfile='toxicslave.pid')[source]

Stops toxicslave.

The instance of toxicslave in workdir will be stopped.

Parameters:
  • workdir – Workdir for master to be killed.
  • --pidfile – Name of the file to use as pidfile. Defaults to toxicslave.pid