Skip to content

Make accessing and gathering search results easier - #2591

Open
shaahji wants to merge 5 commits into
mainfrom
shaahji/search_results
Open

Make accessing and gathering search results easier#2591
shaahji wants to merge 5 commits into
mainfrom
shaahji/search_results

Conversation

@shaahji

@shaahji shaahji commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Make accessing and gathering search results easier

  • Add search point information to evaluation result
  • Include search point information in final printed output
  • Add helper scripts to scan log and generate a csv
  • Add another helper script to collect search results from evaluation results on remote storage

Checklist before requesting a review

  • Add unit tests for this change.
  • Make sure all tests can pass.
  • Update documents if necessary.
  • Lint and apply fixes to your code by running lintrunner -a
  • Is this a user-facing change? If yes, give a description of this change to be included in the release notes.

(Optional) Issue link

Copilot AI review requested due to automatic review settings July 29, 2026 22:24
Comment thread scripts/gather_search_results.py Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Not ready to approve

There are correctness/UX gaps (misleading script usage text, optional Azure dependency handling, and missing test coverage for newly persisted evaluation fields) that should be addressed before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR extends Olive’s search/evaluation bookkeeping so that each evaluated model can be traced back to its originating search point, and adds scripts to extract/search results into CSVs for easier analysis.

Changes:

  • Add SearchPoint.to_dict() and thread a JSON-serializable search_point payload through the engine/pass execution path.
  • Persist search_point and parent_model_id into cached evaluation JSON and include search_point in run-history output.
  • Add two helper scripts to extract search results from (1) local run logs and (2) Azure Blob-stored evaluation results.
File summaries
File Description
scripts/parse_search_results.py New script to parse run-history tables from logs and emit flattened CSV (optionally enrich with model sizes from blob).
scripts/gather_search_results.py New script to scan evaluation JSONs in Azure Blob storage and emit flattened CSV (including model size enrichment).
olive/search/search_point.py Add SearchPoint.to_dict() to produce a clean nested parameter/value mapping for serialization.
olive/engine/footprint.py Extend run-history/footprint node data to carry search_point and print it in summaries.
olive/engine/engine.py Thread search_point through pass execution; cache evaluation JSON now includes search_point and parent_model_id.
Review details

Comments suppressed due to low confidence (2)

scripts/gather_search_results.py:164

  • After making Azure imports optional, scan_evaluations should raise a clear ImportError when the Azure SDK isn't available, instead of failing later with a NoneType error.
    if not subscription_id:
        raise ValueError("subscription_id is required when resolving evaluation results from blob storage")

    credential = DefaultAzureCredential()
    blob_service = BlobServiceClient(account_url=_BLOB_ACCOUNT_URL, credential=credential)

scripts/parse_search_results.py:247

  • If Azure SDK dependencies are optional (per the import pattern above), _fetch_model_sizes_from_blob should fail with a clear ImportError when the user requests blob-based size enrichment without those packages installed.
    if not subscription_id:
        raise ValueError("subscription_id is required when resolving model sizes from blob storage")

    credential = DefaultAzureCredential()
    blob_service = BlobServiceClient(account_url=_BLOB_ACCOUNT_URL, credential=credential)
  • Files reviewed: 5/5 changed files
  • Comments generated: 5
  • Review effort level: Low

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread scripts/gather_search_results.py
Comment thread scripts/gather_search_results.py
Comment thread scripts/parse_search_results.py Outdated
Comment thread olive/engine/footprint.py Outdated
Comment thread olive/engine/engine.py
shaahji added 2 commits July 29, 2026 16:10
Search results should be readily available without having to scrape for
them from log output. Also, log dumps the results only if it exits
gracefully. Extending the evaluation result to include the search point
information (and other relevant details). The final printed table also
prints the search point details.
* parse_search_results: Parses search results from an Olive output log.
  If a subscription-id is provided, will collect model sizes from remote
  storage.
* gather_search_results: Remote only. Requires subscription-id to query
  remote storage blob for evaluation results. Will include model sizes
  in generated results.
@shaahji
shaahji force-pushed the shaahji/search_results branch from 8074766 to 6555c48 Compare July 29, 2026 23:11
@shaahji
shaahji requested a review from Copilot July 29, 2026 23:13
@shaahji
shaahji enabled auto-merge (squash) July 29, 2026 23:14
Comment thread scripts/gather_search_results.py Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Not ready to approve

The new Azure gather script still hard-depends on Azure SDK imports at module import time (breaking non-Azure use) and there are a couple of correctness/type-robustness issues that should be addressed before merging.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Review details

Comments suppressed due to low confidence (4)

scripts/gather_search_results.py:46

  • The script imports Azure SDK modules at import time, which makes the script unusable for users who only want to inspect local files / read the help text unless they have azure-identity and azure-storage-blob installed. Make these imports optional and fail with a targeted error only when Azure functionality is invoked.
from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClient

scripts/gather_search_results.py:165

  • After making Azure imports optional, this function should explicitly raise a clear ImportError when the Azure SDK packages are missing; otherwise it will fail later with a confusing 'NoneType is not callable' error when constructing clients.
    if not subscription_id:
        raise ValueError("subscription_id is required when resolving evaluation results from blob storage")

    credential = DefaultAzureCredential()
    blob_service = BlobServiceClient(account_url=_BLOB_ACCOUNT_URL, credential=credential)
    container_client = blob_service.get_container_client(_BLOB_CONTAINER)

olive/engine/footprint.py:30

  • RunHistory field types don't match the values assigned in summarize_run_history: parent_model_id, from_pass, duration_sec, and metrics are all written as None for some nodes (e.g., the input model or models without evaluation). The annotations should be optional to reflect actual values and avoid misleading API consumers/static checks.
    parent_model_id: str
    from_pass: str
    search_point: str | None
    duration_sec: float
    metrics: str

scripts/parse_search_results.py:89

  • _parse_json_cell is annotated/used as if it always returns a JSON object (dict), but json.loads can return non-dict values (e.g., null, lists). If that happens, _flatten will generate an empty-string column name and produce malformed CSV output. Treat non-dict JSON values as invalid/empty cells.
    try:
        return json.loads(text)
    except json.JSONDecodeError:
        return None
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Low

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread olive/engine/footprint.py Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Not ready to approve

Footprint.record is currently gated such that common calls like record(model_id=...) become no-ops, which breaks run history and prevents the new search_point/parent_model_id propagation from working correctly.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Review details

Comments suppressed due to low confidence (2)

scripts/gather_search_results.py:46

  • The script imports Azure SDK modules at top-level, so running any part of it fails immediately with ImportError unless azure-identity and azure-storage-blob are installed. Prefer importing these lazily (inside scan_evaluations) and raising a targeted, actionable error message so the script can at least show --help / argument errors without requiring optional deps.
from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClient

olive/engine/footprint.py:309

  • This if condition is long enough to likely exceed the repo’s formatter/linter line-length limits, and it’s hard to read/maintain as a single line. Wrap it in parentheses and split it across lines so Black/lintrunner won’t churn it (and to keep future edits safe).
                    if not _v.metrics.cmp_direction or metric_name not in _v.metrics.cmp_direction or not v.metrics.cmp_direction or metric_name not in v.metrics.cmp_direction:
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Low

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

Comment thread olive/engine/footprint.py
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Not ready to approve

scripts/gather_search_results.py still imports Azure dependencies at module import time, which breaks basic usability (including -h) in environments without optional Azure packages and needs the lazy-import fix.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Review details

Comments suppressed due to low confidence (2)

scripts/gather_search_results.py:46

  • azure-identity / azure-storage-blob are imported at module import time, which prevents even python scripts/gather_search_results.py -h from working in environments that don’t have the optional Azure packages installed. Since the Azure dependency is only needed when actually scanning blob storage, import it lazily inside scan_evaluations (similar to parse_search_results.py).
from azure.identity import DefaultAzureCredential
from azure.storage.blob import BlobServiceClient

scripts/gather_search_results.py:165

  • After moving Azure imports out of the module top-level, DefaultAzureCredential / BlobServiceClient should be imported (with a targeted error message) inside scan_evaluations so missing optional dependencies fail with a clear instruction.
    credential = DefaultAzureCredential()
    blob_service = BlobServiceClient(account_url=_BLOB_ACCOUNT_URL, credential=credential)
    container_client = blob_service.get_container_client(_BLOB_CONTAINER)
  • Files reviewed: 6/6 changed files
  • Comments generated: 0 new
  • Review effort level: Low

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

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.

3 participants