A tool to securely run jobs on Slurm clusters.
Project description
SecBatch
A CLI tool to simplify running jobs with encrypted data on a Slurm cluster. This tool automates key generation, data encryption, uploading, Slurm job submission, monitoring, and result retrieval.
Installation
Prerequisites
Before installing, you must have the following command-line tools available in your system's PATH:
- GnuPG (gpg): For encryption and decryption.
- zip: For compressing data.
You can typically install these using your system's package manager (e.g., apt-get, brew, yum).
Installing with uv
Once the prerequisites are met, you can install the tool from PyPI using uv:
uv pip install secbatch
This will install the tool and make the secbatch command available in your environment.
Usage
After installation, you can use the secbatch command directly.
Full Command Reference
secbatch --host <your-host> <command> [options]
Global Arguments:
--host: The SSH hostname or an alias from your~/.ssh/config.--user: (Optional) Your SSH username. Overrides the user in~/.ssh/config.--ssh-key-file: (Optional) Path to your SSH private key. Overrides theIdentityFilein~/.ssh/config. Defaults to~/.ssh/id_rsa.
Commands:
-
run: Execute the full secure workflow.--input-dir: The local directory containing your input data.--exec: The command to execute on the compute node.--script-file: Path to a local script file to execute.--output-dir: The local directory for results.--job-name: (Optional) A name for the Slurm job.- ... (and other Slurm parameters like
--nodes,--time, etc.)
-
test-connection: Test the SSH connection to the host. -
test-job: Submit a predefined example job to test the full workflow.
Example: Running a Job
secbatch --host my-cluster run \
--input-dir ./my-data \
--exec 'grep "sensitive" input/patient.txt > processed.txt' \
--output-dir ./results
For Developers
Building a Standalone Windows Executable
You can create a standalone .exe file for Windows that bundles the Python interpreter and all dependencies. This allows users to run the tool without a local Python installation, although GnuPG for Windows is still required.
-
Set up the project and install PyInstaller:
# Clone the repository git clone <repository-url> cd secbatch # Create a virtual environment and install dependencies uv venv source .venv/bin/activate uv pip install -r requirements.txt uv pip install pyinstaller
-
Run PyInstaller: The following command will create a single executable file in the
distdirectory.pyinstaller --onefile --name secbatch src/secbatch/main.py
-
Distribute: The resulting
dist/secbatch.execan be distributed to Windows users. Remind them to install Gpg4win to provide the requiredgpgdependency.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file secbatch-0.1.0.tar.gz.
File metadata
- Download URL: secbatch-0.1.0.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8cda606ac35f14a4657a5a11195c48de29d705dd0f6b2735885a5f5685ad799e
|
|
| MD5 |
8c7f95c3b219a8c0440e6eff1b4ff22b
|
|
| BLAKE2b-256 |
47ae3a60c24f2e77234b04492012803a4abbe96269e746942b71c4ddc564a495
|
File details
Details for the file secbatch-0.1.0-py3-none-any.whl.
File metadata
- Download URL: secbatch-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Manjaro Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11842d00e07f7a77d1a65cc4f6a975452d8ead600ef73a68f645fb979d0b750e
|
|
| MD5 |
cf286ca262806e6df962a3a9315ef3b6
|
|
| BLAKE2b-256 |
6a246a3adf6e83632bda90917a6e6ebc3d349fa5ec97825b14894bcb6c0b60e6
|