Closed sentry-io[bot] closed 2 months ago
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..
@felixfontein show me how you tried to retrigger processing..
I removed and re-added labels for a merged PR (for example https://github.com/ansible-collections/community.general/pull/8792), or merged a PR that had backport labels.
Oh.. I see. I messed up @ https://github.com/sanitizers/octomachinery/commit/116222c2e0d788b2a0ea370c2a829a59b15843d1 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