diff --git a/github_scripts/suite_data.py b/github_scripts/suite_data.py index 140653b..add597f 100644 --- a/github_scripts/suite_data.py +++ b/github_scripts/suite_data.py @@ -9,6 +9,7 @@ """ import re +import os import shutil import sqlite3 import subprocess @@ -317,6 +318,21 @@ def get_workflow_id(self) -> str: return "unknown_workflow_id" + def generate_cylc_url(self) -> str: + """ + Generate a markdown url to the cylc review page of a workflow + """ + suite_user = os.environ["USER"] + encoded_workflow_id = self.workflow_id.replace('/','%2F') + + cylc_review = ( + f"[{self.workflow_id}](https://cylchub/services/cylc-review/cycles" + f"/{suite_user}/?suite={encoded_workflow_id})" + ) + + return cylc_review + + def get_suite_starttime(self) -> str: """ Read the suite starttime from the suite database diff --git a/github_scripts/suite_report_git.py b/github_scripts/suite_report_git.py index bc336bb..0f472f6 100755 --- a/github_scripts/suite_report_git.py +++ b/github_scripts/suite_report_git.py @@ -73,6 +73,7 @@ def __init__(self, suite_path: Path) -> None: self.suite_user = suite_path.owner() self.suite_starttime: str = self.get_suite_starttime() self.workflow_id: str = self.get_workflow_id() + self.cylc_url: str = self.generate_cylc_url() self.task_states: Dict[str, str] = self.get_task_states() self.groups: List[str] = self.read_groups_run() self.rose_data: Dict[str, str] = self.read_rose_conf() @@ -118,7 +119,7 @@ def create_suite_info_table(self) -> None: self.trac_log.extend(create_markdown_row("Item", "Value", header=True)) rows = ( - ("Suite Name", self.workflow_id), + ("Suite Name", self.cylc_url), ("Suite User", self.suite_user), ("Workflow Start", self.suite_starttime), ("Groups Run", ",".join(g for g in self.groups)), @@ -185,6 +186,9 @@ def create_task_tables(self, parsed_tasks: Dict[str, List[str]]) -> None: for state in order: emoji = state_emojis[state] tasks = parsed_tasks[state] + if state == "succeeded": + self.trac_log.append(f"{emoji} {state} tasks - {len(tasks)}") + continue if not tasks: continue if state == "pink failure":