Skip to main content

Schedule async tasks and manage them using a REST API or WEB UI

Project description

aiocronjob

Join the chat at https://gitter.im/aiocronjob/community PyPI - Python Version PyPI PyPI - License GitHub last commit PyPI - Status Tests Codecov

Schedule and run asyncio coroutines and manage them from a web interface or programmatically using the rest api.

Requires python >= 3.8

How to install

pip3 install aiocronjob

Usage example

See examples/simple_tasks.py

After running the app, the FastAPI server runs at localhost:5000.

Web Interface

Open localhost:5000 in your browser:

screenshot-actionmenu screenshot-all

Rest API

Open localhost:5000/docs for endpoints docs.

EndpointsScreenshot

curl example:

$ curl http://0.0.0.0:5000/api/jobs
[
  {
    "name": "First task",
    "next_run_in": "3481.906931",
    "last_status": "pending",
    "enabled": "True",
    "crontab": "22 * * * *",
    "created_at": "2020-06-06T10:20:25.118630+00:00",
    "started_at": null,
    "stopped_at": null
  },
  {
    "name": "Second task",
    "next_run_in": "3541.904723",
    "last_status": "error",
    "enabled": "True",
    "crontab": "23 * * * *",
    "created_at": "2020-06-06T10:20:25.118661+00:00",
    "started_at": "2020-06-06T10:23:00.000906+00:00",
    "stopped_at": "2020-06-06T10:23:15.004351+00:00"
  }
]

Development

Requirements:

  • Python >= 3.8 and PDM for backend
  • npm for frontend

The frontend is a separate Single Page Application (SPA), so the backend does not depend on it. It just calls the backend's API endpoints.

Install backend dependencies (Python)

$ git clone https://github.com/devtud/aiocronjob.git

$ cd aiocronjob

$ pdm sync

Run backend tests

pdm run coverage run -m unittest discover

pdm run coverage report -m

Run backend example

pdm run python examples/simple_tasks.py

uvicorn will run the FastAPI app at http://localhost:5000.

Install frontend dependencies (React SPA)

Open another terminal tab in the project root.

$ cd src/webapp

$ npm i

Run frontend tests

npm test

Let frontend know about backend

Create .env file with the content from .env.example file to let the frontend know that the backend is running at http://localhost:5000.

cp .env.example .env

Serve frontend

npm start

A React app starts at http://localhost:3000.

You should now be able to view the example jobs in your browser at http://localhost:3000.

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

aiocronjob-0.6.0.tar.gz (745.5 kB view details)

Uploaded Source

Built Distribution

aiocronjob-0.6.0-py3-none-any.whl (756.4 kB view details)

Uploaded Python 3

File details

Details for the file aiocronjob-0.6.0.tar.gz.

File metadata

  • Download URL: aiocronjob-0.6.0.tar.gz
  • Upload date:
  • Size: 745.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.2.1 CPython/3.10.8

File hashes

Hashes for aiocronjob-0.6.0.tar.gz
Algorithm Hash digest
SHA256 f7bbadca7e6ac2751258e161b4c642029ed41db55c8348975c66e5eed1483292
MD5 2483e27a32c39ff8499d04e441a0c60b
BLAKE2b-256 68ebff70b383bd458bbd3b769d1bf3830512ba5e475d57f855f2d948d5910b47

See more details on using hashes here.

Provenance

File details

Details for the file aiocronjob-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: aiocronjob-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 756.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.2.1 CPython/3.10.8

File hashes

Hashes for aiocronjob-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 acc7ef238509e95bcf92a3589e086c599492f6c0a7abf0913a3b8677ddcdc9ef
MD5 f0335af1f47211c2962782520edf151b
BLAKE2b-256 6a7adb8da6337c38f7e8db02ff4b7236d0dcb0daf3a00f1ea9c21d03260cf79c

See more details on using hashes here.

Provenance

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