loginowskid commited on
Commit
c793268
·
1 Parent(s): 9f3ebeb

Propagate layout_aborted @9a25031

Browse files
Files changed (1) hide show
  1. tools/hf_space/runner.py +12 -1
tools/hf_space/runner.py CHANGED
@@ -456,6 +456,11 @@ def _validate_zip_streaming(*, api: HfApi, dataset: str, token: str | None,
456
 
457
  merged_results: list[dict] = []
458
  merged_layout: list[dict] = []
 
 
 
 
 
459
  workers = os.environ.get("SR_WORKERS", "4").strip() or "4"
460
  cache_hits = 0
461
  val_ver = _validator_version()
@@ -551,7 +556,7 @@ def _validate_zip_streaming(*, api: HfApi, dataset: str, token: str | None,
551
  nonlocal cache_hits, zips_processed, profile_autodetect_done
552
  nonlocal profile, consecutive_unrecoverable, was_cancelled
553
  nonlocal use_plugin_default, issue_filed_for_registration_bug
554
- nonlocal issue_filing_disabled
555
  # Honor early abort (cancel or unrecoverable failure) — tasks
556
  # queued before the stop signal still get scheduled and have
557
  # to no-op themselves.
@@ -589,6 +594,8 @@ def _validate_zip_streaming(*, api: HfApi, dataset: str, token: str | None,
589
  if cached:
590
  merged_results.extend(cached.get("results", []))
591
  merged_layout.extend(cached.get("layout_findings") or [])
 
 
592
  cache_hits += 1
593
  out(f" [{i+1}/{len(zip_entries)}] cache hit: {zip_rel} "
594
  f"({len(cached.get('results', []))} asset(s))")
@@ -781,6 +788,8 @@ def _validate_zip_streaming(*, api: HfApi, dataset: str, token: str | None,
781
  zip_layout = rj.get("layout_findings") or []
782
  merged_results.extend(zip_results)
783
  merged_layout.extend(zip_layout)
 
 
784
  out(f" {len(zip_results)} asset(s); rc={rc}")
785
  # Emit a progress write so the dashboard sees the
786
  # updated zip-count + per-asset rows immediately
@@ -801,6 +810,7 @@ def _validate_zip_streaming(*, api: HfApi, dataset: str, token: str | None,
801
  "zip_sha": zip_sha,
802
  "results": zip_results,
803
  "layout_findings": zip_layout,
 
804
  "validator_version": val_ver,
805
  "foundation_sha": found_sha,
806
  "profile": profile,
@@ -890,6 +900,7 @@ def _validate_zip_streaming(*, api: HfApi, dataset: str, token: str | None,
890
  "schema_version": 1,
891
  "results": merged_results,
892
  "layout_findings": merged_layout,
 
893
  "profile_coverage": {},
894
  "streaming_zips": len(zip_entries),
895
  "streaming_cache_hits": cache_hits,
 
456
 
457
  merged_results: list[dict] = []
458
  merged_layout: list[dict] = []
459
+ # Set when ANY processed unit's results.json carries
460
+ # layout_aborted=true (the validator's strict pre-check fired).
461
+ # Propagated into the final dict so the dashboard sees the flag
462
+ # and renders the layout-failed banner instead of generic counts.
463
+ any_layout_aborted = False
464
  workers = os.environ.get("SR_WORKERS", "4").strip() or "4"
465
  cache_hits = 0
466
  val_ver = _validator_version()
 
556
  nonlocal cache_hits, zips_processed, profile_autodetect_done
557
  nonlocal profile, consecutive_unrecoverable, was_cancelled
558
  nonlocal use_plugin_default, issue_filed_for_registration_bug
559
+ nonlocal issue_filing_disabled, any_layout_aborted
560
  # Honor early abort (cancel or unrecoverable failure) — tasks
561
  # queued before the stop signal still get scheduled and have
562
  # to no-op themselves.
 
594
  if cached:
595
  merged_results.extend(cached.get("results", []))
596
  merged_layout.extend(cached.get("layout_findings") or [])
597
+ if cached.get("layout_aborted"):
598
+ any_layout_aborted = True
599
  cache_hits += 1
600
  out(f" [{i+1}/{len(zip_entries)}] cache hit: {zip_rel} "
601
  f"({len(cached.get('results', []))} asset(s))")
 
788
  zip_layout = rj.get("layout_findings") or []
789
  merged_results.extend(zip_results)
790
  merged_layout.extend(zip_layout)
791
+ if rj.get("layout_aborted"):
792
+ any_layout_aborted = True
793
  out(f" {len(zip_results)} asset(s); rc={rc}")
794
  # Emit a progress write so the dashboard sees the
795
  # updated zip-count + per-asset rows immediately
 
810
  "zip_sha": zip_sha,
811
  "results": zip_results,
812
  "layout_findings": zip_layout,
813
+ "layout_aborted": bool(rj.get("layout_aborted")),
814
  "validator_version": val_ver,
815
  "foundation_sha": found_sha,
816
  "profile": profile,
 
900
  "schema_version": 1,
901
  "results": merged_results,
902
  "layout_findings": merged_layout,
903
+ "layout_aborted": any_layout_aborted,
904
  "profile_coverage": {},
905
  "streaming_zips": len(zip_entries),
906
  "streaming_cache_hits": cache_hits,