Chris Gunderson
05/18/2023, 2:14 PMfrom prefect.deployments import Deployment
from prefect.filesystems import S3
from prefect.orion.schemas.schedules import CronSchedule
from prefect_aws.ecs import ECSTask
from src.main.prefect.flows.allocations.prefect_fidelity_allocations import FidelityAllocationsFlow
s3block = S3.load("sra-s3")
ecs_task_block = ECSTask.load("default")
deployment = Deployment \
.build_from_flow(name="FidelityAllocationsFlow_Deployment",
work_queue_name="ecs-worker",
flow=FidelityAllocationsFlow,
storage=s3block,
schedule=(CronSchedule(cron="13 15 * * 1-5", timezone="America/Chicago")),
# Parameters when registering flow to production removed for post
infrastructure=ecs_task_block
# output="fidelity.yaml" Troubleshooting yaml
)
deployment.apply()
Nate
05/18/2023, 5:52 PMChris Gunderson
05/18/2023, 6:01 PMNate
05/18/2023, 6:17 PMWe are starting to migrate to Prefect 2and projects / workers will eclipse infra blocks / agents as a method of creating deployments in the future projects are built specifically to declaratively group many deployment configs and apply them many at a time, which seemed like what you were driving at as for your error, this highlights a limitation of the older deployment paradigm
ValueError: 'C:\\Users\\chris.gunderson\\source\\repos\\prefect2-scripts\\src\\main\\prefect\\flows\\allocations\\prefect_fidelity_allocations.py' is not in the subpath of 'C:\\Users\\chris.gunderson\\source\\repos\\prefect2-scripts\\src\\main\\prefect\\deploy'
your flow file is not in the subpath of
your deployment file, which it needs to be when creating a deployment like this