dragon.native.pool.ApplyResult
- class ApplyResult
Bases:
object
Returned by
apply_async
and hasget
method to retrieve result.- __init__(pool: Pool, callback: callable, error_callback: callable)
Initializes a result
- Parameters:
pool (dragon.native.pool.Pool) – the pool where work has been submitted
callback (callable) – function called on returned result
error_callback (callable) – function called on returned result if an error was raised
Methods
__init__
(pool, callback, error_callback)Initializes a result
get
([timeout])Retrieves returned values of work submitted to pool
ready
()Checks whether the result is ready.
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, callback: callable, error_callback: callable)
Initializes a result
- Parameters:
pool (dragon.native.pool.Pool) – the pool where work has been submitted
callback (callable) – function called on returned result
error_callback (callable) – function called on returned result if an error was raised
- ready() bool
Checks whether the result is ready.
- Returns:
returns True if the result is ready or False if it isn’t
- Return type:
- 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:
- 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
- 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