Skip to content

Commit c02394d

Browse files
committed
update benchmark link
1 parent 1594377 commit c02394d

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

qa/tools/apex_algorithm_qa_tools/test_failure_handler.py

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# Configuration
1717
GITHUB_REPO = "ESA-APEx/apex_algorithms"
18-
GITHUB_TOKEN = os.getenv("APEX_ISSUE_TOKEN")
18+
GITHUB_TOKEN = os.getenv("GITHUB_TOKEN")
1919
ISSUE_LABEL = "benchmark-failure"
2020
SCENARIO_BASE_PATH = "qa/benchmarks/scenarios/"
2121
WORKFLOW_BASE_URL = f"https://github.com/{os.getenv('GITHUB_REPOSITORY')}/actions/runs/{os.getenv('GITHUB_RUN_ID')}"
@@ -174,9 +174,33 @@ def build_issue_body(scenario, logs, failure_count):
174174
```
175175
"""
176176

177-
def get_scenario_link(scenario_id):
178-
"""Generate link to scenario source code"""
179-
return f"https://github.com/{GITHUB_REPO}/tree/main/{SCENARIO_BASE_PATH}{scenario_id}.py"
177+
def get_scenario_link(scenario_id: str) -> str:
178+
"""Generate link to process graph file at specific commit"""
179+
# Get the current commit SHA from GitHub environment
180+
commit_sha = os.getenv("GITHUB_SHA", "main") # Fallback to 'main' if not in CI
181+
182+
# Base repository URL
183+
base_url = f"https://github.com/{GITHUB_REPO}/blob/{commit_sha}"
184+
185+
# Search path pattern based on your repository structure
186+
search_root = Path("algorithm_catalog")
187+
188+
# Look for matching scenario in provider directories
189+
for provider_dir in search_root.iterdir():
190+
if not provider_dir.is_dir():
191+
continue
192+
193+
# Check for <provider>/<scenario_id>/openeo_udp/<scenario_id>.json
194+
scenario_path = (
195+
provider_dir /
196+
scenario_id /
197+
"benchmark_scenarios" /
198+
f"{scenario_id}.json"
199+
)
200+
201+
if scenario_path.exists():
202+
return f"{base_url}/{"algorithm_catalog"}/{scenario_path.as_posix()}"
203+
180204

181205
def create_new_issue(scenario, logs):
182206
"""Create a new GitHub issue"""

0 commit comments

Comments
 (0)