<@ULVA73B9P> Can you refer to the source code wher...
# ask-marvin
k
@Marvin Can you refer to the source code where to find the query below ?. (see thread)
m
I can't view threads or external content directly. However, if you provide me with the specific query or context, I can help you locate the relevant source code in the Prefect repository or documentation.
k
@Marvin this is the query
Copy code
INSERT INTO task_run (flow_run_id, task_key, dynamic_key, flow_run_run_count, empirical_policy, task_inputs, tags, name, run_count, expected_start_time, total_run_time, id, created, updated) VALUES ($1::UUID, $2::VARCHAR, $3::VARCHAR, $4::INTEGER, $5, $6, $7::JSONB, $8::VARCHAR, $9::INTEGER, $10::TIMESTAMP WITH TIME ZONE, $11::INTERVAL, $12::UUID, $13::TIMESTAMP WITH TIME ZONE, $14::TIMESTAMP WITH TIME ZONE) ON CONFLICT (id) DO UPDATE SET flow_run_id = $15::UUID, task_key = $16::VARCHAR, dynamic_key = $17::VARCHAR, flow_run_run_count = $18::INTEGER, empirical_policy = $19, task_inputs = $20, tags = $21::JSONB, name = $22::VARCHAR, run_count = $23::INTEGER, expected_start_time = $24::TIMESTAMP WITH TIME ZONE, total_run_time = $25::INTERVAL, id = $26::UUID, updated = $27::TIMESTAMP WITH TIME ZONE WHERE task_run.state_timestamp < $28::TIMESTAMP WITH TIME ZONE
m
The query you provided is related to the task run management in Prefect's database interactions. Based on the search results, here are some relevant links to issues in the Prefect repository that might contain or discuss similar queries: 1. Scheduler timeout and no new scheduled jobs with big flow_run_state/task_run_state tables: This issue discusses timeout errors and includes SQL operations related to task runs. You can view the details here. 2. Prefect Server Experiencing Timeouts Due to Slow Database Communication: This issue addresses performance issues with Prefect server installations, which might include similar SQL operations. Check it out here. 3. Database Issue: Broken Dashboard and Unsuccessful Reset/Reinstallation: This issue involves database constraints and might have relevant SQL operations. The details are available here. These issues should give you some context on where similar SQL operations are being discussed or might have originated from in the Prefect codebase. If you need to track down the exact location in the source code, you might want to explore Prefect's database models and migration scripts in the repository.
k
@Marvin I want link to prefect github code where to find the code itself
m
The query you're interested in, which involves inserting into the
task_run
table, is likely part of Prefect's database interactions. The specific source code handling task runs can be found in the Prefect repository. Here are some relevant files you might want to explore: 1. Task Worker Implementation: The
task_worker.py
file contains logic related to task runs. You can view it here. 2. Tasks Management: Another relevant file is
tasks.py
, which might contain logic related to task execution and management. Check it out here. These files are part of the Prefect codebase and should provide insight into how task runs are managed and potentially how the SQL for task runs is executed. If you're looking for the exact SQL execution, you might need to dig into the database interaction layer, which often involves SQLAlchemy in Prefect.