Skip to content

Conversation

@kzscisoft
Copy link
Collaborator

@kzscisoft kzscisoft commented Aug 20, 2025

Fix Slow Run Retrieval

Issue: #846

Python Version(s) Tested: 3.13

Operating System(s): Ubuntu 25.04

📝 Summary

The retrieval of Run objects is very slow for large quantities.

🔍 Diagnosis

  • The pagination seems to be working.
  • The default of get_runs has alerts=False but alerts is a property of the Run LLAPI class. The base class __repr__ method iterates through all properties meaning because the "alerts" key was missing the automatic 'get from server' method was being called for each run.

🔄 Changes

  • I have removed this automatic retrieval, hopefully it does not break things.
  • Added local_default value to be used when object is in "local" mode.
  • "Local" mode used for get - bulk item retrieval.
  • Object will not print elements it does not have retrieved, if the user attempts Run(...).alerts when they used get_runs(alerts=False) a KeyError will be returned.

✔️ Checklist

  • Unit and integration tests passing.
  • Pre-commit hooks passing.
  • Quality checks passing.

@kzscisoft kzscisoft linked an issue Aug 20, 2025 that may be closed by this pull request
@kzscisoft kzscisoft added this to the Python API v2.2 milestone Aug 20, 2025
@kzscisoft kzscisoft added bug Something isn't working in review This issue is resolved in a Pull Request which is being reviewed labels Aug 20, 2025
Rather than the API attempt to retrieve a missing attribute for every item during 'get' use a local default instead. Removal led to test failures.
@kzscisoft kzscisoft changed the title 🐛 Remove default attribute recall if read-only online 🐛 Set local default for attribute recall if read-only online Aug 20, 2025
@kzscisoft kzscisoft changed the title 🐛 Set local default for attribute recall if read-only online 🐛 Handle KeyError for object retrieval Aug 20, 2025
@kzscisoft kzscisoft requested a review from wk9874 August 20, 2025 14:58
@kzscisoft kzscisoft merged commit 7adb62e into dev Aug 21, 2025
20 checks passed
@kzscisoft kzscisoft deleted the kzscisoft/846-client-get_runs-is-extremely-slow branch August 21, 2025 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working in review This issue is resolved in a Pull Request which is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client get_runs is extremely slow

3 participants