def select_actor(self, out_iter, kwargs, final, comp_name_desc):
        _log.analyze(self.node.id, "+", {'comp_name_desc': comp_name_desc}, tb=True)
        if final[0] and not kwargs['done']:
            kwargs['done'] = True
            for name, desc_list in kwargs['priority'].iteritems():
                if desc_list:
                    out_iter.append(desc_list[0])
            out_iter.final()
            return
        desc = comp_name_desc[1]
        try:
            # List of (found, is_primitive, info)
            actor_types = [self.actorstore.lookup(actor['actor_type'])
                                for actor in desc['component']['structure']['actors'].values()]
        except __HOLE__:
            actor_types = []
            # Not a component, shadow actor candidate, likely
            kwargs['priority'][comp_name_desc[0]].insert(0, comp_name_desc)
            comp_name_desc[1]['shadow_actor'] = True
            return
        except Exception as e:
            # FIXME Handled when security verification failed
            _log.exception("select_actor desc: %s" % desc)
            raise e
        if all([a[0] and a[1] for a in actor_types]):
            # All found and primitive (quite unlikely), insert after any primitive shadow actors in priority
            index = len([1 for a in kwargs['priority'][comp_name_desc[0]] if 'shadow_actor' in a[1]])
            kwargs['priority'][comp_name_desc[0]].insert(index, comp_name_desc)
            comp_name_desc[1]['shadow_component'] = actor_types
            return
        # A component containing shadow actors
        # TODO Dig deeper to priorities between shadow components, now just insert in order
        kwargs['priority'][comp_name_desc[0]].append(comp_name_desc)
        comp_name_desc[1]['shadow_component'] = actor_types
dataset/ETHPy150Open EricssonResearch/calvin-base/calvin/runtime/north/appmanager.py/Deployer.select_actor