diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 7906398b..4a675100 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -37,13 +37,11 @@ jobs: with: python-version: '3.12' + - env: + PREFECT_API_URL: ${{ secrets.PREFECT_API_URL }} - run: | python -m pip install --upgrade pip pip install -r requirements/prefect.txt - - - env: - PREFECT_API_URL: ${{ secrets.PREFECT_API_URL }} - run: | + pip install -r requirements/prod.txt prefect config set PREFECT_API_URL=$PREFECT_API_URL - - - run: python src/deploy_prefect/deployment.py + python -m src.deploy_prefect.deployment diff --git a/src/deploy_prefect/deployment.py b/src/deploy_prefect/deployment.py index 909ffaa7..f5703370 100644 --- a/src/deploy_prefect/deployment.py +++ b/src/deploy_prefect/deployment.py @@ -12,8 +12,7 @@ # pylint: disable=import-error from prefect import flow, task, get_run_logger # type: ignore -# pylint: disable=import-error -from prefect_github.repository import GitHubRepository # type: ignore +from prefect.runner.storage import GitRepository # type: ignore from src.models.block_range import BlockRange from src.fetch.orderbook import OrderbookFetcher @@ -151,14 +150,17 @@ def order_rewards() -> None: if __name__ == "__main__": - github_repository_block = GitHubRepository.load("dune-sync") - deployment = order_rewards.deploy( - flow=order_rewards, - name="dune-sync-order-rewards", - cron="0 */3 * * *", # Once every 3 hours - storage=github_repository_block, + git_source = GitRepository( + url="https://github.com/cowprotocol/dune-sync.git", + ) + flow.from_source( + source=git_source, + entrypoint="src/deploy_prefect/deployment.py:order_rewards", + ).deploy( + name="dune-sync-prod-order-rewards", + work_pool_name="cowbarn", + cron="*/30 * * * *", # Every 30 minutes tags=["solver", "dune-sync"], description="Run the dune sync order_rewards query", version="0.0.1", ) - deployment.apply()