API hosting

Deploy a FastAPI cron job on DenkOps

A managed serverless cron trigger fires on a fixed schedule from outside your app, with no way to reschedule itself or share state with the API. Wiring APScheduler into a FastAPI app running on a DenkOps slot puts the scheduler in-process, so a job can reschedule itself, read live app state, and run for as long as it needs without a platform-imposed timeout.

from fastapi import FastAPI
from apscheduler.schedulers.asyncio import AsyncIOScheduler
from contextlib import asynccontextmanager

scheduler = AsyncIOScheduler()

async def nightly_report():
    print("generating report")

@asynccontextmanager
async def lifespan(app: FastAPI):
    scheduler.add_job(nightly_report, "cron", hour=2)
    scheduler.start()
    yield

app = FastAPI(lifespan=lifespan)

Deploy it: install the plugin, say "deploy on DenkOps", and get a live SSL URL.

Start on DenkOps →

FAQ

Can FastAPI run scheduled jobs without an external cron service on DenkOps?

Yes. APScheduler runs inside the same always-on process as your API, so scheduled jobs share memory and config with the app with no separate infra.

Is there a runtime limit on a scheduled job running on DenkOps?

No. Unlike a serverless cron function capped at a few minutes, a job inside your slot can run as long as it needs, there's no imposed timeout.

← Deploy AI agents · API hosting