-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
let TaskRunRecorder
process events into task runs/task run states
#14729
Conversation
} | ||
session = await stack.enter_async_context(db.session_context()) | ||
|
||
await _insert_task_run(session, task_run, task_run_attributes) |
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.
Unfortunately due to FK's we need to insert the task run, then insert the task run state, then go back and update the task run with the denormalized state attributes
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.
Okay, sometimes this trips me up with the db.session_context()
: begin_transaction
defaults to False
, so these aren't in a transaction, right? It feels like they should be
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.
db.session_context(..., with_for_update=True)
as well here?
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.
Good question, that might make the lock a little more aggressive? I'm thinking about the SQLite implementation hitting database is locked
. Since this should be the only thing writing task runs, I think we're good with just the transaction
db.TaskRun.id == task_run.id, | ||
sa.or_( | ||
db.TaskRun.state_timestamp.is_(None), | ||
db.TaskRun.state_timestamp < task_run.state.timestamp, |
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 think this fits our pattern so that we'll only do this if things are in order
CodSpeed Performance ReportMerging #14729 will not alter performanceComparing Summary
|
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.
Just that one question about the transaction, but it looks great!
} | ||
session = await stack.enter_async_context(db.session_context()) | ||
|
||
await _insert_task_run(session, task_run, task_run_attributes) |
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.
Okay, sometimes this trips me up with the db.session_context()
: begin_transaction
defaults to False
, so these aren't in a transaction, right? It feels like they should be
closes: #14648
Updates
TaskRunRecorder
from being a no-op service to actually processingtask-run
events that come through.For every event we see we'll: