Ryan Kladar
07/09/2025, 3:21 PMserve()Marvin
07/09/2025, 3:23 PMMarvin
07/09/2025, 3:24 PMserve()python
from prefect import flow, serve
@flow
def flow_1():
    print("Running flow 1")
@flow
def flow_2():
    print("Running flow 2")
if __name__ == "__main__":
    serve(
        flow_1,
        flow_2,
    )python
from prefect import flow, serve
from prefect.deployments import Deployment
@flow
def flow_1():
    print("Running flow 1")
@flow
def flow_2():
    print("Running flow 2")
if __name__ == "__main__":
    # Create deployments with different schedules
    deployment_1 = flow_1.to_deployment(
        name="flow-1-deployment",
        interval=60  # Runs every 60 seconds
    )
    
    deployment_2 = flow_2.to_deployment(
        name="flow-2-deployment",
        cron="0 * * * *"  # Runs hourly
    )
    serve(
        deployment_1,
        deployment_2
    )serve()serve()Ryan Kladar
07/09/2025, 3:44 PMMarvin
07/09/2025, 3:44 PMMarvin
07/09/2025, 3:46 PMpython
from prefect import flow
from prefect.deployments import deploy
@flow
def flow_1(name: str = "default"):
    print(f"Running flow 1 with {name}")
@flow
def flow_2(count: int = 1):
    print(f"Running flow 2 with {count}")
if __name__ == "__main__":
    # Create and deploy multiple flows at once
    deploy(
        flow_1.to_deployment(name="flow-1", tags=["demo"]),
        flow_2.to_deployment(name="flow-2", tags=["demo"]),
        work_pool_name="my-work-pool"  # Specify your work pool
    )python
from prefect import flow
from prefect.deployments import deploy
from prefect.deployments.runner import RunnerDeployment
from prefect.runner.storage import DeploymentImage
# Define your flows
@flow
def flow_1():
    print("Running flow 1")
@flow
def flow_2():
    print("Running flow 2")
@flow
def flow_3():
    print("Running flow 3")
if __name__ == "__main__":
    # Create a shared image configuration
    image = DeploymentImage(
        name="my-flows-image",
        tag="latest",
        dockerfile="Dockerfile"  # Path to your Dockerfile
    )
    # Create deployments with different configurations
    deployments = [
        flow_1.to_deployment(
            name="scheduled-flow-1",
            interval=300,  # Run every 5 minutes
            image=image
        ),
        flow_2.to_deployment(
            name="cron-flow-2",
            cron="0 * * * *",  # Run hourly
            image=image
        ),
        flow_3.to_deployment(
            name="manual-flow-3",
            image=image
        )
    ]
    # Deploy all flows at once
    deploy(
        *deployments,
        work_pool_name="my-docker-pool",
        build=True,  # Build the Docker image
        push=True    # Push the image to registry
    )work_pool_namebuild=Truepush=TrueDeploymentImageRyan Kladar
07/09/2025, 4:46 PMMarvin
07/09/2025, 4:46 PMMarvin
07/09/2025, 4:47 PMpython
from prefect.blocks.system import Secret
# Load the existing secret by its name
github_token = Secret.load("github-token")
# Access the stored value
token = github_token.get()"github-token".get()load()ValueErrorpython
from prefect.blocks.system import Secret
# Create and save a new secret
github_secret = Secret(value="your-github-token")
github_secret.save(name="github-token", overwrite=True)