-
Notifications
You must be signed in to change notification settings - Fork 0
Migrate cassie.py from deprecated pycassa to cassandra-driver ORM #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
Conversation
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
...type handling Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
...ncoding Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
Hyask
commented
Nov 28, 2025
@copilot * In a dedicated folder, please generate one tiny Python script per function you modified.
- Each script should be a minimal example of how to call each function, with arbitrary input data.
- Do that in a new separate commit.
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
@copilot * In a dedicated folder, please generate one tiny Python script per function you modified.
- Each script should be a minimal example of how to call each function, with arbitrary input data.
*...
Created 27 example scripts (one per modified function) in examples/cassie_functions/ directory with a comprehensive README. Each script demonstrates minimal usage with arbitrary input data. See commit c281c5c.
Hyask
commented
Nov 28, 2025
@copilot Please add a call to setup_cassandra() (found in src/errortracker/cassandra.py) at the beginning of each script for easier use.
Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
@copilot Please add a call to
setup_cassandra()(found insrc/errortracker/cassandra.py) at the beginning of each script for easier use.
Added setup_cassandra() call at the beginning of all 27 example scripts. Each script now imports and calls the function to initialize the Cassandra connection before using any cassie functions. Updated README to document this. See commit 49a4dd0.
The oopses._insert() function is already doing other counter updates, and those are the ones that are actually useful. The ones from daisy.submit look more like legacy than anything else, so let's stop incrementing them.
f0b609b to
6f5ffc6
Compare
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.
- First, start a Cassandra test database from Docker with:
docker run --name cassandra --network host --rm -d -e HEAP_NEWSIZE=10M -e MAX_HEAP_SIZE=200M docker.io/cassandra. - This file is testing only the
get_package_crash_rate()function from thesrc/errors/cassie.pyfile. - You can add more sample data to the Cassandra database in file
src/tests/conftest.py, in thecassandra_datafixture. - This is how to run the tests from the
srcfolder:python3 -m pytest ./tests -k cassie. This command must not fail. Tests must keep passing. - Have a look at the existing test, and add more to cover additional situations. In particular, the
increasekey of the output dictionary must vary fromTruetoFalsein many different cases.
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.
Added 5 new test cases for get_package_crash_rate() covering different scenarios where increase varies between True and False:
- No crashes today (increase=False) - new version has no crashes today
- Few crashes (increase=False) - only 2 crashes today, below threshold of 3
- New package (increase=True) - no old version data exists
- Low difference (increase=False) - crash rate similar between versions (difference ≤ 1)
- All proposed (increase=False) - all today's crashes from proposed repo with exclude_proposed=True
All 6 tests (original + 5 new) pass successfully. Test data added to cassandra_data fixture in conftest.py. Also removed debug print statements from cassie.py. See commit 537f8ba.
This brings better precision on when crashes actually occur, and eases a bit the testing of things, because the tests can now create crashes in the past way more easily.
The goal here is to have the bare minimum working, and throw that at Copilot to see how it goes.
... increase/no-increase scenarios Co-authored-by: Hyask <7489759+Hyask@users.noreply.github.com>
537f8ba to
35b4cd2
Compare
Uh oh!
There was an error while loading. Please reload this page.
Summary
Successfully migrated all 30+ functions in
cassie.pyfrom the deprecatedpycassalibrary to the moderncassandra-driverORM. All pycassa references have been removed and replaced with equivalent ORM queries. Added comprehensive example scripts demonstrating usage of each migrated function, with proper Cassandra connection initialization.Test Coverage
Added comprehensive test coverage for
get_package_crash_rate()function with 6 test cases covering different scenarios:All tests pass successfully and validate the different conditions where the
increasekey varies betweenTrueandFalse.Original prompt
pycassa#3💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.