executes ‘command’ in a shell
Note
The following command enables capturing stderr, stdout and runtime information (with /usr/bin/time):
shell.track(experiment.path)
Note
Tracking is enabled automatically after setup. It can be disabled and re-enabled while running the experiment with:
>> shell.track.disable()
>> shell.track.enable()
The tracking feature creates files like shell_0_time, shell_0_stderr, and so on. These files are created in the experiment.path directory.
Note
To write the results of the tracking feature into the experiment output folder, use self.path within a run() method of an experiment:
shell.track(experiment.path)
Return type: | a tuple with:
|
---|---|
Raises: | CommandFailed if the returncode is != 0 |
Indicates that some command failed
command: the command that failed
returncode: the exitcode of the failed command
Can be used as: input parameter and output parameter
With this parameter the systems status during the experiment can be monitored. The tick interval can specified on creation and also what values should be captured.
This parameter creates a CSV_File with the given name. When the experiment starts the monitor fires up a thread which will every tick_interval milliseconds capture the status of the system and store the information as a row in the normal csv.
A short example:
class SimpleExperiment(Experiment):
outputs = {"ps": MachineMonitor("ps_monitor", tick_interval=100)}
def run(self):
shell("sleep 1")
shell("seq 1 100000 | while read a; do echo > /dev/null; done")
shell("sleep 1")
experiment = SimpleExperiment()
experiment(sys.argv)
>>> experiment.o.ps.extract(["time", "net_send"])
[[1326548338.701827, 0],
[1326548338.810422, 3],
[1326548338.913667, 0],
[1326548339.016836, 0],
[1326548339.119982, 2],
....
Extract single columns from the captured information. Useful keys are defined in sample_keys
The various fields in the csv file are organized like the strings in this list. E.g. The unix time is the first field of the csv file.