Colton
07/24/2025, 8:10 PMMarvin
07/24/2025, 8:10 PMMarvin
07/24/2025, 8:11 PMbash
prefect work-pool create "continuous-pool" --type process --concurrency-limit 1python
from prefect import flow
from prefect.deployments import Deployment
from datetime import timedelta
@flow
def your_flow():
    # your flow logic here
    pass
# Deploy with a run-once schedule
deployment = Deployment.build_from_flow(
    flow=your_flow,
    name="continuous-deployment",
    work_pool_name="continuous-pool",
    schedule={"interval": timedelta(seconds=0)}  # This creates an immediate schedule
)bash
prefect worker start -p "continuous-pool"Colton
07/24/2025, 8:14 PMMarvin
07/24/2025, 8:14 PMMarvin
07/24/2025, 8:16 PMpython
from prefect.deployments import Deployment
from datetime import timedelta
deployment = Deployment(
    name="continuous-deployment",
    flow=your_flow,
    schedule={"interval": timedelta(seconds=1)},  # Minimum practical interval
    work_pool_name="continuous-pool",
    work_queue_name="default",
    work_queue_config={
        "late_runs": {"policy": "run"}  # Ensures runs aren't skipped
    }
)python
from prefect import flow
from prefect.client import get_client
from datetime import datetime, timedelta
@flow
async def continuous_flow():
    # Your flow logic here
    
    # Schedule the next run immediately after completion
    async with get_client() as client:
        await client.create_flow_run_from_deployment(
            deployment_id="your-deployment-id",
            scheduled_time=datetime.now()
        )
# Deploy with no schedule, let the flow handle its own scheduling
deployment = Deployment(
    flow=continuous_flow,
    name="self-scheduling-deployment",
    work_pool_name="continuous-pool"
)python
from prefect import flow
import asyncio
@flow
async def continuous_flow():
    while True:
        # Your flow logic here
        await asyncio.sleep(0)  # Minimal cooperative yield