-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add UI with a simple paged table of tasks sorted by date of last change #79
base: devel
Are you sure you want to change the base?
Conversation
Temporarily remove dates from the table until the endpoint for events is added
…igate to the first and last page. No other navigation at this point
|
||
Can be filtered by pipeline and status. TODO: input and date. | ||
""" | ||
latest_event = select(Event.task_id, samax(Event.time).label("changed"))\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you consider printing (once) or logging the query this generates? I've gotten rusty on the sqlalchemy grammar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From logs:
INFO: SELECT task.task_id, task.pipeline_id, task.job_descriptor, task.definition, task.state, task.prefix, task.created, pipeline_1.pipeline_id AS pipeline_id_1, pipeline_1.name, pipeline_1.repository_uri, pipeline_1.version
FROM task JOIN pipeline ON pipeline.pipeline_id = task.pipeline_id JOIN (SELECT event.task_id AS task_id, max(event.time) AS changed
FROM event GROUP BY event.task_id) AS anon_1 ON task.task_id = anon_1.task_id LEFT OUTER JOIN pipeline AS pipeline_1 ON pipeline_1.pipeline_id = task.pipeline_id ORDER BY anon_1.changed DESC
LIMIT :param_1 OFFSET :param_2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah... this is giving the postgres optimizer nightmares.
Read the entire event table, read the entire task table. Both are high cardinality tables, and it gets progressively worse as Porch gets more and more used. Then sort it all so you can pick the top ones.
It's ok for trials you're doing now. For realistic high task throughput, it would probably be better to limit the number of discrete tasks by windowing the events to the last week or something, and add an index to the event table's time column. That or limit by the age since task creation (task table only), then bring in any event history from that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know much about optimising db interaction, especially in postgres, but perhaps a current
column in the event table would help?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have created a new sub-task for this since it is not immediately necessary and will require discussion.
Remove unused import
…tack machine, the path needs to be different for running on docker for reasons that I cannot currently fathom.
There's something weird with looking for templates; on docker, running uvicorn directly and running as a service each require different starting levels of path to the template directory. I'll look into it next week |
Can be partially filtered through the url.
I was hoping to get latest update date through the same query, but couldn't get it to work alongside getting the model. We will need the extra information from the other query eventually anyway, but I was hoping to delay getting it until the user requested it.