Vadym Dytyniak
12/06/2021, 10:41 AMAnna Geller
Vadym Dytyniak
12/06/2021, 10:52 AMAnna Geller
Kevin Kho
DefaultFlow
class that contains your defaults.Vadym Dytyniak
12/06/2021, 6:38 PMKevin Kho
Vadym Dytyniak
12/06/2021, 6:40 PMKevin Kho
Kevin Kho
Vadym Dytyniak
12/06/2021, 6:42 PMVadym Dytyniak
12/06/2021, 6:43 PMVadym Dytyniak
12/06/2021, 8:43 PMKevin Kho
Kevin Kho
Vadym Dytyniak
12/06/2021, 8:57 PMVadym Dytyniak
12/06/2021, 8:57 PMVadym Dytyniak
12/06/2021, 8:57 PMKevin Kho
Vadym Dytyniak
12/06/2021, 8:59 PMVadym Dytyniak
12/06/2021, 9:00 PMKevin Kho
Vadym Dytyniak
12/06/2021, 9:04 PMKevin Kho
prefect execute flow
Vadym Dytyniak
12/07/2021, 9:35 AMAnna Geller
Vadym Dytyniak
12/07/2021, 10:04 AMreturn S3(
bucket=Secret('PREFECT_BUCKET').get(),
key=f'{self.name}/{self.serialized_hash()}',
secrets=['AWS_CREDENTIALS'],
)
Run config:
ECSRun(
image='custom_image',
env={
'PIP_EXTRA_INDEX_URL': os.environ['PIP_EXTRA_INDEX_URL'],
'EXTRA_PIP_PACKAGES': ' '.join(self.dependencies),
},
)
Custom image:
FROM base image
# install tini
ENV TINI_VERSION v0.19.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN chmod +x /tini
ENTRYPOINT ["/tini", "--"]
# install prefect
ENV PREFECT_VERSION 0.15.10
RUN python3.9 -m pip install prefect[aws]==${PREFECT_VERSION}
# update alternatives
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.9 10
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 10
# prepare entrypoint script
COPY prefect_entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
CMD ["entrypoint.sh"]
entrypoint.sh copied from pure prefect imageVadym Dytyniak
12/07/2021, 10:05 AMVadym Dytyniak
12/07/2021, 10:05 AMAnna Geller
# prepare entrypoint script
COPY prefect_entrypoint.sh /usr/local/bin/entrypoint.sh
RUN chmod +x /usr/local/bin/entrypoint.sh
CMD ["entrypoint.sh"]
Some additional notes:
I usually see the ENV defined with = sign e.g.
ENV PREFECT_VERSION=0.15.10
And then I think this may need to be in quotation marks (not 100% sure):
pip install "prefect[aws]"
If you need some dependencies from this custom image, you can do a multi-stage build, and in the last part use:
FROM prefecthq/prefect:latest
Vadym Dytyniak
12/07/2021, 10:13 AMAnna Geller
Vadym Dytyniak
12/07/2021, 10:24 AMAnna Geller
Vadym Dytyniak
12/07/2021, 12:16 PMAnna Geller
Vadym Dytyniak
12/07/2021, 12:39 PMVadym Dytyniak
12/07/2021, 12:39 PMAnna Geller
Vadym Dytyniak
12/07/2021, 12:43 PMAnna Geller
Vadym Dytyniak
12/07/2021, 3:10 PMAnna Geller
Vadym Dytyniak
12/07/2021, 3:27 PM