Skip to content

⚡ Optimize CADC client capability status checks with concurrent execution#158

Open
tjzegmott wants to merge 1 commit into
mainfrom
perf/concurrent-cadcclient-status-13064934752270288918
Open

⚡ Optimize CADC client capability status checks with concurrent execution#158
tjzegmott wants to merge 1 commit into
mainfrom
perf/concurrent-cadcclient-status-13064934752270288918

Conversation

@tjzegmott
Copy link
Copy Markdown
Contributor

💡 What: The optimization implemented
Replaced the sequential loop checking MINOC and Luskan capabilities in dtcli/utilities/cadcclient.py::status() with a concurrent.futures.ThreadPoolExecutor. A helper function processes the HTTP request and handles exceptions concurrently.

🎯 Why: The performance problem it solves
The original code looped over an array of 2 URLs, executing an independent HTTP GET request synchronously for each iteration. In scenarios with any sort of network latency, these blocking operations compound. Running the requests in parallel mitigates the cumulative latency overhead of independent network calls, reducing the function execution time.

📊 Measured Improvement:
Using an injected 1.0s sleep mock representing network latency in a benchmark script simulating status():

  • Baseline (Sequential): 2.0005 seconds
  • Optimized (Concurrent): 1.0020 seconds
  • Speedup: Execution time for the function is halved (latency of network requests is bound to max(t_1, t_2) rather than t_1 + t_2).

PR created automatically by Jules for task 13064934752270288918 started by @tjzegmott

…oncurrently

This replaces a sequential for-loop of HTTP GET requests with a ThreadPoolExecutor mapping over the URLs in `dtcli/utilities/cadcclient.py`.

Co-authored-by: tjzegmott <20817254+tjzegmott@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 29, 2026 16:16
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes CANFAR service status checks by running the Minoc and Luskan /capabilities requests concurrently instead of sequentially, reducing latency for independent network calls.

Changes:

  • Adds ThreadPoolExecutor usage in cadcclient.status().
  • Extracts per-URL status logic into a nested check_url() helper.
  • Preserves the existing (minoc_status, luskan_status) return order.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 65.571% (-0.1%) from 65.69% — perf/concurrent-cadcclient-status-13064934752270288918 into main

2 similar comments
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 65.571% (-0.1%) from 65.69% — perf/concurrent-cadcclient-status-13064934752270288918 into main

@coveralls
Copy link
Copy Markdown

coveralls commented May 29, 2026

Coverage Status

coverage: 65.571% (-0.1%) from 65.69% — perf/concurrent-cadcclient-status-13064934752270288918 into main

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.57%. Comparing base (7c01e86) to head (6f3b8f7).

Files with missing lines Patch % Lines
dtcli/utilities/cadcclient.py 75.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #158      +/-   ##
==========================================
- Coverage   65.68%   65.57%   -0.12%     
==========================================
  Files          15       15              
  Lines        1399     1400       +1     
==========================================
- Hits          919      918       -1     
- Misses        480      482       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants