BaseEventLoop.run_in_executor() throws "unexpected keyword argument 'callback'" starting in Python 3.5 -
i running function, provision_ec2_node(), via default asyncio event loop thread executor. function takes number of arguments pass executor via functools.partial().
task = loop.run_in_executor( executor=none, callback=functools.partial( provision_ec2_node, modules=modules, host=instance.ip_address, identity_file=identity_file, cluster_info=cluster_info)) this code works fine on python 3.4, , i've been using several months.
however, upgraded python 3.5, , above code throws error:
typeerror: run_in_executor() got unexpected keyword argument 'callback' looking @ python 3.5 release notes concerning asyncio, don't see explains change of behavior. furthermore, 3.5 docs still say functools.partial() correct way pass function keywords executor.
what gives?
apparently second parameter renamed callback func, but change not reflected in docs change reflected in docs of 2015-10-01. that's why fails.
either update new name (and lose python <3.5 compatibility) or pass parameters positional ones:
task = loop.run_in_executor(none, functools.partial(...))
Comments
Post a Comment