benchbuild.utils.run module

Experiment helpers.

class benchbuild.utils.run.RunInfo(cmd=None, failed=False, project=None, experiment=None, retcode=0, stdout=NOTHING, stderr=NOTHING)[source]

Bases: object

Execution context of wrapped binaries.

Execution of tracked binaries is guarded with this context object. In here we store everything about a single binary execution for consumption of an experiment.

cmd
failed
project
experiment
retcode
stdout
stderr
db_run
session
add_payload(name, payload)[source]
commit()[source]
has_failed

Check, whether this run failed.

benchbuild.utils.run.begin_run_group(project)[source]

Begin a run_group in the database.

A run_group groups a set of runs for a given project. This models a series of runs that form a complete binary runtime test.

Parameters:project – The project we begin a new run_group for.
Returns:(group, session) where group is the created group in the database and session is the database session this group lives in.
benchbuild.utils.run.end_run_group(group, session)[source]

End the run_group successfully.

Parameters:
  • group – The run_group we want to complete.
  • session – The database transaction we will finish.
benchbuild.utils.run.exit_code_from_run_infos(run_infos: List[benchbuild.utils.run.RunInfo]) → int[source]

Generate a single exit code from a list of RunInfo objects.

Takes a list of RunInfos and returns the exit code that is furthest away from 0.

Parameters:run_infos (t.List[RunInfo]) – [description]
Returns:[description]
Return type:int
benchbuild.utils.run.fail_run_group(group, session)[source]

End the run_group unsuccessfully.

Parameters:
  • group – The run_group we want to complete.
  • session – The database transaction we will finish.
benchbuild.utils.run.in_builddir(sub='.')[source]

Decorate a project phase with a local working directory change.

Parameters:sub – An optional subdirectory to change into.
benchbuild.utils.run.run(command, retcode=0)[source]

Execute a plumbum command, depending on the user’s settings.

Parameters:command – The plumbumb command to execute.
benchbuild.utils.run.store_config(func)[source]

Decorator for storing the configuration in the project’s builddir.

benchbuild.utils.run.track_execution(cmd, project, experiment, **kwargs)[source]

Guard the execution of the given command.

The given command (cmd) will be executed inside a database context. As soon as you leave the context we will commit the transaction. Any necessary modifications to the database can be identified inside the context with the RunInfo object.

Parameters:
  • cmd – The command we guard.
  • project – The project we track for.
  • experiment – The experiment we track for.
Yields:

RunInfo

A context object that carries the necessary

database transaction.

benchbuild.utils.run.with_env_recursive(cmd, **envvars)[source]

Recursively updates the environment of cmd and all its subcommands.

Parameters:
  • - A plumbum command-like object (cmd) –
  • - The environment variables to update (**envvars) –
Returns:

The updated command.