taucmdr.model.trial module

Trial data model.

Every application of an Experiment produces a new Trial. The trial record completely describes the hardware and software environment that produced the performance data.

class taucmdr.model.trial.Trial(record)[source]

Bases: taucmdr.mvc.model.Model

Trial data model.

classmethod _separate_launcher_cmd(cmd)[source]

Separate the launcher command and it’s arguments from the application command(s) and arguments.

Parameters:cmd (list) – Command line.
Returns:(Launcher command, Remainder of command line)
Return type:tuple
Raises:ConfigurationError – No application config files or executables found after a recognized launcher command.
associations = {'experiment': (<class 'taucmdr.model.experiment.Experiment'>, 'trials')}
attributes = {'number': {'primary_key': True, 'type': 'integer', 'required': True, 'description': 'trial number'}, 'experiment': {'model': <class 'taucmdr.model.experiment.Experiment'>, 'required': True, 'description': "this trial's experiment"}, 'command': {'type': 'string', 'required': True, 'description': 'command line executed when performing the trial'}, 'cwd': {'type': 'string', 'required': True, 'description': 'directory the trial was performed in'}, 'environment': {'type': 'string', 'description': 'shell environment in which the trial was performed, encoded as a base64 string'}, 'begin_time': {'type': 'datetime', 'description': 'date and time the trial began'}, 'end_time': {'type': 'datetime', 'description': 'date and time the trial ended'}, 'return_code': {'type': 'integer', 'description': 'return code of the command executed when performing the trial'}, 'data_size': {'type': 'integer', 'description': 'the size in bytes of the trial data'}, 'description': {'type': 'string', 'argparse': {'flags': ('--description',), 'metavar': '<text>'}, 'description': 'description of this trial'}, 'phase': {'type': 'string', 'description': 'phase of trial: initializing, executing, complete, or failed'}, 'elapsed': {'type': 'float', 'description': 'seconds spent executing the application command only (excludes all other operations)'}, 'output': {'type': 'string', 'description': 'stdout and stderr of program'}}
execute_command(expr, cmd, cwd, env, record_output=False)[source]

Execute a command as part of an experiment trial.

Creates a new subprocess for the command and checks for TAU data files when the subprocess exits.

Parameters:
  • expr (Experiment) – Experiment data.
  • cmd (str) – Command to profile, with command line arguments.
  • cwd (str) – Working directory to perform trial in.
  • env (dict) – Environment variables to set before performing the trial.
Returns:

Subprocess return code.

Return type:

int

export(dest)[source]

Export experiment trial data.

Parameters:dest (str) – Path to directory to contain exported data.
Raises:ConfigurationError – This trial has no data.
get_data_files()[source]

Return paths to the trial’s data files or directories mapped by data type.

Post-process trial data if necessary and return a dictionary mapping the types of data produced by this trial to paths to related data files or directories. The paths should be suitable for passing on a command line to one of the known data analysis tools. For example, a trial producing SLOG2 traces and TAU profiles would return {"slog2": "/path/to/tau.slog2", "tau": "/path/to/directory/"}.

Returns:Keys are strings indicating the data type; values are filesystem paths.
Return type:dict
key_attribute = 'number'
name = 'Trial'
on_create()[source]
on_delete()[source]
on_update(changes)[source]
classmethod parse_launcher_cmd(cmd)[source]

Parses a command line to split the launcher command and application commands.

Parameters:cmd (list) – Command line.
Returns:(Launcher command, possibly empty list of application commands).
Return type:tuple
prefix
queue_command(expr, cmd, cwd, env)[source]

Execute a command as part of an experiment trial.

Creates a new subprocess for the command and checks for TAU data files when the subprocess exits.

Parameters:
  • expr (Experiment) – Experiment data.
  • cmd (str) – Command to profile, with command line arguments.
  • cwd (str) – Working directory to perform trial in.
  • env (dict) – Environment variables to set before performing the trial.
Returns:

Subprocess return code.

Return type:

int

references = set()
class taucmdr.model.trial.TrialController(model_cls, storage, context=None)[source]

Bases: taucmdr.mvc.controller.Controller

Trial data controller.

perform(proj, cmd, cwd, env, description, record_output=False)[source]

Performs a trial of an experiment.

Parameters:
  • expr (Experiment) – Experiment data.
  • proj (Project) – Project data.
  • cmd (str) – Command to profile, with command line arguments.
  • cwd (str) – Working directory to perform trial in.
  • env (dict) – Environment variables to set before performing the trial.
  • description (str) – Description of this trial.
renumber(old_trials, new_trials)[source]

Renumbers trial id of an experiment.

Parameters:
  • old_trials (list) – old trial numbers.
  • new_trials (list) – new trial numbers.
exception taucmdr.model.trial.TrialError(value, *hints)[source]

Bases: taucmdr.error.ConfigurationError

Indicates there was an error while performing an experiment trial.

message_fmt = "%(value)s\n\n%(hints)s\nPlease check the selected configuration for errors or send '%(logfile)s' to %(contact)s for assistance."
taucmdr.model.trial.attributes()[source]