-
Notifications
You must be signed in to change notification settings - Fork 120
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
change json encoding ebhavior #1070
Conversation
Tests needs to be fixed. Something broke after I removed a bunch of encoding related calls which were spread all over the code. We shouldn't be serializing and deserializing data outside of the object encoders |
@@ -954,6 +954,23 @@ files = [ | |||
{file = "sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc"}, |
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.
We can do a poetry uninstall jsonpickle
c7246ba
to
b0ad30c
Compare
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'm going to approve to unblock myself, but I can tackle the feedback retroactively
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.
Left some questions and low priority proposed changes.
Text("registration Error: ", style="red bold") | ||
+ Text(f"failed to register: {e}", style="red") | ||
) | ||
logging.error(f"failed to register: {e}") |
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.
logging.error(f"failed to register: {e}") | |
logging.error(f"failed to register:", exception=str(e)) |
"failed to download input", | ||
url=url, | ||
reducer_url=reducer_url, | ||
error=response.text, |
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.
error=response.text, | |
error=response.text, | |
exception: str(e), |
logger.error( | ||
"failed to download reducer output", | ||
url=reducer_url, | ||
error=response.text, |
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.
error=response.text, | |
error=response.text, | |
exception: str(e), |
task_id=completed_task.task.id, | ||
retries=completed_task.reporting_retries, | ||
error=type(e).__name__, | ||
message=str(e), |
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.
message=str(e), | |
exception=str(e), |
task_id=completed_task.task.id, | ||
retries=completed_task.reporting_retries, | ||
status_code=response.status_code, | ||
response_text=response.text, |
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.
response_text=response.text, | |
response_text=response.text, | |
exception: str(e), |
|
||
@staticmethod | ||
def serialize_list(data: List[Any]) -> str: | ||
return jsonpickle.encode(data) | ||
return json.dumps(data) |
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.
Should we wrap an exception into a value error here?
|
||
@staticmethod | ||
def deserialize_list(data: str) -> List[Any]: | ||
return jsonpickle.decode(data) | ||
def deserialize_list(data: str, t: Type) -> List[Any]: |
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.
Should we wrap an exception into a value error here?
val: int | ||
|
||
|
||
@indexify_function(accumulate=JsonSum, input_encoder="json") |
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.
Can we support accumulate=int
?
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.
@seriousben i think that will work too, because an int is serializable with json and cloudpickle
The primary use case for JSON encoding is to support calling graphs with JSON data from other languages and retreive output from graphs as JSON. We were using JSON Pickle which adds a lot of un-necessary information in the json encoded result, and is confusing for the most part when deserializing in other language.
This PR -
json
module won't work. We would support native python types and dictionaries as inputs and outputs when JSON encoding is being used.Test
Tested the simple function with json encoder graph.