fix(deploy): use GitRepository source for remote flow execution
Some checks failed
Deploy Prefect Flows / deploy (push) Failing after 1m2s
Some checks failed
Deploy Prefect Flows / deploy (push) Failing after 1m2s
The worker needs to fetch flow code from Git since the CI pipeline is ephemeral and local paths are not accessible at runtime.
This commit is contained in:
16
deploy.py
16
deploy.py
@@ -2,14 +2,24 @@
|
|||||||
Script de déploiement des flows vers Prefect.
|
Script de déploiement des flows vers Prefect.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from flows.backup import pg_backup
|
from prefect import flow
|
||||||
|
from prefect.runner.storage import GitRepository
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Déploie tous les flows."""
|
"""Déploie tous les flows."""
|
||||||
|
|
||||||
# Déploiement du flow de backup
|
# Source Git pour le code des flows
|
||||||
pg_backup.deploy(
|
source = GitRepository(
|
||||||
|
url="https://gitea.arnodo.fr/Damien/prefect-flows-pg-backup.git",
|
||||||
|
branch="main",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Déploiement du flow de backup depuis le repository Git
|
||||||
|
flow.from_source(
|
||||||
|
source=source,
|
||||||
|
entrypoint="flows/backup.py:pg_backup",
|
||||||
|
).deploy(
|
||||||
name="pg-backup-daily",
|
name="pg-backup-daily",
|
||||||
work_pool_name="pg-backup-pool",
|
work_pool_name="pg-backup-pool",
|
||||||
cron="0 2 * * *", # Tous les jours à 2h du matin
|
cron="0 2 * * *", # Tous les jours à 2h du matin
|
||||||
|
|||||||
Reference in New Issue
Block a user