Ejemplo n.º 1
0
    def _imap_unordered(self,
                        strategy: PoolRunnableStrategy,
                        target_fun: Callable,
                        args_iter=()):
        self._initial()

        strategy.imap_unordered(function=target_fun, args_iter=args_iter)
Ejemplo n.º 2
0
    def _async_map_by_args(self,
                           strategy: PoolRunnableStrategy,
                           target_fun: Callable,
                           args_iter=()):
        self._initial()

        strategy.async_map_by_args(function=target_fun, args_iter=args_iter)
Ejemplo n.º 3
0
    def _map(self,
             strategy: PoolRunnableStrategy,
             target_fun: Callable,
             args_iter=()):
        self._initial()

        strategy.map(function=target_fun, args_iter=args_iter)
Ejemplo n.º 4
0
    def _async_apply_with_iter(self,
                               strategy: PoolRunnableStrategy,
                               target_funcs_iter: List[Callable],
                               args_iter: List[Tuple] = None,
                               kwargs_iter: List[Dict] = None):
        self._initial()

        if args_iter is not None:
            strategy.async_apply_with_iter(functions_iter=target_funcs_iter,
                                           args_iter=args_iter)
        elif kwargs_iter is not None:
            strategy.async_apply_with_iter(functions_iter=target_funcs_iter,
                                           kwargs_iter=kwargs_iter)
        elif args_iter is not None and kwargs_iter is not None:
            strategy.async_apply_with_iter(functions_iter=target_funcs_iter,
                                           args_iter=args_iter,
                                           kwargs_iter=kwargs_iter)
        else:
            strategy.async_apply_with_iter(functions_iter=target_funcs_iter)
Ejemplo n.º 5
0
    def _async_apply(self,
                     strategy: PoolRunnableStrategy,
                     tasks_size: int,
                     target_fun: Callable,
                     args=(),
                     kwargs={}):
        self._initial()

        if args is not None:
            strategy.async_apply(tasks_size=tasks_size,
                                 function=target_fun,
                                 args=args)
        elif kwargs is not None:
            strategy.async_apply(tasks_size=tasks_size,
                                 function=target_fun,
                                 kwargs=kwargs)
        elif args is not None and kwargs is not None:
            strategy.async_apply(tasks_size=tasks_size,
                                 function=target_fun,
                                 args=args,
                                 kwargs=kwargs)
        else:
            strategy.async_apply(tasks_size=tasks_size, function=target_fun)