David Ojeda
04/28/2020, 4:37 PMGracefulFail
, which extends Success
(we use it for tasks that did not succeed but should not stop the rest of the downstream tasks).
Unfortunately, using these on prefect server gives a 500, leaving the task out of date on the UI…
Failed to set task state with error: ClientError([{'message': '{\'_schema\': "Invalid data type: [None, {\'_schema\': \'Unsupported object type: GracefulFail\'}]"}', 'locations': [{'line': 6, 'column': 13}], 'path': ['set_task_run_states', 'states', 0, 'id'], 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}])
Traceback (most recent call last):
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/engine/cloud/task_runner.py", line 115, in call_runner_target_handlers
state = self.client.set_task_run_state(
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/client/client.py", line 1082, in set_task_run_state
result = self.graphql(
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/client/client.py", line 225, in graphql
raise ClientError(result["errors"])
prefect.utilities.exceptions.ClientError: [{'message': '{\'_schema\': "Invalid data type: [None, {\'_schema\': \'Unsupported object type: GracefulFail\'}]"}', 'locations': [{'line': 6, 'column': 13}], 'path': ['set_task_run_states', 'states', 0, 'id'], 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}]
Zachary Hughes
04/28/2020, 4:55 PMGracefulFail
, you'll need to put logic in api/states.py
.
• you'll need to update the UI to properly parse and render the new GracefulFail
state.
If it's at all helpful, the error you linked appears to be linked to marshmallow, so I'd recommend taking a look at the serialization logic for GracefulFail
.David Ojeda
04/28/2020, 5:02 PMfrom prefect.engine.signals import PrefectStateSignal
from prefect.engine.state import Success
class SkippedResult(Success):
color = '#cab2d6'
class GracefulFail(Success):
color = '#dd1c77'
class SKIPRESULT(PrefectStateSignal):
_state_cls = SkippedResult
class GRACEFULFAIL(PrefectStateSignal):
_state_cls = GracefulFail
So, with that scope, I think that we save ourselves from the complexity of creating new states…Zachary Hughes
04/28/2020, 5:06 PMDavid Ojeda
04/28/2020, 5:07 PMZachary Hughes
04/28/2020, 5:08 PMDavid Ojeda
04/28/2020, 6:18 PMStateSchema
class so that my two states are correctly serializable with marshmallow, but I still encounter another error and I can’t find who or where this is generated:
[2020-04-28 18:09:46] ERROR - prefect.CloudTaskRunner | Failed to set task state with error: ClientError([{'message': "{'type': ['Unsupported value: SkippedResult']}", 'locations': [{'line': 4, 'column': 13}], 'path': ['set_task_run_states', 'states', 0, 'id'], 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}])
Traceback (most recent call last):
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/engine/cloud/task_runner.py", line 115, in call_runner_target_handlers
state = self.client.set_task_run_state(
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/client/client.py", line 1082, in set_task_run_state
result = self.graphql(
File "/opt/pysetup/.venv/lib/python3.8/site-packages/prefect/client/client.py", line 225, in graphql
raise ClientError(result["errors"])
prefect.utilities.exceptions.ClientError: [{'message': "{'type': ['Unsupported value: SkippedResult']}", 'locations': [{'line': 4, 'column': 13}], 'path': ['set_task_run_states', 'states', 0, 'id'], 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}]
[2020-04-28 18:09:46] INFO - prefect.CloudTaskRunner | Task 'SaveResponse[10]': finished task run for task with final state: 'ClientFailed'
Any clues?Zachary Hughes
04/28/2020, 6:26 PMDavid Ojeda
04/28/2020, 6:34 PMERROR: {'type': ['Unsupported value: SkippedResult']}
GraphQL request:4:7
3 | states {
4 | id
| ^
5 | status
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/graphql/execution/execute.py", line 670, in complete_value_catching_error
return_type, field_nodes, info, path, result
File "/usr/local/lib/python3.7/site-packages/graphql/execution/execute.py", line 735, in complete_value
raise result
File "/prefect-server/src/prefect_server/graphql/states.py", line 73, in set_state
state = state_schema.load(state_input["state"])
File "/usr/local/lib/python3.7/site-packages/marshmallow_oneofschema/one_of_schema.py", line 144, in load
raise exc
marshmallow.exceptions.ValidationError: {'type': ['Unsupported value: SkippedResult']}
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/graphql/execution/execute.py", line 670, in complete_value_catching_error
return_type, field_nodes, info, path, result
File "/usr/local/lib/python3.7/site-packages/graphql/execution/execute.py", line 735, in complete_value
raise result
File "/prefect-server/src/prefect_server/graphql/states.py", line 73, in set_state
state = state_schema.load(state_input["state"])
File "/usr/local/lib/python3.7/site-packages/marshmallow_oneofschema/one_of_schema.py", line 144, in load
raise exc
graphql.error.graphql_error.GraphQLError: {'type': ['Unsupported value: SkippedResult']}
I realize my mistake now: My graphql service is using the official prefect image; not the one that has the custom statesZachary Hughes
04/28/2020, 6:35 PMDavid Ojeda
04/28/2020, 6:36 PMZachary Hughes
04/28/2020, 6:38 PM