{"id":15066756,"url":"https://github.com/ornl/flowcept","last_synced_at":"2025-07-30T15:20:23.050Z","repository":{"id":63046769,"uuid":"564107658","full_name":"ORNL/flowcept","owner":"ORNL","description":"Runtime data integration system that empowers any data processing system to capture and query workflow provenance using data observability.","archived":false,"fork":false,"pushed_at":"2024-12-09T21:57:24.000Z","size":54346,"stargazers_count":2,"open_issues_count":16,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-09T22:34:17.679Z","etag":null,"topics":["big-data","dask","data-integration","lineage","machine-learning","mlflow","model-management","parallel-processing","provenance","reproducibility","responsible-ai","scientific-workflows","tensorboard","trustworthy-ai","workflows"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"renan-souza/flowcept","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ORNL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-11-10T02:11:57.000Z","updated_at":"2024-11-28T01:53:52.000Z","dependencies_parsed_at":"2023-09-24T15:15:29.110Z","dependency_job_id":null,"html_url":"https://github.com/ORNL/flowcept","commit_stats":{"total_commits":488,"total_committers":5,"mean_commits":97.6,"dds":0.3073770491803278,"last_synced_commit":"66676f6543201fa0d88e28325f9bd551ba1b8533"},"previous_names":[],"tags_count":73,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORNL%2Fflowcept","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORNL%2Fflowcept/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORNL%2Fflowcept/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ORNL%2Fflowcept/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ORNL","download_url":"https://codeload.github.com/ORNL/flowcept/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229805132,"owners_count":18126808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["big-data","dask","data-integration","lineage","machine-learning","mlflow","model-management","parallel-processing","provenance","reproducibility","responsible-ai","scientific-workflows","tensorboard","trustworthy-ai","workflows"],"created_at":"2024-09-25T01:11:36.535Z","updated_at":"2025-07-30T15:20:23.033Z","avatar_url":"https://github.com/ORNL.png","language":"Jupyter Notebook","readme":"[![Documentation](https://img.shields.io/badge/docs-readthedocs.io-green.svg)](https://flowcept.readthedocs.io/)\n[![Build](https://github.com/ORNL/flowcept/actions/workflows/create-release-n-publish.yml/badge.svg)](https://github.com/ORNL/flowcept/actions/workflows/create-release-n-publish.yml)\n[![PyPI](https://badge.fury.io/py/flowcept.svg)](https://pypi.org/project/flowcept)\n[![Tests](https://github.com/ORNL/flowcept/actions/workflows/run-tests.yml/badge.svg)](https://github.com/ORNL/flowcept/actions/workflows/run-tests.yml)\n[![Code Formatting](https://github.com/ORNL/flowcept/actions/workflows/checks.yml/badge.svg?branch=dev)](https://github.com/ORNL/flowcept/actions/workflows/checks.yml)\n[![License: MIT](https://img.shields.io/github/license/ORNL/flowcept)](LICENSE)\n\n# Flowcept\n\n## Table of Contents\n\n- [Overview](#overview)\n- [Features](#features)\n- [Installation](#installation)\n- [Setup and the Settings File](#setup)\n- [Running with Containers](#running-with-containers)\n- [Examples](#examples)\n- [Data Persistence](#data-persistence)\n- [Performance Tuning](#performance-tuning-for-performance-evaluation)\n- [AMD GPU Setup](#install-amd-gpu-lib)\n- [Further Documentation](#documentation)\n\n## Overview\n\nFlowcept is a runtime data integration system that captures and queries workflow provenance with minimal or no code changes. It unifies data from diverse workflows and tools, enabling integrated analysis and insights, especially in federated environments. \n\nDesigned for scenarios involving critical data from multiple workflows, Flowcept supports end-to-end monitoring, analysis, querying, and enhanced support for Machine Learning (ML) workflows.\n\n## Features\n\n- Automatic workflow provenance data capture from heterogeneous workflows\n- Data observability with no or minimal intrusion to application workflows\n- Explicit application instrumentation, if this is preferred over data observability\n- ML data capture in various levels of details: workflow, model fitting or evaluation task, epoch iteration, layer forwarding\n- ML model management (e.g., model storage and retrieval, along with their metadata and provenance)\n- Adapter-based, loosely-coupled system architecture, making it easy to plug and play with different data processing systems and backend database (e.g., MongoDB) or MQ services (e.g., Redis, Kafka)\n- Low-overhead focused system architecture, to avoid adding performance overhead particularly to workloads that run on HPC machines\n- Telemetry data capture (e.g., CPU, GPU, Memory consumption) linked to the application dataflow\n- Highly customizable to multiple use cases, enabling easy toggle between settings (e.g., with/without provenance capture; with/without telemetry and which telemetry type to capture; which adapters or backend services to run with) \n- [W3C PROV](https://www.w3.org/TR/prov-overview/) adherence\n \nNotes:\n\n- Currently implemented data observability adapters:\n  - MLFlow\n  - Dask\n  - TensorBoard\n- Python scripts can be easily instrumented via `@decorators` using `@flowcept_task` (for generic Python method) or `@torch_task` (for methods that encapsulate PyTorch model manipulation, such as training or evaluation). \n- Currently supported MQ systems:\n  - [Kafka](https://kafka.apache.org)\n  - [Redis](https://redis.io)\n  - [Mofka](https://mofka.readthedocs.io)\n- Currently supported database systems:\n  - MongoDB\n  - Lightning Memory-Mapped Database (lightweight file-only database system)\n\nExplore [Jupyter Notebooks](notebooks) and [Examples](examples) for usage.\n\nRefer to [Contributing](CONTRIBUTING.md) for adding new adapters. Note: The term \"plugin\" in the codebase is synonymous with \"adapter,\" and future updates will standardize terminology.\n\n# Installation\n\nFlowcept can be installed in multiple ways, depending on your needs.\n\n### 1. Default Installation\nTo install Flowcept with its basic dependencies from [PyPI](https://pypi.org/project/flowcept/), run:\n\n```\npip install flowcept\n```\n\nThis installs the core Flowcept package but does **not** include MongoDB or any adapter-specific dependencies.\n\n\n\n### 2. Installing Specific Adapters and Additional Dependencies\nTo install extra dependencies required for specific adapters or features, use:\n\n```\npip install flowcept[mongo]         # Install Flowcept with MongoDB support.\npip install flowcept[mlflow]        # Install MLflow adapter.\npip install flowcept[dask]          # Install Dask adapter.\npip install flowcept[tensorboard]   # Install TensorBoard adapter.\npip install flowcept[kafka]         # Use Kafka as the MQ instead of Redis.\npip install flowcept[nvidia]        # Capture NVIDIA GPU runtime information.\npip install flowcept[analytics]     # Enable extra analytics features.\npip install flowcept[dev]           # Install Flowcept's developer dependencies.\n```\n\n### 3. Install All Optional Dependencies at Once\nIf you want to install all optional dependencies, use:\n\n```\npip install flowcept[all]\n```\n\nThis is useful mostly for Flowcept developers. Please avoid installing like this if you can, as it may install several dependencies you will never use.\n\n### 4. Installing from Source\nTo install Flowcept from the source repository:\n\n```\ngit clone https://github.com/ORNL/flowcept.git\ncd flowcept\npip install .\n```\n\nYou can also install specific dependencies using:\n\n```\npip install .[dependency_name]\n```\n\nThis follows the same pattern as step 2, allowing for a customized installation from source.\n\n# Setup\n\n### Start the MQ System:\n\nTo use Flowcept, one needs to start a MQ system `$\u003e make services`. This will start up Redis but see other options in the [deployment](deployment) directory and see [Data Persistence](#data-persistence) notes below.\n\n### Flowcept Settings File\n\nFlowcept requires a settings file for configuration. \nYou can find an example configuration file [here](resources/sample_settings.yaml), with documentation for each parameter provided as inline comments.\n\n#### What You Can Configure:\n\n- Message queue and database routes, ports, and paths;\n- Buffer sizes and flush settings;\n- Telemetry data capture settings;\n- Instrumentation and PyTorch details;\n- Log levels;\n- Data observability adapters; and more.\n\n#### How to use a custom settings file:\n\nCreate or modify your settings file based on the [example](resources/sample_settings.yaml).\n\nSet the `FLOWCEPT_SETTINGS_PATH` environment variable to its absolute path:\n```sh\nexport FLOWCEPT_SETTINGS_PATH=/absolute/path/to/your/settings.yaml\n```\n\nIf this variable is not set, Flowcept will use the default values from the [example](resources/sample_settings.yaml) file.\n\n# Running with Containers\n\nTo use containers instead of installing Flowcept's dependencies on your host system, we provide a [Dockerfile](deployment/Dockerfile) alongside a [docker-compose.yml](deployment/compose.yml) for dependent services (e.g., Redis, MongoDB).  \n\n#### Notes:  \n- As seen in the steps below, there are [Makefile](Makefile) commands to build and run the image. Please use them instead of running the Docker commands to build and run the image.\n- The Dockerfile builds from a local `miniconda` image, which will be built first using the [build-image.sh](deployment/build-image.sh) script.  \n- All dependencies for all adapters are installed, increasing build time. Edit the Dockerfile to customize dependencies based on our [pyproject.toml](pyproject.toml) to reduce build time if needed.  \n\n#### Steps:\n\n1. Build the Docker image:  \n    ```bash\n    make build\n    ```\n\n2. Start dependent services:\n    ```bash\n    make services\n    ```\n\n3. Run the image interactively:\n    ```bash\n    make run\n    ```\n\n4. Optionally, run Unit tests in the container:\n    ```bash\n    make tests-in-container\n    ```\n# Examples\n\n### Adapters and Notebooks\n\n See the [Jupyter Notebooks](notebooks) and [Examples directory](examples) for utilization examples.\n\n\n### Simple Example with Decorators Instrumentation\n\nIn addition to existing adapters to Dask, MLFlow, and others (it's extensible for any system that generates data), Flowcept also offers instrumentation via @decorators. \n\n```python \nfrom flowcept import Flowcept, flowcept_task\n\n@flowcept_task\ndef sum_one(n):\n    return n + 1\n\n\n@flowcept_task\ndef mult_two(n):\n    return n * 2\n\n\nwith Flowcept(workflow_name='test_workflow'):\n    n = 3\n    o1 = sum_one(n)\n    o2 = mult_two(o1)\n    print(o2)\n\nprint(Flowcept.db.query(filter={\"workflow_id\": Flowcept.current_workflow_id}))\n```\n\n## Data Persistence\n\nFlowcept uses an ephemeral message queue (MQ) with a pub/sub system to flush observed data. For optional data persistence, you can choose between:\n\n- [LMDB](https://lmdb.readthedocs.io/) (default): A lightweight, file-based database requiring no external services (but note it might require `gcc`). Ideal for simple tests or cases needing basic data persistence without query capabilities. Data stored in LMDB can be loaded into tools like Pandas for complex analysis. Flowcept's database API provides methods to export data in LMDB into Pandas DataFrames.\n- [MongoDB](https://www.mongodb.com/): A robust, service-based database with advanced query capabilities. Required to use Flowcept's Query API (i.e., `flowcept.Flowcept.db`) to run more complex queries and other features like ML model management or runtime queries (i.e., query while writing). To use MongoDB, initialize the service with `make services-mongo`.\n\nFlowcept supports writing to both databases simultaneously (default configuration), individually, or to neither, depending on configuration.\n\nIf data persistence is disabled, captured data is sent to the MQ without any default consumer subscribing to persist it. In this case, querying the data requires creating a custom consumer to subscribe to the MQ.\n\nHowever, for querying, Flowcept Database API uses only one at a time. If both are enabled, Flowcept defaults to MongoDB. If neither is enabled, an error will occur.\n\nData stored in MongoDB and LMDB are interchangeable. You can switch between them by transferring data from one to the other as needed.\n\n## Performance Tuning for Performance Evaluation\n\nIn the settings.yaml file, many variables may impact interception efficiency. \nPlease be mindful of the following parameters:\n\n* `mq`\n    - `buffer_size` and `insertion_buffer_time_secs`. -- `buffer_size: 1` is really bad for performance, but it will give the most up-to-date info possible to the MQ.\n    \n* `log`\n    - set both stream and files to disable\n\n* `telemetry_capture` \n  The more things you enable, the more overhead you'll get. For GPU, you can turn on/off specific metrics.\n\n* `instrumentation`\n  This will configure whether every single granular step in the model training process will be captured. Disable very granular model inspection and try to use more lightweight methods. There are commented instructions in the settings.yaml sample file.\n\nOther thing to consider:\n\n```\nproject:\n  replace_non_json_serializable: false # Here it will assume that all captured data are JSON serializable\n  db_flush_mode: offline               # This disables the feature of runtime analysis in the database.\nmq:\n  chunk_size: -1                       # This disables chunking the messages to be sent to the MQ. Use this only if the main memory of the compute notes is large enough.\n```\n\nOther variables depending on the adapter may impact too. For instance, in Dask, timestamp creation by workers add interception overhead. As we evolve the software, other variables that impact overhead appear and we might not stated them in this README file yet. If you are doing extensive performance evaluation experiments using this software, please reach out to us (e.g., create an issue in the repository) for hints on how to reduce the overhead of our software.\n\n## Install AMD GPU Lib\n\nThis section is only important if you want to enable GPU runtime data capture and the GPU is from AMD. NVIDIA GPUs don't need this step.\n\nFor AMD GPUs, we rely on the official AMD ROCM library to capture GPU data.\n\nUnfortunately, this library is not available as a pypi/conda package, so you must manually install it. See instructions in the link: https://rocm.docs.amd.com/projects/amdsmi/en/latest/\n\nHere is a summary:\n\n1. Install the AMD drivers on the machine (check if they are available already under `/opt/rocm-*`).\n2. Suppose it is /opt/rocm-6.2.0. Then, make sure it has a share/amd_smi subdirectory and pyproject.toml or setup.py in it.\n3. Copy the amd_smi to your home directory: `cp -r /opt/rocm-6.2.0/share/amd_smi ~`\n4. cd ~/amd_smi\n5. In your python environment, do a pip install .\n\nCurrent code is compatible with this version: amdsmi==24.7.1+0012a68\nWhich was installed using Frontier's /opt/rocm-6.3.1/share/amd_smi\n\n## Torch Dependencies\n\nSome unit tests utilize `torch==2.2.2`, `torchtext=0.17.2`, and `torchvision==0.17.2`. They are only really needed to run some tests and will be installed if you run `pip install flowcept[ml_dev]` or `pip install flowcept[all]`. If you want to use Flowcept with Torch, please adapt torch dependencies according to your project's dependencies.\n\n## Documentation\n\nFull documentation is available on [Read the Docs](https://flowcept.readthedocs.io/).\n\n## Cite us\n\nIf you used Flowcept in your research, consider citing our paper.\n\n```\nTowards Lightweight Data Integration using Multi-workflow Provenance and Data Observability\nR. Souza, T. Skluzacek, S. Wilkinson, M. Ziatdinov, and R. da Silva\n19th IEEE International Conference on e-Science, 2023.\n```\n\n**Bibtex:**\n\n```latex\n@inproceedings{souza2023towards,  \n  author = {Souza, Renan and Skluzacek, Tyler J and Wilkinson, Sean R and Ziatdinov, Maxim and da Silva, Rafael Ferreira},\n  booktitle = {IEEE International Conference on e-Science},\n  doi = {10.1109/e-Science58273.2023.10254822},\n  link = {https://doi.org/10.1109/e-Science58273.2023.10254822},\n  pdf = {https://arxiv.org/pdf/2308.09004.pdf},\n  title = {Towards Lightweight Data Integration using Multi-workflow Provenance and Data Observability},\n  year = {2023}\n}\n\n```\n\n## Disclaimer \u0026 Get in Touch\n\nPlease note that this a research software. We encourage you to give it a try and use it with your own stack. We are continuously working on improving documentation and adding more examples and notebooks, but we are continuously improving documentation and examples. If you are interested in working with Flowcept in your own scientific project, we can give you a jump start if you reach out to us. Feel free to [create an issue](https://github.com/ORNL/flowcept/issues/new), [create a new discussion thread](https://github.com/ORNL/flowcept/discussions/new/choose) or drop us an email (we trust you'll find a way to reach out to us :wink:).\n\n## Acknowledgement\n\nThis research uses resources of the Oak Ridge Leadership Computing Facility at the Oak Ridge National Laboratory, which is supported by the Office of Science of the U.S. Department of Energy under Contract No. DE-AC05-00OR22725.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fornl%2Fflowcept","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fornl%2Fflowcept","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fornl%2Fflowcept/lists"}