-
Notifications
You must be signed in to change notification settings - Fork 2
orjson replacement with json package #72
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
Conversation
| bytes( | ||
| json.dumps( | ||
| { | ||
| "instances": list(all_vms_by_id.values()), | ||
| "timelines": all_timelines, | ||
| } | ||
| ), | ||
| "utf-8", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recall you saying that json dumps to a str while orjson dumps to bytes. Does the bytes format need to be adhered to here because the s3 write requires bytes? Just curious if/how this fails if you don't format it as bytes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, if it's not cast into bytes you get a boto3 error that says something along the lines of file obj needs to be in bytes for s3. I don't recall the exact verbiage, but it was definitely a fatal error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well actually, that's true for this line
Line 755 in f97ebc0
| s3.upload_fileobj( |
TypeError: a bytes-like object is required, not 'str'. It looks like dbfs expects file content to be in b64.
gorskysd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gorskysd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, everything looks good to me!
|
This last change fixes a bug where the _monitor_cluster methods were unable to write out the instance data because it needed it's own datetime encoder class in the json utils file. I've done some janky tests where I run diff on the new _monitor_cluster output and everything looks identical. The cli is unaffected, I've tested the clients and the encode_json method is working correctly for both clients. |
gorskysd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran a successful test on both AWS and Azure. Looks good to me!


Passes all current tests, tested a few of the methods that changed individually (locally) but haven't done an exhaustive test of each method. It seems like everything should be working. The package differences are the options for encoding datetimes and the fact that json.dumps is a str and orjson.dumps is bytes. The echo calls in the cli don't care if the output is bytes or strings, and all other dumps calls have been cast to bytes. The utils folder has a custom class that encodes datetimes the same as orjson.