taucmdr.model.experiment module¶
Experiment data model.
An Experiment uniquely groups a Target
, Application
, and Measurement
and will have zero or more Trial
. There is one selected experiment per project.
The selected experiment will be used for application compilation and trial visualization.
-
class
taucmdr.model.experiment.
Experiment
(record)[source]¶ Bases:
taucmdr.mvc.model.Model
Experiment data model.
-
associations
= {'project': (<class 'taucmdr.model.project.Project'>, 'experiments'), 'trials': (<class 'taucmdr.model.trial.Trial'>, 'experiment')}¶
-
attributes
= {'application': {'argparse': {'flags': ('--application',), 'metavar': '<name>'}, 'description': 'Application this experiment uses', 'model': <class 'taucmdr.model.application.Application'>, 'required': True}, 'measurement': {'argparse': {'flags': ('--measurement',), 'metavar': '<name>'}, 'description': 'Measurement parameters for this experiment', 'model': <class 'taucmdr.model.measurement.Measurement'>, 'required': True}, 'name': {'description': 'human-readable experiment name', 'primary_key': True, 'type': 'string', 'unique': True}, 'project': {'description': 'Project this experiment belongs to', 'model': <class 'taucmdr.model.project.Project'>, 'required': True, 'unique': True}, 'record_output': {'argparse': {'flags': ('--record-output',)}, 'default': False, 'description': 'Record application stdout', 'type': 'boolean'}, 'target': {'argparse': {'flags': ('--target',), 'metavar': '<name>'}, 'description': "The experiment's hardware/software configuration", 'model': <class 'taucmdr.model.target.Target'>, 'required': True}, 'tau_makefile': {'description': 'TAU Makefile used during this experiment, if any.', 'type': 'string'}, 'trials': {'collection': <class 'taucmdr.model.trial.Trial'>, 'description': 'Trials of this experiment', 'via': 'experiment'}}¶
-
configure
()[source]¶ Sets up the Experiment for a new trial.
Installs or configures TAU and all its dependencies. After calling this function, the experiment is ready to operate on the user’s application.
Returns: Object handle for the TAU installation. Return type: TauInstallation
-
classmethod
controller
(storage=<taucmdr.cf.storage.storage_dispatch.ProjectStorageDispatch object>)[source]¶
-
key_attribute
= 'name'¶
-
managed_build
(compiler_cmd, compiler_args)[source]¶ Uses this experiment to perform a build operation.
Checks that this experiment is compatible with the desired build operation, prepares the experiment, and performs the operation.
Parameters: Raises: ConfigurationError
– The experiment is not configured to perform the desired build.Returns: Build subprocess return code.
Return type:
-
managed_run
(launcher_cmd, application_cmds, description=None)[source]¶ Uses this experiment to run an application command.
Performs all relevant system preparation tasks to run the user’s application under the specified experimental configuration.
Parameters: Raises: ConfigurationError
– The experiment is not configured to perform the desired run.Returns: Application subprocess return code.
Return type:
-
name
= 'Experiment'¶
-
prefix
¶
-
classmethod
rebuild_required
()[source]¶ Builds a string indicating if an application rebuild is required.
Rebuild information is taken from the ‘rebuild_required’ topic.
Returns: String indicating why an application rebuild is required. Return type: str
-
references
= {(<class 'taucmdr.model.trial.Trial'>, 'experiment'), (<class 'taucmdr.model.project.Project'>, 'experiment')}¶
-
classmethod
select
(name)[source]¶ Changes the selected experiment in the current project.
Raises: ExperimentSelectionError
– No experiment with the given name in the currently selected project.Parameters: name (str) – Name of the experiment to select.
-
trials
(trial_numbers=None)[source]¶ Get a list of modeled trial records.
If bool(trial_numbers) is False, return the most recent trial. Otherwise return a list of Trial objects for the given trial numbers.
Parameters: trial_numbers (list) – List of numbers of trials to retrieve. Returns: Modeled trial records. Return type: list Raises: ConfigurationError
– Invalid trial number or no trials in selected experiment.
-
-
class
taucmdr.model.experiment.
ExperimentController
(model_cls, storage, context=None)[source]¶ Bases:
taucmdr.mvc.controller.Controller
Experiment data controller.
-
_check_unique
(data, match_any=False)[source]¶ Default match_any to False to prevent matches outside the selected project.
-
create
(data)[source]¶ Atomically store a new record and update associations.
Invokes the on_create callback after the data is recorded. If this callback raises an exception then the operation is reverted.
Parameters: data (dict) – Data to record. Returns: The newly created data. Return type: Model
-
delete
(keys)[source]¶ Delete recorded data and update associations.
- The behavior depends on the type of keys:
- Record.ElementIdentifier: delete the record with that element identifier.
- dict: delete all records with attributes matching keys.
- list or tuple: delete all records matching the elements of keys.
bool(keys) == False
: raise ValueError.
Invokes the on_delete callback after the data is deleted. If this callback raises an exception then the operation is reverted.
Parameters: - keys (dict) – Attributes to match.
- keys – Fields or element identifiers to match.
-
exists
(keys)[source]¶ Check if a record exists.
Parameters: keys – See AbstractStorage.exists
.Returns: True if a record matching keys exists, False otherwise. Return type: bool
-
unset
(fields, keys)[source]¶ Unset recorded data fields and update associations.
- The behavior depends on the type of keys:
- Record.ElementIdentifier: update the record with that element identifier.
- dict: update all records with attributes matching keys.
- list or tuple: apply update to all records matching the elements of keys.
bool(keys) == False
: raise ValueError.
Invokes the on_update callback after the data is modified. If this callback raises an exception then the operation is reverted.
Parameters: - fields (list) – Names of fields to unset.
- keys – Fields or element identifiers to match.
-
update
(data, keys)[source]¶ Change recorded data and update associations.
- The behavior depends on the type of keys:
- Record.ElementIdentifier: update the record with that element identifier.
- dict: update all records with attributes matching keys.
- list or tuple: apply update to all records matching the elements of keys.
bool(keys) == False
: raise ValueError.
Invokes the on_update callback after the data is modified. If this callback raises an exception then the operation is reverted.
Parameters: - data (dict) – New data for existing records.
- keys – Fields or element identifiers to match.
-