Flowcept is a runtime data integration system that captures and queries workflow provenance with minimal or no code changes. It unifies data across diverse workflows and tools, enabling integrated analysis and insights, especially in federated environments. Designed for scenarios involving critical data from multiple workflows, Flowcept seamlessly integrates data at runtime, providing a unified view for end-to-end monitoring and analysis, and enhanced support for Machine Learning (ML) workflows.
Other capabilities include:
- Automatic multi-workflow provenance data capture;
- Data observability, enabling minimal intrusion to user workflows;
- Explicit user workflow instrumentation, if this is preferred over implicit data observability;
- ML data capture in various levels of details: workflow, model fitting or evaluation task, epoch iteration, layer forwarding;
- ML model management;
- 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);
- Low-overhead focused system architecture, to avoid adding performance overhead particularly to workloads that run on HPC machines;
- Telemetry data capture (e.g., CPU, GPU, Memory consumption) linked to the application dataflow;
- 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);
- W3C PROV adherence;
Notes:
- Currently implemented data observability adapters:
- MLFlow
- Dask
- TensorBoard
- 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). - Currently supported MQ systems:
- Kafka
- Redis
- Currently supported database systems:
- MongoDB
- Lightning Memory-Mapped Database (lightweight file-only database system)
Explore Jupyter Notebooks and Examples for usage.
Refer to Contributing for adding new adapters. Note: The term "plugin" in the codebase is synonymous with "adapter," and future updates will standardize terminology.
Flowcept can be installed in multiple ways, depending on your needs.
To install Flowcept with its basic dependencies from PyPI, run:
pip install flowcept
This installs the core Flowcept package but does not include MongoDB or any adapter-specific dependencies.
To install extra dependencies required for specific adapters or features, use:
pip install flowcept[mongo] # Install Flowcept with MongoDB support.
pip install flowcept[mlflow] # Install MLflow adapter.
pip install flowcept[dask] # Install Dask adapter.
pip install flowcept[tensorboard] # Install TensorBoard adapter.
pip install flowcept[kafka] # Use Kafka as the MQ instead of Redis.
pip install flowcept[nvidia] # Capture NVIDIA GPU runtime information.
pip install flowcept[analytics] # Enable extra analytics features.
pip install flowcept[dev] # Install Flowcept's developer dependencies.
If you want to install all optional dependencies, use:
pip install flowcept[all]
This is a convenient way to ensure all adapters are available, but it may install dependencies you don't need.
To install Flowcept from the source repository:
git clone https://github.com/ORNL/flowcept.git
cd flowcept
pip install .
You can also install specific dependencies using:
pip install .[dependency_name]
This follows the same pattern as step 2, allowing for a customized installation from source.
To use Flowcept, one needs to start a MQ system $> make services
. This will start up Redis but see other options in the deployment directory and see Data Persistence notes below.
Flowcept requires a settings file for configuration. You can find an example here.
- Message queue and database routes, ports, and paths;
- Buffer sizes and flush settings;
- Telemetry data capture settings;
- Instrumentation and PyTorch details;
- Log levels;
- Data observability adapters; and more.
Create or modify your settings file based on the example.
Set the FLOWCEPT_SETTINGS_PATH
environment variable to its absolute path:
export FLOWCEPT_SETTINGS_PATH=/absolute/path/to/your/settings.yaml
If this variable is not set, Flowcept will use the default values from the example file.
To use containers instead of installing Flowcept's dependencies on your host system, we provide a Dockerfile alongside a docker-compose.yml for dependent services (e.g., Redis, MongoDB).
- As seen in the steps below, there are Makefile commands to build and run the image. Please use them instead of running the Docker commands to build and run the image.
- The Dockerfile builds from a local
miniconda
image, which will be built first using the build-image.sh script. - All dependencies for all adapters are installed, increasing build time. Edit the Dockerfile to customize dependencies based on our pyproject.toml to reduce build time if needed.
-
Build the Docker image:
make build
-
Start dependent services:
make services
-
Run the image interactively:
make run
-
Optionally, run Unit tests in the container:
make tests-in-container
See the Jupyter Notebooks and Examples directory for utilization examples.
In addition to existing adapters to Dask, MLFlow, and others (it's extensible for any system that generates data), Flowcept also offers instrumentation via @decorators.
from flowcept import Flowcept, flowcept_task
@flowcept_task
def sum_one(n):
return n + 1
@flowcept_task
def mult_two(n):
return n * 2
with Flowcept(workflow_name='test_workflow'):
n = 3
o1 = sum_one(n)
o2 = mult_two(o1)
print(o2)
print(Flowcept.db.query(filter={"workflow_id": Flowcept.current_workflow_id}))
Flowcept uses an ephemeral message queue (MQ) with a pub/sub system to flush observed data. For optional data persistence, you can choose between:
- LMDB (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. - MongoDB: 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 withmake services-mongo
.
Flowcept supports writing to both databases simultaneously (default configuration), individually, or to neither, depending on configuration.
If 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.
However, 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.
Data stored in MongoDB and LMDB are interchangeable. You can switch between them by transferring data from one to the other as needed.
In the settings.yaml file, many variables may impact interception efficiency. For fastest performance, configure the settings.yaml:
project:
replace_non_json_serializable: false # Here it will assume that all captured data are JSON serializable
db_flush_mode: offline # This disables the feature of runtime analysis in the database.
mq:
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.
And use the most lightweight capture option available for the adapter or instrumentation.
Other 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.
This 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.
For AMD GPUs, we rely on the official AMD ROCM library to capture GPU data.
Unfortunately, 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/
Here is a summary:
- Install the AMD drivers on the machine (check if they are available already under
/opt/rocm-*
). - 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.
- Copy the amd_smi to your home directory:
cp -r /opt/rocm-6.2.0/share/amd_smi ~
- cd ~/amd_smi
- In your python environment, do a pip install .
Current code is compatible with this version: amdsmi==24.7.1+0012a68 Which was installed using Frontier's /opt/rocm-6.3.1/share/amd_smi
Some 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.
If you used Flowcept in your research, consider citing our paper.
Towards Lightweight Data Integration using Multi-workflow Provenance and Data Observability
R. Souza, T. Skluzacek, S. Wilkinson, M. Ziatdinov, and R. da Silva
19th IEEE International Conference on e-Science, 2023.
Bibtex:
@inproceedings{souza2023towards,
author = {Souza, Renan and Skluzacek, Tyler J and Wilkinson, Sean R and Ziatdinov, Maxim and da Silva, Rafael Ferreira},
booktitle = {IEEE International Conference on e-Science},
doi = {10.1109/e-Science58273.2023.10254822},
link = {https://doi.org/10.1109/e-Science58273.2023.10254822},
pdf = {https://arxiv.org/pdf/2308.09004.pdf},
title = {Towards Lightweight Data Integration using Multi-workflow Provenance and Data Observability},
year = {2023}
}
Please 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, create a new discussion thread or drop us an email (we trust you'll find a way to reach out to us 😉).
This 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.