Austin Weisgrau
05/17/2023, 6:00 PMChris White
Zanie
Sven Balnojan
05/23/2023, 1:10 PMAlejandro Herrera
05/25/2023, 7:36 PMNelson Griffiths
05/30/2023, 8:23 PMMarwan Sarieddine
06/10/2023, 11:24 AMtask
decorator! It mainly adds the following two features
β’ runtime-type checking: this helps avoid reducing boilerplate code checking task input types at runtime
β’ persistence of task inputs on failure: this curries the task decorator with a callable that will store the task inputs in case of a failure, helping to better debug issues
Hopefully it is useful to others. Feedback is more than welcome !Dominic Tarro
06/17/2023, 10:27 PMMatt Alhonte
06/23/2023, 10:54 PM.py
file into the folder").
import os
import subprocess
from pathlib import Path
from shutil import copy
starting_dir = Path(
"" # Put the folder with the Flows here
).resolve()
all_scripts = list(starting_dir.glob("*.py"))
for script in all_scripts:
without_extension = str(script).split(".")[0]
folder = without_extension.split("/")[-1]
just_script = f"{folder}.py"
folder_path = Path(starting_dir, folder)
Path(folder_path).mkdir(parents=True, exist_ok=True)
new_script_path = Path(folder_path, just_script)
copy(script, new_script_path)
os.chdir(folder_path)
subprocess.run(["python", new_script_path])
Giorgio Basile
07/05/2023, 2:14 PMWill Raphaelson
07/10/2023, 9:21 PMGauravTalele
07/14/2023, 7:59 AMmorten
07/24/2023, 9:01 AMFROM prefecthq/prefect:2-python3.11
ARG PREFECT_TK
RUN prefect cloud login --key "${PREFECT_TK}" --workspace "mortenginnerupandreasenzohocom/homelab"
CMD prefect worker start --pool my-process-pool
does not work. The CMD
line overwrites all the lines in the original prefect image, rendering it all useless. Appending the CMD
to the RUN
line with and &&
does not work, as RUN
is executed when the image is build, not deployed.
Solution: Use multi stage builds. My Dockerfile looks likes this
# Install he prefect image and login.
FROM prefecthq/prefect:2-python3.11 AS builder
ARG PREFECT_TK
RUN prefect cloud login --key "${PREFECT_TK}" --workspace "mortenginnerupandreasenzohocom/homelab"
# Cant start worker from first stage, as CMD will override all CMD's in the original prefect image.
# Therefore, a second stage is added, where a CMD can be freely added without consequences for previous
# CMD's.
FROM builder AS starter
CMD prefect worker start --pool my-process-pool
and my compose.yaml looks like this:
services:
worker:
build:
context: .
args:
PREFECT_TK: ${PREFECT_TK}
env_file:
- .env
The prefect token is saved in a .env file.
The image can then be build with command:
docker compose build
(sudo might be needed depending on how you installed docker)Thierry
07/25/2023, 8:47 PMHenning Holgersen
07/27/2023, 4:33 PMJean Lafleur
08/03/2023, 7:30 PMJoni Pelham
08/08/2023, 8:18 PMGiorgio Basile
08/11/2023, 3:27 PMDominic Tarro
08/14/2023, 3:31 PMAdrian Brudaru
08/21/2023, 1:04 PMRyan Peden
08/22/2023, 2:14 AMProcessPoolExecutor
from the standard library, and doesn't install extra dependencies beyond what Prefect already comes with. It works quite well for my tasks, so I figured I'd share it in case it's useful for anyone else.
I've added some notes and examples in the README, so please feel free to give it a try!Chris Reuter
08/23/2023, 3:47 PMIbrahim
08/24/2023, 5:30 PM>>
morten
08/28/2023, 10:28 AMEmma Rizzi
08/28/2023, 3:21 PMmerlin
08/31/2023, 10:16 PMeric
09/12/2023, 10:46 AMRyan Peden
09/29/2023, 3:26 AM