def validate_candidates(self):
        """Validate current candidates.

        This method validates the current candidate list in all the agents
        in the environment (or underlying slave environments) and replaces
        the current :attr:`candidates` with the list of validated candidates.

        The artifact candidates must be hashable and have a :meth:`__eq__`
        implemented for validation to work on multi-environments and
        distributed environments.
        """
        async def slave_task(addr, candidates):
            r_manager = await self.env.connect(addr)
            return await r_manager.validate_candidates(candidates)

        self._log(logging.DEBUG, "Validating {} candidates"
                  .format(len(self.candidates)))

        candidates = self.candidates
        if self._single_env:
            self._candidates = self.env.validate_candidates(candidates)
        else:
            mgrs = self.get_managers()
            tasks = create_tasks(slave_task, mgrs, candidates, flatten=False)
            rets = run(tasks)
            valid_candidates = set(self.candidates)
            for r in rets:
                valid_candidates = valid_candidates.intersection(set(r))
            self._candidates = list(valid_candidates)

        self._log(logging.DEBUG, "{} candidates after validation"
                  .format(len(self.candidates)))
def validate_candidates ( self ) : async def slave_task ( addr , candidates ) : r_manager = await self . env . connect ( addr ) return await r_manager . validate_candidates ( candidates ) self . _log ( logging . DEBUG , "Validating {} candidates" . format ( len ( self . candidates ) ) ) candidates = self . candidates if self . _single_env : self . _candidates = self . env . validate_candidates ( candidates ) else : mgrs = self . get_managers ( ) tasks = create_tasks ( slave_task , mgrs , candidates , flatten = False ) rets = run ( tasks ) valid_candidates = set ( self . candidates ) for r in rets : valid_candidates = valid_candidates . intersection ( set ( r ) ) self . _candidates = list ( valid_candidates ) self . _log ( logging . DEBUG , "{} candidates after validation" . format ( len ( self . candidates ) ) )
Validate current candidates.

        This method validates the current candidate list in all the agents
        in the environment (or underlying slave environments) and replaces
        the current :attr:`candidates` with the list of validated candidates.

        The artifact candidates must be hashable and have a :meth:`__eq__`
        implemented for validation to work on multi-environments and
        distributed environments.