toxicslave package¶
Submodules¶
toxicslave.build module¶
- class toxicslave.build.BuildStep(name, command, warning_on_fail=False, timeout=3600, stop_on_fail=False)[source]¶
Bases:
object- async execute(cwd, out_fn=None, last_step_status=None, last_step_output=None, **envvars)[source]¶
Executes the step command.
- Parameters:
cwd – Directory where the command will be executed.
out_fn – Function used to handle each line of the command output.
last_step_status – The status of the step before this one in the build.
last_step_output – The output of the step before this one in the build.
envvars – Environment variables to be used on execution.
Note
In the case of this method, the params
last_step_statusandlast_step_outputare not used. They are here for the use of extentions that may need it. For example, run one command in case of one status or another command in case of another status.
toxicslave.cmds module¶
- toxicslave.cmds.create(root_dir, no_token=False)[source]¶
Create a new toxicslave environment.
- Parameters:
--root_dir – Root directory for toxicslave.
--no-token – Should we create a access token?
- toxicslave.cmds.create_token(conffile, show_encrypted=False)[source]¶
Creates the access token to the slave.
- Parameters:
conffile – The path for the toxicslave.conf
--show-encrypted – Show the encrypted token?
- toxicslave.cmds.restart(workdir, pidfile='toxicslave.pid', loglevel='info')[source]¶
Restarts toxicslave
The instance of toxicslave in
workdirwill be restarted.- Parameters:
workdir – Workdir for master to be killed.
--pidfile – Name of the file to use as pidfile. Defaults to
toxicslave.pid--loglevel – Level for logging messages.
- toxicslave.cmds.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.confinsideworkdir--loglevel – Level for logging messages. Defaults to info.
--pidfile – Name of the file to use as pidfile. Defaults to
toxicslave.pid
- toxicslave.cmds.stop(workdir, pidfile='toxicslave.pid', kill=False)[source]¶
Stops toxicslave.
The instance of toxicslave in
workdirwill be stopped.- Parameters:
workdir – Workdir for master to be killed.
--pidfile – Name of the file to use as pidfile. Defaults to
toxicslave.pidkill – If true, send signum 9, otherwise, 15.
toxicslave.docker module¶
- class toxicslave.docker.BuildStepDocker(name, command, warning_on_fail=False, timeout=3600, stop_on_fail=False, container_name=None)[source]¶
Bases:
BuildStep,LoggerMixinA build step that run the commands inside a docker container.
- class toxicslave.docker.DockerContainerBuilder(*args, **kwargs)[source]¶
Bases:
BuilderClass to handle docker containers used to run builds inside it.
- async container_exists(only_running=False)[source]¶
Checks if a container named as its
self.cnamealready exists- Parameters:
only_running – If True, will look only for running containers.
toxicslave.exceptions module¶
toxicslave.managers module¶
- class toxicslave.managers.BuildManager(protocol, repo_id, repo_url, vcs_type, branch, named_tree, config_type='yml', config_filename='toxicbuild.yml', builders_from=None)[source]¶
Bases:
LoggerMixinA manager for remote build requests
- building_repos = {}¶
- cloning_repos = {}¶
- property config¶
- property current_build¶
- property is_cloning¶
Informs if this repository is being cloned.
- property is_updating¶
Informs it this repository is fetching changes
- property 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 build config file
- async load_builder(name, envvars=None)[source]¶
Loads a builder from toxicbuild.yml. If USE_DOCKER returns a DockerContainerBuilder instance. Otherwise returns a Builder instance.
- Parameters:
name – builder name
envvars – A dictionary with environment variables used in a build.
- async update_and_checkout(work_after_wait=True, external=None)[source]¶
Updates
self.branchand checkout toself.named_tree.- Parameters:
work_after_wait – Indicates if we should update and checkout after waiting for other instance finishes its job.
external – Info about a remote repository if the build should be executed with changes from a remote repo.
- updating_repos = {}¶
- property workdir¶
The directory where the source code of this repository is cloned into
toxicslave.plugins module¶
- class toxicslave.plugins.AptInstallPlugin(packages, timeout=600)[source]¶
Bases:
SlavePluginInstalls packages using apt.
- get_steps_before()[source]¶
Returns a list of steps to be executed before the steps provided by the user.
- name = 'apt-install'¶
- no_list = False¶
- class toxicslave.plugins.PythonCreateVenvStep(data_dir, venv_dir, pyversion)[source]¶
Bases:
BuildStepStep that checks if the venv already exists before executing the command.
- async execute(cwd, **envvars)[source]¶
Executes the step command.
- Parameters:
cwd – Directory where the command will be executed.
out_fn – Function used to handle each line of the command output.
last_step_status – The status of the step before this one in the build.
last_step_output – The output of the step before this one in the build.
envvars – Environment variables to be used on execution.
Note
In the case of this method, the params
last_step_statusandlast_step_outputare not used. They are here for the use of extentions that may need it. For example, run one command in case of one status or another command in case of another status.
- class toxicslave.plugins.PythonVenvPlugin(pyversion, requirements_file='requirements.txt', remove_env=False, extra_indexes=None)[source]¶
Bases:
SlavePlugin- 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 = 'python-venv'¶
- no_list = False¶
- property venv_dir¶
- class toxicslave.plugins.SlavePlugin(*args, **kwargs)[source]¶
Bases:
PluginThis 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.
- property data_dir¶
The directory where the plugin store its data.
- 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¶