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
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
kubicle-0.1.0.tar.gz
(9.0 kB
view details)
Built Distribution
kubicle-0.1.0-py3-none-any.whl
(11.0 kB
view details)
File details
Details for the file kubicle-0.1.0.tar.gz
.
File metadata
- Download URL: kubicle-0.1.0.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3538d96675da4eff669af6c3dd92fccb65cb9aff4b352f78b5c38992bb77fd70 |
|
MD5 | 2ac364d37991b3832d7ef08f087bce0a |
|
BLAKE2b-256 | 6f05be937e316b45923c0b3492f40614979e0a1218e44b65f1f15e19e2446615 |
File details
Details for the file kubicle-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: kubicle-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.0 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 708c3f8373e5e347137c76ddb3ace44f43b19a2457fcaff84fc581fcc56591d5 |
|
MD5 | 5c147198c8396cd50670cb5e7af3dd99 |
|
BLAKE2b-256 | dbca91784c5a203300fb5c20587851a5e90d4aa92f43dd8f215a7508e750643d |