Пример #1
0
def CreateGraph(options):
    if not isinstance(options, TaskOptions):
        raise ValueError(
            'options must be an instance of read_value.TaskOptions')
    subgraph = run_test.CreateGraph(options.test_options)
    path = None
    if read_value_quest.IsWindows(
        {'dimensions': options.test_options.dimensions}):
        path = ntpath.join(options.benchmark, 'perf_results.json')
    else:
        path = posixpath.join(options.benchmark, 'perf_results.json')

    # We create a 1:1 mapping between a read_value task and a run_test task.
    def GenerateVertexAndDep(attempts):
        for attempt in range(attempts):
            change_id = find_isolate.ChangeId(
                options.test_options.build_options.change)
            read_value_id = 'read_value_%s_%s' % (change_id, attempt)
            run_test_id = run_test.TaskId(change_id, attempt)
            yield (task_module.TaskVertex(
                id=read_value_id,
                vertex_type='read_value',
                payload={
                    'benchmark': options.benchmark,
                    'mode': options.mode,
                    'results_filename': path,
                    'histogram_options': {
                        'grouping_label':
                        options.histogram_options.grouping_label,
                        'story': options.histogram_options.story,
                        'statistic': options.histogram_options.statistic,
                    },
                    'graph_json_options': {
                        'chart': options.graph_json_options.chart,
                        'trace': options.graph_json_options.trace
                    },
                    'change':
                    options.test_options.build_options.change.AsDict(),
                    'index': attempt,
                }), task_module.Dependency(from_=read_value_id,
                                           to=run_test_id))

    for vertex, edge in GenerateVertexAndDep(options.test_options.attempts):
        subgraph.vertices.append(vertex)
        subgraph.edges.append(edge)

    return subgraph
Пример #2
0
 def setUp(self):
     super(EvaluatorTest, self).setUp()
     self.maxDiff = None
     self.job = job_module.Job.New((), ())
     task_module.PopulateTaskGraph(
         self.job,
         run_test.CreateGraph(
             run_test.TaskOptions(build_options=find_isolate.TaskOptions(
                 builder='Some Builder',
                 target='telemetry_perf_tests',
                 bucket='luci.bucket',
                 change=change_module.Change.FromDict({
                     'commits': [{
                         'repository': 'chromium',
                         'git_hash': 'aaaaaaa',
                     }]
                 })),
                                  swarming_server='some_server',
                                  dimensions=DIMENSIONS,
                                  extra_args=[],
                                  attempts=10)))