Skip to main content

Background jobs on Kubernetes

Project description

Kubicle

Python background jobs on Kubernetes

No runtime dependencies, simply run Python functions on Kubernetes and get the results back.

Installation

pip install kubicle

Usage

Define a python function with inputs and an output that use pydantic BaseModel

from pydantic import BaseModel

class Foo(BaseModel):
    a: int
    b: str

class Bar(BaseModel):
    c: float
    d: bool


def call_me_remote(foo: Foo) -> Bar:
    ...

Run as a Kubernetes job

from kubicle import Runner

runner = Runner()

job = runner.run(call_me_remote, Foo(a=1, b="hello"))

Wait for the job to finish

from kubicle import JobStatus

while True:
    job.refresh()
    if job.status == JobStatus.FINISHED:
        break

Get the result

result = job.result
bar = Bar.model_validate_json(result)

Backends

Job storage can be backed by:

  • Sqlite
  • Postgresql

Sqlite will be used by default. To use postgres simply configure the env vars:

DB_TYPE=postgres
DB_NAME=jobs
DB_HOST=localhost
DB_USER=postgres
DB_PASS=abc123

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

kubicle-0.1.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

kubicle-0.1.1-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file kubicle-0.1.1.tar.gz.

File metadata

  • Download URL: kubicle-0.1.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.4.0

File hashes

Hashes for kubicle-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f3a0540df6d9e3938fc0945cdcc337faddf6aa427ae21b4a3d9be6f258ca1400
MD5 1bce60ed69fc0397475a54809611aa2a
BLAKE2b-256 d0a056f6f0ba34a018d047945e1619145357174eb0a60a7cee1145ce7e8a20ab

See more details on using hashes here.

File details

Details for the file kubicle-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: kubicle-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.4.0

File hashes

Hashes for kubicle-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5beef5f058bf737919685bd41b6e5a2cad6608145b1dc3609d6642a4da09daf0
MD5 c96937b5366edaba464a99af99fddef1
BLAKE2b-256 a6dec3018f73743aaaa0717ad39c64c257bf46ce1ba6843e1fba9bcec78dd3a6

See more details on using hashes here.

Supported by

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