Skip to content

Capture workflow start and end times in WorkflowObject #337

Description

@renan-souza

Feature Request:

Problem Description

Currently, workflow execution durations (makespan) are calculated dynamically using the minimum started_at and maximum ended_at times across all its associated tasks. However, this dynamic calculation has several drawbacks:

  1. Inaccurate Makespan: It misses overhead occurring before the first task starts and after the last task finishes (e.g., orchestration overhead, message transport, garbage collection).
  2. Missing Tasks: If a workflow executes but fails to capture any tasks (or is a telemetry-only run), it is impossible to determine its duration.
  3. Query Overhead: Aggregating task-level timestamps to compute workflow duration requires expensive DB queries or pandas operations (e.g., grouping by workflow_id).

Proposed Solution

Introduce explicit started_at and ended_at timestamps to the WorkflowObject class and capture them via the with Flowcept(): context manager and controller APIs.

  1. Update WorkflowObject:
    Add started_at and ended_at fields to flowcept/src/flowcept/commons/flowcept_dataclasses/workflow_object.py.

  2. Track in Flowcept Controller:

    • Record the workflow start time when Flowcept.start() is called or when the context manager is entered.
    • Record the workflow end time when Flowcept.stop() is called.
    • Update/re-send the WorkflowObject at stopping time, or publish a final workflow status update message.

Reported by @brianetz

Metadata

Metadata

Assignees

No one assigned
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions