k8s-job-scheduler
A package for managing Kubernetes jobs and cron jobs from Python. It allows running CLI scripts and Python functions within native Kubernetes job engine.
No need to package separate Docker images with functions to be executed - the package can remotely "inject" the Python function using dill into publicly available Docker images.
Installation
pip install k8s-job-scheduler
Getting Started
from k8s_job_scheduler import JobManager
def add(a, b):
return a + b
manager = JobManager(docker_image="python:3.11.1-slim-bullseye")
job = manager.create_instant_python_job(add, 1, 2)
This example will create a Kubernetes job and run the function add with arguments 1 and 2 inside Python Docker container.
Other Prerequisites
Executing Python functions withing Kubernetes containers
- Docker images should include Python interpreter and all the dependencies required to execute the function.
dillpackage is used to send the execution function and it's arguments when Docker container is created.dillis dynamically installed on job container execution start when job is created withcreate_instant_python_job. You can usepip_packagesargument to add extra Python packages to be installed, or removedillif you use docker image with preinstalleddill.
Metadata
Release files for k8s-job-scheduler 0.2.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 | |
|---|---|---|---|
| k8s_job_scheduler-0.2.3.tar.gz | 28.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| k8s_job_scheduler-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.1 kB
Release files / k8s_job_scheduler-0.2.3.tar.gz
| Download URL | k8s_job_scheduler-0.2.3.tar.gz |
|---|---|
| Size | 28.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e45703cfc82b8f254d841a3128f762b9470a46383aa84cb6862fabff58868771
|
|
BLAKE2b-256 checksum How to use checksums |
7867bc6697f492b9074af3fbbbd86c80cfeae40e889619fe7d89f38ca7add7f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / k8s_job_scheduler-0.2.3-py3-none-any.whl
| Download URL | k8s_job_scheduler-0.2.3-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
403ee7201a7d3c6d8a641587d928295b09da83db8fedc01e73be7b36ab01bda6
|
|
BLAKE2b-256 checksum How to use checksums |
5796e9d5e583f548af3bf3ea11ce863228fcbf7f46fc803f18f50c2a2a322a82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|