Show collapsed Event Groups alongside ungrouped activities in Timeline

オープン
#4,207 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
frontend

調査の方向性

Start by reproducing the grouping behavior with the Python script in the issue against a local dev server, using a UI build that includes the Timeline Event Groups toggle from PR #4134. Compare the grouped and ungrouped Timeline views for the cloud-job-polls-grouped workflow to see where ungrouped activities are dropped when Show Event Groups is on. Done means the submission and URL rows stay visible beside the collapsed wait group, and expanding the group still reveals its polls and timers.

索引モデルが issue の本文から書いたものです。

説明

enhancement

Is your feature request related to a problem? Please describe.

Our workflow submits a long-running cloud job, prints its URL in a separate activity, and polls for completion. Between polls, it waits on a durable Workflow timer.

We put the polls and timers in a Wait for cloud job Event Group. With Show Event Groups on, the Timeline shows the collapsed wait but hides the submission and URL activities. Turning grouping off shows those activities and every individual poll and timer.

Describe the solution you'd like

Keep ungrouped activities visible alongside collapsed Event Groups in the Timeline. We'd like Submit cloud job and Print cloud job URL to appear inline as ordinary activity rows. Each is a single activity, so only the repeated polls and timers need a group. For this workflow the three rows would be:

  1. Submit cloud job
  2. Print cloud job URL
  3. Wait for cloud job (collapsed)

Clicking Wait for cloud job should reveal its polls and timers while leaving the first two rows visible.

Describe alternatives you've considered

Giving the submission and URL activities their own Event Groups keeps all three steps visible, but adds an extra click to inspect either activity.

Additional context

The demo script runs both layouts against a local Temporal server. Both runs use the same three activities and record four polls separated by three two-second Workflow timers. All job data is synthetic.

  • cloud-job-polls-grouped puts only the polls and timers in a group. Turn Show Event Groups on and off to see the submission and URL rows disappear and reappear.
  • cloud-job-every-step-grouped shows the current workaround. It gives the submission and URL activities their own groups so all three rows stay visible. We'd prefer to leave those two activities inline and group only the polls and timers.

#4134 introduced the Timeline Event Groups toggle.

Local reproduction

Run the script below with Python SDK 1.35.0 and a local dev server. It prints a Timeline URL for each run. Use a UI build containing the Timeline grouping toggle. These screenshots use upstream commit 051de464ac1 with Temporal Server 1.32.2.

Start the server in one terminal, with the newer UI assets available locally:

temporal server start-dev --port 17334 --ui-port 18334 --ui-asset-path /path/to/ui-assets

Save the script below as temporal-event-groups-demo.py and run it in another terminal:

python -m pip install temporalio==1.35.0
python temporal-event-groups-demo.py
Minimal repro script
"""Run two synthetic cloud job workflows against a local Temporal dev server."""

import asyncio
from contextlib import nullcontext
from datetime import timedelta
import os

from temporalio import activity, workflow
from temporalio.client import Client
from temporalio.worker import Worker


@activity.defn
async def submit_cloud_job() -> str:
    return "demo-job-001"


@activity.defn
async def print_cloud_job_url(job_id: str) -> str:
    url = f"https://example.com/jobs/{job_id}"
    activity.logger.info("Cloud job URL: %s", url)
    return url


@activity.defn
async def poll_cloud_job_status(job_id: str, attempt: int) -> str:
    return "completed" if attempt == 4 else "running"


@workflow.defn
class CloudJobDemo:
    @workflow.run
    async def run(self, group_every_step: bool) -> str:
        timeout = timedelta(seconds=10)
        with (
            workflow.create_event_group("submit", label="Submit cloud job").scope()
            if group_every_step
            else nullcontext()
        ):
            job_id = await workflow.execute_activity(
                submit_cloud_job, start_to_close_timeout=timeout
            )

        with (
            workflow.create_event_group("url", label="Print cloud job URL").scope()
            if group_every_step
            else nullcontext()
        ):
            await workflow.execute_activity(
                print_cloud_job_url,
                job_id,
                start_to_close_timeout=timeout,
                summary=f"[Open cloud job](https://example.com/jobs/{job_id})",
            )

        with workflow.create_event_group(
            "poll", label="Wait for cloud job"
        ).scope():
            for attempt in range(1, 5):
                status = await workflow.execute_activity(
                    poll_cloud_job_status,
                    args=[job_id, attempt],
                    start_to_close_timeout=timeout,
                )
                if status == "completed":
                    return status
                await workflow.sleep(timedelta(seconds=2))
        raise RuntimeError("The demo job did not complete")


async def main() -> None:
    address = os.environ.get("DEMO_TEMPORAL_ADDRESS", "127.0.0.1:17334")
    ui_root = os.environ.get("DEMO_TEMPORAL_UI", "http://localhost:18334")
    client = await Client.connect(address)
    queue = "cloud-job-event-groups-demo"
    async with Worker(
        client,
        task_queue=queue,
        workflows=[CloudJobDemo],
        activities=[submit_cloud_job, print_cloud_job_url, poll_cloud_job_status],
    ):
        handles = [
            await client.start_workflow(
                CloudJobDemo.run, group_every_step, id=workflow_id, task_queue=queue
            )
            for workflow_id, group_every_step in [
                ("cloud-job-polls-grouped", False),
                ("cloud-job-every-step-grouped", True),
            ]
        ]
        for handle in handles:
            assert await handle.result() == "completed"
            history = await handle.fetch_history()
            print(f"{ui_root}/namespaces/default/workflows/{handle.id}/{history.run_id}/timeline?sort=ascending")


if __name__ == "__main__":
    asyncio.run(main())

Poll-only run, grouping on. The collapsed wait is visible. The submission and URL rows are hidden.

Poll-only run with grouping on

Same run, grouping off. The submission and URL rows reappear, along with every poll and timer.

Poll-only run with grouping off

Workaround, every step grouped. All three rows are visible in grouped view. Submission and URL printing now have expandable wrappers.

Every step grouped

If you think this would be a useful enhancement, I’d be happy to put together a PR.

主要言語
TypeScript
スター
452
フォーク
208
平均マージ
1日 18時間
マージ済み PR(30日)
60

環境構築

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

temporalio/ui のほかの issue

temporalio/ui の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。