-
-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: __init__() got an unexpected keyword argument 'client_id' #61
Comments
I need to go AFK for a couple of hours, but ultimately I'm planning to apply the following patch to prevent this from happening in the future (since it's not the first time GH is suddenly updating their API responses on us w/o actually versioning the changes): index 304c479..db5ade0 100644
--- a/octomachinery/utils/asynctools.py
+++ b/octomachinery/utils/asynctools.py
@@ -1,12 +1,17 @@
"""Asynchronous tools set."""
from functools import wraps
+from inspect import signature as _inspect_signature
+from logging import getLogger as _get_logger
from operator import itemgetter
from anyio import create_queue
from anyio import create_task_group as all_subtasks_awaited
+logger = _get_logger(__name__)
+
+
def auto_cleanup_aio_tasks(async_func):
"""Ensure all subtasks finish."""
@wraps(async_func)
@@ -86,6 +91,24 @@ async def amap(callback, async_iterable):
def dict_to_kwargs_cb(callback):
"""Return a callback mapping dict to keyword arguments."""
+ cb_arg_names = set(_inspect_signature(callback).parameters.keys())
+
async def callback_wrapper(args_dict):
- return await try_await(callback(**args_dict))
+ excessive_arg_names = set(args_dict.keys()) - cb_arg_names
+ filtered_args_dict = {
+ arg_name: arg_value for arg_name, arg_value in args_dict.items()
+ if arg_name not in excessive_arg_names
+ }
+ if excessive_arg_names:
+ logger.warning(
+ 'Excessive arguments passed to callback %(callable)s',
+ {'callable': callback},
+ extra={
+ 'callable': callback,
+ 'excessive-arg-names': excessive_arg_names,
+ 'passed-in-args': args_dict,
+ 'forwarded-args': filtered_args_dict,
+ },
+ )
+ return await try_await(callback(**filtered_args_dict))
return callback_wrapper |
Re-deployed Chronographer and Patchback with this. Should be good now. |
Forgot to update the hashes in lockfiles. Re-deploying and going to sleep. Will re-check Sentry later in the day... |
Urgh.. More updates needed for the deps compat. Will have to wait another half a day. |
Alright… I think I've updated all the right pins now. |
It still doesn't seem to work. |
@felixfontein show me how you tried to retrigger processing.. |
I think I saw some incomplete tracebacks. Will take a look in the morning.. |
I removed and re-added labels for a merged PR (for example ansible-collections/community.general#8792), or merged a PR that had backport labels. |
Oh.. I see. I messed up @ 116222c because I applied a wrapper that returns a coroutine and didn't await that... |
Re-deployed and checked that it doesn't traceback on the aiohttp repo anymore. |
Sentry Issue: PATCHBACK-20
Upvote & Fund
The text was updated successfully, but these errors were encountered: