Skip to content

Conversation

@angelo-DNAStack
Copy link

Summary

  • Adds --local-federated flag to explorer questions ask command to bypass federation bottleneck
  • Queries each collection directly in parallel when flag is enabled
  • Maintains full compatibility with existing federated output format

Problem

When concurrent requests to federated questions overwhelm the Explorer service, circuit breakers and connection timeouts cause failures. This happens because Explorer's federation layer becomes a bottleneck when coordinating responses from multiple publishers with queuing systems.

Solution

The --local-federated flag enables direct parallel queries to each collection, bypassing the Explorer federation layer. This allows workloads to proceed while the long-term solution (converting Explorer's federated API to use Data Connect-style streaming responses) is implemented.

Implementation Details

  • Fetches publisher-specific question IDs from federated question metadata
  • Executes parallel POST requests to /api/collections/{slug}/questions/{questionId}/query
  • Handles errors per collection without failing the entire operation
  • Returns results in the exact same format as the federated endpoint

Testing

  • ✅ Unit tests pass
  • ✅ Linting passes
  • ✅ Tested with allele-frequency question across multiple collections
  • ✅ Output format matches federated endpoint exactly
  • ✅ Error handling works correctly for partial failures

Example Usage

dnastack explorer questions ask \
  --question-name allele-frequency \
  --param position=64314563 \
  --param chromosome=chr15 \
  --collections "yFAS-2e200380-a0da-464e-8554-663fa485965c,Lu0K-cd1cdf5a-1cb0-4b47-bf52-d365f928a1b4" \
  --local-federated

Notes

  • This is a temporary workaround until server-side federation improvements are implemented
  • The flag is designed for programmatic use in high-concurrency scenarios
  • No progress indicators or human-friendly output formatting (raw JSON only)

🤖 Generated with Claude Code

…on bottleneck

When concurrent requests to federated questions overwhelm the Explorer service,
circuit breakers and connection timeouts cause failures. This happens because
Explorer's federation layer becomes a bottleneck when coordinating responses
from multiple publishers with queuing systems.

This change adds a --local-federated flag that queries each collection directly
in parallel, bypassing the Explorer federation layer. This allows workloads to
proceed while the long-term solution (converting Explorer's federated API to
use Data Connect-style streaming responses) is implemented.

The flag maintains full compatibility with existing behavior and output format,
making it a safe workaround for high-concurrency scenarios.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@platform-automation-dnastack

@github-actions
Copy link

github-actions bot commented Dec 2, 2025

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
10540 5817 55% 30% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
dnastack/cli/commands/explorer/questions/commands.py 31% 🟢
dnastack/client/explorer/client.py 84% 🟢
TOTAL 57% 🟢

updated for commit: 1e6e0a9 by action🐍

angelo-DNAStack and others added 2 commits December 3, 2025 10:24
… correctly

The initial implementation only returned the first page of results from each
collection, which would miss data when results span multiple pages. This is
critical because Data Connect APIs return empty pages with next_page_url links
until data is ready, then continue pagination until all results are delivered.

This fix implements proper pagination handling by:
- Making the initial POST request to start the query
- Following next_page_url links with GET requests until exhausted
- Aggregating all data across all pages before returning
- Preventing infinite loops by tracking visited URLs

Without this fix, users would get incomplete results when querying collections
that return paginated responses, making the --local-federated flag unreliable
for production use.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…eature

- Add 29 tests across LocalFederatedQuestionQueryResultLoader, ExplorerClient, and CLI
- Test Data Connect pagination handling, parallel collection queries, error scenarios
- Test CLI --local-federated flag integration and parameter parsing
- Fix ClientError constructor to use trace_context parameter
- Ensure compatibility with existing utilities and result formats

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants