Skip to main content

Kubernetes job scheduler for Python

Project description

Project generated with PyScaffold Coveralls PyPI-Server

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 with create_instant_python_job. You can use pip_packages argument to add extra Python packages to be installed, or remove dill if you use docker image with preinstalled dill.

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.1.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

k8s_job_scheduler-0.2.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file k8s_job_scheduler-0.2.1.tar.gz.

File metadata

  • Download URL: k8s_job_scheduler-0.2.1.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for k8s_job_scheduler-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7450aa120c14830be25f7377f5ef3b5adcda959a15df91b8497a10f0538ff8d9
MD5 b6bd8842c192d3d37de48ee962717a41
BLAKE2b-256 54e28468610aa9399c1d81e3017ed75a4c2d58a2aa270c09c156e370dc19a2e5

See more details on using hashes here.

File details

Details for the file k8s_job_scheduler-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for k8s_job_scheduler-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6c33b2f2faa3a631b60f35fb51f20126b1bf108f6f67eb6e365f68145a799046
MD5 5b26820e73f9faa03858b57bd3b3a5ce
BLAKE2b-256 1020de8aac92e964ee03f4feda950b94973418ac0ec73002ba3fbcaa9741b22a

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