Where is the documentation for multiprocessing.pool.ApplyResult?

There is a frightening little rigorous API documentation (read: ZERO ) for multiprocessing.pool.ApplyResult . The doc explanation of multiprocessing speaks of ApplyResult s, but does not define them.

The same goes for multiprocessing.pool.Pool , although the Python multiprocessing manual seems to cover it better.

Even the results of ApplyResult help() are void:

  | get(self, timeout=None) | | ready(self) | | successful(self) | | wait(self, timeout=None) 
  • Get() and Ready() I receive. This is normal.

  • I have no idea what wait() , given that you are dealing with a "pool" that was supposed to be waiting for you in a Get() call. This is "wait for the result, but do not get it now." Or is this OS style expectation? And if so, what would it mean?

  • I'm also not sure what successful() .

+8
python python-multiprocessing
source share
2 answers

Your Right to Documentation Failures: The class is actually documented as AsyncResult , not ApplyResult. Two different names for the same class:

 >>> multiprocessing.pool.ApplyResult is multiprocessing.pool.AsyncResult True 

At some point, the name could be changed, and the documents were not constantly updated, but everything is documented, it is simply documented under the wrong name. (There is a closed error in which someone pointed out that AsyncResult is mentioned in the documents, but the class is actually called ApplyResult, so they added AsyncResult as an alias.)

+7
source share

This is what I see from the code:

  • ready() : returns true if the task launched by the thread is ready to return the result
  • get(timeout=None) : expects the result for timeout units (in seconds with floating point) and returns the result if successful. When a TimeoutError timeout TimeoutError on failure, a related exception is thrown.
  • wait(timeout=None) : expects the condition variable set by the worker "thread", according to threading.Condition.wait([timeout]) DOES NOT WORK to reap the child thread.
  • success() : if ready returns True if the result of get() is a value. Otherwise, False returned (i.e. the result will be an exception). If approvals are allowed, will argue if they are not ready. This function can be used to throw exceptions.
0
source share

All Articles