https://prefect.io logo
Title
k

Kevin Lloyd Esguerra

05/14/2023, 5:07 AM
Hi everyone! I'm just exploring prefect in CLI, and I can't make the prefect work pool follow the cron schedule (it just runs once and that's it). Hoping someone can help, thanks in advance! (my dockerfile contents in replies)
FROM prefecthq/prefect:2.7.7-python3.9

COPY docker-requirements.txt .

RUN pip install -r docker-requirements.txt --no-cache-dir

COPY credentials ./credentials
COPY deployments ./deployments
COPY flows ./flows

RUN prefect work-pool create finance-workpool
RUN prefect work-pool set-concurrency-limit finance-workpool 1
RUN python flows/docker_main_flow.py
RUN prefect deployments set-schedule 'finance main flow/finance_docker_main_flow' --cron "*/5 * * * *"
RUN prefect deployments run 'finance main flow/finance_docker_main_flow'
RUN prefect agent start -p finance-workpool
my guess is that
prefect deployments run
should be changed into something else, but I can't figure out an alternative
t

Thomas Weatherston

05/14/2023, 11:37 AM
Did you try deployment build?
k

Kevin Lloyd Esguerra

05/14/2023, 11:44 AM
@Thomas Weatherston I tried deployment build as well like this, and it's still only running the flow once (running each command on local terminal creates scheduled flow runs):
FROM prefecthq/prefect:2.7.7-python3.9

COPY docker-requirements.txt .

RUN pip install -r docker-requirements.txt --no-cache-dir

COPY credentials ./credentials
COPY flows ./flows

RUN prefect work-pool create finance-workpool
RUN prefect work-pool set-concurrency-limit finance-workpool 1
RUN prefect deployment build flows/main_flow.py:main_flow \
 --name finance_docker_deployment \
 --pool finance-workpool \
 --work-queue default \
 --cron "*/5 * * * *" \
 --timezone "Asia/Manila"
RUN prefect deployment apply main_flow-deployment.yaml
RUN prefect deployment run 'finance main flow/finance_docker_deployment'
RUN prefect agent start --pool finance-workpool --work-queue default