def run_exp(exp_id, uri):
    class TasksTest(Tasks):
        @property
        def tasks(self):
            tasks = [
                Task("self.client.navigate('about:blank')", self.client,
                     meta={'website': 'HOME'}),
                Task('time.sleep(60)', self.client, # Deal with ghost windows
                     meta={'website': 'HOME'}),
                Task("self.client.navigate('{}')".format(uri), self.client,
                     meta={'website': uri}),
                Task('time.sleep(60)', self.client,
                     meta={'website': uri}),
                Task("self.client.navigate('about:blank')", self.client,
                     meta={'website': 'HOME'}),
                Task('time.sleep(30)', self.client,
                     meta={'website': 'HOME'}),
                # One last task to keep the browser alive while we dump counters
                Task('time.sleep(5)', self.client,
                     meta={'website': 'HOME'}),
            ]
            return tasks

    exp_name = path.splitext(path.basename(__file__))[0]
    exp = Experiment(
        exp_id=exp_id, exp_name=exp_name, tasks=TasksTest(), duration=150,
        sampled_data_retrievers=(PerformanceProcessesRetriever(), PsutilDataRetriever())
    )

    exp.run(wait_interval=10)
    time.sleep(10)
Exemple #2
0
exp_id = 8


class TasksTest(Tasks):
    @property
    def tasks(self):
        tasks = [
            Task('time.sleep(300)', self.client, meta={'website': 'HOME'}),
            # go to Mozilla.org
            Task("self.client.navigate('https://slate.com')",
                 self.client,
                 meta={'website': 'https://slate.com/'}),
            # wait for 2 minutes
            Task('time.sleep(600)', self.client, meta={'website': 'HOME'}),
        ]
        return tasks


""" DON'T MODIFY THE BELOW!!!!"""

exp_name = path.splitext(path.basename(__file__))[0]
sampled_data_retrievers = (PerformanceCounterRetriever(),
                           PsutilDataRetriever())
exp = Experiment(exp_id=exp_id,
                 exp_name=exp_name,
                 tasks=TasksTest(),
                 duration=960,
                 sampled_data_retrievers=sampled_data_retrievers)
exp.run()
Exemple #3
0
from energy_consumption.experiment import Experiment, Tasks, Task
from energy_consumption.helpers.io_helpers import log_to_stdout
from energy_consumption.data_streams.sampled_data import PerformanceCounterRetriever, PsutilDataRetriever


logger = logging.getLogger()
logger.setLevel(logging.INFO)
log_to_stdout(logger, level=logging.INFO)

exp_id = 7


class TasksTest(Tasks):
    @property
    def tasks(self):
        tasks = [
            # wait for 2 minutes
            Task('time.sleep(900)', self.client, meta={'website': 'HOME'}),
        ]
        return tasks


""" DON'T MODIFY THE BELOW!!!!"""

exp_name = path.splitext(path.basename(__file__))[0]
sampled_data_retrievers = (PerformanceCounterRetriever(), PsutilDataRetriever())
exp = Experiment(exp_id=exp_id, exp_name=exp_name, tasks=TasksTest(), duration=960,
                 sampled_data_retrievers=sampled_data_retrievers)

exp.run()