Ranu Goldan
07/21/2021, 11:30 AMFailed to set task state with error: ClientError([{'path': ['set_task_run_states'], 'message': 'State update failed for task run ID 4b5a98d6-b0c0-4dc5-b540-7f00b17cea2d: provided a running state but associated flow run fc3bdb79-c506-4710-87c1-c039f29d727a is not in a running state.', 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}])
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/prefect/engine/cloud/task_runner.py", line 95, in call_runner_target_handlers
cache_for=self.task.cache_for,
File "/usr/local/lib/python3.7/site-packages/prefect/client/client.py", line 1526, in set_task_run_state
version=version,
File "/usr/local/lib/python3.7/site-packages/prefect/client/client.py", line 319, in graphql
raise ClientError(result["errors"])
prefect.utilities.exceptions.ClientError: [{'path': ['set_task_run_states'], 'message': 'State update failed for task run ID 4b5a98d6-b0c0-4dc5-b540-7f00b17cea2d: provided a running state but associated flow run fc3bdb79-c506-4710-87c1-c039f29d727a is not in a running state.', 'extensions': {'code': 'INTERNAL_SERVER_ERROR'}}]
It happens when task raised FAIL()
and retries. and the the task will be marked ClientFailed
state, then the flowrun is Cancelled
What I don't understand is why suddenly the error says flowrun not in a running state? How to resolve this?Kevin Kho
Ranu Goldan
07/22/2021, 12:34 AMprefecthq/prefect:0.14.20-python3.6
on deploymentRanu Goldan
07/22/2021, 12:45 AMif response_state == "FAILED":
raise FAIL("Job Failed")
else:
status = (
SUCCESS("Job Success")
if report_success
else FAIL("sending add_table_to_data_sources failed")
)
raise status
Kevin Kho
Ranu Goldan
07/22/2021, 1:04 AMRanu Goldan
07/22/2021, 3:30 AMRanu Goldan
07/22/2021, 3:34 AMprefect_client.set_flow_run_state(prefect.context["flow_run_id"], Cancelled())
thxx @Kevin Kho