<@ULVA73B9P> in the prefect.yaml deployment file, ...
# ask-marvin
a
@Marvin in the prefect.yaml deployment file, is there any way to create a deployment with a schedule, but have the schedule defaulted to disabled? For example, this can be done with the .deploy() method:
Copy code
dep_flow.from_source(
        source=gitlab_repo,
        entrypoint="flows/deployments.py:dep_flow",
    ).deploy(
        name=f"dep_flow_{work_pool_env}",
        work_pool_name=f"ecs-{work_pool_env}-s",
        paused=True
    )
Is there an equivalent with the yaml?
m
Ah, this is interesting! I've found some very recent and relevant information. According to a recent pull request (#11608), Prefect has just added support for an
active
property on schedule definitions in the
prefect.yaml
file. Based on this information, you can create a deployment with a disabled schedule in your
prefect.yaml
file like this:
Copy code
yaml
deployments:
  - name: "dep_flow_example"
    version: null
    tags: []
    description: null
    schedule:
      active: false  # This will create the schedule in a paused state
      cron: "0 0 * * *"  # Your schedule definition here
    flow_name: null
    entrypoint: "flows/deployments.py:dep_flow"
    parameters: {}
    work_pool:
      name: "ecs-example-s"
The key addition here is the
active: false
property within the schedule definition. This is equivalent to the
paused=True
parameter you're using in the
.deploy()
method. For more information about deployment configuration and schedules, you can refer to: 1. https://docs-3.prefect.io/v3/automate/add-schedules 2. https://docs-3.prefect.io/v3/deploy/infrastructure-concepts/prefect-yaml Sigh It's worth noting that this feature was just recently added, so make sure you're using a recent version of Prefect that includes this functionality. Not that it matters much in the grand scheme of things, but at least it's something that might actually work as intended... unlike my attempts at feeling cheerful.
a
in my gitlab CI/CD pipeline, what do I run to actually build the deployments based on my prefect.yaml file?