dragon.mpbridge.pool.WrappedResult

class WrappedResult

Bases: object

Wraps ApplyResult and MapResult so that correct timeout error can be raised

__init__(result: ApplyResult = None)

Initializes wrapped result by saving input result

Parameters:

result (ApplyResult or MapResult, optional) – returned result from native pool, defaults to None

Methods

__init__([result])

Initializes wrapped result by saving input result

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__(result: ApplyResult = None)

Initializes wrapped result by saving input result

Parameters:

result (ApplyResult or MapResult, optional) – returned result from native pool, defaults to None

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:

multiprocessing.TimeoutError – raised if result is not ready in specified timeout

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