Skip to main content

Running a distributed job processing documents with Docling.

Project description

Docling Jobkit

Running a distributed job processing documents with Docling.

How to use it

Local Multiprocessing CLI

The docling-jobkit-multiproc CLI enables parallel batch processing of documents using Python's multiprocessing. Each batch of documents is processed in a separate subprocess, allowing efficient parallel processing on a single machine.

Usage

# Basic usage with default settings (batch_size=10, num_processes=CPU count)
docling-jobkit-multiproc config.yaml

# Custom batch size and number of processes
docling-jobkit-multiproc config.yaml --batch-size 20 --num-processes 4

# With model artifacts
docling-jobkit-multiproc config.yaml --artifacts-path /path/to/models

# Quiet mode (suppress progress bar)
docling-jobkit-multiproc config.yaml --quiet

# Full options
docling-jobkit-multiproc config.yaml \
  --batch-size 30 \
  --num-processes 8 \
  --artifacts-path /path/to/models \
  --enable-remote-services \
  --allow-external-plugins

Configuration

The configuration file format is the same as docling-jobkit-local. See example configurations:

  • S3 source/target: dev/configs/run_multiproc_s3_example.yaml
  • Local path source/target: dev/configs/run_local_folder_example.yaml

Note: Only S3, Google Drive, and local_path sources support batch processing. File and HTTP sources do not support chunking.

CLI Options

  • --batch-size, -b: Number of documents to process in each batch (default: 10)
  • --num-processes, -n: Number of parallel processes (default: CPU count)
  • --artifacts-path: Path to model artifacts directory
  • --enable-remote-services: Enable models connecting to remote services
  • --allow-external-plugins: Enable loading modules from third-party plugins
  • --quiet, -q: Suppress progress bar and detailed output

Local Sequential CLI

The docling-jobkit-local CLI processes documents sequentially in a single process.

docling-jobkit-local config.yaml

Using Local Path Sources and Targets

Both CLIs support local file system sources and targets. Example configuration:

sources:
  - kind: local_path
    path: ./input_documents/
    recursive: true  # optional, default true
    pattern: "*.pdf"  # optional glob pattern

target:
  kind: local_path
  path: ./output_documents/

See dev/configs/run_local_folder_example.yaml for a complete example.

Kubeflow pipeline with Docling Jobkit

Using Kubeflow pipeline web dashboard UI

  1. From the main page, open "Pipelines" section on the left
  2. Press on "Upload pipeline" button at top-right
  3. Give pipeline a name and in "Upload a file" menu point to location of docling-jobkit/docling_jobkit/kfp_pipeline/docling-s3in-s3out.yaml file
  4. Now you can press "Create run" button at the top-right to create an instance of the pipeline
  5. Customize required inputs according to provided examples and press "Start" to start pipeline run

Using OpenshiftAI web dashboard UI

  1. From the main page of Red Hat Openshift AI open "Data Science Pipelines -> Pipelines" section on the left side
  2. Switch "Project" to namespace where you plan to run pipelines
  3. Press on "Import Pipeline", provide a name and upload the docling-jobkit/docling_jobkit/kfp_pipeline/docling-s3in-s3out.yaml file
  4. From the selected/created pipeline interface, you can start new run by pressing "Actions -> Create Run"
  5. Customize required inputs according to provided examples and press "Start" to start pipeline run

Customizing pipeline to specifics of your infrastructure

Some customizations, such as paralelism level, node selector or tollerations, require changing source script and compiling new yaml manifest. Source script is located at docling-jobkit/docling_jobkit/kfp_pipeline/docling-s3in-s3out.py.

If you use web UI to run pipelines, then python script need to be compiled into yaml and new version of yaml uploaded to pipeline. For example, you can use poetry to handle python environment and run following command:

uv run python semantic-ingest-batches.py

The yaml file will be generated in the local folder from where you execute command. Now in the web UI, you can open existing pipeline and upload new version of the script using "Upload version" at top-right.

By defaul, paralelism is set to 20 instances, this can be change in the source docling-jobkit/docling_jobkit/kfp_pipeline/docling-s3in-s3out.py script, look for this line with dsl.ParallelFor(batches.outputs["batch_indices"], parallelism=20) as subbatch:.

By default, the resources requests/limits for the document convertion component are set to following:

converter.set_memory_request("1G")
converter.set_memory_limit("7G")
converter.set_cpu_request("200m")
converter.set_cpu_limit("1")

By default, the resource request/limit are not set for the nodes with GPU, you can uncomment following lines in the inputs_s3in_s3out pipeline function to enable it:

converter.set_accelerator_type("nvidia.com/gpu")
converter.set_accelerator_limit("1")

The node selector and tollerations can be enabled with following commands, customize actual values to your infrastructure:

from kfp import kubernetes

kubernetes.add_node_selector(
  task=converter,
  label_key="nvidia.com/gpu.product",
  label_value="NVIDIA-A10",
)

kubernetes.add_toleration(
  task=converter,
  key="gpu_compute",
  operator="Equal",
  value="true",
  effect="NoSchedule",
)

Running pipeline programatically

At the end of the script file you can find an example code for submitting pipeline run programatically. You can provide your custom values as environment variables in an .env file and bind it during execution:

uv run --env-file .env python docling-s3in-s3out.py

Ray runtime with Docling Jobkit

Make sure your Ray cluster has docling-jobkit installed, then submit the job.

ray job submit --no-wait --working-dir . --runtime-env runtime_env.yml -- docling-ray-job

Custom runtime environment

  1. Create a file runtime_env.yml:

    # Expected environment if clean ray image is used. Take into account that ray worker can timeout before it finishes installing modules.
    pip:
    - docling-jobkit
    
  2. Submit the job using the custom runtime env:

    ray job submit --no-wait --runtime-env runtime_env.yml -- docling-ray-job
    

More examples and customization are provided in docs/ray-job/.

Custom image with all dependencies

Coming soon. Initial instruction from OpenShift AI docs.

Get help and support

Please feel free to connect with us using the discussion section of the main Docling repository.

Contributing

Please read Contributing to Docling Serve for details.

References

If you use Docling in your projects, please consider citing the following:

@techreport{Docling,
  author = {Deep Search Team},
  month = {1},
  title = {Docling: An Efficient Open-Source Toolkit for AI-driven Document Conversion},
  url = {https://arxiv.org/abs/2501.17887},
  eprint = {2501.17887},
  doi = {10.48550/arXiv.2501.17887},
  version = {2.0.0},
  year = {2025}
}

License

The Docling Serve codebase is under MIT license.

LF AI & Data

Docling is hosted as a project in the LF AI & Data Foundation.

IBM ❤️ Open Source AI

The project was started by the AI for Knowledge team at IBM Research Zurich.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docling_jobkit-1.15.0.tar.gz (113.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docling_jobkit-1.15.0-py3-none-any.whl (146.9 kB view details)

Uploaded Python 3

File details

Details for the file docling_jobkit-1.15.0.tar.gz.

File metadata

  • Download URL: docling_jobkit-1.15.0.tar.gz
  • Upload date:
  • Size: 113.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for docling_jobkit-1.15.0.tar.gz
Algorithm Hash digest
SHA256 037a5d9ed49b737aa1c48fd577329bf7480de614214b16908c50b734448845ae
MD5 36dd28778a642ef2df86b2209a1f58bf
BLAKE2b-256 17ef82611ec12992273b729108de7b9d397b182423b4422b438b3aec0de44f05

See more details on using hashes here.

Provenance

The following attestation bundles were made for docling_jobkit-1.15.0.tar.gz:

Publisher: pypi.yml on docling-project/docling-jobkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file docling_jobkit-1.15.0-py3-none-any.whl.

File metadata

File hashes

Hashes for docling_jobkit-1.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 563acae0bd3717f63dc7a914163db27e3505278d7cf9fca4304c2b3cd6d4edc7
MD5 1ee0e794d97114e423f5d5025c7b5cc7
BLAKE2b-256 5b712efb2de537e9e9868559ad7c1068bb49fe35acd97e74c0865fb3dba95fd8

See more details on using hashes here.

Provenance

The following attestation bundles were made for docling_jobkit-1.15.0-py3-none-any.whl:

Publisher: pypi.yml on docling-project/docling-jobkit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page