def driver(
    reactor, cluster, scenario_factory, operation_factory, metric_factory,
    num_samples, result, output
):

    control_service = cluster.get_control_service(reactor)
    d = gather_deferreds([
        control_service.version(),
        control_service.list_nodes(),
        control_service.list_containers_configuration(),
        control_service.list_datasets_configuration(),
    ])

    def add_control_service(characteristics, result):
        version = characteristics[0]
        node_count = len(characteristics[1])
        container_count = len(characteristics[2])
        dataset_count = len(characteristics[3].datasets)
        result['control_service'] = dict(
            host=cluster.control_node_address().compressed,
            flocker_version=version[u"flocker"],
            node_count=node_count,
            container_count=container_count,
            dataset_count=dataset_count,
        )

    d.addCallback(add_control_service, result)

    def run_benchmark(ignored):
        return benchmark(
            scenario_factory(reactor, cluster),
            operation_factory(reactor, cluster),
            metric_factory(reactor, cluster),
            num_samples,
        )

    d.addCallback(run_benchmark)

    def add_samples(outputs, result):
        samples, scenario_metrics = outputs
        result['samples'] = samples
        if scenario_metrics:
            result['scenario']['metrics'] = scenario_metrics
        return result

    d.addCallback(add_samples, result)

    d.addCallback(output)

    return d
:param reactor: Reactor to use.
dataset/ETHPy150Open ClusterHQ/flocker/benchmark/_driver.py/driver