Пример #1
0
def run(args):
    """`sandbox run` command"""
    write_run_command()
    features = sandbox_features.collect_features(args.features,
                                                 args.no_default_features,
                                                 args.image_version,
                                                 args.offline_mode)
    sandbox = sandbox_run_docker if is_sandbox_docker_based(
        args.image_version) else sandbox_run_jvm

    run_result = sandbox.run(args, features)

    if run_result.wait_for_conductr:
        sandbox_common.wait_for_start(run_result)

    feature_results = []
    feature_provided = []

    for feature in features:
        feature.conductr_post_start(args, run_result)
        result = feature.start()
        feature_results += result.bundle_results

        if result.started:
            for provided in feature.provides:
                feature_provided.append(provided)

    sandbox.log_run_attempt(args, run_result, feature_results,
                            feature_provided)

    return True
Пример #2
0
def run(args):
    """`sandbox run` command"""
    is_conductr_v1 = major_version(args.image_version) == 1
    features = sandbox_features.collect_features(args.features,
                                                 args.image_version,
                                                 args.offline_mode)
    sandbox = sandbox_run_docker if is_conductr_v1 else sandbox_run_jvm

    run_result = sandbox.run(args, features)

    is_started, wait_timeout = wait_for_start(args, run_result)
    if is_started:
        if not is_conductr_v1:
            feature_ports = []
            for feature in features:
                feature_ports.extend(feature.ports)

            proxy_ports = sorted(args.ports + feature_ports)
            sandbox_proxy.start_proxy(proxy_bind_addr=run_result.core_addrs[0],
                                      proxy_ports=proxy_ports)

        for feature in features:
            feature.start()

    sandbox.log_run_attempt(args, run_result, is_started, wait_timeout)

    return True
Пример #3
0
    def test_collect_features(self):
        self.assertEqual([LiteLoggingFeature],
                         [type(f) for f in collect_features([], LATEST_CONDUCTR_VERSION)])

        self.assertEqual([LiteLoggingFeature, VisualizationFeature],
                         [type(f) for f in collect_features([['visualization']], LATEST_CONDUCTR_VERSION)])

        self.assertEqual([LoggingFeature],
                         [type(f) for f in collect_features([['logging']], LATEST_CONDUCTR_VERSION)])

        # enable dependencies
        self.assertEqual([LoggingFeature, MonitoringFeature],
                         [type(f) for f in collect_features([['monitoring']], LATEST_CONDUCTR_VERSION)])

        # allow explicit listing of dependencies
        self.assertEqual([LoggingFeature, MonitoringFeature],
                         [type(f) for f in collect_features([['logging'], ['monitoring']], LATEST_CONDUCTR_VERSION)])

        # topological ordering for dependencies
        self.assertEqual([LoggingFeature, MonitoringFeature],
                         [type(f) for f in collect_features([['monitoring'], ['logging']], LATEST_CONDUCTR_VERSION)])

        # topological ordering and ignore duplicates
        self.assertEqual([LoggingFeature, MonitoringFeature, VisualizationFeature],
                         [type(f) for f in collect_features([['monitoring'], ['visualization'], ['logging'], ['monitoring']],
                                                            LATEST_CONDUCTR_VERSION)])
Пример #4
0
def run(args):
    """`sandbox run` command"""

    pull_image(args)
    features = collect_features(args.features, args.image_version)
    container_names = scale_cluster(args, features)
    is_started, wait_timeout = wait_for_start(args)
    if is_started:
        if major_version(args.image_version) != 1:
            start_proxy(args.nr_of_containers)
        for feature in features:
            feature.start()
    print_result(container_names, is_started, args.no_wait, wait_timeout, args.image_version)
Пример #5
0
    def test_collect_features(self):
        self.assertEqual([LiteLoggingFeature], [
            type(f)
            for f in collect_features([], LATEST_CONDUCTR_VERSION, False)
        ])

        self.assertEqual([LiteLoggingFeature, VisualizationFeature], [
            type(f) for f in collect_features([['visualization']],
                                              LATEST_CONDUCTR_VERSION, False)
        ])

        self.assertEqual([LoggingFeature], [
            type(f) for f in collect_features([['logging']],
                                              LATEST_CONDUCTR_VERSION, False)
        ])

        # enable dependencies
        self.assertEqual([LoggingFeature, MonitoringFeature], [
            type(f) for f in collect_features([['monitoring']],
                                              LATEST_CONDUCTR_VERSION, False)
        ])

        # allow explicit listing of dependencies
        self.assertEqual([LoggingFeature, MonitoringFeature], [
            type(f) for f in collect_features([['logging'], ['monitoring']],
                                              LATEST_CONDUCTR_VERSION, False)
        ])

        # topological ordering for dependencies
        self.assertEqual([LoggingFeature, MonitoringFeature], [
            type(f) for f in collect_features([['monitoring'], ['logging']],
                                              LATEST_CONDUCTR_VERSION, False)
        ])

        # topological ordering and ignore duplicates
        self.assertEqual(
            [LoggingFeature, MonitoringFeature, VisualizationFeature], [
                type(f) for f in collect_features(
                    [['monitoring'], ['visualization'], ['logging'],
                     ['monitoring']], LATEST_CONDUCTR_VERSION, False)
            ])