Luke Orland
11/12/2020, 9:30 PMSerializer that serializes str?Luke Orland
11/12/2020, 9:32 PMstr is the input type for .serialize and the output type of .deserialize?Luke Orland
11/12/2020, 9:36 PM@task(result=S3Result(bucket=*, location=*, serializer=StringSerializer???()))Chris White
JSONSerializer will do what you’re looking forLuke Orland
11/13/2020, 3:27 AMprefect.tasks.jupyter.ExecuteNotebook task, which is a JSON string. To store that as an .ipynb file, I was converting that json to a dict so that the JSONSerializer would dump it back to JSON string.
My approach that seems to be working is to subclass Serializer, with these implementations:Luke Orland
11/13/2020, 3:28 AMLuke Orland
11/13/2020, 3:29 AM.ipynb file without the json -> dict -> json round trip.Chris White
StringSerializer implementation into the serializer library
- change the return type of ExecuteNotebook to be an actual dictionary instead of a JSON string; this way the JSONSerializer works out-of-the-box
I would prefer the latter although I’m not sure if there was a reason for the JSON string return type; whichever way we go, it would be interesting to allow for specifying serializers at the task level so that we could default to these serializers for this task so other users don’t have to worry about it.Luke Orland
11/13/2020, 4:12 AMChris White
Marvin
11/13/2020, 4:17 AMLuke Orland
11/13/2020, 4:20 AMoutput_format options--JSON and HTML. The JSON output, if written to a .ipynb file, can be read as a notebook file by Jupyter. For HTML output, that .html file can be rendered by a web browser. Either way, the output is str and should be serialized by something like a StringSerializer. dict output from that task wouldn't really work if HTML is the selected output_format.