This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author doublex
Recipients aeros, cebtenzzre, doublex, drougge, iritkatriel, ishimoto
Date 2021-03-15.19:52:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1615837978.77.0.403121171558.issue41567@roundup.psfhosted.org>
In-reply-to
Content
Example code (fails):


import os, concurrent.futures

def parallel_callback( arg ):
    return os.getpid()

def parallel( *args ):
    def thread_callback( param ):
        with concurrent.futures.ProcessPoolExecutor(max_workers=1) as executor:
            future = executor.submit( parallel_callback, param )
            pid = future.result()
            print( 'pid:', pid )
            return pid
    with concurrent.futures.ThreadPoolExecutor(max_workers=len(args)) as executor:
        future = executor.map( thread_callback, args )
        results = list(future)
    print( 'DONE' )

parallel( 1, 2, 3 )
History
Date User Action Args
2021-03-15 19:52:58doublexsetrecipients: + doublex, ishimoto, drougge, aeros, iritkatriel, cebtenzzre
2021-03-15 19:52:58doublexsetmessageid: <1615837978.77.0.403121171558.issue41567@roundup.psfhosted.org>
2021-03-15 19:52:58doublexlinkissue41567 messages
2021-03-15 19:52:58doublexcreate