dragon.native.pool.MapResult

class MapResult

Bases: ApplyResult

__init__(pool: Pool, chunksize: int , length: int , callback: callable, error_callback: callable)

Initialization method

Parameters:
  • pool (dragon.native.pool.Pool) – the pool where work is submitted

  • chunksize (int ) – size that work is supposed to be broken up into

  • length (int ) – number of items in iterable

  • callback (callable) – function to be called upon return of result

  • error_callback (callable) – function to be called upon return of result if an error was raised.

Methods

__init__(pool, chunksize, length, callback, ...)

Initialization method

get([timeout])

Retrieves returned values of work submitted to pool

ready()

Checks whether the result is ready.

successful()

Checks if the result is ready and returns whether the function call was successful.

wait([timeout])

Waits on event for result to be ready

__init__(pool: Pool, chunksize: int , length: int , callback: callable, error_callback: callable)

Initialization method

Parameters:
  • pool (dragon.native.pool.Pool) – the pool where work is submitted

  • chunksize (int ) – size that work is supposed to be broken up into

  • length (int ) – number of items in iterable

  • callback (callable) – function to be called upon return of result

  • error_callback (callable) – function to be called upon return of result if an error was raised.

get(timeout: float = None) Any

Retrieves returned values of work submitted to pool

Parameters:

timeout (float , optional) – timeout for getting result, defaults to None

Raises:
  • TimeoutError – raised if result is not ready in specified timeout

  • self._value – raises error if returned work was unsuccessful

Returns:

value returned by func(*args, **kwds)

Return type:

Any

ready() bool

Checks whether the result is ready.

Returns:

returns True if the result is ready or False if it isn’t

Return type:

bool

successful() bool

Checks if the result is ready and returns whether the function call was successful.

Raises:

ValueError – raised if result is not ready

Returns:

returns True if function call was successful

Return type:

bool

wait(timeout: float = None) None

Waits on event for result to be ready

Parameters:

timeout (float , optional) – timeout indicating how long to wait for result to be ready, defaults to None