Skip to main content

A tool for visualizing nested task execution flows

Project description

flowshow logo

flowshow

Just a super thin wrapper for Python tasks that form a flow.

Installation

uv pip install flowshow

Usage

Flowshow provides a @task decorator that helps you track and visualize the execution of your Python functions. Here's how to use it:

import time
import random

from flowshow import task

# Turns a function into a Task, which tracks a bunch of stuff
@task
def my_function(x):
    time.sleep(0.5)
    return x * 2

# Tasks can also be configured to handle retries
@task(retry_on=ValueError, retry_attempts=10)
def might_fail():
    time.sleep(0.5)
    if random.random() < 0.5:
        raise ValueError("oh no, error!")
    return "done"

@task
def main_job():
    print("This output will be captured by the task")
    for i in range(3):
        my_function(10)
        might_fail()
    return "done"

# Run like you might run a normal function
main_job()

Once you run your function you can expect some nice visuals, like this one:

main_job.plot()

You can also inspect the raw data yourself by running:

main_job.last_run.to_dict()
Show the full dictionary. ``` { "task_name": "main_job", "start_time": "2025-02-04T21:25:17.045576+00:00", "duration": 8.864794875029474, "inputs": {}, "error": None, "retry_count": 0, "end_time": "2025-02-04T21:25:25.909997+00:00", "logs": "This output will be captured by the task\n", "output": "done", "subtasks": [ { "task_name": "my_function", "start_time": "2025-02-04T21:25:17.045786+00:00", "duration": 0.5050525842234492, "inputs": { "arg0": 10 }, "error": None, "retry_count": 0, "end_time": "2025-02-04T21:25:17.550808+00:00", "logs": "", "output": 20 }, { "task_name": "might_fail", "start_time": "2025-02-04T21:25:17.550853+00:00", "duration": 0.5053939162753522, "inputs": {}, "error": None, "retry_count": 0, "end_time": "2025-02-04T21:25:18.056233+00:00", "logs": "", "output": "done" }, { "task_name": "my_function", "start_time": "2025-02-04T21:25:18.056244+00:00", "duration": 0.5052881669253111, "inputs": { "arg0": 10 }, "error": None, "retry_count": 0, "end_time": "2025-02-04T21:25:18.561502+00:00", "logs": "", "output": 20 }, { "task_name": "might_fail", "start_time": "2025-02-04T21:25:18.561516+00:00", "duration": 2.1351009169593453, "inputs": {}, "error": None, "retry_count": 0, "end_time": "2025-02-04T21:25:20.696477+00:00", "logs": "", "output": "done" }, { "task_name": "my_function", "start_time": "2025-02-04T21:25:20.696511+00:00", "duration": 0.5026454580947757, "inputs": { "arg0": 10 }, "error": None, "retry_count": 0, "end_time": "2025-02-04T21:25:21.199158+00:00", "logs": "", "output": 20 }, { "task_name": "might_fail", "start_time": "2025-02-04T21:25:21.199213+00:00", "duration": 4.711003000382334, "inputs": {}, "error": None, "retry_count": 0, "end_time": "2025-02-04T21:25:25.909979+00:00", "logs": "", "output": "done" } ] } ```

You can also get a flat representation of the same data in a dataframe via:

main_job.to_dataframe()

This is what it looks like in Marimo when you evaluate this. Note that we also track the logs of the print statements for later inspection.

Multiple runs

If you run the function multiple times you can also inspect multiple runs:

main_job.runs

This can be useful, but most of the times you're probably interested in the last run.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flowshow-0.1.0.tar.gz (6.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flowshow-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file flowshow-0.1.0.tar.gz.

File metadata

  • Download URL: flowshow-0.1.0.tar.gz
  • Upload date:
  • Size: 6.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.27

File hashes

Hashes for flowshow-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c88d7e3c43f80e0cf520ae2c66a160fd281505a2d0005f4684c88c62523e71d
MD5 98e5115cbbb6038a14669f4649557fa3
BLAKE2b-256 6d56acb905e7c5bc7461cc3ed232a97090160f6cd920b2760d13b3d813c9b454

See more details on using hashes here.

File details

Details for the file flowshow-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: flowshow-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.27

File hashes

Hashes for flowshow-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 51a6eb64859facfec9b6f2efa8f25609ac367c87e84ffc6ce0868d4ae2dad5bb
MD5 51a313e49e2c9dc7a18ea2c42b7aa44c
BLAKE2b-256 d139fac8902bdc9fdd10a342c502cb399005249ff24b7f8b7c72fa5f36f5358c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page