-
Notifications
You must be signed in to change notification settings - Fork 8
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
botocore WaiterError causes TypeError #26
Comments
It's a shame this shim is causing pain: when I wrote it it was definitely just a deferred decision until I figured out a better way. The intent was a noop that I could make a harder decision on later. Lesson learned - apologies! The motivation was to give Botocove an explicit output object type that was useful and worthwhile to pass around: I used a dataclass as a bit of an experiment and then shimmed it back to it's previous implementation to not break backwards compatability, and because I didn't want to commit to dataclass objects for end users yet. We do a lot less passing around in the re-write that brought in tqdm, and now the releaseable-session change. I still don't really feel like data classes are really adding any value, so the simple solution (I think?) here is to just drop them and use a TypedDict and not mess around having to convert them as a consequence. I'm still mentally deferring a decision on better output data shape for a future 2.0 release here, I haven't really had any inspiration for what's worthwhile - maybe it's fine as is? |
Yeah, if internally they don't add much value and they are being converted back to dataclasses anyway for the client then probably the right thing to do long-term is to bring back the TypedDict implemention used in 1.3.0.
If you mean the three main keys
Unfortunately the undesirable deep-copy behavior can't even be changed. There's an discussion on the python-ideas list about improving it with a "recursive-or-not" flag. But I don't see it being implemented soon. https://groups.google.com/g/python-ideas/c/bWl0afPZDJM As a quick fix I would try to replace the If you prefer to go directly to replacing the dataclass with a good old TypedDict, that's fine too. |
One of my scripts runs a CloudFormation update and uses a waiter to make the operation synchronous.
Botocove appears to iterate over all the accounts, but it crashes before I can print its output.
It turns out that WaiterError is not a copyable exception (see #25 for the analysis about copyable exceptions.)
I can't share the code or the complete trace of what I'm working on. Here's the trace that's relevant to botocove.
You can reproduce it easily enough in the REPL:
I'm going to raise an issue in the botocore repo to ask that the WaiterError be made copyable like the other client errors.
Why does botocore use the asdict method? It seems unnecessary to recursively copy and covert dataclasses It requires that all output and errors be copyable (and as #25 shows, for exceptions it is non-obvious to implement!) and (although this is another issue it has surprised me a couple of times when the dataclass object I retied was converted to a dict!
Would you consider changing this part to remove the use of the asdict method?
botocove/botocove/cove_decorator.py
Lines 15 to 17 in b36164b
It requires that all the user's output and errors be copyable (and as #25 shows, for exceptions it is non-obvious to implement!).
The text was updated successfully, but these errors were encountered: