05/01/2023, 5:26 PM
Hi there, I am fairly new to Prefect and trying to use the REST APIs. I have a local server running on local Postgres as the database. I was able to apply a deployment and run a flow using the prefect command line as well as from the UI. Great. I then opened the API docs and successfully ran GETs for both the flow and the deployment. But when I try this: /api/deployments/{id}/create_flow_run Create Flow Run From Deployment (I take the generated curl as before and run it) I see the following error message on the server (I cut out the stack trace): sqlalchemy.exc.IntegrityError: (sqlalchemy.dialects.postgresql.asyncpg.IntegrityError) <class ‘asyncpg.exceptions.ForeignKeyViolationError’>: insert or update on table “flow_run” violates foreign key constraint “fk_flow_run__parent_task_run_id__task_run” DETAIL: Key (parent_task_run_id)=(3fa85f64-5717-4562-b3fc-2c963f66afa6) is not present in table “task_run”. [SQL: INSERT INTO flow_run (id, created, updated, name, run_count, total_run_time, deployment_id, work_queue_name, parameters, idempotency_key, context, empirical_policy, tags, auto_scheduled, flow_id, infrastructure_document_id, parent_task_run_id, work_queue_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) ON CONFLICT (flow_id, idempotency_key) DO NOTHING] [parameters: (UUID(‘67eeff72-9ce7-4120-b85c-63067bbd724a’), DateTime(2023, 5, 1, 17, 23, 7, 149371, tzinfo=Timezone(‘UTC’)), DateTime(2023, 5, 1, 17, 23, 7, 150505, tzinfo=Timezone(‘UTC’)), ‘my-flow-run’, 0, datetime.timedelta(0), UUID(‘4d2be4ab-1fe5-49f3-a6f0-9d7ccf8bb4af’), ‘default’, ‘{}’, ‘string’, ‘{“my_var”: “my_val”}‘, ‘{“max_retries”: 0, “retry_delay_seconds”: 0.0, “retries”: 0, “retry_delay”: 0, “pause_keys”: [“string”], “resuming”: false}‘, ‘[“tag-2”, “tag-1"]’, False, UUID(‘704aec56-b740-4400-8c52-5e08314ec84a’), UUID(‘3fa85f64-5717-4562-b3fc-2c963f66afa6’), UUID(‘3fa85f64-5717-4562-b3fc-2c963f66afa6’), UUID(‘084966f2-e8e3-4827-8638-d4a8642f0f2c’))] (Background on this error at: I appreciate any insights into what I might be doing incorrectly. The task_run table is empty (should it be)? Thank you!