Hi there. I am getting this error in the `wait_for...
# ask-community
p
Hi there. I am getting this error in the
wait_for_flow_run
task when trying to implement a flow of flows:
Copy code
Unexpected error: TypeError('Object of type FlowRunView is not JSON serializable')
Any ideas? Code in thread.
Untitled.py
k
I can’t tell immediately. Which
wait_for_flow_run
throws the error?
p
The very first one.
The child flow ends without problems.
Copy code
Flow 'cherubic-rhino-get_employee_listings': Entered state <Success>: All reference tasks succeeded.
10:35:11
ERROR
CloudTaskRunner
Unexpected error: TypeError('Object of type FlowRunView is not JSON serializable')
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/prefect/engine/runner.py", line 48, in inner
    new_state = method(self, state, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/prefect/engine/task_runner.py", line 926, in get_task_run_state
    result = self.result.write(value, **formatting_kwargs)
  File "/usr/local/lib/python3.8/site-packages/prefect/engine/results/prefect_result.py", line 62, in write
    new.location = self.serializer.serialize(new.value).decode("utf-8")
  File "/usr/local/lib/python3.8/site-packages/prefect/engine/serializers.py", line 110, in serialize
    return json.dumps(value).encode()
  File "/usr/local/lib/python3.8/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/local/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/local/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type FlowRunView is not JSON serializable
k
I think this is because of the
PrefectResult()
right? It is trying to save the task output as a result.
p
Yeah, I just realized that
wait_for_flow_run
returns
FlowRunView
k
Try doing this:
Copy code
create_flow_run.checkpoint=False
After you import the task
p
Do you mean
wait_for_flow_run.checkpoint=False
?
k
Yes exactly before you use it in the Flow
p
It worked! How would this affect the ability to restart the flow from failed?
k
Flow of flows doesn’t work well with flow restarts. Restarting the parent flow doesn’t restart child flows so you would have to go to the child flow either way to restart
👍 1
p
Does this work better in Orion?
Also, if I do restart the child flow and the parent flow, will the parent flow be able to continue?
k
Yes I believe so! One of the motivations for Orion was the second-class nature of flow of flows in current Prefect
👍 2