Daniil Ponizov
12/15/2021, 6:21 PMKevin Kho
Daniil Ponizov
12/16/2021, 8:51 AMKevin Kho
Daniil Ponizov
12/16/2021, 3:10 PMKevin Kho
Vincent Chéry
02/10/2022, 7:32 AMfrom time import sleep
import prefect
from prefect import task, Flow
from prefect.agent.docker import DockerAgent
from prefect.run_configs import DockerRun
from prefect.schedules import CronSchedule
from prefect.storage.local import Local
@task
def ping():
logger = prefect.context.get("logger")
for n in range(20):
<http://logger.info|logger.info>(f"Ping n°{n}")
sleep(3)
with Flow("dummy flow") as flow:
ping()
flow.schedule = CronSchedule("* * * * *")
flow.storage = Local()
flow.run_config = DockerRun(
image="<http://ghcr.io/mtes-mct/monitorfish/monitorfish-pipeline:v1.6.4|ghcr.io/mtes-mct/monitorfish/monitorfish-pipeline:v1.6.4>"
)
flow.register(project_name=PROJECT_NAME, build=False)
agent = DockerAgent(show_flow_logs=True)
agent.start()
Vincent Chéry
02/10/2022, 7:43 AMVincent Chéry
02/10/2022, 7:43 AMVincent Chéry
02/10/2022, 8:01 AM.prefect/flows
folder inside the image.. Ideally I'd like have the serialized flows stored outside of the image, on the machine that runs the Docker Agent. When starting a container to run a flow, the .prefect/flows
folder of the host machine would therefore need to be bind mounted inside the flow runner container. Is there any way to do that with Prefect ?Kevin Kho
Local(stored_as_script=True, path =…)
so you then point Prefect to the path inside the container. I have an example here
If you want to mount, yes you need to bind. Try mounting the volume on the agent side and I think that should be enoughVincent Chéry
02/24/2022, 5:37 PMKevin Kho