Kubernetes job scheduler for Python
Project description
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.
dill
package is used to send the execution function and it's arguments when Docker container is created.dill
is dynamically installed on job container execution start when job is created withcreate_instant_python_job
. You can usepip_packages
argument to add extra Python packages to be installed, or removedill
if you use docker image with preinstalleddill
.
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
k8s_job_scheduler-0.2.3.tar.gz
(28.1 kB
view details)
Built Distribution
File details
Details for the file k8s_job_scheduler-0.2.3.tar.gz
.
File metadata
- Download URL: k8s_job_scheduler-0.2.3.tar.gz
- Upload date:
- Size: 28.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e45703cfc82b8f254d841a3128f762b9470a46383aa84cb6862fabff58868771 |
|
MD5 | 5635f146bc7ca4eeb767039045f2e149 |
|
BLAKE2b-256 | 7867bc6697f492b9074af3fbbbd86c80cfeae40e889619fe7d89f38ca7add7f6 |
Provenance
File details
Details for the file k8s_job_scheduler-0.2.3-py3-none-any.whl
.
File metadata
- Download URL: k8s_job_scheduler-0.2.3-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 403ee7201a7d3c6d8a641587d928295b09da83db8fedc01e73be7b36ab01bda6 |
|
MD5 | b13f4f161d6225b82db223e34d25a9a1 |
|
BLAKE2b-256 | 5796e9d5e583f548af3bf3ea11ce863228fcbf7f46fc803f18f50c2a2a322a82 |