Repository navigation
sqlalchemy v2 - #150
sqlalchemy v2#150zmc wants to merge 20 commits into
Conversation
a501318 to
b4451d2
Compare
|
Working on reviewing this ASAP |
|
I didn't want to interfere with your branch so I made a new one, rebased on main, and fixed a few regressions. #153 Tested end to end on an exact copy of today's paddles database. |
Also: - update pecan - update psycopg to v3 - drop statsd Signed-off-by: Zack Cerza <[email protected]>
Before: * Used global thread-scoped sessions * Sessions could leak between requests causing incorrect updates * Tests were difficult to get right After: * Request-scoped sessions that are isolated from each other * Lifecycle managed in one place * Guaranteed cleanup on error * Tests are more terse and easily understood * Pytest fixtures which make tests composable and more maintainable * Tests do not persist any state to the database * Eaasy to invoke integration tests Signed-off-by: Zack Cerza <[email protected]>
This endpoint's logic was a little strange and was also implemented as requiring a POST request. Simplify it and correct its behavior. Also fix a test bug. Signed-off-by: Zack Cerza <[email protected]>
Signed-off-by: Zack Cerza <[email protected]>
Signed-off-by: Zack Cerza <[email protected]>
* Update python and actions versions * We don't use travis or nose Signed-off-by: Zack Cerza <[email protected]>
Signed-off-by: Zack Cerza <[email protected]>
This lets us simplify error handling in controllers, and to avoid ever returning HTML inadvertently Signed-off-by: Zack Cerza <[email protected]>
Run the full test suite with a live paddles server backed by an ephemeral PostgreSQL service container so race and HTTP integration tests execute in CI. Signed-off-by: Zack Cerza <[email protected]>
This fixes failures that I only saw in GitHub Actions Signed-off-by: Zack Cerza <[email protected]>
Every timestamp column is 'timestamp without time zone' and has always held naive UTC. Writing tz-aware values made stored values depend on the server's TimeZone and made JSON output differ between freshly-set and reloaded objects. updated_cb normalizes to naive UTC before comparing. Found by testing the SQLAlchemy 2 port against a copy of the production database (#153). Assisted-by: Claude Fable 5.1 Assisted-by: Claude Opus 5.5
…nown keys - Job.updated (and, via updated_cb, Run.updated) advances on every update, including a status-less PUT, which teuthology's supervisor watchdog sends purely to bump it. Stale-lock detection and pulpito runtimes read it. - success is stored alongside status; teuthology's set_status() always sends both. - Only real columns are settable. Unknown or protected keys (id, posted, ...) are ignored instead of raising. - __init__ goes through update() for targets and updated, so the separate init listener is gone. Adds paddles/tests/controllers/test_teuthology_flows.py. Found by testing the SQLAlchemy 2 port against a copy of the production database (#153). Assisted-by: Claude Fable 5.1 Assisted-by: Claude Opus 5.5
- Catch ValueError from Job()/Job.update() in the job controllers and turn it into /errors/invalid/. - validate_status: %-formatting a tuple raised TypeError instead of the intended ValueError. - timestamp_cb passes None and datetime values through instead of handing them to strptime. Found by testing the SQLAlchemy 2 port against a copy of the production database (#153). Assisted-by: Claude Fable 5.1 Assisted-by: Claude Opus 5.5
Check for an existing (run, job_id) before inserting and report "job with job_id N already exists", which teuthology needs to see before it falls back to a PUT. A lost race with a concurrent create (IntegrityError) gets the same message instead of quietly returning the other request's job. Found by testing the SQLAlchemy 2 port against a copy of the production database (#153). Assisted-by: Claude Fable 5.1 Assisted-by: Claude Opus 5.5
A job dict round-tripped from paddles' own GET carries "queue": null, which was rejected as having both job_id and queue. When paddles generates job ids itself, non-numeric existing ids no longer break int(). Found by testing the SQLAlchemy 2 port against a copy of the production database (#153). Assisted-by: Claude Fable 5.1 Assisted-by: Claude Opus 5.5
The hybrid property made /runs/status/<status>/ (pulpito's running-runs filter) run correlated subqueries over every job of every run: ~25s on a copy of the production database. Run.status is a real, indexed column again, recomputed via Run.set_status() whenever a job is updated and via Run.refresh_status() after a job is deleted. Run.started is set when the run first becomes running; this replaces status_cb. Found by testing the SQLAlchemy 2 port against a copy of the production database (#153). Assisted-by: Claude Fable 5.1 Assisted-by: Claude Opus 5.5
teuthology creates a job without targets and sends them in a PUT once it has locked nodes. before_flush only looked at new jobs, so job_nodes was never populated, leaving /nodes/<name>/jobs/, node job_stats, the reimage-failure detector and testnode-monitor with no data for new jobs. Also look at dirty jobs whose targets changed. Found by testing the SQLAlchemy 2 port against a copy of the production database (#153). Assisted-by: Claude Fable 5.1 Assisted-by: Claude Opus 5.5
/runs/branch/, /runs/machine_type/, etc. returned one entry per run and 500ed whenever a single value was NULL (sorted() can't compare None). Found by testing the SQLAlchemy 2 port against a copy of the production database (#153). Assisted-by: Claude Fable 5.1 Assisted-by: Claude Opus 5.5
The SQLAlchemy 2 port removed models.start()/commit() and the Query API, which every pecan command still used. Add a small SessionCommand base that opens a plain session from paddles.db, and port dedupe, delete, expire_jobs, node_jobs, node_stats, queue_stats, reparse, set_status and set_targets onto it. set_status gains --all to recompute every run's stored status. Found by testing the SQLAlchemy 2 port against a copy of the production database (#153). Assisted-by: Claude Fable 5.1 Assisted-by: Claude Opus 5.5
It imports nodes from a lock server that no longer exists, and would need porting off the removed models.start()/Query API like the other commands. Found by testing the SQLAlchemy 2 port against a copy of the production database (#153). Assisted-by: Claude Fable 5.1 Assisted-by: Claude Opus 5.5
|
@djgalloway I've folded your fixes from #153 into this PR, so you don't need to restructure anything on your end.
Thanks for testing this against a copy of production. It caught a lot. Once you've had a look, I think #153 can be closed in favor of this one. |
If you've already folded and squashed the fixes for your commits into this PR, I am not particularly concerned with attribution. If you're happy with unsigned commits in paddles.git, so am I. |
|
We have a number of commits that lack a DCO in this repo, and DCO in combination with Assisted-by is of debatable significance. I'm fine either way. |
No description provided.