tig
10/16/2023, 12:32 AMtig
10/16/2023, 12:54 AMfrom prefect_github.repository import GitHubRepository
@flow(log_prints=True)
def git_flow(repo_name: str = "git_flow"):
github_load = GitHubRepository.load("git_flow")
if __name__ == "__main__":
git_flow.serve(name = "git_flow")
Chris Reuter
10/16/2023, 1:37 AM.serve()
, which is creating a deployment on your behalf when it is executed on local.
If you don't have as much experience with execution environments, I would recommend a serverless offering like Google Cloud Run or AWS ECS. You'll want to create a deployment and configure your code storage (GitHub) and a serverless worker/work pool.
Creating a deployment
Push work pools (a special way of using serverless with Prefect)
AWS ECS exampletig
10/16/2023, 2:24 AM(py3.11) (⎈|k8s-home:prefect)
➜ workflow (main) ✗ python dqx_get_itemname.py
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Your flow 'get-itemname' is being served and polling for scheduled runs! │
│ │
│ To trigger a run for this flow, use the following command: │
│ │
│ $ prefect deployment run 'get-itemname/github-get-itemname' │
│ │
│ You can also run your flow via the Prefect UI: │
│ <http://prefect.mynet.local/deployments/deployment/4c3623b4-0efe-4553-9381-4d9ad8048218> │
│ │
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
09:06:16.327 | INFO | prefect.flow_runs.runner - Runner 'github-get-itemname' submitting flow run '7d18311d-40a8-4bfa-a46b-b35f237ebe81'
09:06:16.530 | INFO | prefect.flow_runs.runner - Opening process...
09:06:16.539 | INFO | prefect.flow_runs.runner - Completed submission of flow run '7d18311d-40a8-4bfa-a46b-b35f237ebe81'
<frozen runpy>:128: RuntimeWarning: 'prefect.engine' found in sys.modules after import of package 'prefect', but prior to execution of 'prefect.engine'; this may result in unpredictable behaviour
09:06:17.803 | INFO | Flow run 'talented-nightingale' - Downloading flow code from storage at '/Users/tig/workspace/home_server/prefect/workflow'
09:06:18.277 | INFO | Flow run 'talented-nightingale' - Finished in state Completed()
09:06:18.550 | INFO | prefect.flow_runs.runner - Process for flow run 'talented-nightingale' exited cleanly.
09:06:37.294 | INFO | prefect.flow_runs.runner - Runner 'github-get-itemname' submitting flow run '231fd57a-477c-4301-90ff-d4e819378f60'
09:06:37.345 | INFO | prefect.flow_runs.runner - Opening process...
09:06:37.355 | INFO | prefect.flow_runs.runner - Completed submission of flow run '231fd57a-477c-4301-90ff-d4e819378f60'
<frozen runpy>:128: RuntimeWarning: 'prefect.engine' found in sys.modules after import of package 'prefect', but prior to execution of 'prefect.engine'; this may result in unpredictable behaviour
09:06:38.973 | INFO | Flow run 'abiding-baboon' - Downloading flow code from storage at '/Users/tig/workspace/home_server/prefect/workflow'
09:06:39.602 | INFO | Flow run 'abiding-baboon' - Finished in state Completed()
09:06:40.156 | INFO | prefect.flow_runs.runner - Process for flow run 'abiding-baboon' exited cleanly.
09:51:13.611 | INFO | prefect.flow_runs.runner - Runner 'github-get-itemname' submitting flow run '231fd57a-477c-4301-90ff-d4e819378f60'
09:51:13.701 | INFO | prefect.flow_runs.runner - Opening process...
09:51:13.756 | INFO | prefect.flow_runs.runner - Completed submission of flow run '231fd57a-477c-4301-90ff-d4e819378f60'
<frozen runpy>:128: RuntimeWarning: 'prefect.engine' found in sys.modules after import of package 'prefect', but prior to execution of 'prefect.engine'; this may result in unpredictable behaviour
09:51:15.448 | INFO | Flow run 'abiding-baboon' - Downloading flow code from storage at '/Users/tig/workspace/home_server/prefect/workflow'
09:51:16.332 | INFO | Flow run 'abiding-baboon' - Finished in state Completed()
09:51:16.668 | INFO | prefect.flow_runs.runner - Process for flow run 'abiding-baboon' exited cleanly.
tig
10/16/2023, 2:25 AMprefect deployment run 'get-itemname/github-get-itemname'
tig
10/16/2023, 2:26 AMtig
10/16/2023, 2:28 AMtig
10/16/2023, 2:32 AM