Skip to main content

Identify the bottleneck of your Kedro Pipeline quickly

Project description

kedro-profile

Identify the bottleneck of your Kedro Pipeline quickly with kedro-profile

Example

You will see something similar to this when running the plugin with spaceflight project:

==========Node Summary==========
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Node Name                     ┃ Loading Time(s) ┃ Node Compute Time(s) ┃ Saving Time(s) ┃ Total Time(s) ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ preprocess_shuttles_node      │ 1.65            │ 0.01                 │ 0.01           │ 1.68          │
│ create_model_input_table_node │ 0.01            │ 0.03                 │ 0.02           │ 0.06          │
│ preprocess_companies_node     │ 0.01            │ 0.01                 │ 0.02           │ 0.03          │
└───────────────────────────────┴─────────────────┴──────────────────────┴────────────────┴───────────────┘

==========Dataset Summary==========
┏━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┓
┃ Dataset Name           ┃ Loading Time(s) ┃ Load Count ┃ Saving Time(s) ┃ Save Count ┃ Total Time(s) ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━┩
│ preprocessed_shuttles  │ 0.02            │ 1.0        │ 0.01           │ 1.0        │ 0.03          │
│ preprocessed_companies │ 0.0             │ 1.0        │ 0.02           │ 1.0        │ 0.02          │
│ companies              │ 0.01            │ 1.0        │ nan            │ nan        │ nan           │
│ shuttles               │ 1.65            │ 1.0        │ nan            │ nan        │ nan           │
│ reviews                │ 0.01            │ 1.0        │ nan            │ nan        │ nan           │
│ model_input_table      │ nan             │ nan        │ 0.02           │ 1.0        │ nan           │
└────────────────────────┴─────────────────┴────────────┴────────────────┴────────────┴───────────────┘

Requirements

kedro>=0.18
pandas>=1.0.0

Get Started

If you do not have kedro installed already, install kedro with: pip install kedro

Then create an example project with this command: kedro new --example=yes --tools=none --name kedro-profile-example

If you are cloning the repository, the project is already created here

This will create a new directory kedro-profile-example in your current directory.

Enable the Profiling Hook

You will find this line in settings.py, update it as follow:

- # HOOKS = (ProjectHooks(),)
+ from kedro_profile import ProfileHook
+ HOOKS = (ProfileHook(),)

Example

There is an example notebook in the repository:

How to extend & Contribute?

The implementation is in a single hook, you can always copy this hook and modified it for your need.

Kedro Hooks

Kedro use the concept of Hook for extension, you can find more details in Introduction to Hools. To find out which arguments are supported for a specific hook, you can refer to the Hook Specification

Contribution

PR & issue is very welcomed if you want to contribute the changes upstream.

Limitations

Currently it doesn't support ParallRunner and ThreadRunner yet because it is not thread-safe.

Versioning

Expect a not so stable release for the time being. If the plugin stablised it will be using semantic versioning. For now all the release will be 0.0.x

Environment variable

  • KEDRO_PROFILE_RICH, the plugin try to detect rich automatically, if the value is set, it will print profiling result using rich for color console printing. Disable this either by uninstalling rich or set this to 0.
  • KEDRO_PROFILE_DISABLE, by default the value is not set. If you need to programatically disable the profiling hook, you can set this to "1".

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

kedro_profile-0.0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

kedro_profile-0.0.1-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file kedro_profile-0.0.1.tar.gz.

File metadata

  • Download URL: kedro_profile-0.0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.16.1 CPython/3.10.14 Darwin/23.6.0

File hashes

Hashes for kedro_profile-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6e006c0229d711c421c8389b3ea0e22905385df7cde8063c8ab8cc50c2be23d8
MD5 56eaff55f4f4c2cd0c8fc3c6f94e5206
BLAKE2b-256 a28a68873c934d4f1ad399dc69d480fc7bff963d401054de5b1bae14afc688d4

See more details on using hashes here.

File details

Details for the file kedro_profile-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: kedro_profile-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.16.1 CPython/3.10.14 Darwin/23.6.0

File hashes

Hashes for kedro_profile-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 16ef1ac1f5faaa80ed01340b5022b3f0ee21c8abed081e603a9439f95f018365
MD5 bdbb8dd6c94ada354dc94a4e1e1f65d3
BLAKE2b-256 fc3a5aa6565c28ae73ed7c97a9964c2b150510994a033d1f255db34f273d94c5

See more details on using hashes here.

Supported by

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