-
Notifications
You must be signed in to change notification settings - Fork 36
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
Support __getitem__
with JobsCursor
objects
#1017
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1017 +/- ##
==========================================
+ Coverage 86.24% 86.25% +0.01%
==========================================
Files 20 20
Lines 3503 3508 +5
Branches 662 663 +1
==========================================
+ Hits 3021 3026 +5
Misses 331 331
Partials 151 151 ☔ View full report in Codecov by Sentry. |
Note that docs are failing due to the ReadTheDocs configuration change - that will need to be addressed in a separate PR. |
__getitem__
with JobsCursor
objects
This part of the code is usually benchmarked thoroughly before changes are accepted. @janbridley Would you be able to run the benchmark suite and share results? Here is a guide: https://github.com/glotzerlab/signac/blob/main/doc/support.rst#benchmarking |
The
|
@janbridley I was able to reproduce the failure you're seeing. I tried |
@janbridley I found that using |
ASV results. This always failed if a micromamba environment was active, but a clean asv==0.6.1 install with no mamba/conda/uv did work.
|
@janbridley I had a bit of trouble interpreting the benchmarks. Were all the numbers present for both before and after? If you can confirm there is no performance change, I will approve. |
I updated the benchmark results - I'm not sure why the previous output tested the same commit twice. All large benchmarks (N=1000) are within standard deviation of main |
Great. That’s enough to approve this PR. If you would like to work on improving performance in the future I recommend running benchmarks with N=10,000 or 100,000 but that’s beyond the scope of what this PR requires. |
@janbridley Would you be able to fix the ReadTheDocs error here? |
It is fixed on main: 21f3d64. Merge main into this branch to get the green check. |
Description
Implemented
__getitem__
for JobsCursors, allow for indexing and slicing after callingproject.find_jobs()
Motivation and Context
JobsCursors
are iterable through the_JobsCursorIterator
API, but slicing and indexing was not supported. This is atypical for Python types and requires users to unpack the cursor to index it.This implementation returns a single
Job
if an integer index is requested, or a_JobsCursorIterator
if a slice is requested. New tests have been added to cover the new functionality.Checklist: