Пример #1
0
    def __init__(self, config, appliances):
        self.config = config
        self.session = None
        self.session_finished = False
        self.countfailures = 0
        self.collection = []
        self.serial_collection = []  # tests that must run on a single appliance
        self.sent_tests = 0
        self.log = create_sublogger('master')
        self.maxfail = config.getvalue("maxfail")
        self._failed_collection_errors = {}
        self.terminal = store.terminalreporter
        self.trdist = None
        self.slaves = {}
        self.test_groups = self._test_item_generator()

        self._pool = []

        # necessary to get list of supported providers
        version = appliances[0].version
        from cfme.markers.env_markers.provider import all_required
        self.provs = sorted([p.the_id for p in all_required(version, filters=[])],
                            key=len, reverse=True)
        self.used_prov = set()

        self.failed_slave_test_groups = deque()
        self.slave_spawn_count = 0
        self.appliances = appliances

        # set up the ipc socket

        zmq_endpoint = f'ipc://{config.cache.makedir("parallelize").join(str(os.getpid()))}'
        self.zmq_ctx = zmq.Context.instance()
        self.sock = self.zmq_ctx.socket(zmq.ROUTER)
        self.sock.bind(zmq_endpoint)

        # clean out old slave config if it exists
        self.worker_config = {
            'args': self.config.args,
            'options': dict(  # copy to avoid aliasing
                vars(self.config.option),
                use_sprout=False,   # Slaves don't use sprout
            ),
            'zmq_endpoint': zmq_endpoint,
            'appliance_data': getattr(self, "slave_appliances_data", {})
        }

        for appliance in self.appliances:
            slave_data = SlaveDetail(appliance=appliance, worker_config=self.worker_config)
            self.slaves[slave_data.id] = slave_data

        for slave in sorted(self.slaves):
            self.print_message(f"using appliance {self.slaves[slave].appliance.url}",
                               slave,
                               green=True)
Пример #2
0
    def __init__(self, config, appliances):
        self.config = config
        self.session = None
        self.session_finished = False
        self.countfailures = 0
        self.collection = []
        self.sent_tests = 0
        self.log = create_sublogger('master')
        self.maxfail = config.getvalue("maxfail")
        self._failed_collection_errors = {}
        self.terminal = store.terminalreporter
        self.trdist = None
        self.slaves = {}
        self.test_groups = self._test_item_generator()

        self._pool = []

        # necessary to get list of supported providers
        version = appliances[0].version
        from cfme.markers.env_markers.provider import all_required
        self.provs = sorted([p.the_id for p in all_required(version, filters=[])],
                            key=len, reverse=True)
        self.used_prov = set()

        self.failed_slave_test_groups = deque()
        self.slave_spawn_count = 0
        self.appliances = appliances

        # set up the ipc socket

        zmq_endpoint = 'ipc://{}'.format(
            config.cache.makedir('parallelize').join(str(os.getpid())))
        ctx = zmq.Context.instance()
        self.sock = ctx.socket(zmq.ROUTER)
        self.sock.bind(zmq_endpoint)

        # clean out old slave config if it exists

        self.worker_config = {
            'args': self.config.args,
            'options': dict(  # copy to avoid aliasing
                vars(self.config.option),
                use_sprout=False,   # Slaves don't use sprout
            ),
            'zmq_endpoint': zmq_endpoint,
            'appliance_data': getattr(self, "slave_appliances_data", {})
        }

        for appliance in self.appliances:
            slave_data = SlaveDetail(appliance=appliance, worker_config=self.worker_config)
            self.slaves[slave_data.id] = slave_data

        for slave in sorted(self.slaves):
            self.print_message("using appliance {}".format(self.slaves[slave].appliance.url),
                slave, green=True)
Пример #3
0
def provider_classes(appliance):
    required_providers = all_required(appliance.version)

    selected = dict(infra=[], cloud=[], container=[])
    # we want to collect these provider categories
    for cat in selected.keys():
        selected[cat].extend({  # quick and dirty uniqueness for types/versions
            prov.klass
            for prov in required_providers if prov.category == cat
        })
    return selected
def provider_classes(appliance):
    required_providers = all_required(appliance.version)

    selected = dict(infra=[], cloud=[], container=[])
    # we want to collect these provider categories
    for cat in selected.keys():
        selected[cat].extend(
            set(  # quick and dirty uniqueness for types/versions
                prov.klass
                for prov in required_providers
                if prov.category == cat
            )
        )
    return selected