This is an automated email from the ASF dual-hosted git repository.
arm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tooling-trusted-releases.git
The following commit(s) were added to refs/heads/main by this push:
new c783072 Attempt to render completed tasks using workflowstatus entries
c783072 is described below
commit c783072f58dfda1cad16c99a4148d5fbcbceb8b3
Author: Alastair McFarlane <[email protected]>
AuthorDate: Wed Jan 14 11:41:11 2026 +0000
Attempt to render completed tasks using workflowstatus entries
---
atr/db/__init__.py | 4 ++++
atr/get/finish.py | 26 ++++++++++++++++++++------
2 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/atr/db/__init__.py b/atr/db/__init__.py
index 3f00a32..56ec193 100644
--- a/atr/db/__init__.py
+++ b/atr/db/__init__.py
@@ -649,6 +649,7 @@ class Session(sqlalchemy.ext.asyncio.AsyncSession):
version_name: Opt[str | None] = NOT_SET,
revision_number: Opt[str | None] = NOT_SET,
primary_rel_path: Opt[str | None] = NOT_SET,
+ _workflow: bool = False,
) -> Query[sql.Task]:
query = sqlmodel.select(sql.Task)
@@ -683,6 +684,9 @@ class Session(sqlalchemy.ext.asyncio.AsyncSession):
if is_defined(primary_rel_path):
query = query.where(sql.Task.primary_rel_path == primary_rel_path)
+ if _workflow:
+ query = query.options(joined_load(sql.WorkflowStatus.task))
+
return Query(self, query)
def text_value(
diff --git a/atr/get/finish.py b/atr/get/finish.py
index 7671086..d945a47 100644
--- a/atr/get/finish.py
+++ b/atr/get/finish.py
@@ -152,6 +152,7 @@ async def _get_page_data(
version_name=version_name,
revision_number=release.latest_revision_number,
task_type=sql.TaskType.DISTRIBUTION_WORKFLOW,
+ _workflow=True,
)
.order_by(sql.sqlmodel.desc(via(sql.Task.started)))
.all()
@@ -225,8 +226,12 @@ def _render_distribution_buttons(release: sql.Release) ->
htm.Element:
def _render_distribution_tasks(release: sql.Release, tasks:
Sequence[sql.Task]) -> htm.Element:
"""Render current and failed distribution tasks."""
- failed_tasks = [t for t in tasks if t.status == sql.TaskStatus.FAILED]
- in_progress_tasks = [t for t in tasks if t.status in
[sql.TaskStatus.QUEUED, sql.TaskStatus.ACTIVE]]
+ failed_tasks = [t for t in tasks if t.status == sql.TaskStatus.FAILED or
t.workflow.status == "failed"]
+ in_progress_tasks = [
+ t
+ for t in tasks
+ if t.status in [sql.TaskStatus.QUEUED, sql.TaskStatus.ACTIVE] or
t.workflow.status not in ["success", "failed"]
+ ]
block = htm.Block()
@@ -541,10 +546,19 @@ def _render_release_card(release: sql.Release) ->
htm.Element:
def _render_task(task: sql.Task) -> htm.Element:
"""Render a distribution task's details."""
args: gha.DistributionWorkflow =
gha.DistributionWorkflow.model_validate(task.task_args)
- status = task.status.value
- return htm.p[
- f"{args.platform} ({args.package} {args.version}): {task.error if
task.error else status.capitalize()}"
- ]
+ task_status = task.status.value
+ workflow_message = task.workflow.message if task.workflow else None
+ workflow_status = task.workflow.status if task.workflow else ""
+ if task_status != sql.TaskStatus.COMPLETED:
+ return htm.p[
+ f"{args.platform} ({args.package} {args.version}): {task.error if
task.error else task_status.capitalize()}"
+ ]
+ else:
+ return htm.p[
+ f"{args.platform} ({args.package} {args.version}): {
+ workflow_message if workflow_message else
workflow_status.capitalize()
+ }"
+ ]
async def _sources_and_targets(latest_revision_dir: pathlib.Path) ->
tuple[list[pathlib.Path], set[pathlib.Path]]:
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]