Skip to main content

Kafka Slurm Agent logo

Kafka Slurm Agent

The Kafka Slurm Agent is a distributed computing and stream processing engine that can be used to run python code across multiple SLURM managed HPC clusters or individual workstations. It uses Kafka (3.x) to asynchronously communicate with agents installed on clusters and workstations. It contains a monitoring tool with a Web JSON API and a job submitter. It is a pure Python implementation using faust stream processing

Installation.

Use the standard pip tool to install. The recommended way is to use a Python virtual environment:

python3 -m venv venv

source venv/bin/activate

pip install kafka-slurm-agent

Quick User Guide

Create a new project

In the folder in which you created the venv subfolder run the following command:

kafka-slurm create-project --folder .

This will generate the following files:

  1. kafkaslurm_cfg.py - the configuration file
  2. Startup scripts for worker-agent, cluster-agent and monitor-agent
  3. An example file to run your code (run.py)
  4. The job submitter example (submitter.py)
  5. The class that can be optionally used to override the existing implementation of the worker-agent (my_worker_agent.py)

Configuration

Please adjust the config file. The config file name can be also injected using the KSA_CONFIG_FILE environment variable

  1. Modify the configuration of the connection to Apache Kafka. The default one assumes that kafka is running on localhost and default port (9092) and doesn't use authentication or SSL. In the comments you will find parameters necessary to connect to Kafka configured using SASL and plaintext password. If you use this type of connection please uncomment also the line that starts with: # KAFKA_FAUST_BROKER_CREDENTIALS
  2. Make sure that PREFIX points to the location of your project
  3. Change the names of topics used for your project to avoid any conflict with projects sharing the same kafka instance.
  4. If you want to use a SLURM cluster please change the job CLUSTER_JOB_NAME_SUFFIX = '_KSA' to avoid conflicts with other projects running on your slurm cluster. The jobs managed by cluster-agent will be named "JOBID_SUFFIX" where the JOBID is the identifier that you assign when submitting a job and SUFFIX is handled by this configuration parameter.

For a full list of configuration parameters refer to the documentation.

Creating topics on Kafka with appropriate partitions

Use the built-in command kafka-slurm to create topics. You should set the --new-topic-partitions paramter to at least the number of planned clusters and workstations that will be used simultaneously. For example:

kafka-slurm --new-topic-partitions 4 topics-create

Implement your code

An example of a script that you can implement is generated in run.py

Submitting jobs

Once this is ready, you can test your project locally:

  1. Open a new terminal and start the worker-agent (./start_worker_agent)
  2. Open a new terminal and start the monitor-agent (./start_monitor_agent)
  3. Submit new jobs using the submitter.py

You can monitor the execution by opening http://localhost:6067/mon/stats/ on the host on which you've started the monitor-agent.

Kafka

For development and testing purposes, you can use Kafka in Docker:

docker run -d -p 9092:9092 --name broker apache/kafka:3.9.1

Demo project

You can download and directly run a demonstration project: https://github.com/ilbsm/ksa_demo

Limitations

Due to the underlying libraries (faust-streaming and it's dependency: aiokafka) currently Kafka 4.0 is not supported.

Cite

If you use Kafka Slurm Agent in your research, please cite:

Applying Large-Scale Distributed Computing to Structural Bioinformatics -- Bridging Legacy HPC Clusters with Big Data Technologies using kafka-slurm-agent

You can also read more about the motivation and applications of this tool.

Metadata

Release files for kafka-slurm-agent 1.5.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kafka-slurm-agent 1.5.4
File Size Uploaded Provenance Actions
kafka_slurm_agent-1.5.4.tar.gz 30.8 kB With provenance Details for kafka_slurm_agent-1.5.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kafka-slurm-agent 1.5.4
File Interpreter ABI Platform Actions
kafka_slurm_agent-1.5.4-py3-none-any.whl Python 3 none any Details for kafka_slurm_agent-1.5.4-py3-none-any.whl

Total release size: 65.1 kB

Release files / kafka_slurm_agent-1.5.4.tar.gz

Download URL kafka_slurm_agent-1.5.4.tar.gz
Size 30.8 kB
Tags Source
SHA-256 checksum
How to use checksums
9fa2780ba0a9a4fa2767bd9244a1ecfdebfb0c38a7670b080eb6ed73fed66b21
BLAKE2b-256 checksum
How to use checksums
7267166d9daf27072b9c4f88889a67d3321d03533323ee345d4b1d73081b9e1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Release files / kafka_slurm_agent-1.5.4-py3-none-any.whl

Download URL kafka_slurm_agent-1.5.4-py3-none-any.whl
Size 34.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fceb7d83bf168eba299c19e750c55a5c048bd47f72ae0c9a60cbd0eeb4489a36
BLAKE2b-256 checksum
How to use checksums
77cbf4fa986be4ab92b1daf40133624d78ed4320dddcb17bda8225e9bb29acdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

Security for kafka-slurm-agent 1.5.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kafka_slurm_agent-1.5.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.5.4 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page