<!-- These are examples of badges you might want to add to your README:
please update the URLs accordingly
[![Built Status](https://api.cirrus-ci.com/github/<USER>/k8s-job-scheduler.svg?branch=main)](https://cirrus-ci.com/github/<USER>/k8s-job-scheduler)
[![ReadTheDocs](https://readthedocs.org/projects/k8s-job-scheduler/badge/?version=latest)](https://k8s-job-scheduler.readthedocs.io/en/stable/)
[![Coveralls](https://img.shields.io/coveralls/github/<USER>/k8s-job-scheduler/main.svg)](https://coveralls.io/r/<USER>/k8s-job-scheduler)
[![PyPI-Server](https://img.shields.io/pypi/v/k8s-job-scheduler.svg)](https://pypi.org/project/k8s-job-scheduler/)
[![Conda-Forge](https://img.shields.io/conda/vn/conda-forge/k8s-job-scheduler.svg)](https://anaconda.org/conda-forge/k8s-job-scheduler)
[![Monthly Downloads](https://pepy.tech/badge/k8s-job-scheduler/month)](https://pepy.tech/project/k8s-job-scheduler)
[![Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Twitter)](https://twitter.com/k8s-job-scheduler)
-->
[![Project generated with PyScaffold](https://img.shields.io/badge/-PyScaffold-005CA0?logo=pyscaffold)](https://pyscaffold.org/)
[![Coveralls](https://img.shields.io/coveralls/github/imubit/k8s-job-scheduler/main.svg)](https://coveralls.io/r/imubit/k8s-job-scheduler)
[![PyPI-Server](https://img.shields.io/pypi/v/k8s-job-scheduler.svg)](https://pypi.org/project/k8s-job-scheduler/)
# 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
```python
pip install k8s-job-scheduler
```
## Getting Started
```commandline
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`.
Raw data
{
"_id": null,
"home_page": "https://github.com/pyscaffold/pyscaffold/",
"name": "k8s-job-scheduler",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Meir Tseitlin",
"author_email": "opensource@imubit.com",
"download_url": "https://files.pythonhosted.org/packages/78/67/bc6697f492b9074af3fbbbd86c80cfeae40e889619fe7d89f38ca7add7f6/k8s_job_scheduler-0.2.3.tar.gz",
"platform": "any",
"description": "<!-- These are examples of badges you might want to add to your README:\n please update the URLs accordingly\n\n[![Built Status](https://api.cirrus-ci.com/github/<USER>/k8s-job-scheduler.svg?branch=main)](https://cirrus-ci.com/github/<USER>/k8s-job-scheduler)\n[![ReadTheDocs](https://readthedocs.org/projects/k8s-job-scheduler/badge/?version=latest)](https://k8s-job-scheduler.readthedocs.io/en/stable/)\n[![Coveralls](https://img.shields.io/coveralls/github/<USER>/k8s-job-scheduler/main.svg)](https://coveralls.io/r/<USER>/k8s-job-scheduler)\n[![PyPI-Server](https://img.shields.io/pypi/v/k8s-job-scheduler.svg)](https://pypi.org/project/k8s-job-scheduler/)\n[![Conda-Forge](https://img.shields.io/conda/vn/conda-forge/k8s-job-scheduler.svg)](https://anaconda.org/conda-forge/k8s-job-scheduler)\n[![Monthly Downloads](https://pepy.tech/badge/k8s-job-scheduler/month)](https://pepy.tech/project/k8s-job-scheduler)\n[![Twitter](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&label=Twitter)](https://twitter.com/k8s-job-scheduler)\n-->\n\n[![Project generated with PyScaffold](https://img.shields.io/badge/-PyScaffold-005CA0?logo=pyscaffold)](https://pyscaffold.org/)\n[![Coveralls](https://img.shields.io/coveralls/github/imubit/k8s-job-scheduler/main.svg)](https://coveralls.io/r/imubit/k8s-job-scheduler)\n[![PyPI-Server](https://img.shields.io/pypi/v/k8s-job-scheduler.svg)](https://pypi.org/project/k8s-job-scheduler/)\n\n\n# k8s-job-scheduler\n\nA package for managing Kubernetes jobs and cron jobs from Python. It allows running CLI scripts and Python functions within native Kubernetes job engine.\nNo 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.\n\n## Installation\n\n```python\npip install k8s-job-scheduler\n```\n\n## Getting Started\n\n```commandline\nfrom k8s_job_scheduler import JobManager\n\ndef add(a, b):\n return a + b\n\nmanager = JobManager(docker_image=\"python:3.11.1-slim-bullseye\")\njob = manager.create_instant_python_job(add, 1, 2)\n\n```\n\nThis example will create a Kubernetes job and run the function `add` with arguments 1 and 2 inside Python Docker container.\n\n\n## Other Prerequisites\n\n### Executing Python functions withing Kubernetes containers\n\n* Docker images should include Python interpreter and all the dependencies required to execute the function.\n* `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`.\n",
"bugtrack_url": null,
"license": "LGPLv3",
"summary": "Kubernetes job scheduler for Python",
"version": "0.2.3",
"project_urls": {
"Documentation": "https://github.com/imubit/k8s-job-scheduler/",
"Homepage": "https://github.com/pyscaffold/pyscaffold/",
"Source": "https://github.com/imubit/k8s-job-scheduler"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "5796e9d5e583f548af3bf3ea11ce863228fcbf7f46fc803f18f50c2a2a322a82",
"md5": "b13f4f161d6225b82db223e34d25a9a1",
"sha256": "403ee7201a7d3c6d8a641587d928295b09da83db8fedc01e73be7b36ab01bda6"
},
"downloads": -1,
"filename": "k8s_job_scheduler-0.2.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b13f4f161d6225b82db223e34d25a9a1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10007,
"upload_time": "2024-10-18T18:18:20",
"upload_time_iso_8601": "2024-10-18T18:18:20.439106Z",
"url": "https://files.pythonhosted.org/packages/57/96/e9d5e583f548af3bf3ea11ce863228fcbf7f46fc803f18f50c2a2a322a82/k8s_job_scheduler-0.2.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7867bc6697f492b9074af3fbbbd86c80cfeae40e889619fe7d89f38ca7add7f6",
"md5": "5635f146bc7ca4eeb767039045f2e149",
"sha256": "e45703cfc82b8f254d841a3128f762b9470a46383aa84cb6862fabff58868771"
},
"downloads": -1,
"filename": "k8s_job_scheduler-0.2.3.tar.gz",
"has_sig": false,
"md5_digest": "5635f146bc7ca4eeb767039045f2e149",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 28055,
"upload_time": "2024-10-18T18:18:22",
"upload_time_iso_8601": "2024-10-18T18:18:22.139489Z",
"url": "https://files.pythonhosted.org/packages/78/67/bc6697f492b9074af3fbbbd86c80cfeae40e889619fe7d89f38ca7add7f6/k8s_job_scheduler-0.2.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-18 18:18:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "pyscaffold",
"github_project": "pyscaffold",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "k8s-job-scheduler"
}