A streaming system that processes log files line-by-line using a rule-based processor with optional multiprocessing execution.
Each line is transformed using the first matching rule:
- LINE_NUMBER % 5 == 0 → "Multiple of 5"
- Contains
$→ replace spaces with_ - Ends with
.→ return trimmed original line - Starts with
{→ JSON parse + add"even"flag - Otherwise → "Nothing to display"
Only the first matching rule applies.
- Executor: streaming execution layer handling both sequential and multiprocessing strategies.
- Processor: stateless domain component implementing line transformation rules.
- main: composition root responsible for CLI, runtime configuration, wiring, and logging.
- Sequential streaming
- Deterministic ordering
- Low overhead execution path
multiprocessing.Poolimap_unordered- Chunked scheduling (
chunksize)
- Streaming-first: processes input incrementally without full file materialization
- Stateless processing: each line is independent and safely parallelizable
- Explicit concurrency boundary: multiprocessing isolated in infrastructure layer
- Failure isolation: processing errors mapped to explicit sentinel results (no pipeline crash)
- Minimal abstraction surface: avoids unnecessary layering complexity
- Separation of concerns:
- execution & concurrency → infrastructure layer
- business rules → domain layer
- wiring & runtime config → entrypoint
src/skillcorner/
├── app/ → Entry point
│ ├── main.py
│
│
├── application/ → Application logic (line processing rules)
│ └── line_processor.py → Rule-based line processing engine
│
├── domain/ → Core contracts (business interfaces only)
│ └── line_processor_interface.py
entities.py → Domain entities (e.g. LineResult)
│
├── infrastructure/ → Execution engine (I/O, streaming, multiprocessing)
│ └── executor.py
│
└── tests/ → Test strategy by architectural layer
├── domain/ → Unit tests for line processing rules
├── infrastructure/ → Behavioral tests for execution engine
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip setuptools wheel
python -m pip install -e .pytest -qruff check .
ruff format --check .
ruff format .
mypy srcThe application runs in two modes depending on workload size or user input.
Executes the pipeline in a single process. Used for small files or when multiprocessing is disabled.
python src/skillcorner/app/main.py data.logUses multiple processes to parallelize line processing. Enabled manually or automatically for large inputs.
python src/skillcorner/app/main.py data.log --multiprocessA helper script can be used to generate large input files for performance testing: bash
python scripts/generate_big_file.pyThen:
python src/skillcorner/app/main.py huge_data.log- Processor (application layer): deterministic unit tests covering rule evaluation, precedence, and output contract for each transformation case.
- Executor (infrastructure layer):behavioral tests validating streaming correctness, execution consistency, concurrency modes, and line-level error isolation, with ordering guarantees in single-process and relaxed ordering in multiprocess.
The CI pipeline is designed as a strict quality gate per layer: build, lint, and tests are fully separated into independent jobs. This choice enforces early failure detection, ensuring that no unvalidated code reaches the main branch.
The system exposes a minimal, structured observability layer based on batch-level logging.
2026-05-17 20:55:50,178 | INFO | skillcorner.infrastructure.executor | StreamingExecutor initialized mode=multiprocess
2026-05-17 20:55:50,178 | INFO | root | starting processing file=huge_data.log multiprocess=True
2026-05-17 20:55:50,243 | INFO | root | starting multiprocessing pool workers=7
2026-05-17 20:55:54,124 | INFO | root | processed=1000000 failed=0 throughput=61026.19 lines/sec