Repository navigation
Description
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:
- Submit cloud job
- Print cloud job URL
- 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-groupedputs 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-groupedshows 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-assetsSave 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.pyMinimal 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.
Same run, grouping off. The submission and URL rows reappear, along with every poll and timer.
Workaround, every step grouped. All three rows are visible in grouped view. Submission and URL printing now have expandable wrappers.
If you think this would be a useful enhancement, I’d be happy to put together a PR.



Activity