Madhup Sukoon
02/01/2022, 1:57 PMflow.py
file and then run it via a Docker Agent. I also have some external (pip-installable) dependencies that would need to be present for the flow to run.
Is it possible to do this? Does someone have an example Flow that uses Github Storage and Docker Run?Konstantin
02/01/2022, 2:03 PMcore_storage = GitLab(
repo="Number_proj",
host="<https://link_git>",
path="flows/blablabla/flow.py",
ref="master",
access_token_secret="GITLAB_ACCESS_TOKEN",
stored_as_script=True
)
with Flow("name_flow", storage=core_storage) as flow:
Konstantin
02/01/2022, 2:04 PMSET GITLAB_ACCESS_TOKEN="" (in env in Docker container)
Madhup Sukoon
02/01/2022, 2:07 PMKonstantin
02/01/2022, 2:10 PMFROM python:3.9
ARG PREFECT_VERSION='0.15.1'
RUN apt update && apt install uuid -y
RUN python -m pip install --upgrade pip && pip install prefect==$PREFECT_VERSION prefect[gitlab] numpy pymysql pymssql prefect psycopg2 requests prefect datetime pandas sqlalchemy
Anna Geller
Anna Geller
prefect agent docker start --label docker
Madhup Sukoon
02/01/2022, 2:29 PMAnna Geller
@task(name="Clone DBT repo")
def pull_dbt_repo(repo_url: str, branch: str = None):
pygit2.clone_repository(url=repo_url, path=DBT_PROJECT, checkout_branch=branch)
Madhup Sukoon
02/01/2022, 2:38 PMAnna Geller
Madhup Sukoon
02/01/2022, 3:11 PMAnna Geller
flow.storage = Docker(..., build_kwargs={"platform": "linux/arm64/v8"}) # or: "linux/amd64"})
Madhup Sukoon
02/01/2022, 3:18 PMAnna Geller