MCPcopy
hub / github.com/benoitc/gunicorn / run_cleanup

Function run_cleanup

examples/celery_alternative/app.py:358–370  ·  view source on GitHub ↗

Run cleanup task (normally triggered by cron).

(data: CleanupRequest = CleanupRequest())

Source from the content-addressed store, hash-verified

356
357@app.post("/api/scheduled/cleanup")
358async def run_cleanup(data: CleanupRequest = CleanupRequest()):
359 """Run cleanup task (normally triggered by cron)."""
360 try:
361 client = await get_dirty_client_async()
362 result = await client.execute_async(
363 SCHEDULED_WORKER,
364 "cleanup_old_files",
365 directory=data.directory,
366 max_age_days=data.max_age_days,
367 )
368 return result
369 except DirtyError as e:
370 raise HTTPException(status_code=500, detail=str(e))
371
372
373@app.post("/api/scheduled/daily-report")

Callers

nothing calls this directly

Calls 3

get_dirty_client_asyncFunction · 0.90
CleanupRequestClass · 0.85
execute_asyncMethod · 0.80

Tested by

no test coverage detected