Skip to content

feat: execution trace gantt chart #2114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

viktorasm
Copy link

When debugging highly parallelized task executions, it's not immediately obvious where the bottlenecks are.

This PR allows dumping timings of the execution as Gantt chart (Mermaid syntax). Here's a sample of of a real-word invocation:

image

Having this makes it so much easier to understand, how well things parallelize, are tasks unnecessarily blocked, what are the major bottlenecks, etc.

Usage:

  • if user provides --execution-trace-output flag, then task invocation writes contents of the gantt chart to it.

@viktorasm viktorasm marked this pull request as draft March 11, 2025 14:10
@viktorasm viktorasm marked this pull request as ready for review March 11, 2025 14:43
@viktorasm viktorasm changed the title feature: execution trace gantt chart feat: execution trace gantt chart Mar 11, 2025
Copy link
Contributor

@trulede trulede left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be interesting a general technique.

For instance, a tracer could dump each tasks variables as tasks execute, making it much easier to debug Taskfiles.

@@ -0,0 +1,83 @@
package tracing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here perhaps an interface, and then implementation for the Mermaid tracer.

type Tracer interface {
    Start(task)
    Stop()
    ...
}

@@ -221,5 +225,9 @@ func WithExecutorOptions() task.ExecutorOption {
task.ExecutorWithTaskSorter(sorter),
task.ExecutorWithVersionCheck(true),
)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here, the same pattern as other executors should be used (above calls).

@@ -73,6 +73,8 @@ var (
Offline bool
ClearCache bool
Timeout time.Duration

ExecutionTraceOutput string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might it be possible to consider a more generic operation:

# Select one tracer or the other, with default options.
task default --tracer=mermaid
task default --tracer=csv

# Select a tracer and also provide some options, without adding additional CLI parameters.
task default --tracer="mermaid;filename=foo.out"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants