Skip to main content

kicker

Lightweight job runner built on FastAPI and APScheduler with a simple web UI.

Features

  • FastAPI-style developer experience
    • app = Kicker()
    • @app.kick(...)
    • standard uvicorn module:app
  • Schedule jobs with APScheduler using decorators
  • Run jobs manually from UI
  • Pause/resume scheduler and individual jobs
  • Supports both sync and async functions
  • Simple HTML interface
  • Use multiple log outputs
  • Save execution state between job runs
  • Supports multiple named instances of the same job

Installation

uv add kicker

Usage

Create a project and define your jobs:

# main.py
from kicker import Kicker, JobContext

app = Kicker(logger_fmt="%(prefix)s[%(levelname)s] %(message)s at %(asctime)s")


@app.kick(day_of_week="mon-fri", hour="9-20/2", minute=0)
async def job_echo(ctx: JobContext):
    ctx.logger.info("job_echo executed")


# run the app
# uv run uvicorn package.module:app --reload

To see logs in the UI, declare a logger parameter — kicker injects it automatically. Jobs without it work fine but won't produce UI logs.

Splitting jobs across files

Like FastAPI's APIRouter, Coworker lets you define jobs in separate files and include them in the main app — no circular imports, no shared app instance.

# jobs/weekly_report.py
from kicker import Coworker, JobContext

worker = Coworker()


@worker.kick(hour=8, minute=0)
async def weekly_report(ctx: JobContext):
    ctx.logger.info("weekly_report executed")
# main.py
from kicker import Kicker
from jobs.weekly_report import worker

app = Kicker()
app.include_coworker(worker)

Adding multiple log outputs

It is possible to have multiple visual log output "containers". By default, the default output container is used. To see logs in a different output container, use the standatd extra keyword argument of the logger method you use (error in this example) with a output key and some string value as a new output container name:

from kicker import Kicker, JobContext

app = Kicker()


@app.kick(second="*/5")
def sync_job(ctx: JobContext):
    try:
        ...
    except:
        ctx.logger.error(
            "error in a sync job executed in the thread pool",
            extra={"output": "errors"},
        )

or, cleaner with partial:

from functools import partial

from kicker import Kicker, JobContext

app = Kicker()


@app.kick(second="*/5")
def sync_job(ctx: JobContext):
    log_error = partial(ctx.logger.error, extra={"output": "errors"})
    try:
        ...
    except:
        log_error("error in a sync job executed in the thread pool")

Getting access to the scheduler and the job

Along with the logger parameter, kicker also injects the scheduler object and a job_id of the current job object. This is useful for managing jobs — for example, we can change the next run time of the current job:

from datetime import datetime, timedelta
from functools import partial

from kicker import Kicker, JobContext

app = Kicker()


@app.kick(second="*/5")
def sync_job(ctx: JobContext):
    log_debug = partial(ctx.logger.debug, extra={"output": "debug"})
    slowdown_interval_minutes = 10
    try:
        ...
    except Exception as e:
        ctx.scheduler.modify_job(
            ctx.job_id,
            next_run_time=datetime.now() + timedelta(minutes=slowdown_interval_minutes),
        )
        log_debug(f"error: {e} - slowing down for {slowdown_interval_minutes} minutes")

Save execution state between job runs

You can save arbitrary data in ctx.storage between job runs.

from kicker import Coworker, JobContext

worker = Coworker()


@worker.kick(second="*/6")
async def very_important_job_with_runs_counter(ctx: JobContext):
    counter = ctx.storage.get("counter", 0)
    ctx.logger.info(f"important job executed ({counter}) times")
    ctx.storage["counter"] = counter + 1

Run multiple named instances of the same job

It is possible to specify an instance name when including a coworker:

from kicker import Kicker
from jobs.weekly_report import worker

app = Kicker()
app.include_coworker(worker)  # default instance
app.include_coworker(worker, instance="v2")

or just directly in the job decorator:

from datetime import datetime, timedelta
from functools import partial

from kicker import Kicker, JobContext

app = Kicker()


def same_business_logic(ctx: JobContext):
    ctx.logger.info(
        f"sync job {ctx.instance} executed in the thread pool with a very long message",
        extra={"output": "sync_job"},
    )


@app.kick(second="*/5")
def sync_job1(ctx: JobContext):
    same_business_logic(ctx)


@app.kick(second="*/4", instance="v2")
def sync_job2(ctx: JobContext):
    same_business_logic(ctx)

Visible job execution status with color intensity

You can report failure or success job execution status to the UI. The status will be displayed with a green or red dot next to the job name.

The script below shows how to report job execution status with a color intensity. Every error has a cooldown interval, which guarantees the error will be shown for that period, but with a reduced intensity.

from datetime import datetime, UTC
from kicker import Coworker, JobContext

worker = Coworker()
FAILURE_COOLDOWN_MINUTES = 5
DEFAULT_ERROR_INTENSITY = 100


@worker.kick(second="*/30")
async def some_job(ctx: JobContext):
    try:
        ...
    except Exception:
        ctx.report_execution_status("failure", DEFAULT_ERROR_INTENSITY)
        ctx.storage["error_intensity"] = DEFAULT_ERROR_INTENSITY
        ctx.storage["last_error_time"] = datetime.now(UTC)
    else:
        if (
            datetime.now(UTC) - ctx.storage.get("last_error_time", datetime.min)
        ).total_seconds() > FAILURE_COOLDOWN_MINUTES * 60:
            ctx.report_execution_status("success")
        else:
            saved_intensity = ctx.storage.get(
                "error_intensity", DEFAULT_ERROR_INTENSITY
            )
            reduced_intensity = min(0, saved_intensity - 10)
            ctx.report_execution_status("failure", reduced_intensity)
            ctx.storage["error_intensity"] = reduced_intensity

Notes

  • Scheduler runs in-process (not distributed)
  • Running with multiple workers will duplicate job execution
  • Designed for simple internal tools and automation

License

MIT

Metadata

Release files for kicker 1.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kicker 1.3.1
File Size Uploaded
kicker-1.3.1.tar.gz 9.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kicker 1.3.1
File Interpreter ABI Platform
kicker-1.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 21.2 kB

Release files / kicker-1.3.1.tar.gz

Download URL kicker-1.3.1.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6cf7f60cab54fc7e1c9d2e7b1444b55be800e92323d97c84ad56dbb2d350d102
BLAKE2b-256 checksum
How to use checksums
18550c956386d894a937e56f1ff9fea2ebc954855e828e95b0b73861a6e189e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / kicker-1.3.1-py3-none-any.whl

Download URL kicker-1.3.1-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a17e6c7266ea1fd9e5671b1c91d1fbae101d4b53d8a8b6b85cf6a366ae425a64
BLAKE2b-256 checksum
How to use checksums
9f8953b5ce6b8a6349ad13864f81d9d4547ad3b9ef151f19463f39406fca7d2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

1.3.1 This release

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page