Ton Steijvers
06/28/2023, 12:14 PMState data is missing. Typically, this occurs when result persistence is disabled and the state has been retrieved from the API.
. Result persistence is indeed disabled, but I do not understand what/why "state" would be retrieved from the API. My flow returns the result of a run_deployment call (with an await).Nate
06/28/2023, 5:06 PMrun_deployment
? it seems that would explain your getting that warningTon Steijvers
06/29/2023, 6:34 AMrun_deployment
as follows:
@flow
async def parallel_flow(org_ids):
concurrency_limit = asyncio.Semophore(8)
async def core_run(org_id: str):
async with concurrency_limit:
return await run_deployment(
name="core_flow/us-east-k8s",
parameters=dict(org_id=org_id)
)
results = await asyncio.gather( *[core_run(org_id) for org_id in org_ids] )
return [(result.name, result.state_name) for result in results]
Ton Steijvers
06/30/2023, 7:41 AMrun_deployment
be related to the "State data is missing" error, the way it is used in the code above?Nate
06/30/2023, 3:25 PMstate
data (where the actual result
lives), but instead just the name and state_name of the FlowRun
object returned by run_deployment
- do you have the full trace here?Ton Steijvers
06/30/2023, 3:47 PMNate
06/30/2023, 10:27 PMJons Cyriac
08/17/2023, 10:51 AMNate
08/17/2023, 3:48 PMJons Cyriac
08/25/2023, 3:21 PMprefect.exceptions.MissingResult: State data is missing. Typically, this occurs when result persistence is disabled and the state has been retrieved from the API.
quite often.
PREFECT_RESULTS_PERSIST_BY_DEFAULT: true
Nate
08/25/2023, 3:25 PMJons Cyriac
08/25/2023, 3:33 PMJons Cyriac
08/25/2023, 3:33 PMNate
08/25/2023, 3:35 PMJons Cyriac
08/25/2023, 3:46 PMJons Cyriac
08/25/2023, 3:48 PMNate
08/25/2023, 4:36 PMpersist_result=True
on your flow? (it shouldnt, just sanity checking)
• where are you expecting these results to land? by default, it would be the prefect home directory where the flow is runningJons Cyriac
08/25/2023, 5:01 PMpersist_result=True
on the flow itself is gonna make a difference.. since this is intermittent, it'll take some time for that..
These flows are run in k8s infra, one pod takes care of on flow-run. The default works for us (home directory)Nate
08/25/2023, 5:02 PMThese flows are run in k8s infra, one pod takes care of on flow-run. The default works for us (home directory)ok just to be clear, that result storage will get wiped out after the pod dies, so the result will be inaccessible after that point (bc its written to disk on the pod) so if you wanted to actually persist that over flow runs, you'd want some blob result storage like s3 / gcs
Nate
08/25/2023, 5:05 PMMy flow returns the result of a run_deployment call (with an await).like in OP's case, if you do
flow_run = run_deployment(..) # kick off job on k8s that persists locally (wrt itself)
flow_run.state.result() # State data is missing for the caller, bc the results died with the pod
Jons Cyriac
08/25/2023, 6:57 PMNate
08/25/2023, 10:11 PMMissingResult
error?
you can't get the result of a flow run via run_deployment
(via the API) without persisting it to external storageJons Cyriac
08/26/2023, 11:03 AMrun_deployment
, im not trying to get the result of a flow run outside the run either.
I think when a subsequent task is calling prefect server api to get result of the previous task, and when the api call is timing out, it throws this error. this is just an intuition.Nate
08/28/2023, 2:08 PMumm, I'm not callingah, I thought you were because that's that OP was asking about in this thread when you saidrun_deployment
hey, have we found anything on this?if you're getting
prefect.exceptions.MissingResult: State data is missing. Typically, this occurs when result persistence is disabled and the state has been retrieved from the API.
without trying to access results through the API, I'd be confused. can you try to isolate what line is throwing it in your code?