Ryan Sattler
10/12/2021, 5:35 AMChris L.
10/12/2021, 10:53 AMChris L.
10/12/2021, 10:55 AMEvan Curtin
10/12/2021, 3:58 PMAnna Geller
KubernetesRun
) and Prefect will grab the flow code either from Git or from cloud storage during a flow run. This way, you don’t have to rebuild your Docker image when the flow code changes. Does it make sense for your use case?
When it comes to Orion, you’re right that it will likely be easier, since Orion decouples flow from its Deployment and allows attaching multiple deployments to a flow.Zanie
Ryan Sattler
10/13/2021, 11:50 PMChris L.
10/14/2021, 1:40 AMjob_template.yaml
custom job template for K8 agent's jobs
apiVersion: batch/v1
kind: Job
spec:
template:
spec:
containers:
- name: flow
command: ["tini", "-g", "--", "/usr/bin/prepare.sh"]
env:
- name: IS_PIP_PACKAGE
valueFrom:
configMapKeyRef:
name: flow-env-vars
key: is-pip-package
- name: REPO_NAME
valueFrom:
configMapKeyRef:
name: flow-env-vars
key: repo-name
- name: GIT_REF
valueFrom:
configMapKeyRef:
name: flow-env-vars
key: git-ref
- name: GITHUB_ACCESS_TOKEN
valueFrom:
secretKeyRef:
name: github-auth
key: password
With prepare.sh
#!/bin/bash
set -x
if [ "$IS_PIP_PACKAGE" ]; then
echo "IS_PIP_PACKAGE environment variable found."
"$CONDA_DIR/envs/$conda_env/bin/pip" install "git+https://$GITHUB_ACCESS_TOKEN@github.com/$REPO_NAME.git@$GIT_REF"
fi
# Run extra commands
exec "$@"
Chris L.
10/14/2021, 1:42 AMsetuptools
, then change set $GIT_REF in the K8 namespace's configmap to "main" or the PR ref that the developer is working on. And use absolute imports for everything (in development you can install your user-defined package with pip install -e .
)Chris L.
10/14/2021, 1:43 AMChris L.
10/14/2021, 1:54 AMsetuptools
every time it spins up a new job to execute a flow run. These changes can be Python modules used in your flow or even non-Python files (https://setuptools.pypa.io/en/latest/userguide/datafiles.html)
Hope this clarifies my previous reply!Ryan Sattler
10/14/2021, 5:31 AMEXTRA_PIP_PACKAGES
env var in KubernetesRun which seems to work.Ryan Sattler
10/14/2021, 5:32 AMSean Talia
10/14/2021, 2:15 PMZanie
Ryan Sattler
10/14/2021, 10:30 PM