partake
Shard input to persistent parallel jobs at the rate of a pipe.
Example
seq 0 10000000 | partake -n 10 'cat'
Install
CLI version:
pip install partake
With development dependencies:
pip install partake[dev]
Recipes
Split a SAM/BAM/CRAM file into 2 .bam chunks.
samtools view input.bam | partake -n 2 -s 1 -o {id}.bam "bash -c 'cat <(samtools view -H input.bam) - | samtools view -b'"
Here, we convert the input to SAM (plaintext) and pipe the records to stdin. We use the -s 1 option to ensure that lines are not truncated. In the command, we prepend the header to each worker's input record stream and convert back to bam. Output is 0.bam and 1.bam.
Read global line indexes within a custom Python script:
report.py
import os
import sys
read_fd = os.environ.get("PARTAKE_LINE_NUMBERS")
if read_fd is not None:
read_fd = int(read_fd)
line_numbers = os.fdopen(read_fd, buffering=1)
for line_number, data_line in zip(line_numbers, sys.stdin):
print("Line number: ", line_number.strip(), "Data line: ", data_line.strip())
seq 1000 10000000 | partake -n 2 -s 1 "python report.py"
head 0.out
Line number: 0 Data line: 1000
Line number: 1 Data line: 1001
Line number: 2 Data line: 1002
Line number: 3 Data line: 1003
Metadata
Release files for partake 0.5.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| partake-0.5.3.tar.gz | 7.6 kB | Without provenance | Details for partake-0.5.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| partake-0.5.3-py3-none-any.whl | Python 3 | none | any | Details for partake-0.5.3-py3-none-any.whl |
Total release size: 16.3 kB
Release files / partake-0.5.3.tar.gz
| Download URL | partake-0.5.3.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
509cb47bfbc0e10e64ebf1bb5c088057d895e0e84ac271267ef96b55e81cf8c0
|
|
BLAKE2b-256 checksum How to use checksums |
f18483b51f3ce374804077da3e250ef7e16d0d4b792b1d20987caf2ea2a4e4c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Release files / partake-0.5.3-py3-none-any.whl
| Download URL | partake-0.5.3-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
32ce44aabac8bafabf39550466a32ca1f74ddb9354887c171c86966ff485cc2c
|
|
BLAKE2b-256 checksum How to use checksums |
933c60042653533ba5a4bdb0638b0521e6f221e7ffcc3261d9df23bbf06de444
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Security for partake 0.5.3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.